This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/src/base.hh

68 lines
1.5 KiB
C++
Raw Normal View History

2019-04-02 08:16:11 +00:00
//
// php-armadillo/base.hh
//
// @Author CismonX
//
#ifndef PHP_ARMA_BASE_HH
#define PHP_ARMA_BASE_HH
#include "php_arma.hh"
namespace php_arma
{
template <typename T, typename ChildT>
struct base
{
using native_t = typename ChildT::native_t;
2019-05-25 18:21:48 +00:00
struct operators;
zend_always_inline
static int count_elements(zval *zv, zend_long *count)
{
auto zobj = Z_OBJ_P(zv);
*count = to_native_object<native_t>(zobj)->n_elem;
return SUCCESS;
}
PHP_ARMA_COMMON_DECLARE();
private:
static PHP_FUNCTION(nElem);
static PHP_FUNCTION(add);
static PHP_FUNCTION(sub);
static PHP_FUNCTION(neg);
static PHP_FUNCTION(mul);
static PHP_FUNCTION(dotMul);
static PHP_FUNCTION(div);
static PHP_FUNCTION(replace);
static PHP_FUNCTION(transform);
static PHP_FUNCTION(forEach);
static PHP_FUNCTION(min);
static PHP_FUNCTION(max);
static PHP_FUNCTION(indexMin);
static PHP_FUNCTION(indexMax);
static PHP_FUNCTION(isEmpty);
static PHP_FUNCTION(isFinite);
static PHP_FUNCTION(hasInf);
static PHP_FUNCTION(hasNan);
static PHP_FUNCTION(print);
static PHP_FUNCTION(rawPrint);
2019-04-02 08:16:11 +00:00
};
void base_init();
2019-04-13 10:17:01 +00:00
constexpr const char base_php_name[] = "Base";
2019-04-02 08:16:11 +00:00
inline zend_class_entry *base_ce;
2019-05-25 18:21:48 +00:00
template <typename T, typename ChildT>
struct base<T, ChildT>::operators
{
};
2019-04-02 08:16:11 +00:00
}
#endif // !PHP_ARMA_BASE_HH