// // php-armadillo/constants.cc // // @Author CismonX // #include "constants.hh" #include namespace php_arma { template 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(), 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(), 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(), 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) ); const_declare(hdf5_opts_ce = abstract_class_register(), std::tuple("TRANS", hdf5_opts::trans), std::tuple("APPEND", hdf5_opts::append), std::tuple("REPLACE", hdf5_opts::replace) ); const_declare(features_ce = abstract_class_register(), std::tuple("OPERATORS", features::operators) ); } }