mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
Public Member Functions | Public Attributes | Private Attributes | List of all members
mars::BufferDataType Class Reference

The BufferDataType binds the core and sensor state in form of a shared void pointer. More...

#include </home/runner/work/mars_lib/mars_lib/source/mars/include/mars/type_definitions/buffer_data_type.h>

+ Collaboration diagram for mars::BufferDataType:

Public Member Functions

 BufferDataType ()=default
 
 BufferDataType (std::shared_ptr< void > meas)
 BufferDataType. More...
 
 BufferDataType (std::shared_ptr< void > core, std::shared_ptr< void > sensor)
 
void set_core_state (std::shared_ptr< void > core)
 
void set_sensor_state (std::shared_ptr< void > sensor)
 
void set_states (std::shared_ptr< void > core, std::shared_ptr< void > sensor)
 
void set_measurement (std::shared_ptr< void > meas)
 
void ClearStates (void)
 
bool HasCoreStates (void) const
 
bool HasSensorStates (void) const
 
bool HasStates (void) const
 

Public Attributes

std::shared_ptr< void > core_state_ { nullptr }
 Core state data. More...
 
std::shared_ptr< void > sensor_state_ { nullptr }
 Sensor state data. More...
 
std::shared_ptr< void > measurement_ { nullptr }
 Sensor measurement. More...
 

Private Attributes

bool has_core_state_ = { false }
 
bool has_sensor_state_ = { false }
 

Detailed Description

The BufferDataType binds the core and sensor state in form of a shared void pointer.

This shared pointer is of type void to allow generalized storage of different sensor and core data types. The need for the versatility of data types is caused by the fact that sensor measurements can not be stored with a common base class since the input and output parameter differ for each class. A high-level class such as the PoseSensorClass needs to keep track of the type such that it can cast the data before it is used.

An entry always contains a measurement, if has_state is true, then the entry also has a core state. Not all entrys have sensor states.

Attention
Shared pointer should be passed by value to ensure the correct reference count. Further, using the move operator saves two internal atomic copys of the shared pointer and is more efficient.
Remarks
Implementation: Done, Testing: Open

Constructor & Destructor Documentation

◆ BufferDataType() [1/3]

mars::BufferDataType::BufferDataType ( )
default

◆ BufferDataType() [2/3]

mars::BufferDataType::BufferDataType ( std::shared_ptr< void >  meas)
inline

BufferDataType.

Parameters
corethis data field holds the core state data
sensorthis data field holds the sensor state or measurement data
Note
Return/pass smart pointers by value
48  {
49  set_measurement(meas);
50  }
void set_measurement(std::shared_ptr< void > meas)
Definition: buffer_data_type.h:75
+ Here is the call graph for this function:

◆ BufferDataType() [3/3]

mars::BufferDataType::BufferDataType ( std::shared_ptr< void >  core,
std::shared_ptr< void >  sensor 
)
inline
53  {
54  set_states(core, sensor);
55  }
void set_states(std::shared_ptr< void > core, std::shared_ptr< void > sensor)
Definition: buffer_data_type.h:69
+ Here is the call graph for this function:

Member Function Documentation

◆ set_core_state()

void mars::BufferDataType::set_core_state ( std::shared_ptr< void >  core)
inline
58  {
59  core_state_ = core;
60  has_core_state_ = true;
61  }
std::shared_ptr< void > core_state_
Core state data.
Definition: buffer_data_type.h:103
bool has_core_state_
Definition: buffer_data_type.h:108
+ Here is the caller graph for this function:

◆ set_sensor_state()

void mars::BufferDataType::set_sensor_state ( std::shared_ptr< void >  sensor)
inline
64  {
65  sensor_state_ = sensor;
66  has_sensor_state_ = true;
67  }
bool has_sensor_state_
Definition: buffer_data_type.h:109
std::shared_ptr< void > sensor_state_
Sensor state data.
Definition: buffer_data_type.h:104
+ Here is the caller graph for this function:

◆ set_states()

void mars::BufferDataType::set_states ( std::shared_ptr< void >  core,
std::shared_ptr< void >  sensor 
)
inline
70  {
71  set_core_state(core);
72  set_sensor_state(sensor);
73  }
void set_core_state(std::shared_ptr< void > core)
Definition: buffer_data_type.h:57
void set_sensor_state(std::shared_ptr< void > sensor)
Definition: buffer_data_type.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_measurement()

void mars::BufferDataType::set_measurement ( std::shared_ptr< void >  meas)
inline
76  {
77  measurement_ = meas;
78  }
std::shared_ptr< void > measurement_
Sensor measurement.
Definition: buffer_data_type.h:105
+ Here is the caller graph for this function:

◆ ClearStates()

void mars::BufferDataType::ClearStates ( void  )
inline
81  {
82  core_state_ = nullptr;
83  sensor_state_ = nullptr;
84  has_core_state_ = false;
85  has_sensor_state_ = false;
86  }

◆ HasCoreStates()

bool mars::BufferDataType::HasCoreStates ( void  ) const
inline
89  {
90  return has_core_state_;
91  }
+ Here is the caller graph for this function:

◆ HasSensorStates()

bool mars::BufferDataType::HasSensorStates ( void  ) const
inline
94  {
95  return has_sensor_state_;
96  }
+ Here is the caller graph for this function:

◆ HasStates()

bool mars::BufferDataType::HasStates ( void  ) const
inline
99  {
100  return HasCoreStates() || HasSensorStates();
101  }
bool HasCoreStates(void) const
Definition: buffer_data_type.h:88
bool HasSensorStates(void) const
Definition: buffer_data_type.h:93
+ Here is the call graph for this function:

Member Data Documentation

◆ core_state_

std::shared_ptr<void> mars::BufferDataType::core_state_ { nullptr }

Core state data.

◆ sensor_state_

std::shared_ptr<void> mars::BufferDataType::sensor_state_ { nullptr }

Sensor state data.

◆ measurement_

std::shared_ptr<void> mars::BufferDataType::measurement_ { nullptr }

Sensor measurement.

◆ has_core_state_

bool mars::BufferDataType::has_core_state_ = { false }
private

◆ has_sensor_state_

bool mars::BufferDataType::has_sensor_state_ = { false }
private

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