A hand movement trace. More...
#include <Psycho/HandTrace.H>
Classes | |
struct | RawHandData |
Public Member Functions | |
Constructors, destructor and initialization | |
HandTrace (const std::string &filename, const PixRGB< byte > &color) | |
Constructor from a file on disk, use given display color. | |
~HandTrace () | |
Destructor. | |
Data access functions | |
bool | hasData (const size_t index, const SimTime &t) const |
Did sample of given index happen before given time? | |
bool | hasData (const size_t index) const |
Do we have a sample for the given index? | |
rutz::shared_ptr< HandData > | data (const size_t index) const |
Get the data for a given index. | |
PixRGB< byte > | color () const |
Get our display color. | |
size_t | size () const |
Get number of available (non-trash) samples. | |
size_t | numEvents () const |
Get number of parsed events (if any). | |
Metadata access functions | |
| |
SimTime | period () const |
Get sampling period. | |
std::string | filename () const |
Get filename, with extension if any. | |
std::string | basename () const |
Get filename, without extension if any. |
A hand movement trace.
This class encapsulates a simple hand movement trace and provides I/O functions.
Definition at line 52 of file HandTrace.H.
HandTrace::HandTrace | ( | const std::string & | filename, | |
const PixRGB< byte > & | color | |||
) |
Constructor from a file on disk, use given display color.
Definition at line 111 of file HandTrace.C.
References SimTime::fromString(), SimTime::msecs(), and split().
HandTrace::~HandTrace | ( | ) |
Destructor.
Definition at line 238 of file HandTrace.C.
std::string HandTrace::basename | ( | ) | const [inline] |
Get filename, without extension if any.
Definition at line 186 of file HandTrace.H.
Get our display color.
Definition at line 166 of file HandTrace.H.
rutz::shared_ptr< HandData > HandTrace::data | ( | const size_t | index | ) | const [inline] |
Get the data for a given index.
Note that this will throw a fatal error if we don't have data for that index; so be sure to check with hasData() first.
Definition at line 153 of file HandTrace.H.
References rutz::shared_ptr< T >::reset().
std::string HandTrace::filename | ( | ) | const [inline] |
Get filename, with extension if any.
Definition at line 182 of file HandTrace.H.
bool HandTrace::hasData | ( | const size_t | index | ) | const [inline] |
Do we have a sample for the given index?
This will return true as long as the index is not past the available amount of data.
Definition at line 149 of file HandTrace.H.
bool HandTrace::hasData | ( | const size_t | index, | |
const SimTime & | t | |||
) | const [inline] |
Did sample of given index happen before given time?
Typically one would keep incrementing the index until we return false here, at which point it would be time to increment the time. Note that we will always return false after the index gets past all available samples in the trace.
Definition at line 145 of file HandTrace.H.
size_t HandTrace::numEvents | ( | ) | const [inline] |
Get number of parsed events (if any).
Definition at line 174 of file HandTrace.H.
SimTime HandTrace::period | ( | ) | const [inline] |
Get sampling period.
Definition at line 178 of file HandTrace.H.
size_t HandTrace::size | ( | ) | const [inline] |
Get number of available (non-trash) samples.
Definition at line 170 of file HandTrace.H.