Belle II Software development
|
Wrapper class for a list of strings to either be held in a std::vector or in a python list. More...
#include <Configuration.h>
Public Member Functions | |
boost::python::list & | ensurePy () |
Return the python list version. | |
std::vector< std::string > & | ensureCpp () |
Return the C++ vector version. | |
void | append (const std::string &element) |
Append an element to whatever representation we currently have. | |
void | prepend (const std::string &element) |
Prepend an element to whatever representation we currently have. | |
void | shallowCopy (const boost::python::object &source) |
shallow copy all elements of the source object into the python representation. | |
Private Attributes | |
std::variant< std::vector< std::string >, boost::python::list > | m_value |
Store either a std::vector or a python list of strings. | |
Wrapper class for a list of strings to either be held in a std::vector or in a python list.
It's basically a std::variant with some convenince members to convert between the two representations.
This is necessary as python lists can only exist after Py_Initialize() and before Py_Finalize() and since we want this configuration class to work also in command line tools we need to be able to use std::vector unless python functions are called.
Definition at line 30 of file Configuration.h.
std::vector< std::string > & ensureCpp | ( | ) |
Return the C++ vector version.
Convert if necessary
boost::python::list & ensurePy | ( | ) |
Return the python list version.
Convert if necessary
void shallowCopy | ( | const boost::python::object & | source | ) |
shallow copy all elements of the source object into the python representation.
Also converts to python representation
|
private |
Store either a std::vector or a python list of strings.
Definition at line 45 of file Configuration.h.