#include <rtt/ProgramProcessor.hpp>

It executes Realtime Programs when running.
If you want to change this policy, subclass the ProgramProcessor and override the virtual functions, such as step().
Definition at line 79 of file ProgramProcessor.hpp.
Public Types | |
| typedef ProgramInterface::Status | Status |
Public Member Functions | |
| ProgramProcessor (int f_queue_size=ORONUM_EXECUTION_PROC_QUEUE_SIZE) | |
| Constructs a new ProgramProcessor. | |
| bool | loadProgram (ProgramInterfacePtr pi) |
| Load a new Program. | |
| bool | deleteProgram (const std::string &name) |
| Completely discard a loaded Program. | |
| bool | unloadProgram (const std::string &name) |
| Unload a program from this processor. | |
| void | clear () |
| Stop and unload all programs from the ProgramProcessor. | |
| Status::ProgramStatus | getProgramStatus (const std::string &name) const |
| Return the status of a Program. | |
| std::string | getProgramStatusStr (const std::string &name) const |
| Return the status of a Program as a human readable string. | |
| virtual bool | initialize () |
| The method that will be called before the first periodical execution of step() ( or non periodical execution of loop() ), when the thread is started. | |
| virtual void | step () |
| The method that will be periodically executed when this class is run in a periodic thread. | |
| virtual void | finalize () |
| The method that will be called after the last periodical execution of step() ( or non periodical execution of loop() ), when the RunnableInterface is stopped. | |
| virtual bool | runFunction (ProgramInterface *f) |
| Run a given function in step() or loop(). | |
| virtual bool | removeFunction (ProgramInterface *f) |
| Remove a running function added with runFunction. | |
| std::vector< std::string > | getProgramList () const |
| Get a list of all loaded Programs. | |
| const ProgramInterfacePtr | getProgram (const std::string &name) const |
| Get a pointer to a loaded Program. | |
| ProgramInterfacePtr | getProgram (const std::string &name) |
| virtual void | loop () |
| The method that will be executed once when this class is run in a non periodic thread. | |
| virtual bool | breakLoop () |
| This method is called by the framework to break out of the loop() method. | |
| ThreadInterface * | getThread () const |
| Get the thread this object is run in. | |
| virtual void | setThread (ThreadInterface *t) |
| Set the thread this object will be run in. | |
Protected Types | |
|
typedef ListLockFree < ProgramInterfacePtr > | ProgMap |
Protected Attributes | |
| ProgMap * | programs |
| std::vector< ProgramInterface * > | funcs |
|
AtomicQueue< ProgramInterface *, NonBlockingPolicy, NonBlockingPolicy > * | f_queue |
| ProgramProcessor | ( | int | f_queue_size = ORONUM_EXECUTION_PROC_QUEUE_SIZE |
) |
Constructs a new ProgramProcessor.
| f_queue_size | The maximum number of 'functions' this processor can execute |
Definition at line 55 of file ProgramProcessor.cpp.
| bool loadProgram | ( | ProgramInterfacePtr | pi | ) |
Load a new Program.
The Processor takes full ownership and will delete it upon destruction.
| program_load_exception | if a program with the same name already exists. |
Definition at line 109 of file ProgramProcessor.cpp.
References ListLockFree::append(), ListLockFree::find_if(), ProgramInterface::getName(), and ListLockFree::grow().
| bool deleteProgram | ( | const std::string & | name | ) |
Completely discard a loaded Program.
| program_unload_exception | if the program is not stopped or does not exist. |
Definition at line 121 of file ProgramProcessor.cpp.
References ProgramProcessor::unloadProgram().
| bool unloadProgram | ( | const std::string & | name | ) |
Unload a program from this processor.
| program_unload_exception | if the program is not stopped or does not exist. |
Definition at line 126 of file ProgramProcessor.cpp.
References ListLockFree::erase(), ListLockFree::find_if(), ProgramInterface::getName(), and ListLockFree::shrink().
Referenced by ProgramProcessor::clear(), and ProgramProcessor::deleteProgram().
| bool runFunction | ( | ProgramInterface * | f | ) | [virtual] |
Run a given function in step() or loop().
The function may only be destroyed after isFunctionFinished() returns true,the Processor is stopped or removeFunction() was invoked. The number of functions the Processor can run in parallel is set in its constructor argument queue_size. In addition to that number, a queue of the same size is allocated for pending functions to execute.
Definition at line 196 of file ProgramProcessor.cpp.
References ProgramInterface::setProgramProcessor(), and ProgramInterface::start().
| bool removeFunction | ( | ProgramInterface * | f | ) | [virtual] |
Remove a running function added with runFunction.
This method is only required if the function is to be destroyed and is still present in the ProgramProcessor.
Definition at line 212 of file ProgramProcessor.cpp.
References ProgramInterface::stop().
| void loop | ( | ) | [virtual, inherited] |
The method that will be executed once when this class is run in a non periodic thread.
The default implementation calls step() once.
Reimplemented in Timer.
Definition at line 60 of file RunnableInterface.cpp.
References RunnableInterface::step().
Referenced by SlaveActivity::execute().
| bool breakLoop | ( | ) | [virtual, inherited] |
This method is called by the framework to break out of the loop() method.
Reimplement this method to signal loop() to return and return true on success. When this method is not reimplemented by you, it will always return false, denoting that the loop can not be broken. If breakLoop() returns true, the caller will wait until loop() returns.
Reimplemented in EventProcessor, ExecutionEngine, and Timer.
Definition at line 62 of file RunnableInterface.cpp.
Referenced by SlaveActivity::stop().
| ThreadInterface * getThread | ( | ) | const [inherited] |
Get the thread this object is run in.
Definition at line 69 of file RunnableInterface.cpp.
Referenced by Timer::initialize().
1.5.6