CCA

Global heart beat of the Data-Flow graph. More...

#include <Beat.h>

Inheritance diagram for cca::Beat:
Collaboration diagram for cca::Beat:

List of all members.

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< NodePtrgetReceivers ()
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?

Definition at line 44 of file Beat.h.


Constructor & Destructor Documentation

cca::Beat::~Beat ( ) [virtual]

Definition at line 62 of file Beat.cpp.

cca::Beat::Beat ( unsigned int  milliseconds) [protected]

Definition at line 48 of file Beat.cpp.


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]

Reimplemented in cca::RTPeriodicBeat.

Definition at line 78 of file Beat.cpp.

References _receiver.

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, else false

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<<().

Here is the caller graph for this function:

void cca::Beat::registerReceiver ( NodePtr  receiver) [virtual]

Register a Node to receive the global beat.

Parameters:
Nodeto 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]

Stream operator.

Parameters:
os
node
Returns:

Definition at line 97 of file Beat.cpp.


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().

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: