This file is indexed.

/usr/include/tango/devasyn.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
//
// devsyn.h - include file for TANGO api device asynchronous calls
//
//
// Copyright (C) :      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/>.


#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 DevIntrChangeEventData;
class PipeEventData;
class EventDataList;
class AttrConfEventDataList;
class DataReadyEventDataList;
class DevIntrChangeEventDataList;
class PipeEventDataList;
class EventConsumer;
class EventConsumerKeepAliveThread;

/********************************************************************************
 *                                                                              *
 * 						CmdDoneEvent class										*
 * 																				*
 *******************************************************************************/

/**
 * Asynchronous command execution callback data
 *
 * This class is used to pass data to the callback method in asynchronous callback model for command execution.
 *
 * $Author: bourtemb $
 * $Revision: 29627 $
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class CmdDoneEvent
{
public:
///@privatesection
	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;}

///@publicsection
	Tango::DeviceProxy 	*device;        ///< The DeviceProxy object on which the call was executed
	string				&cmd_name;      ///< The command name
	DeviceData			&argout;        ///< The command argout
	bool				err;            ///< A boolean flag set to true if the command failed. False otherwise
	DevErrorList		&errors;        ///< The error stack

private:
    class CmdDoneEventExt
    {
    public:
        CmdDoneEventExt() {};
    };

#ifdef HAS_UNIQUE_PTR
    unique_ptr<CmdDoneEventExt> ext;
#else
	CmdDoneEventExt		        *ext;
#endif
};

/********************************************************************************
 * 																				*
 * 						AttrReadEvent class										*
 * 																				*
 *******************************************************************************/

/**
 * Asynchronous read attribute execution callback data
 *
 * This class is used to pass data to the callback method in asynchronous callback model for read_attribute(s)
 * execution
 *
 * $Author: bourtemb $
 * $Revision: 29627 $
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class AttrReadEvent
{
public:
///@privatesection
	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;}

///@publicsection
	Tango::DeviceProxy 		*device;        ///< The DeviceProxy object on which the call was executed
	vector<string>			&attr_names;    ///< The attribute name list
	vector<DeviceAttribute>	*argout;        ///< The attribute data
	bool					err;            ///< A boolean flag set to true if the request failed. False otherwise
	DevErrorList			&errors;        ///< The error stack

private:
    class AttrReadEventExt
    {
    public:
        AttrReadEventExt() {};
    };

#ifdef HAS_UNIQUE_PTR
    unique_ptr<AttrReadEventExt>    ext;
#else
	AttrReadEventExt		        *ext;
#endif
};

/********************************************************************************
 * 																				*
 * 						AttrWrittenEvent class									*
 * 																				*
 *******************************************************************************/

/**
 * Asynchronous write attribute execution callback data
 *
 * This class is used to pass data to the callback method in asynchronous callback model for write_attribute(s)
 * execution.
 *
 * $Author: bourtemb $
 * $Revision: 29627 $
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class AttrWrittenEvent
{
public:
///@privatesection
	AttrWrittenEvent(DeviceProxy *dev,
			 vector<string> &att_names,
			 NamedDevFailedList &err_in):device(dev),
			 		       attr_names(att_names),
					       errors(err_in)
	{err = errors.call_failed();}

///@publicsection
	Tango::DeviceProxy	*device;        ///< The DeviceProxy object on which the call was executed
	vector<string>		&attr_names;    ///< The attribute name list
	bool				err;            ///< A boolean flag set to true if the request failed. False otherwise
	NamedDevFailedList	&errors;        ///< The error stack

private:
    class AttrWrittenEventExt
    {
    public:
        AttrWrittenEventExt() {};
    };

#ifdef HAS_UNIQUE_PTR
    unique_ptr<AttrWrittenEventExt> ext;
#else
	AttrWrittenEventExt	            *ext;
#endif
};

/********************************************************************************
 * 																				*
 * 						CallBack class											*
 * 																				*
 *******************************************************************************/

/**
 * Event and asynchronous (callback model) calls base class
 *
 * When using the event push model (callback automatically executed), there are some cases (same callback
 * used for events coming from different devices hosted in device server process running on different hosts)
 * where the callback method could be executed concurently by different threads started by the ORB. The
 * user has to code his callback method in a thread safe manner.
 *
 * $Author: bourtemb $
 * $Revision: 29627 $
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class CallBack
{

friend class EventConsumer;
friend class EventConsumerKeepAliveThread;

public:
#ifdef GEN_DOC
/**
 * Asynchronous command execution callback method
 *
 * This method is defined as being empty and must be overloaded by the user when the asynchronous callback
 * model is used. This is the method which will be executed when the server reply from a command_inout is
 * received in both push and pull sub-mode.
 *
 * @param cde The command data
 */
	virtual void cmd_ended(CmdDoneEvent *cde) {};
/**
 * Asynchronous read attribute execution callback method
 *
 * This method is defined as being empty and must be overloaded by the user when the asynchronous callback
 * model is used. This is the method which will be executed when the server reply from a read_attribute(s) is
 * received in both push and pull sub-mode.
 *
 * @param are The read attribute data
 */
	virtual void attr_read(AttrReadEvent *are) {};
/**
 * Asynchronous write attribute execution callback method
 *
 * This method is defined as being empty and must be overloaded by the user when the asynchronous callback
 * model is used. This is the method which will be executed when the server reply from a write_attribute(s)
 * is received in both push and pull sub-mode.
 *
 * @param awe The write attribute data
 */
	virtual void attr_written(AttrWrittenEvent *awe) {};
/**
 * Event callback method
 *
 * This method is defined as being empty and must be overloaded by the user when events are used. This is
 * the method which will be executed when the server send event(s) to the client.
 *
 * @param ed The event data
 */
	virtual void push_event(EventData *ed) {};
/**
 * attribute configuration change event callback method
 *
 * This method is defined as being empty and must be overloaded by the user when events are used. This
 * is the method which will be executed when the server send attribute configuration change event(s) to the
 * client.
 *
 * @param ace The attribute configuration change event data
 */
	virtual void push_event(AttrConfEventData *ace) {};
/**
 * Data ready event callback method
 *
 * This method is defined as being empty and must be overloaded by the user when events are used. This is
 * the method which will be executed when the server send attribute data ready event(s) to the client.
 *
 * @param dre The data ready event data
 */
	virtual void push_event(DataReadyEventData *dre) {};
/**
 * Device interface change event callback method
 *
 * This method is defined as being empty and must be overloaded by the user when events are used. This is
 * the method which will be executed when the server send device interface change event(s) to the client.
 *
 * @param dic The device interface change event data
 */
	virtual void push_event(DevIntrChangeEventData *dic) {};
/**
 * Pipe event callback method
 *
 * This method is defined as being empty and must be overloaded by the user when events are used. This is
 * the method which will be executed when the server send pipe event(s) to the client.
 *
 * @param ped The pipe event data
 */
	virtual void push_event(PipeEventData *ped) {};
#else
	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 *) {};
	virtual void push_event(DevIntrChangeEventData *) {};
	virtual void push_event(PipeEventData *) {};
#endif

/// @privatesection
	virtual ~CallBack() {};

private:
    class CallBackExt
    {
    public:
        CallBackExt() {};
    };

#ifdef HAS_UNIQUE_PTR
    unique_ptr<CallBackExt> ext;
#else
	CallBackExt		        *ext;
#endif
};

//------------------------------------------------------------------------------

class UniqIdent: public omni_mutex
{
public:
	UniqIdent() {omni_mutex_lock sync(*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 sync(*this);return asyn_poll_req_table.size();}
	size_t get_cb_request_nb() {omni_mutex_lock sync(*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 sync(*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);
};

} // End of Tango namespace

#endif /* _DEVASYN_H */