NRP Core  1.4.1
JsonDataPackController Class Reference

Base controller class for JSON datapacks. More...

#include <json_datapack_controller.h>

Inheritance diagram for JsonDataPackController:
DataPackController< nlohmann::json > gazebo::CameraDataPackController gazebo::JointDataPackController gazebo::LinkDataPackController NestEngineJSONDataPackController NestKernelDataPackController

Public Member Functions

const nlohmann::jsongetEmptyDataPack () const
 
- Public Member Functions inherited from DataPackController< nlohmann::json >
 DataPackController ()=default
 Constructor. More...
 
virtual ~DataPackController ()=default
 
virtual nlohmann::jsongetDataPackInformation ()=0
 Get datapack information to be forwarded to the NRP. More...
 
virtual void handleDataPackData (const nlohmann::json &data)=0
 Handle received datapack data. More...
 

Protected Member Functions

 JsonDataPackController (const DataPackIdentifier &datapackId)
 Constructor that should be called by the derived class. More...
 
void setCachedData (const nlohmann::json &data)
 Sets the "data" part of the cached JSON object. More...
 
nlohmann::jsongetCachedData ()
 Returns reference to the "data" part of the cached JSON object. More...
 

Protected Attributes

DataPackIdentifier _datapackId
 
nlohmann::json _data
 Cached incoming/outgoing data in JSON format. More...
 
nlohmann::json _emptyDataPack
 

Detailed Description

Base controller class for JSON datapacks.

The class provides helper methods and common members for controllers that are used to handle JSON datapacks.

Constructor & Destructor Documentation

◆ JsonDataPackController()

JsonDataPackController::JsonDataPackController ( const DataPackIdentifier datapackId)
inlineprotected

Constructor that should be called by the derived class.

Member Function Documentation

◆ getCachedData()

nlohmann::json* JsonDataPackController::getCachedData ( )
inlineprotected

Returns reference to the "data" part of the cached JSON object.

◆ getEmptyDataPack()

const nlohmann::json& JsonDataPackController::getEmptyDataPack ( ) const
inline

◆ setCachedData()

void JsonDataPackController::setCachedData ( const nlohmann::json data)
inlineprotected

Sets the "data" part of the cached JSON object.

Member Data Documentation

◆ _data

nlohmann::json JsonDataPackController::_data
protected

Cached incoming/outgoing data in JSON format.

The format of the data is the following: { <datapack_name> : { type : <datapack_type>, engine_name : <engine_name>, data : <data> } }

◆ _datapackId

DataPackIdentifier JsonDataPackController::_datapackId
protected

◆ _emptyDataPack

nlohmann::json JsonDataPackController::_emptyDataPack
protected

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