SF2 C++ FRC Class Library
Sensor Fusion Framework (SF2) for FRC
Public Member Functions | List of all members
ThreadsafeInterpolatingTimeHistory< T > Class Template Reference

Public Member Functions

 ThreadsafeInterpolatingTimeHistory (T &default_obj, int num_samples, TimestampInfo &ts_info, string &name)
 Constructs a ThreadsafeInterpolatingTimeHihstory to hold up to a specified number of objects of the specified class. More...
 
void reset ()
 Clears all contents of the ThreadsafeInterpolatingTimeHistory by marking all contained objects as invalid.
 
int getValidSampleCount ()
 Returns the current count of valid objects in this ThreadsafeInterpolatingTimeHistory. More...
 
void add (T &t)
 Adds the provided object to the ThreadsafeInterpolatingTimeHistory. More...
 
bool get (long requested_timestamp, T &out)
 Retrieves the object in the ThreadsafeInterpolatingTimeHistory which matches the provided timestamp. More...
 
bool getMostRecent (T &out)
 Retrieves the most recently-added object in the ThreadsafeInterpolatingTimeHistory. More...
 
bool writeToDirectory (string &directory)
 
bool writeToFile (const string &file_path)
 
bool writeToDiskInternal (PrintWriter &out)
 

Constructor & Destructor Documentation

template<typename T>
ThreadsafeInterpolatingTimeHistory< T >::ThreadsafeInterpolatingTimeHistory ( T &  default_obj,
int  num_samples,
TimestampInfo ts_info,
string &  name 
)
inline

Constructs a ThreadsafeInterpolatingTimeHihstory to hold up to a specified number of objects of the specified class.

Parameters
_class- the Java class of the objects to be contained.
num_samples- the maximum number of objects to be contained.

Member Function Documentation

template<typename T>
void ThreadsafeInterpolatingTimeHistory< T >::add ( T &  t)
inline

Adds the provided object to the ThreadsafeInterpolatingTimeHistory.

Parameters
t- the object to add
template<typename T>
bool ThreadsafeInterpolatingTimeHistory< T >::get ( long  requested_timestamp,
T &  out 
)
inline

Retrieves the object in the ThreadsafeInterpolatingTimeHistory which matches the provided timestamp.

If an exact match is not found, a new object will be created using interpolated values, based upon the nearest objects preceding and following the requested timestamp.

Parameters
requested_timestamp- the timeatamp for which to return an object
Returns
- returns the object (either actual or interpolated) matching the requested timestamp. If no object could be located or interpolated, null is returned.
template<typename T>
bool ThreadsafeInterpolatingTimeHistory< T >::getMostRecent ( T &  out)
inline

Retrieves the most recently-added object in the ThreadsafeInterpolatingTimeHistory.

Returns
- the most recently-added object, or null if no valid objects exist
template<typename T>
int ThreadsafeInterpolatingTimeHistory< T >::getValidSampleCount ( )
inline

Returns the current count of valid objects in this ThreadsafeInterpolatingTimeHistory.

Returns

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