/usr/include/tango/event.h is in libtango-dev 9.2.5a+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | //===================================================================================================================
//
// file : event.h
//
// description : C++ include file for implementing the TANGO event server and client singleton classes -
// EventSupplier and EventConsumer.
// These classes are used to send events from the server to the notification service and to receive
// events from the notification service.
//
// author(s) : A.Gotz (goetz@esrf.fr)
//
// Copyright (C) : 2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This file is part of Tango.
//
// Tango is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License along with Tango.
// If not, see <http://www.gnu.org/licenses/>.
//
// $Revision: 27410 $
//
//===================================================================================================================
#ifndef _EVENTAPI_H
#define _EVENTAPI_H
#include <attribute.h>
#include <except.h>
#include <tango_const.h>
#include <zmq.hpp>
namespace Tango
{
#ifndef _USRDLL
extern "C"
{
#endif
void leavefunc();
#ifndef _USRDLL
}
#endif
/********************************************************************************
* *
* EventData class *
* *
*******************************************************************************/
/**
* Event callback execution data
*
* This class is used to pass data to the callback method when an event is sent to the client
*
* $Author: taurel $
* $Revision: 27410 $
*
* @headerfile tango.h
* @ingroup Client
*/
class EventData
{
public :
///@privatesection
EventData() {}
EventData(DeviceProxy *dev,string &nam,string &evt,Tango::DeviceAttribute *attr_value_in,DevErrorList &errors_in);
~EventData();
EventData(const EventData &);
EventData & operator=(const EventData &);
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
///@publicsection
DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
string attr_name; ///< The attribute name
string event; ///< The event name
DeviceAttribute *attr_value; ///< The attribute data
bool err; ///< A boolean flag set to true if the request failed. False otherwise
DevErrorList errors; ///< The error stack
private:
void set_time();
};
class FwdEventData: public EventData
{
public:
FwdEventData();
FwdEventData(DeviceProxy *,string &,string &,Tango::DeviceAttribute *,DevErrorList &);
FwdEventData(DeviceProxy *,string &,string &,Tango::DeviceAttribute *,DevErrorList &,zmq::message_t *);
void set_av_5(const AttributeValue_5 *_p) {av_5 = _p;}
const AttributeValue_5 *get_av_5() {return av_5;}
zmq::message_t *get_zmq_mess_ptr() {return event_data;}
private:
const AttributeValue_5 *av_5;
zmq::message_t *event_data;
};
/********************************************************************************
* *
* EventDataList class *
* *
*******************************************************************************/
class EventDataList:public vector<EventData *>
{
public:
EventDataList(): vector<EventData *>(0) {};
~EventDataList()
{
if (size() > 0)
{
EventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
}
}
void clear()
{
if (size() > 0)
{
EventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
this->vector<EventData *>::clear();
}
}
};
/********************************************************************************
* *
* AttrConfEventData class *
* *
*******************************************************************************/
/**
* Attribute configuration change event callback execution data
*
* This class is used to pass data to the callback method when an attribute configuration event is sent to the
* client
*
* $Author: taurel $
* $Revision: 27410 $
*
* @headerfile tango.h
* @ingroup Client
*/
class AttrConfEventData
{
public :
///@privatesection
AttrConfEventData() {}
AttrConfEventData(DeviceProxy *dev,string &nam,string &evt,
Tango::AttributeInfoEx *attr_conf_in,
DevErrorList &errors_in);
~AttrConfEventData();
AttrConfEventData(const AttrConfEventData &);
AttrConfEventData & operator=(const AttrConfEventData &);
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
///@publicsection
DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
string attr_name; ///< The attribute name
string event; ///< The event name
AttributeInfoEx *attr_conf; ///< The attribute configuration
bool err; ///< A boolean flag set to true if the request failed. False otherwise
DevErrorList errors; ///< The error stack
private:
void set_time();
};
class FwdAttrConfEventData: public AttrConfEventData
{
public:
FwdAttrConfEventData();
FwdAttrConfEventData(DeviceProxy *,string &,string &,Tango::AttributeInfoEx *,DevErrorList &);
void set_fwd_attr_conf(const AttributeConfig_5 *_p) {fwd_attr_conf = _p;}
const AttributeConfig_5 *get_fwd_attr_conf() {return fwd_attr_conf;}
private:
const AttributeConfig_5 *fwd_attr_conf;
};
/********************************************************************************
* *
* AttrConfEventDataList class *
* *
*******************************************************************************/
class AttrConfEventDataList:public vector<AttrConfEventData *>
{
public:
AttrConfEventDataList(): vector<AttrConfEventData *>(0) {};
~AttrConfEventDataList()
{
if (size() > 0)
{
AttrConfEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
}
}
void clear()
{
if (size() > 0)
{
AttrConfEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
this->vector<AttrConfEventData *>::clear();
}
}
};
/********************************************************************************
* *
* DataReadyEventData class *
* *
*******************************************************************************/
/**
* Data ready event callback execution data
*
* This class is used to pass data to the callback method when an attribute data ready event is sent to the client.
*
* $Author: taurel $
* $Revision: 27410 $
*
* @headerfile tango.h
* @ingroup Client
*/
class DataReadyEventData
{
public :
///@privatesection
DataReadyEventData() {}
DataReadyEventData(DeviceProxy *,AttDataReady *,string &evt,DevErrorList &);
~DataReadyEventData() {};
DataReadyEventData(const DataReadyEventData &);
DataReadyEventData & operator=(const DataReadyEventData &);
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
///@publicsection
DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
string attr_name; ///< The attribute name
string event; ///< The event name
int attr_data_type; ///< The attribute data type
int ctr; ///< The user counter. Set to 0 if not defined when sent by the server
bool err; ///< A boolean flag set to true if the request failed. False otherwise
DevErrorList errors; ///< The error stack
private:
void set_time();
};
/********************************************************************************
* *
* DataReadyEventDataList class *
* *
*******************************************************************************/
class DataReadyEventDataList:public vector<DataReadyEventData *>
{
public:
DataReadyEventDataList(): vector<DataReadyEventData *>(0) {};
~DataReadyEventDataList()
{
if (size() > 0)
{
DataReadyEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
}
}
void clear()
{
if (size() > 0)
{
DataReadyEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
this->vector<DataReadyEventData *>::clear();
}
}
}
;
/********************************************************************************
* *
* DevIntrChangeEventData class *
* *
*******************************************************************************/
/**
* Device interface change event callback execution data
*
* This class is used to pass data to the callback method when a device interface change event is sent to the client.
*
* $Author: taurel $
* $Revision: 27410 $
*
* @headerfile tango.h
* @ingroup Client
*/
class DevIntrChangeEventData
{
public :
///@privatesection
DevIntrChangeEventData() {}
DevIntrChangeEventData(DeviceProxy *,string &,string &,DevCmdInfoList_2 *,AttributeConfigList_5 *,bool,DevErrorList &);
DevIntrChangeEventData(DeviceProxy *,string &,string &,CommandInfoList *,AttributeInfoListEx *,bool,DevErrorList &);
~DevIntrChangeEventData() {};
DevIntrChangeEventData(const DevIntrChangeEventData &);
DevIntrChangeEventData & operator=(const DevIntrChangeEventData &);
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
///@publicsection
DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
string event; ///< The event name
string device_name; ///< The device name
CommandInfoList cmd_list; ///< Device command list info
AttributeInfoListEx att_list; ///< Device attribute list info
bool dev_started; ///< Device started flag (true when event sent due to device being (re)started
///< and with only a possible but not sure interface change)
bool err; ///< A boolean flag set to true if the request failed. False otherwise
DevErrorList errors; ///< The error stack
private:
void set_time();
};
/********************************************************************************
* *
* DevIntrChangeEventDataList class *
* *
*******************************************************************************/
class DevIntrChangeEventDataList:public vector<DevIntrChangeEventData *>
{
public:
DevIntrChangeEventDataList(): vector<DevIntrChangeEventData *>(0) {};
~DevIntrChangeEventDataList()
{
if (size() > 0)
{
DevIntrChangeEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
}
}
void clear()
{
if (size() > 0)
{
DevIntrChangeEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
this->vector<DevIntrChangeEventData *>::clear();
}
}
};
/********************************************************************************
* *
* PipeEventData class *
* *
*******************************************************************************/
/**
* Pipe event callback execution data
*
* This class is used to pass data to the callback method when a pipe event is sent to the client
*
* $Author: taurel $
* $Revision: 27410 $
*
* @headerfile tango.h
* @ingroup Client
*/
class PipeEventData
{
public :
///@privatesection
PipeEventData() {}
PipeEventData(DeviceProxy *dev,string &nam,string &evt,Tango::DevicePipe *pipe_value_in,DevErrorList &errors_in);
~PipeEventData();
PipeEventData(const PipeEventData &);
PipeEventData & operator=(const PipeEventData &);
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
///@publicsection
DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
string pipe_name; ///< The pipe name
string event; ///< The event name
DevicePipe *pipe_value; ///< The pipe data
bool err; ///< A boolean flag set to true if the request failed. False otherwise
DevErrorList errors; ///< The error stack
private:
void set_time();
};
/********************************************************************************
* *
* PipeEventDataList class *
* *
*******************************************************************************/
class PipeEventDataList:public vector<PipeEventData *>
{
public:
PipeEventDataList(): vector<PipeEventData *>(0) {};
~PipeEventDataList()
{
if (size() > 0)
{
PipeEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
}
}
void clear()
{
if (size() > 0)
{
PipeEventDataList::iterator vpos;
for (vpos=begin(); vpos!=end(); ++vpos)
{
delete (*vpos);
}
this->vector<PipeEventData *>::clear();
}
}
};
/********************************************************************************
* *
* EventQueue class *
* *
*******************************************************************************/
class EventQueue
{
public:
EventQueue();
EventQueue(long max_size);
~EventQueue();
void insert_event(EventData *new_event);
void insert_event(AttrConfEventData *new_event);
void insert_event(DataReadyEventData *new_event);
void insert_event(DevIntrChangeEventData *new_event);
void insert_event(PipeEventData *new_event);
int size();
TimeVal get_last_event_date();
bool is_empty() {if (event_buffer.empty() == true) return true;else return false;}
void get_events(EventDataList &event_list);
void get_events(AttrConfEventDataList &event_list);
void get_events(DataReadyEventDataList &event_list);
void get_events(DevIntrChangeEventDataList &event_list);
void get_events(PipeEventDataList &event_list);
void get_events(CallBack *cb);
private:
void inc_indexes();
vector<EventData *> event_buffer;
vector<AttrConfEventData *> conf_event_buffer;
vector<DataReadyEventData *> ready_event_buffer;
vector<DevIntrChangeEventData *> dev_inter_event_buffer;
vector<PipeEventData *> pipe_event_buffer;
long max_elt;
long insert_elt;
long nb_elt;
omni_mutex modification_mutex;
};
} // End of namespace
#endif // _EVENTAPI_H
|