|
AndroMeta
2.0.0
|
Graph-based chaining/signalling and light-weight concurrent processing. More...
#include <MProc.h>
Public Types | |
| typedef MMap< int, mvar > | SignalMap |
| typedef MVector< int > | IdVec |
Public Member Functions | |
| MProc () | |
| virtual | ~MProc () |
| void | queue (MProcTask *task, MProc::SignalMap *signalMap=0, double priority=0, bool activate=false, const mtime *time=0) |
| virtual bool | activate (SignalMap &signalMap) |
| virtual mvar | run (SignalMap &signalMap) |
| void | run (SignalMap *signalMap) |
| virtual int | connect (MProc *mp, const mvar &data=undef) |
| virtual void | connect (int outId, int inId, MProc *mp, const mvar &data=undef) |
| virtual void | disconnect (int outId) |
| virtual void | disconnect () |
| virtual void | detach () |
| virtual void | signal (int outId) |
| virtual void | signal (int outId, const mvar &v) |
| virtual void | signal (int outId, const mvar &v, double priority, bool persist=true, const mtime *time=0) |
| virtual void | signalAll () |
| virtual void | signalAll (const mvar &v) |
| virtual void | signalAll (const mvar &v, double priority, bool persist=true, const mtime *time=0) |
| const IdVec & | outEdges () const |
| const IdVec & | inEdges () const |
| bool | isThreaded () const |
| void | setThreaded (bool flag) |
| bool | terminate (bool block=true) |
| bool | hasTerminated () const |
| void | reset () |
| MProc * | outEdge (int outId) |
| MProc * | inEdge (int inId) |
| const MProc * | outEdge (int outId) const |
| const MProc * | inEdge (int inId) const |
| int | inId (int outId) const |
| int | outId (int inId) const |
| const mvar & | edgeData (int outId) const |
| void | setEdgeData (int outId, const mvar &v) |
Graph-based chaining/signalling and light-weight concurrent processing.
MProc provides a base class for creating a graph-based system or "network" of light-weight concurrent processes. It provides a thread abstraction which is useful in a variety of situations, e.g: recurrent processes, processes which are made up of several stages whereby some of the stages trigger others which may run parallel. MProc's are connected to one another and signal each other with mvar's. Signalling results in an attempt to activate() the MProc, according to an application-specific criteria. When an MProc is activated it is queued in an MProcTask to be run.
Constructor.
| virtual Meta::MProc::~MProc | ( | ) | [virtual] |
Destructor.
| virtual bool Meta::MProc::activate | ( | SignalMap & | signalMap | ) | [virtual] |
| virtual int Meta::MProc::connect | ( | MProc * | mp, |
| const mvar & | data = undef |
||
| ) | [virtual] |
Connect as an output edge the MProc mp.
| data | Associates additional application-specific data with the edge to be created. |
| virtual void Meta::MProc::connect | ( | int | outId, |
| int | inId, | ||
| MProc * | mp, | ||
| const mvar & | data = undef |
||
| ) | [virtual] |
| virtual void Meta::MProc::detach | ( | ) | [virtual] |
Sever all inputs edges.
| virtual void Meta::MProc::disconnect | ( | int | outId | ) | [virtual] |
Sever an output edge referred to by outId.
| virtual void Meta::MProc::disconnect | ( | ) | [virtual] |
Sever all output edges.
| const mvar& Meta::MProc::edgeData | ( | int | outId | ) | const |
Get the edge data associated with an output edge.
| bool Meta::MProc::hasTerminated | ( | ) | const |
Check the termination status of this MProc.
| MProc* Meta::MProc::inEdge | ( | int | inId | ) |
| const MProc* Meta::MProc::inEdge | ( | int | inId | ) | const |
| const IdVec& Meta::MProc::inEdges | ( | ) | const |
| int Meta::MProc::inId | ( | int | outId | ) | const |
| bool Meta::MProc::isThreaded | ( | ) | const |
| MProc* Meta::MProc::outEdge | ( | int | outId | ) |
| const MProc* Meta::MProc::outEdge | ( | int | outId | ) | const |
| const IdVec& Meta::MProc::outEdges | ( | ) | const |
| int Meta::MProc::outId | ( | int | inId | ) | const |
| void Meta::MProc::queue | ( | MProcTask * | task, |
| MProc::SignalMap * | signalMap = 0, |
||
| double | priority = 0, |
||
| bool | activate = false, |
||
| const mtime * | time = 0 |
||
| ) |
Queue an MProc for execution.
| task | The task that will run this MProc. |
| signalMap | A pointer to a signal map if any to run on. signalMap is consumed by this call -- it should not be deleted. |
| priorty | Relative run priority. The MProcTask runs higher priority values first. |
| activate | true if the mproc should be have its activate() function called first. |
| time | For timed execution, or null for untimed. time is consumed by this call -- it should not be deleted. |
| void Meta::MProc::reset | ( | ) |
After having been terminated, this method must be called to reset the MProc so that it may be queued or signalled again.
| virtual mvar Meta::MProc::run | ( | SignalMap & | signalMap | ) | [virtual] |
Application specific run method. Default behavior is to simply return 0.
Reimplemented in Meta::MNetProc.
| void Meta::MProc::run | ( | SignalMap * | signalMap | ) |
Do not call directly.
| void Meta::MProc::setEdgeData | ( | int | outId, |
| const mvar & | v | ||
| ) |
Set the edge data associated with an output edge.
| void Meta::MProc::setThreaded | ( | bool | flag | ) |
| virtual void Meta::MProc::signal | ( | int | outId | ) | [virtual] |
Signal an output edge with signal value undef.
| virtual void Meta::MProc::signal | ( | int | outId, |
| const mvar & | v | ||
| ) | [virtual] |
Signal an output edge with signal value v.
| virtual void Meta::MProc::signal | ( | int | outId, |
| const mvar & | v, | ||
| double | priority, | ||
| bool | persist = true, |
||
| const mtime * | time = 0 |
||
| ) | [virtual] |
Signal an output edge with signal value v.
| persist | If persist is true, in the event of failure to activate, this signal will persist through subsequent activation attempts. |
| time | Pass non-null for a timed execution. |
| virtual void Meta::MProc::signalAll | ( | ) | [virtual] |
Signal all output edges with value from edge data.
| virtual void Meta::MProc::signalAll | ( | const mvar & | v | ) | [virtual] |
Signal all output edges with value v.
| virtual void Meta::MProc::signalAll | ( | const mvar & | v, |
| double | priority, | ||
| bool | persist = true, |
||
| const mtime * | time = 0 |
||
| ) | [virtual] |
Signal all output edges with value v. Similar to signal().
| bool Meta::MProc::terminate | ( | bool | block = true | ) |
1.7.6.1