/usr/include/tango/devasyn.h is in libtango7-dev 7.2.6+dfsg-4build2.
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 | //
// devsyn.h - include file for TANGO api device asynchronous calls
//
//
// Copyright (C) : 2004,2005,2006,2007,2008,2009,2010,2011
// 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/>.
#ifndef _DEVASYN_H
#define _DEVASYN_H
#include <tango.h>
#include <map>
using namespace std;
namespace Tango {
//------------------------------------------------------------------------------
class DeviceProxy;
class Connection;
class DeviceData;
class DeviceAttribute;
class NamedDevFailedList;
class EventData;
class AttrConfEventData;
class DataReadyEventData;
class EventDataList;
class AttrConfEventDataList;
class DataReadyEventDataList;
class EventConsumer;
class EventConsumerKeepAliveThread;
class CmdDoneEventExt;
class AttrReadEventExt;
class AttrWrittenEventExt;
class CallBackExt;
/********************************************************************************
* *
* CmdDoneEvent class *
* *
*******************************************************************************/
class CmdDoneEvent
{
public:
CmdDoneEvent(DeviceProxy *dev,
string &cmd,
DeviceData &arg,
DevErrorList &err_in):device(dev),
cmd_name(cmd),
argout(arg),
errors(err_in)
{if (errors.length()==0) err=false;else err=true;}
Tango::DeviceProxy *device;
string &cmd_name;
DeviceData &argout;
bool err;
DevErrorList &errors;
CmdDoneEventExt *ext;
};
/********************************************************************************
* *
* AttrReadEvent class *
* *
*******************************************************************************/
class AttrReadEvent
{
public:
AttrReadEvent(DeviceProxy *dev,
vector<string> &att_names,
vector<DeviceAttribute> *arg,
DevErrorList &err_in):device(dev),
attr_names(att_names),
argout(arg),
errors(err_in)
{if (errors.length()==0) err=false;else err=true;}
Tango::DeviceProxy *device;
vector<string> &attr_names;
vector<DeviceAttribute> *argout;
bool err;
DevErrorList &errors;
AttrReadEventExt *ext;
};
/********************************************************************************
* *
* AttrWrittenEvent class *
* *
*******************************************************************************/
class AttrWrittenEvent
{
public:
AttrWrittenEvent(DeviceProxy *dev,
vector<string> &att_names,
NamedDevFailedList &err_in):device(dev),
attr_names(att_names),
errors(err_in)
{err = errors.call_failed();}
Tango::DeviceProxy *device;
vector<string> &attr_names;
bool err;
NamedDevFailedList &errors;
AttrWrittenEventExt *ext;
};
/********************************************************************************
* *
* CallBack class *
* *
*******************************************************************************/
class CallBack
{
friend class EventConsumer;
friend class EventConsumerKeepAliveThread;
public:
virtual ~CallBack() {};
virtual void cmd_ended(CmdDoneEvent *) {};
virtual void attr_read(AttrReadEvent *) {};
virtual void attr_written(AttrWrittenEvent *) {};
virtual void push_event(EventData *) {};
virtual void push_event(AttrConfEventData *) {};
virtual void push_event(DataReadyEventData *) {};
CallBackExt *ext;
};
//------------------------------------------------------------------------------
class UniqIdent: public omni_mutex
{
public:
UniqIdent() {omni_mutex_lock(*this);ctr = 0;}
long get_ident() {omni_mutex_lock sync(*this);return ++ctr;}
long ctr;
};
class TgRequest
{
public:
enum ReqType
{
CMD_INOUT,
READ_ATTR,
WRITE_ATTR_SINGLE,
WRITE_ATTR
};
TgRequest(CORBA::Request_ptr re,ReqType ty):request(re),req_type(ty),cb_ptr(NULL),
arrived(false),dev(NULL)
{};
TgRequest(CORBA::Request_ptr re,ReqType ty,CallBack *cb):request(re),req_type(ty),cb_ptr(cb),
arrived(false),dev(NULL)
{};
TgRequest(Tango::Connection *con,ReqType ty,CallBack *cb):request(NULL),req_type(ty),cb_ptr(cb),
arrived(false),dev(con)
{};
CORBA::Request_ptr request;
ReqType req_type;
CallBack *cb_ptr;
bool arrived;
Connection *dev;
};
class AsynReq: public omni_mutex
{
public:
AsynReq(UniqIdent *ptr):ui_ptr(ptr),cond(this) {};
~AsynReq() {delete ui_ptr;}
TgRequest &get_request(long);
TgRequest &get_request(CORBA::Request_ptr);
TgRequest *get_request(Tango::Connection *);
long store_request(CORBA::Request_ptr,TgRequest::ReqType);
void store_request(CORBA::Request_ptr,CallBack *,Connection *,TgRequest::ReqType);
void remove_request(long);
void remove_request(Connection *,CORBA::Request_ptr);
size_t get_request_nb() {omni_mutex_lock(*this);return asyn_poll_req_table.size();}
size_t get_cb_request_nb() {omni_mutex_lock(*this);return cb_req_table.size();}
size_t get_cb_request_nb_i() {return cb_req_table.size();}
void mark_as_arrived(CORBA::Request_ptr req);
multimap<Connection *,TgRequest> &get_cb_dev_table() {return cb_dev_table;}
void mark_as_cancelled(long);
void mark_all_polling_as_cancelled();
void wait() {cond.wait();}
void signal() {omni_mutex_lock(*this);cond.signal();}
protected:
map<long,TgRequest> asyn_poll_req_table;
UniqIdent *ui_ptr;
multimap<Connection *,TgRequest> cb_dev_table;
map<CORBA::Request_ptr,TgRequest> cb_req_table;
vector<long> cancelled_request;
private:
omni_condition cond;
bool remove_cancelled_request(long);
};
//-------------------------------------------------------------------------
//
// Some extension classes foreseen for library binary compatibility
//
class CmdDoneEventExt
{
public:
CmdDoneEventExt() {};
};
class AttrReadEventExt
{
public:
AttrReadEventExt() {};
};
class AttrWrittenEventExt
{
public:
AttrWrittenEventExt() {};
};
class CallBackExt
{
public:
CallBackExt() {};
};
} // End of Tango namespace
#endif /* _DEVASYN_H */
|