DataProcessor Class Reference
#include <DataProcessor.hh>
Inherited by ProcAccum, ProcAdder, ProcAdditive, ProcAmplifier, ProcBatteryPeukert, ProcDCMotorA, ProcDCMotorApex, ProcDCMotorV, ProcEncoder, ProcFileSink, ProcGearheadD, ProcGearheadK, ProcJointSink, ProcJointSource, ProcMultiplier, ProcNullsink, ProcObjectAccelG, ProcObjectAccelL, ProcObjectPose, ProcObjectVelocityG, ProcObjectVelocityL, ProcOnesource, ProcPassthrough, ProcRectifier, ProcSink, ProcSource, and ProcZerosource.
List of all members.
Detailed Description
Abstract base class for all data processor classes.
The DataProcessor class is an abstract base class for all data processors implementing various computational models. A data processor consists of a number of input channels, a number of output channels as well as an update() method which computes output values given the values of the input channels.
The methods connect() and disconnect() can be used to manage connections between different data processors. Note however that the current implementation does not support cycles in the resulting data flow graph. So, computation can only flow in onbe direction and feedback loops are not allowed. If feedback is necessary, it must be implemented internally by the processors.
All data processors created in an executable are registered and maintained by the singleton instance of the ProcessorManager class. The manager uniquely identifies each processor by its name and index. The update methods of all data processors are called by the processor manager in the appropriate topologically sorted order to ensure consistent computation and flow of data through the flow graph.
|
Public Member Functions |
| | DataProcessor (const char *name, int index, int inputs, int outputs) |
| const char * | getName (void) |
| int | getIndex (void) |
| unsigned int | getInputCount (void) |
| unsigned int | getOutputCount (void) |
| DataChannel | findInput (const char *name) |
| DataChannel | findOutput (const char *name) |
| void | connect (DataChannel in, DataProcessor *p, DataChannel out) |
| void | connect (const char *in, DataProcessor *p, const char *out) |
| void | connect (DataChannel in, DataProcessor *p, const char *out) |
| void | connect (const char *in, DataProcessor *p, DataChannel out) |
| void | disconnect (DataChannel in) |
| bool | checkLink (DataProcessor *p) |
| bool | verify (const char *msg=NULL) |
| virtual void | update (void)=0 |
| double | updatePeriod (void) |
| void | printProcessorInfo (void) |
|
void | resetLinkCount (void) |
|
int | getLinkCount (void) |
|
void | cutAllLinks (void) |
Protected Member Functions |
| ProcFloat | readOutput (DataChannel out) |
| ProcFloat | readInput (DataChannel in) |
| void | setOutput (DataChannel out, ProcFloat data) |
| DataChannel | nameInput (const char *name) |
| DataChannel | nameOutput (const char *name) |
Constructor & Destructor Documentation
| DataProcessor::DataProcessor |
( |
const char * |
name, |
|
|
int |
index, |
|
|
int |
inputs, |
|
|
int |
outputs |
|
) |
|
|
|
|
This constructor initializes the data processor.
- Parameters:
-
| name | {Name assigned to the processor} |
| name | {Index assigned to the processor} |
| inputs | {Number of input channels} |
| name | {Number of output channels} |
|
Member Function Documentation
|
|
This method recursively checks through all the input connections for an indirect link to the specified processor. |
|
|
This method connects a named input channel to an output channel on another data processor. |
|
|
This method connects an input channel to a named output channel on another data processor. |
| void DataProcessor::connect |
( |
const char * |
in, |
|
|
DataProcessor * |
p, |
|
|
const char * |
out |
|
) |
|
|
|
|
This method connects a named input channel to a named output channel on another data processor. |
|
|
This method connects an input channel to an output channel on another data processor. Currently, data processors do not support cyclic connection so this method issues an error when it detects a loop. |
|
|
This method disconnects an input channel. It also informs the data processor at the end of the exiting link (if there is one) about the disconnection. |
| DataChannel DataProcessor::findInput |
( |
const char * |
name |
) |
|
|
|
|
This method looks up the channel number for the input name supplied in the argument. Derived classes must name input channels with the method nameInput in their constructor. |
| DataChannel DataProcessor::findOutput |
( |
const char * |
name |
) |
|
|
|
|
This method looks up the channel number for the output name supplied in the argument. Derived classes must name output channels with the method nameOutput in their constructor. |
| int DataProcessor::getIndex |
( |
void |
|
) |
[inline] |
|
|
|
This method returns the index assigned to this processor by its constructor |
| unsigned int DataProcessor::getInputCount |
( |
void |
|
) |
[inline] |
|
|
|
This method returns the number of input channels for this processor |
| const char* DataProcessor::getName |
( |
void |
|
) |
[inline] |
|
|
|
This method returns the name assigned to this processor by its constructor |
| unsigned int DataProcessor::getOutputCount |
( |
void |
|
) |
[inline] |
|
|
|
This method returns the number of output channels for this processor |
| DataChannel DataProcessor::nameInput |
( |
const char * |
name |
) |
[protected] |
|
|
|
This method must be called by derived class constructors to assign names to input channels. |
| DataChannel DataProcessor::nameOutput |
( |
const char * |
name |
) |
[protected] |
|
|
|
This method must be called by derived classe constructors to assign names to output channels. |
| void DataProcessor::printProcessorInfo |
( |
void |
|
) |
|
|
|
|
This method prints out information about the name, and current links of this processor |
|
|
This method reads an input channel by querying the DataProcessor associated with the specified input channel. Derived classes can use this method to read their nput channels. |
|
|
This method retrieves the value of the output buffer for the specified output channel. It can be used by derived classes to read the current value of a selected output. |
|
|
This method sets the value of the output buffer to the supplied data sample. It is expected that derived classes will use this method to buffer computed values at the end of their update. |
| virtual void DataProcessor::update |
( |
void |
|
) |
[pure virtual] |
|
|
|
This method must be implemented by derived classes to perform its processing. It will be periodically called by the processor manager in the appropriate evaluation order. Derived classes can then use setOutput from within this method to store computed outputs in appropriate output buffers. |
| double DataProcessor::updatePeriod |
( |
void |
|
) |
|
|
|
|
This method returns the period inseconds between successive updates. This value can be used by the processors for appropriate modeling of time dependent entities |
| bool DataProcessor::verify |
( |
const char * |
msg = NULL |
) |
|
|
|
|
This method checks the input connections of the processor and reports any unconnected ones. It returns true if all inputs are connected. |
SimLib Reference Documentation