TmVirtualTime Class Reference
[Scheduler]

TmVirtualTime reads the insamples information to advance the timer. More...

#include <TmVirtualTime.h>

Inherits Marsyas::TmTimer.


Public Member Functions

mrs_natural intervalsize (std::string interval)
 convert the given interval into a number of samples.
mrs_natural readTimeSrc ()
 get the difference between the current source control value and its value since it was last read.
void setSource (MarSystem *ms)
 set the MarSystem that contains the read control.
 TmVirtualTime (const TmVirtualTime &s)
 copy constructor
 TmVirtualTime (std::string name, MarSystem *ms)
 main constructor. Has identifier "TmSampleCount/Virtual"
 TmVirtualTime (std::string name)
 named constructor. The read source MarSystem and control are zero values and must be updated using setReadCtrl(...). Given the default name: "TmSampleTime/name"
 TmVirtualTime ()
 empty constructor. The read source MarSystem and control are zero values and must be updated using setReadCtrl(...) Given the default name: Virtual as in "TmSampleTime/Virtual"
virtual void updtimer (std::string cname, TmControlValue value)
 update timer values.

Protected Attributes

mrs_real error_term_
 error term that is smaller than the sample size, to be added to next tick calculation
MarControlPtr nsamples_
 the pointer, constructed in setReadCtrl that will return the number of samples in the buffer: mrs_natural/onSamples
mrs_natural previous_tick_interval_
 the value to add on the next tick.
MarSystemread_src_
 the MarSystem containing the control to read from
MarControlPtr srate_
 the pointer, constructed in setReadCtrl that will return the sample rate: mrs_real/osrate


Detailed Description

TmVirtualTime reads the insamples information to advance the timer.

Author:
Neil Burroughs inb@cs.uvic.ca

Definition at line 39 of file TmVirtualTime.h.


Constructor & Destructor Documentation

TmVirtualTime ( std::string  name  ) 

named constructor. The read source MarSystem and control are zero values and must be updated using setReadCtrl(...). Given the default name: "TmSampleTime/name"

Parameters:
name a unique name to call this timer

Definition at line 32 of file TmVirtualTime.cpp.

References TmVirtualTime::setSource().

TmVirtualTime ( std::string  name,
MarSystem ms 
)

main constructor. Has identifier "TmSampleCount/Virtual"

Parameters:
ms the MarSystem that contains the control to read
cname the control name to read

Definition at line 37 of file TmVirtualTime.cpp.

References TmVirtualTime::setSource().

TmVirtualTime ( const TmVirtualTime s  ) 

copy constructor

Parameters:
s timer to copy

Definition at line 42 of file TmVirtualTime.cpp.

References TmVirtualTime::read_src_, and TmVirtualTime::setSource().


Member Function Documentation

mrs_natural intervalsize ( std::string  interval  )  [virtual]

convert the given interval into a number of samples.

The interval must fall within sample time which can include standard time units: us, ms, s, m, h, d. The sample rate used for this function is the value of the mrs_real/israte control of the source MarSystem.

Parameters:
interval the interval to calculate
Returns:
the number of samples contained in the interval

Implements TmTimer.

Definition at line 84 of file TmVirtualTime.cpp.

mrs_natural readTimeSrc (  )  [virtual]

get the difference between the current source control value and its value since it was last read.

Returns:
the count since last read

Implements TmTimer.

Definition at line 63 of file TmVirtualTime.cpp.

References TmVirtualTime::error_term_, TmVirtualTime::nsamples_, TmVirtualTime::previous_tick_interval_, TmVirtualTime::read_src_, and TmVirtualTime::srate_.

void setSource ( MarSystem ms  ) 

set the MarSystem that contains the read control.

This method sets the read source to the parameter without checking. It then attempts to get the MarControlPtr for the control unless the read source is NULL or the read ctrl path is "". No warnings are produced.

Parameters:
ms read source MarSystem

Definition at line 50 of file TmVirtualTime.cpp.

References TmVirtualTime::error_term_, MarSystem::getctrl(), TmVirtualTime::nsamples_, TmVirtualTime::previous_tick_interval_, TmVirtualTime::read_src_, and TmVirtualTime::srate_.

Referenced by TmVirtualTime::TmVirtualTime(), and TmVirtualTime::updtimer().

void updtimer ( std::string  cname,
TmControlValue  value 
) [virtual]

update timer values.

Allowable control values for this timer are: MarSystem/source, and mrs_string/control.

Parameters:
cname the control name of a timer value
value the value to update the control with

Reimplemented from TmTimer.

Definition at line 92 of file TmVirtualTime.cpp.

References TmControlValue::getType(), TmVirtualTime::setSource(), Marsyas::tmcv_marsystem, and TmControlValue::toMarSystem().


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

Generated on Wed May 23 00:02:23 2012 for Marsyas by  doxygen 1.5.6