CCA
|
Global heart beat of the Data-Flow graph. More...
#include <Beat.h>
Public Member Functions | |
virtual | ~Beat () |
virtual std::string | print () const |
Print. | |
virtual void | execute ()=0 |
The main execution method which is executed with the specified cycle-time. | |
virtual void | registerReceiver (NodePtr receiver) |
Register a Node to receive the global beat. | |
virtual std::vector< NodePtr > | getReceivers () |
virtual NodePtr | getReceiver (unsigned int index) |
virtual unsigned int | getCycleTime () |
Cycle time. | |
virtual void | run ()=0 |
Run it. | |
virtual void | cancel ()=0 |
Interrupts the task. | |
virtual bool | isCancelRequested ()=0 |
Tells whether the task was interrupted by a call to cancel. | |
Protected Member Functions | |
Beat (unsigned int milliseconds) | |
Protected Attributes | |
unsigned int | _cycletime |
Samplerate in milliseconds. | |
std::vector< NodePtr > | _receiver |
Vector of registered Nodes to receive the global beat signal. | |
unsigned int | _numReceivers |
Number of registered receivers. | |
rsc::logging::LoggerPtr | logger |
Beat logger. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Beat &beat) |
Stream operator. |
Detailed Description
Global heart beat of the Data-Flow graph.
With the specified samplerate, all registered node get a global beat signal.
- Todo:
Run methods with specified duration or specified number of ticks
Increasing/decreasing speed?
Constructor & Destructor Documentation
cca::Beat::~Beat | ( | ) | [virtual] |
cca::Beat::Beat | ( | unsigned int | milliseconds | ) | [protected] |
Member Function Documentation
virtual void cca::Beat::cancel | ( | ) | [pure virtual] |
Interrupts the task.
The default implementation sets a boolean flag that can be checked with isCancelRequested.
Implemented in cca::RTPeriodicBeat, and cca::PeriodicBeat.
void cca::Beat::execute | ( | ) | [pure virtual] |
The main execution method which is executed with the specified cycle-time.
Implemented in cca::PeriodicBeat, and cca::RTPeriodicBeat.
Definition at line 53 of file Beat.cpp.
References _numReceivers, _receiver, and logger.
unsigned int cca::Beat::getCycleTime | ( | ) | [virtual] |
Cycle time.
- Returns:
- Cycle-time in milliseconds
Reimplemented in cca::RTPeriodicBeat, and cca::PeriodicBeat.
Definition at line 65 of file Beat.cpp.
References _cycletime.
NodePtr cca::Beat::getReceiver | ( | unsigned int | index | ) | [virtual] |
Reimplemented in cca::RTPeriodicBeat.
Definition at line 82 of file Beat.cpp.
References _numReceivers, and _receiver.
std::vector< NodePtr > cca::Beat::getReceivers | ( | ) | [virtual] |
virtual bool cca::Beat::isCancelRequested | ( | ) | [pure virtual] |
Tells whether the task was interrupted by a call to cancel.
The default implementation returns the value of a boolean flag. Override this for more complex logic but don't forget to also override cancel then.
- Returns:
true
if cancel was called, elsefalse
Implemented in cca::RTPeriodicBeat, and cca::PeriodicBeat.
string cca::Beat::print | ( | ) | const [virtual] |
Print.
Reimplemented in cca::PeriodicBeat, and cca::RTPeriodicBeat.
Definition at line 89 of file Beat.cpp.
References _cycletime, and _numReceivers.
Referenced by cca::operator<<().
void cca::Beat::registerReceiver | ( | NodePtr | receiver | ) | [virtual] |
Register a Node to receive the global beat.
- Parameters:
-
Node to receive the global beat.
Reimplemented in cca::RTPeriodicBeat.
Definition at line 69 of file Beat.cpp.
References _numReceivers, _receiver, and logger.
virtual void cca::Beat::run | ( | ) | [pure virtual] |
Run it.
Implemented in cca::RTPeriodicBeat, and cca::PeriodicBeat.
Friends And Related Function Documentation
std::ostream& operator<< | ( | std::ostream & | os, |
const Beat & | beat | ||
) | [friend] |
Member Data Documentation
unsigned int cca::Beat::_cycletime [protected] |
Samplerate in milliseconds.
Each _cycletime milliseconds, alls receivers get the global beat signal.
Definition at line 108 of file Beat.h.
Referenced by cca::PeriodicBeat::getCycleTime(), getCycleTime(), cca::RTPeriodicBeat::getCycleTime(), print(), cca::RTPeriodicBeat::print(), and cca::PeriodicBeat::print().
unsigned int cca::Beat::_numReceivers [protected] |
Number of registered receivers.
Definition at line 119 of file Beat.h.
Referenced by execute(), cca::PeriodicBeat::execute(), cca::RTPeriodicBeat::execute(), getReceiver(), cca::RTPeriodicBeat::getReceiver(), print(), cca::RTPeriodicBeat::print(), cca::PeriodicBeat::print(), registerReceiver(), and cca::RTPeriodicBeat::registerReceiver().
std::vector<NodePtr> cca::Beat::_receiver [protected] |
Vector of registered Nodes to receive the global beat signal.
- Todo:
- use std::list
Definition at line 114 of file Beat.h.
Referenced by execute(), cca::PeriodicBeat::execute(), cca::RTPeriodicBeat::execute(), getReceiver(), cca::RTPeriodicBeat::getReceiver(), getReceivers(), cca::RTPeriodicBeat::getReceivers(), registerReceiver(), and cca::RTPeriodicBeat::registerReceiver().
rsc::logging::LoggerPtr cca::Beat::logger [protected] |
Beat logger.
Definition at line 122 of file Beat.h.
Referenced by execute(), and registerReceiver().
The documentation for this class was generated from the following files: