Privacy
An open-source, flexible 3D physical simulation framework
mars::data_broker::DataItem Class Reference

class containing a single value. More...

#include <DataItem.h>

Public Member Functions

 DataItem ()
 
 ~DataItem ()
 
 DataItem (const DataItem &other)
 
DataItemoperator= (const DataItem &other)
 
std::string getName () const
 
void setName (const std::string &newName)
 
bool get (int *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (unsigned int *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (long *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (unsigned long *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (float *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (double *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (std::string *val) const
 tries to retrieve the value from this DataItem More...
 
bool get (bool *val) const
 tries to retrieve the value from this DataItem More...
 
bool set (int val)
 tries to set the value of this DataItem More...
 
bool set (unsigned int val)
 tries to set the value of this DataItem More...
 
bool set (long val)
 tries to set the value of this DataItem More...
 
bool set (unsigned long val)
 tries to set the value of this DataItem More...
 
bool set (float val)
 tries to set the value of this DataItem More...
 
bool set (double val)
 tries to set the value of this DataItem More...
 
bool set (const std::string &val)
 tries to set the value of this DataItem More...
 
bool set (bool val)
 tries to set the value of this DataItem More...
 

Public Attributes

DataType type
 the type of the DataItem More...
 
union {
   int   i
 
   unsigned int   ui
 
   long   l
 
   unsigned long   ul
 
   float   f
 
   double   d
 
   bool   b
 
}; 
 
std::string s
 

Private Attributes

std::string name
 

Detailed Description

class containing a single value.

Definition at line 60 of file DataItem.h.

Constructor & Destructor Documentation

◆ DataItem() [1/2]

mars::data_broker::DataItem::DataItem ( )

Definition at line 28 of file DataItem.cpp.

◆ ~DataItem()

mars::data_broker::DataItem::~DataItem ( )

Definition at line 30 of file DataItem.cpp.

◆ DataItem() [2/2]

mars::data_broker::DataItem::DataItem ( const DataItem other)

Definition at line 33 of file DataItem.cpp.

Member Function Documentation

◆ get() [1/8]

bool mars::data_broker::DataItem::get ( int *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 61 of file DataItem.cpp.

◆ get() [2/8]

bool mars::data_broker::DataItem::get ( unsigned int *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 69 of file DataItem.cpp.

◆ get() [3/8]

bool mars::data_broker::DataItem::get ( long *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 77 of file DataItem.cpp.

◆ get() [4/8]

bool mars::data_broker::DataItem::get ( unsigned long *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 85 of file DataItem.cpp.

◆ get() [5/8]

bool mars::data_broker::DataItem::get ( float *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 93 of file DataItem.cpp.

◆ get() [6/8]

bool mars::data_broker::DataItem::get ( double *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 101 of file DataItem.cpp.

◆ get() [7/8]

bool mars::data_broker::DataItem::get ( std::string *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 109 of file DataItem.cpp.

◆ get() [8/8]

bool mars::data_broker::DataItem::get ( bool *  val) const

tries to retrieve the value from this DataItem

Parameters
valA pointer to a variable where the value can be written to.
Returns
true if the value was successfully retrieved. false if the pointer val was of the wrong type. In the latter case the content of the pointer remains unchanged.

Definition at line 117 of file DataItem.cpp.

◆ getName()

std::string mars::data_broker::DataItem::getName ( ) const

Definition at line 57 of file DataItem.cpp.

◆ operator=()

DataItem & mars::data_broker::DataItem::operator= ( const DataItem other)

Definition at line 38 of file DataItem.cpp.

◆ set() [1/8]

bool mars::data_broker::DataItem::set ( int  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 134 of file DataItem.cpp.

◆ set() [2/8]

bool mars::data_broker::DataItem::set ( unsigned int  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 142 of file DataItem.cpp.

◆ set() [3/8]

bool mars::data_broker::DataItem::set ( long  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 150 of file DataItem.cpp.

◆ set() [4/8]

bool mars::data_broker::DataItem::set ( unsigned long  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 158 of file DataItem.cpp.

◆ set() [5/8]

bool mars::data_broker::DataItem::set ( float  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 166 of file DataItem.cpp.

◆ set() [6/8]

bool mars::data_broker::DataItem::set ( double  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 174 of file DataItem.cpp.

◆ set() [7/8]

bool mars::data_broker::DataItem::set ( const std::string &  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 182 of file DataItem.cpp.

◆ set() [8/8]

bool mars::data_broker::DataItem::set ( bool  val)

tries to set the value of this DataItem

Parameters
valThe value to which the DataItem should be set.
Returns
true if the value was successfully set. false if the type of val does not match the type of this DataItem. In the latter case the current value of the DataItem is unchanged.

Definition at line 190 of file DataItem.cpp.

◆ setName()

void mars::data_broker::DataItem::setName ( const std::string &  newName)

Definition at line 130 of file DataItem.cpp.

Member Data Documentation

◆ @1

union { ... }

◆ b

bool mars::data_broker::DataItem::b

Definition at line 77 of file DataItem.h.

◆ d

double mars::data_broker::DataItem::d

Definition at line 76 of file DataItem.h.

◆ f

float mars::data_broker::DataItem::f

Definition at line 75 of file DataItem.h.

◆ i

int mars::data_broker::DataItem::i

Definition at line 71 of file DataItem.h.

◆ l

long mars::data_broker::DataItem::l

Definition at line 73 of file DataItem.h.

◆ name

std::string mars::data_broker::DataItem::name
private

Definition at line 133 of file DataItem.h.

◆ s

std::string mars::data_broker::DataItem::s

Definition at line 79 of file DataItem.h.

◆ type

DataType mars::data_broker::DataItem::type

the type of the DataItem

Definition at line 68 of file DataItem.h.

◆ ui

unsigned int mars::data_broker::DataItem::ui

Definition at line 72 of file DataItem.h.

◆ ul

unsigned long mars::data_broker::DataItem::ul

Definition at line 74 of file DataItem.h.


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