TmSampleCount Class Reference
[Scheduler]

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

#include <TmSampleCount.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 setReadCtrl (MarSystem *ms, std::string cname)
 set the control that is to be the reference for this timer
void setSource (MarSystem *ms)
 set the MarSystem that contains the read control.
void setSourceCtrl (std::string cname)
 set the control path
 TmSampleCount (const TmSampleCount &s)
 copy constructor
 TmSampleCount (MarSystem *ms, std::string cname)
 main constructor. Has identifier "TmSampleCount/Virtual"
 TmSampleCount (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"
 TmSampleCount ()
 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

std::string read_cname_
 the control to read from
MarControlPtr read_ctrl_
 the pointer, constructed in setReadCtrl that will be read to update the time
MarSystemread_src_
 the MarSystem containing the control to read from


Detailed Description

TmSampleCount reads the insamples information to advance the timer.

Author:
Neil Burroughs inb@cs.uvic.ca

Definition at line 39 of file TmSampleCount.h.


Constructor & Destructor Documentation

TmSampleCount ( 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 TmSampleCount.cpp.

References TmSampleCount::setReadCtrl().

TmSampleCount ( MarSystem ms,
std::string  cname 
)

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 TmSampleCount.cpp.

References TmSampleCount::setReadCtrl().

TmSampleCount ( const TmSampleCount s  ) 

copy constructor

Parameters:
s timer to copy

Definition at line 42 of file TmSampleCount.cpp.

References TmSampleCount::read_cname_, TmSampleCount::read_src_, and TmSampleCount::setReadCtrl().


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 88 of file TmSampleCount.cpp.

References MarSystem::getctrl(), and TmSampleCount::read_src_.

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 77 of file TmSampleCount.cpp.

References TmSampleCount::read_ctrl_, and TmSampleCount::read_src_.

void setReadCtrl ( MarSystem ms,
std::string  cname 
)

set the control that is to be the reference for this timer

Set the reference control for this timer. The control must be of type mrs_natural. The control value is read by getting a MarControlPtr from the MarSystem that owns the control then reading that pointer on each readTimeSrc() call.

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

Definition at line 50 of file TmSampleCount.cpp.

References MarSystem::getctrl(), TmSampleCount::read_cname_, TmSampleCount::read_ctrl_, and TmSampleCount::read_src_.

Referenced by TmSampleCount::TmSampleCount().

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 59 of file TmSampleCount.cpp.

References MarSystem::getctrl(), TmSampleCount::read_cname_, TmSampleCount::read_ctrl_, and TmSampleCount::read_src_.

Referenced by TmSampleCount::updtimer().

void setSourceCtrl ( std::string  cname  ) 

set the control path

This method sets the read control path to the parameter. 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:
cname the control path to read from

Definition at line 68 of file TmSampleCount.cpp.

References MarSystem::getctrl(), TmSampleCount::read_cname_, TmSampleCount::read_ctrl_, and TmSampleCount::read_src_.

Referenced by TmSampleCount::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 95 of file TmSampleCount.cpp.

References TmControlValue::getType(), TmSampleCount::setSource(), TmSampleCount::setSourceCtrl(), Marsyas::tmcv_marsystem, Marsyas::tmcv_string, TmControlValue::toMarSystem(), and TmControlValue::toString().


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