#include <FileDescriptorSimulationActivity.hpp>
Public Member Functions | |
void | clearAllWatches () |
Does nothing. More... | |
virtual bool | execute () |
Returns true. More... | |
FileDescriptorSimulationActivity (int priority, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity") | |
FileDescriptorSimulationActivity (int scheduler, int priority, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity") | |
FileDescriptorSimulationActivity (int scheduler, int priority, Seconds period, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity") | |
FileDescriptorSimulationActivity (int scheduler, int priority, Seconds period, unsigned cpu_affinity, base::RunnableInterface *_r=0, const std::string &name="FileDescriptorSimulationActivity") | |
virtual unsigned | getCpuAffinity () const |
Returns 0. More... | |
virtual Seconds | getPeriod () const |
Returns period. More... | |
int | getTimeout () const |
Return 0. More... | |
int | getTimeout_us () const |
Returns 0. More... | |
bool | hasError () const |
bool | hasTimeout () const |
virtual bool | isActive () const |
Returns true. More... | |
virtual bool | isPeriodic () const |
Returns true iff (0 != period) More... | |
virtual bool | isRunning () const |
Returns true. More... | |
bool | isUpdated (int fd) const |
bool | isWatched (int fd) const |
Returns false always. More... | |
virtual bool | setCpuAffinity (unsigned cpu) |
Returns true. More... | |
virtual bool | setPeriod (Seconds s) |
If s>0 then returns true and period == s, otherwise returns false. More... | |
void | setTimeout (int timeout) |
Does nothing. More... | |
void | setTimeout_us (int timeout_us) |
Does nothing. More... | |
virtual bool | start () |
Returns true. More... | |
virtual bool | stop () |
Returns true. More... | |
virtual os::ThreadInterface * | thread () |
Returns os::MainThread::Instance() More... | |
virtual bool | timeout () |
Returns true. More... | |
virtual bool | trigger () |
Returns true. More... | |
void | unwatch (int fd) |
Does nothing. More... | |
void | watch (int fd) |
Does nothing. More... | |
virtual void | work (base::RunnableInterface::WorkReason reason) |
If have a runner then pass the reason to the runner and store in lastReason. More... | |
virtual | ~FileDescriptorSimulationActivity () |
Public Member Functions inherited from RTT::extras::FileDescriptorActivityInterface | |
virtual | ~FileDescriptorActivityInterface () |
Public Member Functions inherited from RTT::base::ActivityInterface | |
ActivityInterface () | |
ActivityInterface (RunnableInterface *run) | |
virtual RunnableInterface * | getRunner () const |
virtual bool | run (RunnableInterface *r) |
virtual | ~ActivityInterface () |
Protected Attributes | |
base::RunnableInterface::WorkReason | lastReason |
Seconds | period |
bool | running |
Protected Attributes inherited from RTT::base::ActivityInterface | |
RunnableInterface * | runner |
Additional Inherited Members | |
Public Types inherited from RTT::base::ActivityInterface | |
typedef boost::shared_ptr< ActivityInterface > | shared_ptr |
Protected Member Functions inherited from RTT::base::ActivityInterface | |
void | disableRun (RunnableInterface *caller) |
Simulate a FileDescriptorActivity (FDA) Primarily this is designed for unit tests that are testing components that require a FDA. This implementation allows deterministic cycling of such a component.
The intended use case is a component that is woken up by its FDA and then the component determines why it was woken up by calling isUpdated(), hasTimeout(), and hasError(). The unit test code should call work() with an appropriate reason, which will end up being returned to the component through the above calls. So a unit test call of work(IOReady) will result in isUpdated() returning true to the component, and similarly for work(TimeOut) and hasTimeout(). Currently hasError() always returns false - there is no way to simulate this with the current implementation.
Definition at line 58 of file FileDescriptorSimulationActivity.hpp.
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity | ( | int | priority, |
base::RunnableInterface * | _r = 0 , |
||
const std::string & | name = "FileDescriptorSimulationActivity" |
||
) |
Definition at line 37 of file FileDescriptorSimulationActivity.cpp.
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity | ( | int | scheduler, |
int | priority, | ||
base::RunnableInterface * | _r = 0 , |
||
const std::string & | name = "FileDescriptorSimulationActivity" |
||
) |
Definition at line 50 of file FileDescriptorSimulationActivity.cpp.
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity | ( | int | scheduler, |
int | priority, | ||
Seconds | period, | ||
base::RunnableInterface * | _r = 0 , |
||
const std::string & | name = "FileDescriptorSimulationActivity" |
||
) |
Definition at line 64 of file FileDescriptorSimulationActivity.cpp.
FileDescriptorSimulationActivity::FileDescriptorSimulationActivity | ( | int | scheduler, |
int | priority, | ||
Seconds | period, | ||
unsigned | cpu_affinity, | ||
base::RunnableInterface * | _r = 0 , |
||
const std::string & | name = "FileDescriptorSimulationActivity" |
||
) |
Definition at line 80 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Cleanup and notify the base::RunnableInterface that we are gone.
Definition at line 98 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Does nothing.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 117 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 225 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns 0.
Implements RTT::base::ActivityInterface.
Definition at line 214 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns period.
Implements RTT::base::ActivityInterface.
Definition at line 195 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Return 0.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 152 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns 0.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 157 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
True if one of the file descriptors has a problem (for instance it has been closed)
This should only be used from within the base::RunnableInterface this activity is driving, i.e. in TaskContext::updateHook() or TaskContext::errorHook().
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 137 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Return (Timeout == lastReason)
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 132 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 190 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true iff (0 != period)
Implements RTT::base::ActivityInterface.
Definition at line 200 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 185 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Return (IOReady == lastReason)
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 127 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns false always.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 121 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 219 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
If s>0 then returns true and period == s, otherwise returns false.
Implements RTT::base::ActivityInterface.
Definition at line 205 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Does nothing.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 142 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Does nothing.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 147 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 167 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 176 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns os::MainThread::Instance()
Implements RTT::base::ActivityInterface.
Definition at line 240 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 235 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Returns true.
Implements RTT::base::ActivityInterface.
Definition at line 230 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Does nothing.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 112 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
Does nothing.
Implements RTT::extras::FileDescriptorActivityInterface.
Definition at line 107 of file FileDescriptorSimulationActivity.cpp.
|
virtual |
If have a runner then pass the reason to the runner and store in lastReason.
Definition at line 245 of file FileDescriptorSimulationActivity.cpp.
|
protected |
Value passed to last work() call Used to determine the return from isUpdated() and hasTimeout()
Definition at line 172 of file FileDescriptorSimulationActivity.hpp.
|
protected |
Fake period - some classes require period!=0. Is initialized to 0
Definition at line 167 of file FileDescriptorSimulationActivity.hpp.
|
protected |
Definition at line 169 of file FileDescriptorSimulationActivity.hpp.