NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeuralEngine::MatlabIOContainer Class Reference

A container class for storing type agnostic variables. More...

#include <NeMatlabIOContainer.h>

Collaboration diagram for NeuralEngine::MatlabIOContainer:

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 >
Data (void) const
 Gets the stored data. More...
 

Private Attributes

std::string name_
 
boost::any data_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MatlabIOContainer() [1/2]

NeuralEngine::MatlabIOContainer::MatlabIOContainer ( )

Default constructor.

Hmetal T, 02/08/2019.

◆ MatlabIOContainer() [2/2]

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.

Parameters
nameThe string name of the variable.
dataThe associated data, of any type.

◆ ~MatlabIOContainer()

virtual NeuralEngine::MatlabIOContainer::~MatlabIOContainer ( )
virtual

Destructor.

Hmetal T, 02/08/2019.

Member Function Documentation

◆ SetName()

void NeuralEngine::MatlabIOContainer::SetName ( const std::string  name)

Sets a name.

Hmetal T, 02/08/2019.

Parameters
nameThe name.

◆ SetData()

void NeuralEngine::MatlabIOContainer::SetData ( const boost::any  data)

Sets any kind of data.

Hmetal T, 02/08/2019.

Parameters
dataThe data.

◆ TypeEquals()

template<class T >
bool NeuralEngine::MatlabIOContainer::TypeEquals ( void  ) const
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.

Template Parameters
TGeneric type parameter.
Returns
true if the types are equal (premised on the above conditions), false otherwise.

Definition at line 98 of file NeMatlabIOContainer.h.

◆ Type()

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

Returns
the variable type as a string

HmetalT, 02/08/2019.

Returns
A std::string.

◆ Name()

std::string NeuralEngine::MatlabIOContainer::Name ( void  ) const

Gets the name.

Hmetal T, 02/08/2019.

Returns
A std::string.

◆ Data()

template<class T >
T NeuralEngine::MatlabIOContainer::Data ( void  ) const
inline

Gets the stored data.


Returns the stored data, cast to the templated type

Exceptions
boost::bad_any_castif the requested type is not the stored data type

Hmetal T, 02/08/2019.

Template Parameters
TGeneric type parameter.
Returns
The data.

Definition at line 141 of file NeMatlabIOContainer.h.

Member Data Documentation

◆ name_

std::string NeuralEngine::MatlabIOContainer::name_
private

Definition at line 147 of file NeMatlabIOContainer.h.

◆ data_

boost::any NeuralEngine::MatlabIOContainer::data_
private

Definition at line 148 of file NeMatlabIOContainer.h.


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