InstantIO::Data< T > Class Template Reference

Helper class that combines a data value with a timestamp. More...

#include <InstantIO/Data.h>

Inheritance diagram for InstantIO::Data< T >:
InstantIO::BasicData

List of all members.

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.

Detailed Description

template<class T>
class InstantIO::Data< T >

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();
 ...
 

Author:
Patrick Dähne
See also:
OutSlot OutSlot
InSlot InSlot

Constructor & Destructor Documentation

template<class T>
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.

Parameters:
value The value that is put into the Data object.
template<class T>
InstantIO::Data< T >::Data ( const Data< T > &  other  )  [inline]

Creates a new Data object that is an exact copy of another Data object.

Parameters:
other The other Data object we take the value and the timestamp from.

Member Function Documentation

template<class T>
const Data<T>& InstantIO::Data< T >::operator= ( const Data< T > &  other  )  [inline]

Assignment operator that copies value and timestamp from another Data object.

Parameters:
other The other Data object
Returns:
Itself
template<class T>
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.

Parameters:
value The value
Returns:
The value
template<class T>
InstantIO::Data< T >::operator const T & (  )  const [inline]

Typecast operator that transforms the Data object to the value contained in the Data object.

Returns:
The data value contained in the Data object.
template<class T>
InstantIO::Data< T >::operator T & (  )  [inline]

Typecast operator that transforms the Data object to the value contained in the Data object.

Returns:
The data value contained in the Data object.
template<class T>
const T& InstantIO::Data< T >::getValue (  )  const [inline]

Returns the data value.

Returns:
The data value contained in the Data object.
template<class T>
T& InstantIO::Data< T >::getValue (  )  [inline]

Returns the data value.

Returns:
The data value contained in the Data object.
template<class T>
void InstantIO::Data< T >::setValue ( const T &  value  )  [inline]

Sets the data value.

Parameters:
value The value that is put into the Data object.

The documentation for this class was generated from the following file:
Generated on Thu Jul 31 17:17:32 2014 by  doxygen 1.6.3