NRP Core  1.4.1
DataPack< DATA_TYPE > Class Template Reference

Base datapack class. More...

#include <datapack.h>

Inheritance diagram for DataPack< DATA_TYPE >:
DataPackInterface PtrTemplates< DataPackInterface > RawData< DATA_TYPE >

Public Member Functions

 DataPack (const std::string &name, const std::string &engineName, DATA_TYPE *data_)
 
 DataPack (const std::string &name, const std::string &engineName)
 
 DataPack (const DataPack &)=delete
 
DataPackoperator= (const DataPack &)=delete
 
 DataPack (DataPack &&obj)=default
 
DataPackoperator= (DataPack &&)=default
 
const DATA_TYPE & getData () const
 Returns reference to data stored in the object. More...
 
PyObject * toPythonString ()
 Returns a python string representation of this object content. More...
 
DataPackInterfaceclone () const override
 Virtual clone method to support polymorphic copy. More...
 
- Public Member Functions inherited from DataPackInterface
 DataPackInterface ()=default
 
 DataPackInterface (const DataPackInterface &)=default
 
DataPackInterfaceoperator= (const DataPackInterface &)=default
 
 DataPackInterface (DataPackInterface &&obj)=default
 
DataPackInterfaceoperator= (DataPackInterface &&)=default
 
template<class DEV_ID_T >
 DataPackInterface (DEV_ID_T &&id)
 
 DataPackInterface (const std::string &name, const std::string &engineName, const std::string &type)
 
virtual ~DataPackInterface ()=default
 
const std::string & name () const
 
void setName (const std::string &name)
 
const std::string & type () const
 
void setType (const std::string &type)
 
const std::string & engineName () const
 
void setEngineName (const std::string &engineName)
 
const DataPackIdentifierid () const
 
void setID (const DataPackIdentifier &id)
 
bool isEmpty () const
 Indicates if the datapack contains any data aside from datapack ID. More...
 
bool isUpdated () const
 Indicates if the DataPack was created or received on the current simulation iteration. More...
 
void resetIsUpdated () const
 Sets the isUpdated flag to false TODO This method is obviously non-const, it will be changed in NRRPLT-8589. More...
 

Static Public Member Functions

static std::string getType ()
 Returns type of the datapack class. More...
 
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. More...
 
static void create_python (const std::string &name)
 

Additional Inherited Members

- Public Types inherited from PtrTemplates< DataPackInterface >
using shared_ptr = std::shared_ptr< DataPackInterface >
 
using const_shared_ptr = std::shared_ptr< const DataPackInterface >
 
using unique_ptr = std::unique_ptr< DataPackInterface >
 
using const_unique_ptr = std::unique_ptr< const DataPackInterface >
 
- Protected Member Functions inherited from DataPackInterface
void setIsEmpty (bool value)
 
 DataPackInterface (const std::string &name, const std::string &engineName, const std::string &type, bool isUpdated)
 

Detailed Description

template<class DATA_TYPE>
class DataPack< DATA_TYPE >

Base datapack class.

The class must be specialized by providing a template argument. The argument defines what data class will be stored in the datapack objects.

Constructor & Destructor Documentation

◆ DataPack() [1/4]

template<class DATA_TYPE >
DataPack< DATA_TYPE >::DataPack ( const std::string &  name,
const std::string &  engineName,
DATA_TYPE *  data_ 
)
inline

◆ DataPack() [2/4]

template<class DATA_TYPE >
DataPack< DATA_TYPE >::DataPack ( const std::string &  name,
const std::string &  engineName 
)
inline

◆ DataPack() [3/4]

template<class DATA_TYPE >
DataPack< DATA_TYPE >::DataPack ( const DataPack< DATA_TYPE > &  )
delete

◆ DataPack() [4/4]

template<class DATA_TYPE >
DataPack< DATA_TYPE >::DataPack ( DataPack< DATA_TYPE > &&  obj)
default

Member Function Documentation

◆ clone()

template<class DATA_TYPE >
DataPackInterface* DataPack< DATA_TYPE >::clone ( ) const
inlineoverridevirtual

Virtual clone method to support polymorphic copy.

Reimplemented from DataPackInterface.

◆ create_python()

template<class DATA_TYPE >
static void DataPack< DATA_TYPE >::create_python ( const std::string &  name)
inlinestatic

◆ createID()

template<class DATA_TYPE >
static DataPackIdentifier DataPack< DATA_TYPE >::createID ( const std::string &  name,
const std::string &  engineName 
)
inlinestatic

Creates a DataPackIdentifier object with type matching the DATA_TYPE used by the DataPack class.

Parameters
[in]nameName of the datapack
[in]nameName of the engine to which the datapack belongs
Returns
A DataPackIdentifier object, with DataPackIdentifier::Name and DataPackIdentifier::EngineName provided as arguments, and with DataPackIdentifier::Type deduced from DATA_TYPE template argument of the DataPack class.

◆ getData()

template<class DATA_TYPE >
const DATA_TYPE& DataPack< DATA_TYPE >::getData ( ) const
inline

Returns reference to data stored in the object.

The function returns a read-only reference to the data stored by the object. This is the main accessor function of the DataPack object.

Returns
Read-only reference to the data stored by the object

◆ getType()

template<class DATA_TYPE >
static std::string DataPack< DATA_TYPE >::getType ( )
inlinestatic

Returns type of the datapack class.

The function returns type of the datapack class as string. The return value is not human readable. It's an implementation-defined name of the DATA_TYPE used by the datapack.

◆ operator=() [1/2]

template<class DATA_TYPE >
DataPack& DataPack< DATA_TYPE >::operator= ( const DataPack< DATA_TYPE > &  )
delete

◆ operator=() [2/2]

template<class DATA_TYPE >
DataPack& DataPack< DATA_TYPE >::operator= ( DataPack< DATA_TYPE > &&  )
default

◆ toPythonString()

template<class DATA_TYPE >
PyObject* DataPack< DATA_TYPE >::toPythonString ( )
inline

Returns a python string representation of this object content.

Returns
Python string

The documentation for this class was generated from the following file: