EvEvent Class Reference
[Scheduler]

EvEvent. More...

#include <EvEvent.h>

Inherited by EvExpr, EvGetUpd, and EvValUpd.


Public Member Functions

bool checkupd (std::string c1, std::string c2, TmControlValue v, mrs_natural t)
 convenience method for concrete events to use when checking types of values against path names during updctrl. This method constitutes two checks (c1=c2 and v=t) that must be true to return true.
virtual EvEventclone ()=0
 clone this event and all its parameters. This method must be implemented so that scheduled events may be copied.
virtual void dispatch ()=0
 the action to be performed by the event. This method is called when the event is due. Since Marsyas is not threaded, this method will block so be careful not to do too much.
void doRepeat ()
 force the event to update its dispatch time and decrement its repeat count based on the repetition information. If the event does not repeat then this method is meaningless and doesn't do anything. This method is used by the dispatch() method of the timer.
std::string getName () const
 get the name of the event, hopefully a unique identifier
std::string getPrefix () const
 the prefix is a concatenation of type and name as "type/name"
Repeat getRepeat ()
 get the repetition information for this event
virtual mrs_natural getRepeatCount ()
 get the repetition count for this event
virtual std::string getRepeatInterval ()
 get the repetition time interval for this event.
mrs_natural getTime () const
 get the time that this event is to be dispatched
std::string getType () const
 get the type of the event which is usually the class name
virtual bool repeat ()
 report if the event is to be repeated
virtual std::string repeat_interval (std::string interval)
 the reason for this method escapes me. It simply returns parameter supplied but obviously could be overridden for whatever reason. Although this method is never actually called by anyone right now.
void setName (std::string n)
 set the name of the event, should be a unique identifier
virtual void setRepeat (Repeat r)
 set the repeat state of this event
void setTime (mrs_natural t)
 set the time at which this event is to be dispatched
virtual void setTimer (TmTimer *t)
 set the timer on which this event is scheduled. This method is called by the timer's post method when the scheduled event is posted on the timer.
virtual void updctrl (std::string cname, TmControlValue value)
 update event parameters dynamically. Parameters of the event may be updated while the event is on the heap. The support for modifiable parameters is dependent on the implementation of concrete events. Unsupported parameter updates should generate warnings.

Protected Attributes

std::string name_
 a unique identifier for the event. There is no checking for uniqueness. If a search is made for a unique name the first hit will be taken.
Repeat repeat_
 repeat info for this event
mrs_natural time_
 the event dispatch time
TmTimertimer_
 the timer on which the event is to be dispatched
std::string type_
 the type of the event, probably the class name


Detailed Description

EvEvent.

Author:
Neil Burroughs inb@cs.uvic.ca

Definition at line 38 of file EvEvent.h.


Member Function Documentation

bool checkupd ( std::string  c1,
std::string  c2,
TmControlValue  v,
mrs_natural  t 
)

convenience method for concrete events to use when checking types of values against path names during updctrl. This method constitutes two checks (c1=c2 and v=t) that must be true to return true.

As an example, the call: checkupd(cname,"mrs_string/control",value,tmcv_string) might appear in updctrl(...) and checks the path name against the specific parameter "mrs_string/control" for an exact match. Next, the type of the value supplied will be checked against the type enumeration tmcv_string. The type enumerations can be found in the TmControlValue class.

Parameters:
c1 a path name to compare against c2
c2 a path name to compare against c1
v a control value to check
t a type enumeration from the TmControlValue class representing the expected type
Returns:
true if both checks succeed

Definition at line 145 of file EvEvent.cpp.

References TmControlValue::getType().

Referenced by EvValUpd::updctrl().

virtual EvEvent* clone (  )  [pure virtual]

clone this event and all its parameters. This method must be implemented so that scheduled events may be copied.

Returns:
a pointer to a copy of this event

Implemented in EvExpr, EvGetUpd, and EvValUpd.

std::string getName (  )  const

get the name of the event, hopefully a unique identifier

Returns:
the event identifier

Definition at line 43 of file EvEvent.cpp.

References EvEvent::name_.

std::string getPrefix (  )  const

the prefix is a concatenation of type and name as "type/name"

Returns:
string representation of the prefix

Definition at line 49 of file EvEvent.cpp.

References EvEvent::name_, and EvEvent::type_.

Referenced by TmTimer::dispatch(), and TmTimer::post().

Repeat getRepeat (  ) 

get the repetition information for this event

Returns:
the repetition information for this event

Definition at line 85 of file EvEvent.cpp.

References EvEvent::repeat_.

mrs_natural getRepeatCount (  )  [virtual]

get the repetition count for this event

Returns:
a pointer to the event object

Definition at line 73 of file EvEvent.cpp.

References Repeat::getCount(), and EvEvent::repeat_.

std::string getRepeatInterval (  )  [virtual]

get the repetition time interval for this event.

If this event does not repeat then the returned time interval is undefined (may be an empty string). It is best to check to see if there is repeat information prior to reading the interval.

Returns:
string representation of the time interval

Definition at line 79 of file EvEvent.cpp.

References Repeat::getInterval(), and EvEvent::repeat_.

Referenced by EvEvent::doRepeat().

mrs_natural getTime (  )  const

get the time that this event is to be dispatched

Returns:
the dispatch time count for this event

Definition at line 61 of file EvEvent.cpp.

References EvEvent::time_.

Referenced by EvEvent::doRepeat().

std::string getType (  )  const

get the type of the event which is usually the class name

Returns:
the type name

Definition at line 37 of file EvEvent.cpp.

References EvEvent::type_.

bool repeat (  )  [virtual]

report if the event is to be repeated

Returns:
true if event should repeat

Reimplemented in EvExpr.

Definition at line 97 of file EvEvent.cpp.

References Repeat::repeat(), and EvEvent::repeat_.

Referenced by TmTimer::dispatch(), and EvEvent::doRepeat().

std::string repeat_interval ( std::string  interval  )  [virtual]

the reason for this method escapes me. It simply returns parameter supplied but obviously could be overridden for whatever reason. Although this method is never actually called by anyone right now.

Parameters:
interval an interval of time
Returns:
the same as what was supplied

Definition at line 103 of file EvEvent.cpp.

void setName ( std::string  n  ) 

set the name of the event, should be a unique identifier

Parameters:
n a unique identifier

Definition at line 55 of file EvEvent.cpp.

References EvEvent::name_.

void setRepeat ( Repeat  r  )  [virtual]

set the repeat state of this event

Parameters:
r new repetition information for this event

Definition at line 91 of file EvEvent.cpp.

References EvEvent::repeat_.

Referenced by TmTimer::post().

void setTime ( mrs_natural  t  ) 

set the time at which this event is to be dispatched

Parameters:
t the dispatch time for this event

Definition at line 67 of file EvEvent.cpp.

References EvEvent::time_.

Referenced by TmTimer::post().

void setTimer ( TmTimer t  )  [virtual]

set the timer on which this event is scheduled. This method is called by the timer's post method when the scheduled event is posted on the timer.

Parameters:
t the timer on which this event is posted.

Reimplemented in EvExpr.

Definition at line 132 of file EvEvent.cpp.

References EvEvent::timer_.

Referenced by TmTimer::post(), and EvExpr::setTimer().

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

update event parameters dynamically. Parameters of the event may be updated while the event is on the heap. The support for modifiable parameters is dependent on the implementation of concrete events. Unsupported parameter updates should generate warnings.

Parameters:
cname the path name of the parameter to be modified.
value the value to be assigned

Reimplemented in EvExpr, and EvValUpd.

Definition at line 138 of file EvEvent.cpp.


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