|
ppap4lmp
0.7.2
|
Namespace for utility functions. More...
Functions | |
| Str | join (const Vec< Str > &strs, const Str &jointer) |
Mimicking Python's join. More... | |
| Map< Json, int > | map_to_index (const Json &data, const Str &key) |
| Create a Map object from values of selected property in an array Json object to corresponding index in the Json object. More... | |
| void | _message (const Str &msg) |
| Print to standard output. More... | |
| void | log (const Str &msg) |
| Logging a message. More... | |
| void | warning (const Str &msg) |
| Waning with a message. More... | |
| void | log_switch (bool input) |
| Switch on/off logging. More... | |
| template<typename T > | |
| void | pyargs_to_vec (const py::args &args, Vec< T > &vec) |
| Convert a py::args (a variable number arguments) object to a Vec object. More... | |
| void | runtime_error (const Str &msg) |
| Raise (for Python) and throw (for C++) a runtime error. More... | |
| Vec< Str > | split (const Str &str, char delim=' ') |
Mimicking Python's split. More... | |
Namespace for utility functions.
| void utils::_message | ( | const Str & | msg | ) |
Print to standard output.
| msg | A string to be printed. |
Definition at line 18 of file message.cpp.
| void utils::log | ( | const Str & | msg | ) |
Logging a message.
| msg | A string to be printed. |
Definition at line 29 of file message.cpp.
| void utils::log_switch | ( | bool | input | ) |
Switch on/off logging.
| input | A boolean, whether take log or not. |
Note that logging is disabled by default.
Definition at line 48 of file message.cpp.
Create a Map object from values of selected property in an array Json object to corresponding index in the Json object.
| data | An array Json object. |
| key | A string key specifying a property used as domain of the mapping. |
data to corresponding index in the data.Note that the mapping must be bijection.
Definition at line 15 of file map_to_index.cpp.
| void utils::pyargs_to_vec | ( | const py::args & | args, |
| Vec< T > & | vec | ||
| ) |
Convert a py::args (a variable number arguments) object to a Vec object.
| args | Python's variable number arguments. |
| vec | Mutable reference to a Vec object where elements of the args are appended to. |
Definition at line 15 of file pyargs_to_vec.cpp.
| void utils::runtime_error | ( | const Str & | msg | ) |
Raise (for Python) and throw (for C++) a runtime error.
| msg | A string message for the runtime error. |
Definition at line 16 of file runtime_error.cpp.
| void utils::warning | ( | const Str & | msg | ) |
Waning with a message.
| msg | A string to be printed. |
Definition at line 40 of file message.cpp.