Add implementation for vector interface

This commit is contained in:
CismonX 2019-11-04 16:46:08 +08:00
parent 69e98ca96b
commit 7b89ddefac
3 changed files with 60 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "mat.hh"
#include "subview_mat.hh"
#include "diagonal.hh"
#include "vector.hh"
#ifdef PHP_ARMA_OPERATORS
#include "operators.hh"
@ -51,6 +52,7 @@ namespace php_arma
mat_init();
subview_mat_init();
diagonal_init();
vector_init();
#ifdef PHP_ARMA_OPERATORS
operators_init();

26
src/vector.cc Normal file
View File

@ -0,0 +1,26 @@
//
// php-armadillo/vector.cc
//
// @Author CismonX
//
#include "vector.hh"
namespace php_arma
{
template <typename T, typename ChildT>
PHP_ARMA_METHOD(vector, t, T, ChildT)
{
}
template <typename T, typename T1>
PHP_ARMA_START_ME(vector, T, T1)
PHP_ARMA_ME(t, ZEND_ACC_PUBLIC)
PHP_ARMA_END_ME();
void vector_init()
{
vector_ce = interface_register<vector_php_name>();
}
}

32
src/vector.hh Normal file
View File

@ -0,0 +1,32 @@
//
// php-armadillo/vector.hh
//
// @Author CismonX
//
#ifndef PHP_ARMA_VECTOR_HH
#define PHP_ARMA_VECTOR_HH
#include "php_arma.hh"
namespace php_arma
{
template <typename T, typename ChildT>
struct vector
{
using native_t = typename ChildT::native_t;
PHP_ARMA_COMMON_DECLARE();
private:
PHP_FUNCTION(t);
};
void vector_init();
constexpr const char vector_php_name[] = "Vector";
inline zend_class_entry *vector_ce;
}
#endif // !PHP_ARMA_VECTOR_HH