// // php-armadillo/constants.hh // // @Author CismonX // #ifndef PHP_ARMA_CONSTANTS_HH #define PHP_ARMA_CONSTANTS_HH #include "php_arma.hh" #include namespace php_arma { struct fill { static constexpr auto none = 0; static constexpr auto zeros = 1; static constexpr auto ones = 2; static constexpr auto eye = 3; static constexpr auto randu = 4; static constexpr auto randn = 5; template zend_always_inline static void invoke(T *obj, zend_long val) { switch (val) { case none: break; case zeros: obj->zeros(); break; case ones: obj->ones(); break; case eye: obj->eye(); break; case randu: obj->randu(); break; case randn: obj->randn(); break; default: throw_error("bad fill type"); } } }; constexpr const char fill_php_name[] = "Fill"; inline zend_class_entry *fill_ce; struct file_type { static constexpr auto auto_detect = 0; static constexpr auto arma_binary = 1; static constexpr auto arma_ascii = 2; static constexpr auto raw_binary = 3; static constexpr auto raw_ascii = 4; static constexpr auto csv_ascii = 5; static constexpr auto coord_ascii = 6; static constexpr auto pgm_binary = 7; static constexpr auto hdf5_binary = 8; zend_always_inline static arma::file_type native(zend_long val) { switch (val) { case auto_detect: return arma::file_type::auto_detect; case arma_binary: return arma::file_type::arma_binary; case arma_ascii: return arma::file_type::arma_ascii; case raw_binary: return arma::file_type::raw_binary; case csv_ascii: return arma::file_type::csv_ascii; case coord_ascii: return arma::file_type::coord_ascii; case pgm_binary: return arma::file_type::pgm_binary; #ifdef ARMA_USE_HDF5 case hdf5_binary: return arma::file_type::hdf5_binary; #endif // ARMA_USE_HDF5 default: return arma::file_type::file_type_unknown; } } }; constexpr const char file_type_php_name[] = "FileType"; inline zend_class_entry *file_type_ce; struct sort_direction { static constexpr auto ascend = 0; static constexpr auto descend = 1; static constexpr auto strict_ascend = 2; static constexpr auto strict_descend = 3; zend_always_inline static const char *native(zend_long val) { switch (val) { case ascend: return "ascend"; case descend: return "decend"; case strict_ascend: return "strictascend"; case strict_descend: return "strictdescend"; default: return nullptr; } } }; constexpr const char sort_direction_php_name[] = "SortDirection"; inline zend_class_entry *sort_direction_ce; #ifdef ARMA_USE_HDF5 struct hdf5_opts { static constexpr auto none = 0u; static constexpr auto trans = 1u << 0; static constexpr auto append = 1u << 1; static constexpr auto replace = 1u << 2; }; constexpr const char hdf5_opts_php_name[] = "Hdf5Opts"; inline zend_class_entry *hdf5_opts_ce; #endif // ARMA_USE_HDF5 struct features { #ifdef PHP_ARMA_OPERATORS static constexpr auto operators = true; #else static constexpr auto operators = false; #endif // PHP_ARMA_OPERATORS #ifdef ARMA_USE_HDF5 static constexpr auto hdf5 = true; #else static constexpr auto hdf5 = false; #endif // ARMA_USE_HDF5 #ifdef __GLIBCXX__ static constexpr auto stream_res = true; #else static constexpr auto stream_res = false; #endif // __GLIBCXX__ }; constexpr const char features_php_name[] = "Features"; inline zend_class_entry *features_ce; void constants_init(); } #endif //!PHP_ARMA_CONSTANTS_HH