A base class for constituent elements of a generic DataWarehouse. More...
#include <DataElement.h>
Public Types | |
enum | ElementSize { EightBit, SixteenBit, ThirtyTwoBit } |
An enum representing the number of bits of the value held by the DataElement. More... | |
enum | ReadWrite { Read, Write } |
An enum representing whether the DataElement's value is to be written down to hardware or read from hardware. More... | |
typedef boost::variant< bool, int16_t, int32_t, uint16_t, uint32_t, float > | ValueType |
A boost::variant that stores a data type chosen from a specific list of types. | |
Public Member Functions | |
DataElement () | |
The default constructor for the DataElement class. | |
DataElement (const std::string &type, ReadWrite readWrite, std::shared_ptr< SMT::Resource > resource=nullptr) | |
The specific constructor for the DataElement class. | |
ReadWrite | getReadWrite () |
Get whether the value of the DataElement is to be read from (or written to) hardware. | |
ElementSize | getSize () |
Get the size of the value of the DataElement. | |
const std::type_info * | getType () |
Get the data type of the value of the DataElement. | |
template<typename T > | |
T | getValue () const |
Return the value held by the DataElement in the specified data type. | |
void | setReadWrite (ReadWrite readWrite) |
Set whether the value of the DataElement is to be read from (or written to) hardware. | |
template<typename T > | |
void | setValue (const T v) |
Set the value held by the DataElement in the specified data type. | |
virtual std::string | toString () |
Convert the DataElement into a string representation. | |
virtual | ~DataElement () |
The destructor for the DataElement class. | |
Public Attributes | |
ReadWrite | readWrite |
Stores whether the DataElement should be read from (or written to) hardware. | |
std::shared_ptr< SMT::Resource > | smtResource |
SMT Resource used to access this data in SMT. | |
ValueType | value |
The value held by the DataElement. |
A base class for constituent elements of a generic DataWarehouse.
Definition at line 19 of file DataElement.h.
typedef boost::variant<bool, int16_t, int32_t, uint16_t, uint32_t, float> DataElement::ValueType |
A boost::variant that stores a data type chosen from a specific list of types.
Definition at line 25 of file DataElement.h.
An enum representing the number of bits of the value held by the DataElement.
Definition at line 30 of file DataElement.h.
An enum representing whether the DataElement's value is to be written down to hardware or read from hardware.
Definition at line 39 of file DataElement.h.
The default constructor for the DataElement class.
Initializes the value to "uint32_t 0" and sets the direction to "Read"
Definition at line 15 of file DataElement.cpp.
DataElement::DataElement | ( | const std::string & | type, |
ReadWrite | rw, | ||
std::shared_ptr< SMT::Resource > | resource = nullptr |
||
) |
The specific constructor for the DataElement class.
type | The data type of the value held by this DataElement. |
rw | Whether the value of the DataElement is to be read from (or written to) hardware. |
resource | SMT Resource to use to interface with SMT. |
std::invalid_argument | If a type is given that doesn't match the types supported by the DataElement::ValueType |
Initializes the value to "0" in whatever data type is specified
Definition at line 29 of file DataElement.cpp.
DataElement::~DataElement | ( | ) | [virtual] |
The destructor for the DataElement class.
Definition at line 70 of file DataElement.cpp.
Get whether the value of the DataElement is to be read from (or written to) hardware.
Definition at line 78 of file DataElement.cpp.
Get the size of the value of the DataElement.
std::runtime_error | If the size is not one of those enumerated in DataElement::ElementSize |
Definition at line 106 of file DataElement.cpp.
const std::type_info * DataElement::getType | ( | ) |
Get the data type of the value of the DataElement.
Definition at line 96 of file DataElement.cpp.
T DataElement::getValue | ( | ) | const |
Return the value held by the DataElement in the specified data type.
std::invalid_argument | If the data type requested does not match the underlying boost::variant type of the DataElement. Change that type using DataElement::setValue . |
Definition at line 71 of file DataElement.h.
void DataElement::setReadWrite | ( | ReadWrite | rw | ) |
Set whether the value of the DataElement is to be read from (or written to) hardware.
rw | Representing whether the value of the DataElement is to be read from (or written to) hardware. |
Definition at line 87 of file DataElement.cpp.
void DataElement::setValue | ( | const T | v | ) |
Set the value held by the DataElement in the specified data type.
v | The value to be held by the DataElement in the specified data type. |
When you set the value, is doesn't matter what the previous type was, this method will overwrite the type as well as the value.
Reimplemented in RobonetDataElement.
Definition at line 94 of file DataElement.h.
std::string DataElement::toString | ( | ) | [virtual] |
Convert the DataElement into a string representation.
Reimplemented in RobonetDataElement.
Definition at line 137 of file DataElement.cpp.
Stores whether the DataElement should be read from (or written to) hardware.
Definition at line 47 of file DataElement.h.
std::shared_ptr<SMT::Resource> DataElement::smtResource |
SMT Resource used to access this data in SMT.
Definition at line 48 of file DataElement.h.
The value held by the DataElement.
Definition at line 46 of file DataElement.h.