Newer
Older
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
/*----- PROTECTED REGION ID(AccessConf.h) ENABLED START -----*/
//=============================================================================
//
// file : AccessConf.h
//
// description : Include for the AccessConf class.
//
// project : Storage Ring Access.
//
// $Author: graziano $
//
// $Revision: 1.7 $
// $Date: 2019-11-06 08:38:53 $
//
// SVN only:
// $HeadURL: $
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/accessconf/src/AccessConf.h,v $
// $Log: AccessConf.h,v $
// Revision 1.7 2019-11-06 08:38:53 graziano
// Fixed
//
// Revision 1.6 2019-11-06 08:23:36 graziano
// Added cutoff_ind to change/disable index for cutoff
//
// Revision 1.5 2017-08-23 14:16:23 claudio
// #1554 tango-9.2.5a
//
// Revision 1.4 2016-01-07 10:44:44 graziano
// fixed
//
// Revision 1.3 2013-08-20 07:06:01 graziano
// event support
//
// Revision 1.2 2012-10-31 17:40:12 graziano
// fixed for valves
//
// Revision 1.1 2012-10-30 09:29:15 graziano
// *** empty log message ***
//
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef ACCESSCONF_H
#define ACCESSCONF_H
#include <tango.h>
#define MAX_ATTR_SIZE 100
/*----- PROTECTED REGION END -----*/
/**
* AccessConf class Description:
*
*/
namespace AccessConf_ns
{
/*----- PROTECTED REGION ID(AccessConf::Additional Class Declarations) ENABLED START -----*/
// Additional Class Declarations
class EventCallBack : public Tango::CallBack
{
public:
EventCallBack();
~EventCallBack(void);
void push_event(Tango::EventData* ev);
void init(Tango::DeviceImpl *p);
private:
Tango::DeviceImpl *mydevice;
//vector<DeviceImpl *> mydevices;
};
typedef struct
{
string remote_attr_name;
unsigned int attr_index;
unsigned int remote_index;
string descr;
string comment;
string type;
//Tango::DevBoolean val;
} attr_desc_t;
typedef struct
{
Tango::DevBoolean val[MAX_ATTR_SIZE];
} attr_val_t;
typedef struct
{
vector<Tango::DevBoolean> val_b;
vector<string> val_s;
vector<Tango::DevBoolean> val_b_ev;
vector<string> val_s_ev;
vector<string> loc_attr_name; //list of local attributes interested in this remote value
} rem_val_t;
typedef struct
{
char val[MAX_ATTR_SIZE][128];
} attr_val_string_t;
typedef struct
{
string remote_cmd_name;
int cmd_code;
int cmd_offset;
int cmd_offset2;
int cmd_offset3;
int cmd_offset4;
string pass;
} cmd_desc_t;
/*----- PROTECTED REGION END -----*/ // AccessConf::Additional Class Declarations
class AccessConf : public TANGO_BASE_CLASS
{
friend class CmdClass;
/*----- PROTECTED REGION ID(AccessConf::Data Members) ENABLED START -----*/
// Add your own data members
public:
/**
* This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
* @return State Code
* @exception DevFailed
*/
virtual Tango::DevState dev_state();
/**
* This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
* @return Status description
* @exception DevFailed
*/
virtual Tango::ConstDevString dev_status();
protected:
map<string,vector<attr_desc_t> > att_data;
map<string,attr_val_t > att_value;
map<string,attr_val_string_t > att_value_string;
vector<string> remote_attr;
map<string,string> remote_type;
//map<string,vector<Tango::DevBoolean> > remote_att_value;
map<string,rem_val_t > remote_att_value;
vector<unsigned int> eid;
EventCallBack ecb;
friend class EventCallBack;
Tango::DevState ll_state;
void string_explode(string, string, vector<string>*);
void init_attributeprop();
long create_dynamic_command(const char* cmd_name, Tango::CmdArgType type_in, Tango::CmdArgType type_out, long size_in, long size_out);
void create_dynamic_attributes(vector<string> attr_config);
void extract_values(Tango::DeviceAttribute *attr_value, vector<Tango::DevBoolean> &v_bo, vector<string> &v_string);
Tango::DeviceProxy *lldevice;
struct timeval last_read;
map<string,cmd_desc_t> cmd_data;
char version_str[1024];
char status_str[1024];
Tango::DevString *attr_status_read;
Tango::DevState state_event;
bool ValveStat_initialized;
bool created_attr;
/*----- PROTECTED REGION END -----*/ // AccessConf::Data Members
// Device property data members
public: // Low_level_srv:
string low_level_srv;
// Attr_config_file:
string attr_config_file;
// Attr_config_prop:
vector<string> attr_config_prop;
// Cutoff_ind:
Tango::DevLong cutoff_ind;
// Attribute data members
public:
Tango::DevBoolean *attr_BoolScalarDyn_read;
Tango::DevBoolean *attr_BoolSpectrumDyn_read;
Tango::DevString *attr_StringSpectrumDyn_read;
Tango::DevString *attr_Version_read;
// Constructors and destructors
public:
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
AccessConf(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
AccessConf(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
AccessConf(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The object destructor.
*/
~AccessConf() {delete_device();};
// Miscellaneous methods
public:
/**
* will be called at device destruction or at init command.
*/
void delete_device();
/**
* Initialize the device
*/
virtual void init_device();
/**
* Read the device properties from database
*/
void get_device_property();
/**
* Always executed method before execution command method.
*/
virtual void always_executed_hook();
// Attribute methods
public:
/**
* Method : AccessConf::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* BoolScalarDyn attribute related methods.
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_BoolScalarDyn(Tango::Attribute &attr);
virtual bool is_BoolScalarDyn_allowed(Tango::AttReqType type);
/**
* BoolSpectrumDyn attribute related methods.
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Spectrum max = 1000
*/
virtual void read_BoolSpectrumDyn(Tango::Attribute &attr);
virtual bool is_BoolSpectrumDyn_allowed(Tango::AttReqType type);
/**
* StringSpectrumDyn attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum max = 1000
*/
virtual void read_StringSpectrumDyn(Tango::Attribute &attr);
virtual bool is_StringSpectrumDyn_allowed(Tango::AttReqType type);
/**
* Version attribute related methods.
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_Version(Tango::Attribute &attr);
virtual bool is_Version_allowed(Tango::AttReqType type);
/**
* Method : AccessConf::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
void add_dynamic_attributes();
// Command related methods
public:
/*----- PROTECTED REGION ID(AccessConf::Additional Method prototypes) ENABLED START -----*/
// Additional Method prototypes
/*----- PROTECTED REGION END -----*/ // AccessConf::Additional Method prototypes
};
/*----- PROTECTED REGION ID(AccessConf::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes definitions
class CmdClass : public Tango::Command
{
public:
CmdClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level,
int size_in,
Tango::DeviceImpl *dev)
:Command(name,in,out,in_desc,out_desc, level) {_max_in=size_in;};
CmdClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
int size_in,
Tango::DeviceImpl *dev)
:Command(name,in,out) {_max_in=size_in;};
~CmdClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return true/*(static_cast<TangoLib *>(dev))->is_Cmd_allowed(any)*/;}
int _max_in;
AccessConf *mydevice;
};
/*----- PROTECTED REGION END -----*/ // AccessConf::Additional Classes Definitions
} // namespace
#endif // ACCESSCONF_H