Defines classes for registering values that can be parsed, communicated, and stored in the WebServerControl. More...
Functions | |
| template<class T > | |
| char | registerType (const std::string type_name, std::function< T(const nlohmann::json &)> &&parse_function) |
| Register a generic type to be controlled by the WebServerControl. More... | |
| template<class T > | |
| char | registerScalarType (const std::string &type_name) |
| Register a scalar type to be controlled by the WebServerControl. More... | |
| template<class T > | |
| char | registerVectorType (const std::string &type_name) |
| Register a vector type to be controlled by the WebServerControl. More... | |
| registerWebServerControlScalar (bool) | |
| registerWebServerControlScalar (Real) | |
| registerWebServerControlScalar (int) | |
| registerWebServerControlScalar (std::string) | |
| registerWebServerControlVector (Real) | |
| registerWebServerControlVector (int) | |
| registerWebServerControlVector (std::string) | |
| registerWebServerControlType (RealEigenMatrix, [](const nlohmann::json &json_value) -> RealEigenMatrix { const auto vec_of_vec=json_value.get< std::vector< std::vector< double >>>();const auto nrows=vec_of_vec.size();if(nrows==0) return RealEigenMatrix::Zero(0, 0);const auto ncols=vec_of_vec[0].size();RealEigenMatrix matrix;matrix.resize(nrows, ncols);for(const auto i :make_range(nrows)) { const auto &row=vec_of_vec[i];if(row.size() !=ncols) throw std::runtime_error("Matrix is jagged");for(const auto j :index_range(row)) matrix(i, j)=row[j];} return matrix;}) | |
Defines classes for registering values that can be parsed, communicated, and stored in the WebServerControl.
Registers the base parameter types that are controllable in the WebServerControl.
You can use the common macros from the header file to register custom types as controllable in your own application or derived WebServerControl.
| char Moose::WebServerControlTypeRegistration::registerScalarType | ( | const std::string & | type_name | ) |
Register a scalar type to be controlled by the WebServerControl.
This should be used through the registerWebServerControlScalar macro.
Uses nlohmann::json to perform the type conversion.
| type_name | Name of the type; this is the name that the client will associate with the value when it is communicated |
Definition at line 72 of file WebServerControlTypeRegistration.h.
| char Moose::WebServerControlTypeRegistration::registerType | ( | const std::string | type_name, |
| std::function< T(const nlohmann::json &)> && | parse_function | ||
| ) |
Register a generic type to be controlled by the WebServerControl.
This should be used through the registerWebServerControlType macro.
| type_name | Name of the type; this is the name that the client will associate with the value when it is communicated |
| parse_function | Function that parses the value from a JSON value |
Definition at line 53 of file WebServerControlTypeRegistration.h.
| char Moose::WebServerControlTypeRegistration::registerVectorType | ( | const std::string & | type_name | ) |
Register a vector type to be controlled by the WebServerControl.
This should be used through the registerWebServerControlVector macro.
Uses nlohmann::json to perform the type conversion.
| type_name | Name of the type in the vector; this is the name that the client will associate with the value when it is communicated |
Definition at line 91 of file WebServerControlTypeRegistration.h.
| Moose::WebServerControlTypeRegistration::registerWebServerControlScalar | ( | bool | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlScalar | ( | Real | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlScalar | ( | int | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlScalar | ( | std::string | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlType | ( | RealEigenMatrix | , |
| [] (const nlohmann::json &json_value) -> RealEigenMatrix { const auto vec_of_vec=json_value.get< std::vector< std::vector< double >>>();const auto nrows=vec_of_vec.size();if(nrows==0) return RealEigenMatrix::Zero(0, 0);const auto ncols=vec_of_vec[0].size();RealEigenMatrix matrix;matrix.resize(nrows, ncols);for(const auto i :make_range(nrows)) { const auto &row=vec_of_vec[i];if(row.size() !=ncols) throw std::runtime_error("Matrix is jagged");for(const auto j :index_range(row)) matrix(i, j)=row[j];} return matrix;} | |||
| ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlVector | ( | Real | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlVector | ( | int | ) |
| Moose::WebServerControlTypeRegistration::registerWebServerControlVector | ( | std::string | ) |
1.8.14