Flair
Framework Libre Air
flair::core::io_data Class Referenceabstract

Abstract class for data types. More...

#include <io_data.h>

+ Inheritance diagram for flair::core::io_data:

Public Member Functions

 io_data (const Object *parent, std::string name, int n)
 Constructor. More...
 
virtual ~io_data ()
 Destructor. More...
 
void SetDataTime (Time time)
 Set data time, also caluculates the delta time based on last call. More...
 
void SetDataTime (Time time, Time deltaTime)
 Set data time and delta time (thus delta time is not based on last call) More...
 
Time DataTime (void) const
 Data time. More...
 
Time DataDeltaTime (void) const
 Data delta time. More...
 
void GetDataTime (Time &time, Time &deltaTime) const
 Get data time and delta time. More...
 
const io_dataPrev (int n) const
 Previous data. More...
 
virtual DataType const & GetDataType () const =0
 
virtual void RawWrite (char *src)
 Raw write datas. More...
 
virtual void RawRead (char *dst) const =0
 Raw read datas. More...
 
- Public Member Functions inherited from flair::core::Mutex
 Mutex (const Object *parent, std::string name="")
 Constructor. More...
 
 ~Mutex ()
 Destructor. More...
 
void GetMutex (void) const
 GetMutex. More...
 
void ReleaseMutex (void) const
 ReleaseMutex. More...
 
- Public Member Functions inherited from flair::core::Object
 Object (const Object *parent=NULL, std::string name="", std::string type="")
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string ObjectName (void) const
 Name. More...
 
std::string ObjectType (void) const
 Type. More...
 
const ObjectParent (void) const
 Parent. More...
 
std::vector< const Object * > * TypeChilds (void) const
 Childs of the same type. More...
 
std::vector< const Object * > * Childs (void) const
 Childs. More...
 
void Information (const char *function, int line, const char *format,...) const
 Formatted information. More...
 
void Warning (const char *function, const char *format,...) const
 Formatted warning. More...
 
void Error (const char *function, const char *format,...) const
 Formatted error. More...
 
bool ErrorOccured (bool recursive=true) const
 Has an errror occured? More...
 

Protected Member Functions

void AppendLogDescription (std::string description, DataType const &datatype)
 Specify the description of the reimplemented class data's. More...
 
void SetPtrToCircle (void **ptr)
 Set the datas to circle. More...
 

Protected Attributes

io_dataprev
 Pointer to previous data. More...
 

Additional Inherited Members

- Public Types inherited from flair::core::Object
enum  color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 }
 

Detailed Description

Abstract class for data types.

Use this class to define a custom data type. Data types ares used for logging and graphs.
The reimplemented class must call SetSize() in its constructor.
io_data can be constructed with n samples (see io_data::io_data). In this case, old samples can be accessed throug io_data::Prev.

Constructor & Destructor Documentation

flair::core::io_data::io_data ( const Object parent,
std::string  name,
int  n 
)

Constructor.

Construct an io_data.

Parameters
parentparent
namename
nnumber of samples
virtual flair::core::io_data::~io_data ( )
virtual

Destructor.

Member Function Documentation

void flair::core::io_data::SetDataTime ( Time  time)

Set data time, also caluculates the delta time based on last call.

TIME_INFINITE represents an unitialized time

Parameters
timetime
void flair::core::io_data::SetDataTime ( Time  time,
Time  deltaTime 
)

Set data time and delta time (thus delta time is not based on last call)

TIME_INFINITE represents an unitialized time

Parameters
timetime
deltaTimedelta time
Time flair::core::io_data::DataTime ( void  ) const

Data time.

TIME_INFINITE represents an unitialized time.

Returns
data time
Time flair::core::io_data::DataDeltaTime ( void  ) const

Data delta time.

TIME_INFINITE represents an unitialized time.

Returns
data delta time
void flair::core::io_data::GetDataTime ( Time time,
Time deltaTime 
) const

Get data time and delta time.

TIME_INFINITE represents an unitialized time

Parameters
timetime
deltaTimedelta time
const io_data* flair::core::io_data::Prev ( int  n) const

Previous data.

Access previous data. io_data must have been constructed with n>1, io_data::SetPtrToCircle must have been set and io_data::prev must have been allocated.

Parameters
nprevious data number
Returns
previous data
virtual void flair::core::io_data::RawWrite ( char *  src)
inlinevirtual

Raw write datas.

Copy the source to the internal datas. Source must be of the corresponding size.

Parameters
srcsource buffer

Reimplemented in flair::core::Matrix.

virtual void flair::core::io_data::RawRead ( char *  dst) const
pure virtual

Raw read datas.

This method is automatically called by IODevice::ProcessUpdate to log io_data datas.
This method must be reimplemented, in order to copy the datas to the logs. Copy the internal datas to destination. Destination must be of the corresponding size.

Parameters
dstdestination buffer

Implemented in flair::core::GpsData, and flair::core::Matrix.

void flair::core::io_data::AppendLogDescription ( std::string  description,
DataType const &  datatype 
)
protected

Specify the description of the reimplemented class data's.

This method must be called in the constructor of the reimplemented class, once by element.
Each element description must be called in the same order as CopyDatas put the datas in the buffer.
The description will be used for the log descriptor file.

Parameters
descriptiondescription of the element
datatypetype of the element
void flair::core::io_data::SetPtrToCircle ( void **  ptr)
protected

Set the datas to circle.

Parameters
ptrpointer to the data to circle

Member Data Documentation

io_data* flair::core::io_data::prev
protected

Pointer to previous data.

Reimplemented class must allocate this pointer if n>1.
Pointer must be allocated with the same kind of reimplemented class.