/usr/include/tango/event.h is in libtango8-dev 8.1.2c+dfsg-5.
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 | ////////////////////////////////////////////////////////////////////////////////
///
/// file event.h
///
/// 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
// 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/>.
//
///
/// original : 7 April 2003
///
/// $Revision: 22744 $
///
/// copyright : European Synchrotron Radiation Facility
/// BP 220, Grenoble 38043
/// FRANCE
///
////////////////////////////////////////////////////////////////////////////////
#ifndef _EVENTAPI_H
#define _EVENTAPI_H
#include <attribute.h>
#include <except.h>
namespace Tango
{
#ifndef _USRDLL
extern "C"
{
#endif
void leavefunc();
void client_leavefunc();
#ifndef _USRDLL
}
#endif
#define CONF_TYPE_EVENT "attr_conf"
#define DATA_READY_TYPE_EVENT "data_ready"
#define ALL_EVENTS 0
/********************************************************************************
* *
* EventData class *
* *
*******************************************************************************/
class EventData
{
public :
EventData() {}
EventData(DeviceProxy *dev,string &nam,string &evt,Tango::DeviceAttribute *attr_value_in,DevErrorList &errors_in);
~EventData();
EventData(const EventData &);
EventData & operator=(const EventData &);
DeviceProxy *device;
string attr_name;
string event;
DeviceAttribute *attr_value;
bool err;
DevErrorList errors;
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
private:
void set_time();
};
/********************************************************************************
* *
* 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 *
* *
*******************************************************************************/
class AttrConfEventData
{
public :
AttrConfEventData() {}
AttrConfEventData(DeviceProxy *dev,string &nam,string &evt,
Tango::AttributeInfoEx *attr_conf_in,
DevErrorList &errors_in);
~AttrConfEventData();
AttrConfEventData(const AttrConfEventData &);
AttrConfEventData & operator=(const AttrConfEventData &);
DeviceProxy *device;
string attr_name;
string event;
AttributeInfoEx *attr_conf;
bool err;
DevErrorList errors;
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
private:
void set_time();
};
/********************************************************************************
* *
* 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 *
* *
*******************************************************************************/
class DataReadyEventData
{
public :
DataReadyEventData() {}
DataReadyEventData(DeviceProxy *,AttDataReady *,string &evt,DevErrorList &);
~DataReadyEventData() {};
DataReadyEventData(const DataReadyEventData &);
DataReadyEventData & operator=(const DataReadyEventData &);
DeviceProxy *device;
string attr_name;
string event;
int attr_data_type;
int ctr;
bool err;
DevErrorList errors;
/**
* The date when the event arrived
*/
Tango::TimeVal reception_date;
Tango::TimeVal &get_date() {return reception_date;}
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();
}
}
}
;
/********************************************************************************
* *
* 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);
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(CallBack *cb);
private:
void inc_indexes();
vector<EventData *> event_buffer;
vector<AttrConfEventData *> conf_event_buffer;
vector<DataReadyEventData *> ready_event_buffer;
long max_elt;
long insert_elt;
long nb_elt;
omni_mutex modification_mutex;
};
} // End of namespace
#endif // _EVENTAPI_H
|