Go to the documentation of this file.
22 #ifndef DATA_DATAPACK_H
23 #define DATA_DATAPACK_H
27 #include <boost/python.hpp>
35 template<
class DATA_TYPE>
63 return typeid(DATA_TYPE).
name();
104 std::string dataStr = boost::python::extract<std::string>(
boost::python::str(this->data.get()));
105 std::string dataPackStr =
"- name: '" + this->
name() +
"'\n- engine: '" + this->
engineName() +
"'\n- data:\n" + dataStr;
106 return PyUnicode_FromString(dataPackStr.c_str());
111 using namespace boost::python;
112 class_< DataPack<DATA_TYPE>,
DataPack<DATA_TYPE> *, bases<DataPackInterface>, boost::noncopyable >
113 binder(
name.data(), init<const std::string&, const std::string& >((boost::python::arg(
"name"), boost::python::arg(
"engine_name"))));
131 std::unique_ptr<DATA_TYPE> data;
142 template<
class DATA_TYPE>
153 using namespace boost::python;
154 class_< RawData<DATA_TYPE>,
RawData<DATA_TYPE> *, bases<DataPack<DATA_TYPE>>, boost::noncopyable>
155 binder(
name.data(), init<>());
162 #endif // DATA_DATAPACK_H
Wrapper class for DataPacks with no name and no engine association.
Definition: datapack.h:143
DataPack & operator=(const DataPack &)=delete
DataPackInterface * clone() const override
Virtual clone method to support polymorphic copy.
Definition: datapack.h:119
PyObject * toPythonString()
Returns a python string representation of this object content.
Definition: datapack.h:102
static std::string getType()
Returns type of the datapack class.
Definition: datapack.h:61
const DATA_TYPE & getData() const
Returns reference to data stored in the object.
Definition: datapack.h:89
DataPack(const std::string &name, const std::string &engineName)
Definition: datapack.h:44
str
Definition: python_grpc_engine.py:63
bool isEmpty() const
Indicates if the datapack contains any data aside from datapack ID.
Definition: datapack_interface.cpp:74
static EXCEPTION logCreate(LOG_EXCEPTION_T &exception, const std::string &msg, NRPLogger::spdlog_out_fcn_t spdlogCall=NRPLogger::critical)
Definition: nrp_exceptions.h:73
static void create_python(const std::string &name)
Definition: datapack.h:151
Identifies a single datapack.
Definition: datapack_interface.h:38
Base datapack class.
Definition: datapack.h:36
DataPack(const std::string &name, const std::string &engineName, DATA_TYPE *data_)
Definition: datapack.h:40
bool isUpdated() const
Indicates if the DataPack was created or received on the current simulation iteration.
Definition: datapack_interface.cpp:84
Interface to datapacks.
Definition: datapack_interface.h:89
const std::string & name() const
Definition: datapack_interface.cpp:34
static DataPackIdentifier createID(const std::string &name, const std::string &engineName)
Creates a DataPackIdentifier object with type matching the DATA_TYPE used by the DataPack class.
Definition: datapack.h:76
static void create_python(const std::string &name)
Definition: datapack.h:109
void setIsEmpty(bool value)
Definition: datapack_interface.cpp:79
const std::string & engineName() const
Definition: datapack_interface.cpp:54
RawData()
Definition: datapack.h:147