SF2 C++ FRC Class Library
Sensor Fusion Framework (SF2) for FRC
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TimestampedValue< T > Class Template Reference
Inheritance diagram for TimestampedValue< T >:
ITimestampedValue ICopy< TimestampedValue< T > >

Public Member Functions

 TimestampedValue (T &value)
 Default constructor for a TimestampedValue<T>; initializes all values to reasonable defaults.
 
 TimestampedValue (T &src, long timestamp)
 Constructor allowing a TimestampedValue<T> to be created from a T object and a timestamp. More...
 
 TimestampedValue (TimestampedValue< T > &src)
 Copy constructor; initializes all values to that of the source TimestampedValue<T>. More...
 
long getTimestamp ()
 Returns the timestamp for this TimestampedValue.
 
void setTimestamp (long timestamp)
 
void set (TimestampedValue< T > &src)
 Initalizes this TimestampedValue to be equal to the source TimestampedValue. More...
 
void set (T &src, long timestamp)
 Initializes this TimestampedValue to be equal to the source value object and a timestamp. More...
 
T & getValue ()
 
bool getInterpolated ()
 If true, this TimestampedValue<T> was interpolated, otherwise it is an actual (measured) TimestampedValue<T>
 
void setInterpolated (bool interpolated)
 Modifies this TimestampedValue<T>'s interpolated state; if true, this TimestampedValue<T> was interpolated; otherwise, it is an actual (measured) TimestampedValue<T>.
 
void interpolate (TimestampedValue< T > &to, double time_ratio, TimestampedValue< T > &out)
 Modifies this TimestampedValue (representing the "from" value) to represent a new value and Timestamp value which is located at a ratio (in time) between itself and a "to" TimestampedValue. More...
 
void copy (TimestampedValue< T > &t)
 Initalizes this TimestampedValue to be equal to the source TimestampedValue. More...
 
bool getValid ()
 Returns whether this TimestampedValue is valid or not. More...
 
void setValid (bool valid)
 Sets whether this TimestampedValue is valid or not. More...
 
TimestampedValue< T > * instantiate_copy ()
 
IQuantitygetQuantity ()
 

Protected Attributes

value
 
long timestamp
 
uint8_t flags
 

Static Protected Attributes

static const uint8_t valid_flag = 0x01
 
static const uint8_t interpolated_flag = 0x02
 

Constructor & Destructor Documentation

template<typename T>
TimestampedValue< T >::TimestampedValue ( T &  src,
long  timestamp 
)
inline

Constructor allowing a TimestampedValue<T> to be created from a T object and a timestamp.

Parameters
src- source T object
timestamp- timestamp representing the time at which the source value is valid.
template<typename T>
TimestampedValue< T >::TimestampedValue ( TimestampedValue< T > &  src)
inline

Copy constructor; initializes all values to that of the source TimestampedValue<T>.

Parameters
src- source TimestampedValue<T>

Member Function Documentation

template<typename T>
void TimestampedValue< T >::copy ( TimestampedValue< T > &  t)
inlinevirtual

Initalizes this TimestampedValue to be equal to the source TimestampedValue.

Parameters
src- source TimestampedValue

Implements ICopy< TimestampedValue< T > >.

template<typename T>
bool TimestampedValue< T >::getValid ( )
inlinevirtual

Returns whether this TimestampedValue is valid or not.

This can be used when the TimestampedValue is stored within a statically-allocated data structure, allowing reuse of the same object without requiring the destruction/reconstruction of a new object.

Implements ITimestampedValue.

template<typename T>
void TimestampedValue< T >::interpolate ( TimestampedValue< T > &  to,
double  time_ratio,
TimestampedValue< T > &  out 
)
inline

Modifies this TimestampedValue (representing the "from" value) to represent a new value and Timestamp value which is located at a ratio (in time) between itself and a "to" TimestampedValue.

This actual method of interpolation used depends upon the value type (T).

template<typename T>
void TimestampedValue< T >::set ( TimestampedValue< T > &  src)
inline

Initalizes this TimestampedValue to be equal to the source TimestampedValue.

Parameters
src- source TimestampedValue
template<typename T>
void TimestampedValue< T >::set ( T &  src,
long  timestamp 
)
inline

Initializes this TimestampedValue to be equal to the source value object and a timestamp.

Parameters
src- source Quaternion
timestamp- timestamp representing the time at which the source value object is valid.
template<typename T>
void TimestampedValue< T >::setValid ( bool  valid)
inlinevirtual

Sets whether this TimestampedValue is valid or not.

This can be used when the TimestampedValue is stored within a statically-allocated data structure, allowing reuse of the same object without requiring the destruction/reconstruction of a new object.

Implements ITimestampedValue.


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