Helper class that combines a data value with a timestamp. More...
#include <InstantIO/Data.h>
Public Member Functions | |
| Data () | |
| Creates a new Data object that does not contain any data and whose timestamp is 0. | |
| Data (const T &value) | |
| Creates a new Data object that contains a given value and whose timestamp is set to the current system time. | |
| Data (const Data &other) | |
| Creates a new Data object that is an exact copy of another Data object. | |
| const Data< T > & | operator= (const Data< T > &other) |
| Assignment operator that copies value and timestamp from another Data object. | |
| const T & | operator= (const T &value) |
| Assignment operator that sets the value of the Data object. | |
| operator const T & () const | |
| Typecast operator that transforms the Data object to the value contained in the Data object. | |
| operator T & () | |
| Typecast operator that transforms the Data object to the value contained in the Data object. | |
| const T & | getValue () const |
| Returns the data value. | |
| T & | getValue () |
| Returns the data value. | |
| void | setValue (const T &value) |
| Sets the data value. | |
Helper class that combines a data value with a timestamp.
This class is used when writing values into InSlots or when reading values from OutSlots to transfer timestamps between different software components. The timestamp is a long value that specifies the number of milliseconds since midnight January 1., 1970 UTC.
The following code snippet demonstrates how to use the Data class when pushing values into OutSlots:
... bool value = ...; TimeStamp timeStamp = ...; Data<bool> data(value, timeStamp); outSlot.push(data); ...
The following code snippet demonstrates how to use the Data class when receiving values from InSlots:
... Data<bool> data = inSlot.pop(); bool value = data.getValue(); TimeStamp timeStamp = data.getTimeStamp(); ...
| InstantIO::Data< T >::Data | ( | const T & | value | ) | [inline] |
Creates a new Data object that contains a given value and whose timestamp is set to the current system time.
| value | The value that is put into the Data object. |
| InstantIO::Data< T >::Data | ( | const Data< T > & | other | ) | [inline] |
Creates a new Data object that is an exact copy of another Data object.
| other | The other Data object we take the value and the timestamp from. |
| const Data<T>& InstantIO::Data< T >::operator= | ( | const Data< T > & | other | ) | [inline] |
Assignment operator that copies value and timestamp from another Data object.
| other | The other Data object |
| const T& InstantIO::Data< T >::operator= | ( | const T & | value | ) | [inline] |
Assignment operator that sets the value of the Data object.
Sets the timestamp to the current system time.
| value | The value |
| InstantIO::Data< T >::operator const T & | ( | ) | const [inline] |
Typecast operator that transforms the Data object to the value contained in the Data object.
| InstantIO::Data< T >::operator T & | ( | ) | [inline] |
Typecast operator that transforms the Data object to the value contained in the Data object.
| const T& InstantIO::Data< T >::getValue | ( | ) | const [inline] |
Returns the data value.
| T& InstantIO::Data< T >::getValue | ( | ) | [inline] |
Returns the data value.
| void InstantIO::Data< T >::setValue | ( | const T & | value | ) | [inline] |
Sets the data value.
| value | The value that is put into the Data object. |
1.6.3