A container class for storing type agnostic variables. More...
#include <NeMatlabIOContainer.h>
Public Member Functions | |
MatlabIOContainer () | |
Default constructor. More... | |
MatlabIOContainer (const std::string name, const boost::any data) | |
Constructor to initalize the container with data and an associated name. More... | |
virtual | ~MatlabIOContainer () |
Destructor. More... | |
void | SetName (const std::string name) |
Sets a name. More... | |
void | SetData (const boost::any data) |
Sets any kind of data. More... | |
template<class T > | |
bool | TypeEquals (void) const |
Check if the stored type is equal to the templated type. More... | |
std::string | Type (void) const |
The type of the variable. More... | |
std::string | Name (void) const |
Gets the name. More... | |
template<class T > | |
T | Data (void) const |
Gets the stored data. More... | |
Private Attributes | |
std::string | name_ |
boost::any | data_ |
A container class for storing type agnostic variables.
MatlabIOContainer stores variables of any type using the boost::any type. This allows multiple MatlabIOContainers to be stored in a single vector
when reading multiple variables from a file or constructing a Matlab struct.
HmetalT, 02/08/2019.
Definition at line 35 of file NeMatlabIOContainer.h.
NeuralEngine::MatlabIOContainer::MatlabIOContainer | ( | ) |
Default constructor.
Hmetal T, 02/08/2019.
NeuralEngine::MatlabIOContainer::MatlabIOContainer | ( | const std::string | name, |
const boost::any | data | ||
) |
Constructor to initalize the container with data and an associated name.
Hmetal T, 02/08/2019.
name | The string name of the variable. |
data | The associated data, of any type. |
|
virtual |
Destructor.
Hmetal T, 02/08/2019.
void NeuralEngine::MatlabIOContainer::SetName | ( | const std::string | name | ) |
Sets a name.
Hmetal T, 02/08/2019.
name | The name. |
void NeuralEngine::MatlabIOContainer::SetData | ( | const boost::any | data | ) |
Sets any kind of data.
Hmetal T, 02/08/2019.
data | The data. |
|
inline |
Check if the stored type is equal to the templated type.
This method uses typeid(T) internally, so child classes may return true if compared with their parent.
Hmetal T, 02/08/2019.
T | Generic type parameter. |
Definition at line 98 of file NeMatlabIOContainer.h.
std::string NeuralEngine::MatlabIOContainer::Type | ( | void | ) | const |
The type of the variable.
Returns a string containing the type of the variable. This may or may not be human readable (Microsoft compilers will produce human readable outputs, GCC
compilers will not) but are guaranteed to be unique for unique types
HmetalT, 02/08/2019.
std::string NeuralEngine::MatlabIOContainer::Name | ( | void | ) | const |
Gets the name.
Hmetal T, 02/08/2019.
|
inline |
Gets the stored data.
Returns the stored data, cast to the templated type
boost::bad_any_cast | if the requested type is not the stored data type |
Hmetal T, 02/08/2019.
T | Generic type parameter. |
Definition at line 141 of file NeMatlabIOContainer.h.
|
private |
Definition at line 147 of file NeMatlabIOContainer.h.
|
private |
Definition at line 148 of file NeMatlabIOContainer.h.