63 lines
2.5 KiB
C++
63 lines
2.5 KiB
C++
//
|
|
// php-armadillo/constants.cc
|
|
//
|
|
// @Author CismonX
|
|
//
|
|
|
|
#include "constants.hh"
|
|
|
|
#include <tuple>
|
|
|
|
namespace php_arma
|
|
{
|
|
template <typename... Ts>
|
|
zend_always_inline
|
|
void const_declare(zend_class_entry *ce, Ts&&... constants)
|
|
{
|
|
for (auto [name, val] : { constants... }) {
|
|
zend_declare_class_constant_long(ce, name, strlen(name), val);
|
|
}
|
|
}
|
|
|
|
void constants_init()
|
|
{
|
|
const_declare(fill_ce = abstract_class_register<fill_php_name>(),
|
|
std::tuple("NONE", fill::none),
|
|
std::tuple("ZEROS", fill::zeros),
|
|
std::tuple("ONES", fill::ones),
|
|
std::tuple("EYE", fill::eye),
|
|
std::tuple("RANDU", fill::randu),
|
|
std::tuple("RANDN", fill::randn)
|
|
);
|
|
const_declare(file_type_ce = abstract_class_register<file_type_php_name>(),
|
|
std::tuple("AUTO_DETECT", file_type::auto_detect),
|
|
std::tuple("ARMA_BINARY", file_type::arma_binary),
|
|
std::tuple("ARMA_ASCII", file_type::arma_ascii),
|
|
std::tuple("RAW_BINARY", file_type::raw_binary),
|
|
std::tuple("RAW_ASCII", file_type::raw_ascii),
|
|
std::tuple("CSV_ASCII", file_type::csv_ascii),
|
|
std::tuple("COORD_ASCII", file_type::coord_ascii),
|
|
std::tuple("PGM_BINARY", file_type::pgm_binary),
|
|
std::tuple("HDF5_BINARY", file_type::hdf5_binary)
|
|
);
|
|
const_declare(sort_direction_ce = abstract_class_register<sort_direction_php_name>(),
|
|
std::tuple("ASCEND", sort_direction::ascend),
|
|
std::tuple("DESCEND", sort_direction::descend),
|
|
std::tuple("STRICT_ASCEND", sort_direction::strict_ascend),
|
|
std::tuple("STRICT_DESCEND", sort_direction::strict_descend)
|
|
);
|
|
#ifdef ARMA_USE_HDF5
|
|
const_declare(hdf5_opts_ce = abstract_class_register<hdf5_opts_php_name>(),
|
|
std::tuple("NONE", hdf5_opts::none),
|
|
std::tuple("TRANS", hdf5_opts::trans),
|
|
std::tuple("APPEND", hdf5_opts::append),
|
|
std::tuple("REPLACE", hdf5_opts::replace)
|
|
);
|
|
#endif // ARMA_USE_HDF5
|
|
const_declare(features_ce = abstract_class_register<features_php_name>(),
|
|
std::tuple("OPERATORS", features::operators),
|
|
std::tuple("HDF5", features::hdf5)
|
|
);
|
|
}
|
|
}
|