|
DUECA/DUSIME
|
The most common type of activity, one which uses a GenericCallback object to call something. More...
#include <Activity.hxx>


Public Member Functions | |
| ActivityCallback (const GlobalId &owner, const char *my_name, GenericCallback *f, const PrioritySpec &spec) | |
| Constructor. | |
| ~ActivityCallback () | |
| Destructor. | |
Public Member Functions inherited from dueca::Activity | |
| Activity (const GlobalId &owner, const char *my_name, const PrioritySpec &s) | |
| Constructor. | |
| virtual | ~Activity () |
| Destructor. | |
| void | switchOn (const TimeTickType &time=0) |
| Specify the time from which the Activity is switched on. | |
| void | switchOff (const TimeTickType &time=0) |
| Specify the time when this Activity should be switched off. | |
| void | switchOn (const TimeSpec &time) |
| Specify the time from which the Activity is switched on. | |
| void | switchOff (const TimeSpec &time) |
| Specify the time when this Activity should be switched off. | |
| void | setTimeSpec (const TimeSpec &ts) |
| Supply a periodic time specification to the activity. | |
| void | changePriority (const PrioritySpec &s) |
| Change the priority spec. | |
| void | print (ostream &os) |
| Print to stream, for debugging purposes. | |
| int | noScheduledBehind () const |
| Find out how many more instances of this activity are scheduled. | |
| int | numScheduledBehind () const |
| Find out how many more instances of this activity are scheduled. | |
| TimingCheck * | getCheck () |
| Return a pointer to the check associated with this activity. | |
| const vstring & | getName () const |
| Return the name of the activity. | |
| const std::string & | getTargetName () const |
| As an activity target. | |
| void | logBlockingWait () |
| If your activity does blocking waits (file io etc.), it might be neat to report that, so that logging facilities can correctly interpret run times. | |
| void | logBlockingWaitOver () |
| Report that the blocking wait is over. | |
| bool | firstCycle (const TimeSpec &ts=TimeSpec(0, 0)) |
| Is this the first run after the activity has been switched on? | |
| bool | lastCycle (const TimeSpec &ts=TimeSpec(0, 0)) |
| Is this the last cycle before the activity will be switched off? | |
| bool | isBraking () |
| Indicate that the system has been commanded to stop. | |
Friends | |
| class | ActivityItem |
| Only an ActivityItem may use despatch. | |
Additional Inherited Members | |
Public Types inherited from dueca::Activity | |
| enum | RunState { Off , Last , Ready , Braking , Running , ReadyWork , FirstWork , RunningWork , BrakingWork , LastWork } |
| To track the run state, and signal about first/last/work etc. More... | |
Public Attributes inherited from dueca::Activity | |
| GlobalId | owner |
| Owner of this activity. | |
| int | activity_id |
| Integer handle, unique within a node. | |
| PrioritySpec | prio_spec |
| Priority of the activity. | |
| RunState | run_state |
| Runstate of the activity, to save cycles on switch logic. | |
| TimeTickType | switch_on |
| Indicates the time from which this activity is switched on. | |
| TimeTickType | switch_off |
| Indicates the time until which this activity is switched on. | |
| PeriodicTimeSpec * | time_spec |
| Periodic timing specification for this activity. | |
| TimingCheck * | check |
| Pointer to a TimingCheck object. | |
| ActivityManager * | my_manager |
| A pointer to this activity's ActivityManager. | |
| int | no_schedules |
| Count of the number of times the activity has been scheduled. | |
| int | no_despatches |
| Count of the number of times the activity has been run. | |
| vstring | name |
| string format name. | |
Protected Member Functions inherited from dueca::Activity | |
| int | getOrder () const |
| Return the "order" part of the priority. | |
| const GlobalId & | getOwner () |
| Return the id of the owner of the activity. | |
| bool | isInRunPeriod (const DataTimeSpec &ts) |
| Test whether activation is appropriate. | |
| DataTimeSpec | trimToRunPeriod (const DataTimeSpec &ts) |
| Trim a time spec to the run period. | |
| unsigned int | getDescriptionId () const |
| Return the id of the activity. | |
| void | trigger (const DataTimeSpec &t, unsigned idx) |
| Override of the trigger method from the TriggerTarget class. | |
The most common type of activity, one which uses a GenericCallback object to call something.
Use objects of this class if you want to "do" something in a DUECA process. The common use is to create a Callback object which calls back a function in your class, and then create an ActivityCallback object that takes the Callback object as an argument. Then, as needed, switch the Activity on and off, and supply a PeriodicTimeSpec to your own taste.
In your header
In the initialisation list of your constructor:
Where OneOfMyFunctions has to have the following type:
Commonly used member functions are:
| dueca::ActivityCallback::ActivityCallback | ( | const GlobalId & | owner, |
| const char * | my_name, | ||
| GenericCallback * | f, | ||
| const PrioritySpec & | spec ) |
Constructor.
Constructing an ActivityCallback object is a metafor for allocating/requesting thread of control from DUECA.
| owner | Your own id |
| my_name | A name (character string) for the Activity |
| f | GenericCallback object |
| spec | Priority specification. |