cumbia-tango 1.x
C++ multi threaded library based on cumbia and the Tango control system
|
an activity to subscribe and receive events from Tango. Implements CuActivity and Tango::Callback interfaces More...
#include <cueventactivity.h>
Public Types | |
enum | Type { CuEventActivityType = CuActivity::UserAType + 2 } |
Public Member Functions | |
CuEventActivity (const TSource &tso, CuDeviceFactory_I *df, const std::string &refreshmo, const CuData &tag, int update_policy) | |
the class constructor that configures the activity event flags More... | |
~CuEventActivity () | |
the class destructor More... | |
int | getType () const |
returns the CuEventActivityType value More... | |
void | event (CuActivityEvent *e) |
Receive events from the main thread to the CuActivity thread. More... | |
bool | matches (const CuData &token) const |
returns true if the passed token's src and activity values matche this activity token's src and activity values. More... | |
int | repeat () const |
returns 0. CuEventActivity's execute is called only once. More... | |
Protected Member Functions | |
void | init () |
the implementation of the CuActivity::init hook More... | |
void | execute () |
the implementation of the CuActivity::execute hook More... | |
void | onExit () |
the implementation of the CuActivity::onExit hook More... | |
void | push_event (Tango::EventData *) |
receive events from Tango, extract data and post the result on the main thread through publishResult More... | |
an activity to subscribe and receive events from Tango. Implements CuActivity and Tango::Callback interfaces
Implementing CuActivity, the work is done in the background by the three methods
They are called from a separate thread. In cumbia-tango, threads are grouped by device. As an implementor of Tango::Callback, events are received through the push_event callback
Apart from the three execution hooks listed above, some other methods have been written to comply with the CuActivityInterface:
CuEventActivity::CuEventActivity | ( | const TSource & | tso, |
CuDeviceFactory_I * | df, | ||
const std::string & | refreshmo, | ||
const CuData & | tag, | ||
int | update_policy | ||
) |
the class constructor that configures the activity event flags
token | a CuData that will identify this activity |
df | a pointer to a CuDeviceFactoryService that is used by init and onExit to create/obtain and later get rid of a Tango device, respectively. |
CuEventActivity::~CuEventActivity | ( | ) |
the class destructor
void CuEventActivity::event | ( | CuActivityEvent * | e | ) |
Receive events from the main thread to the CuActivity thread.
e | the event. Do not delete e after use. Cumbia will delete it after this method invocation. |
|
protected |
the implementation of the CuActivity::execute hook
This is called in the CuActivity's thread of execution.
To learn about the contents of the CuData delivered as result, please see the CuEventActivity::push_event documentation.
See also CuActivity::execute
References CuTangoWorld::strerror().
int CuEventActivity::getType | ( | ) | const |
returns the CuEventActivityType value
References CuEventActivityType.
|
protected |
the implementation of the CuActivity::init hook
This is called in the CuActivity's thread of execution.
References CuTThread::CuTThreadType.
bool CuEventActivity::matches | ( | const CuData & | token | ) | const |
returns true if the passed token's src and activity values matche this activity token's src and activity values.
token | a CuData containg key/value pairs of another activity's token |
Two CuEventActivities match if the "src" and the "activity" names match. CuEventActivity "activity" key is set to the "E" value by CuTReader, so two activities match if they are both CuEventActivity and share the same source name.
|
protected |
the implementation of the CuActivity::onExit hook
This is called in the CuActivity's thread of execution.
See also CuActivity::onExit
References CuTangoWorld::strerror().
|
protected |
receive events from Tango, extract data and post the result on the main thread through publishResult
e | the Tango::EventData passed by the tango callback |
References CuTangoWorld::error(), CuTangoWorld::extractData(), CuTangoWorld::getLastMessage(), and CuTangoWorld::strerror().
int CuEventActivity::repeat | ( | ) | const |
returns 0. CuEventActivity's execute is called only once.