* add an optional printout for test
[diffractometer.git] / src / pseudoaxis / PseudoAxisClass.h
blob3926061c17c1a82d5a77803ee9905d70555eae0a
1 //=============================================================================
2 //
3 // file : PseudoAxisClass.h
4 //
5 // description : Include for the PseudoAxisClass root class.
6 // This class is represents the singleton class for
7 // the PseudoAxis device class.
8 // It contains all properties and methods which the
9 // PseudoAxis requires only once e.g. the commands.
10 //
11 // project : TANGO Device Server
13 // $Author: piccaf $
15 // $Revision: 1.3 $
17 // $Log: PseudoAxisClass.h,v $
18 // Revision 1.3 2008/09/24 08:37:48 piccaf
19 // * add dummy commandes for the Axis V2 interface
21 // Revision 1.2 2008/09/22 08:46:40 piccaf
22 // * add files from the new diffractometer Device
24 // Revision 1.3 2007/07/11 07:19:27 picca
25 // * add the "offset" and the "relativeMove" attributes to the PseudoAxes.
26 // * syntax in Kappa6C
28 // Revision 1.2 2007/05/15 08:26:58 hardion
29 // * Merge with branch DIFFRACTO_KAPPA_6C
31 // Revision 1.1.2.1 2006/08/25 15:08:22 hardion
32 // * Merge corrections of hubert
33 // * Create directory for each class of device
34 // * Fix problem when PseudoAxis is initialized on first
35 // * Tested on diffabs for the communication part
37 // Revision 1.2 2006/07/06 10:29:44 hardion
38 // * commit to keep modification about Pseudo axis management but it doesn't work ( Error Check the wavelength)
39 // try to come back to old version to see if the problem persists
41 // Revision 1.1 2006/03/29 16:45:47 hardion
42 // * Add PseudoAxis device
43 // * Add DiffractometerFactory which associates Diffracto and PseudoAxis
46 // copyleft : European Synchrotron Radiation Facility
47 // BP 220, Grenoble 38043
48 // FRANCE
50 //=============================================================================
52 // This file is generated by POGO
53 // (Program Obviously used to Generate tango Object)
55 // (c) - Software Engineering Group - ESRF
56 //=============================================================================
58 #ifndef _PSEUDOAXISCLASS_H
59 #define _PSEUDOAXISCLASS_H
61 #include <tango.h>
62 #include <PseudoAxis.h>
65 namespace PseudoAxis_ns
67 //=====================================
68 // Define classes for attributes
69 //=====================================
70 class relativeMoveAttrib: public Tango::Attr
72 public:
73 relativeMoveAttrib():Attr("relativeMove", Tango::DEV_DOUBLE, Tango::WRITE) {};
74 ~relativeMoveAttrib() {};
76 virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
77 {(static_cast<PseudoAxis *>(dev))->read_relativeMove(att);}
78 virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
79 {(static_cast<PseudoAxis *>(dev))->write_relativeMove(att);}
80 virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
81 {return (static_cast<PseudoAxis *>(dev))->is_relativeMove_allowed(ty);}
84 class IsInitialisedAttrib: public Tango::Attr
86 public:
87 IsInitialisedAttrib():Attr("IsInitialised", Tango::DEV_BOOLEAN, Tango::READ_WRITE) {};
88 ~IsInitialisedAttrib() {};
90 virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
91 {(static_cast<PseudoAxis *>(dev))->read_IsInitialised(att);}
92 virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
93 {(static_cast<PseudoAxis *>(dev))->write_IsInitialised(att);}
94 virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
95 {return (static_cast<PseudoAxis *>(dev))->is_IsInitialised_allowed(ty);}
98 class offsetAttrib: public Tango::Attr
100 public:
101 offsetAttrib():Attr("offset", Tango::DEV_DOUBLE, Tango::READ_WRITE) {};
102 ~offsetAttrib() {};
104 virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
105 {(static_cast<PseudoAxis *>(dev))->read_offset(att);}
106 virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
107 {(static_cast<PseudoAxis *>(dev))->write_offset(att);}
108 virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
109 {return (static_cast<PseudoAxis *>(dev))->is_offset_allowed(ty);}
112 class positionAttrib: public Tango::Attr
114 public:
115 positionAttrib():Attr("position", Tango::DEV_DOUBLE, Tango::READ_WRITE) {};
116 ~positionAttrib() {};
118 virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
119 {(static_cast<PseudoAxis *>(dev))->read_position(att);}
120 virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
121 {(static_cast<PseudoAxis *>(dev))->write_position(att);}
122 virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
123 {return (static_cast<PseudoAxis *>(dev))->is_position_allowed(ty);}
126 //=========================================
127 // Define classes for commands
128 //=========================================
129 class InitializeReferencePositionCmd : public Tango::Command
131 public:
132 InitializeReferencePositionCmd(const char *name,
133 Tango::CmdArgType in,
134 Tango::CmdArgType out,
135 const char *in_desc,
136 const char *out_desc,
137 Tango::DispLevel level)
138 :Command(name,in,out,in_desc,out_desc, level) {};
140 InitializeReferencePositionCmd(const char *name,
141 Tango::CmdArgType in,
142 Tango::CmdArgType out)
143 :Command(name,in,out) {};
144 ~InitializeReferencePositionCmd() {};
146 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
147 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
148 {return (static_cast<PseudoAxis *>(dev))->is_InitializeReferencePosition_allowed(any);}
153 class DefinePositionCmd : public Tango::Command
155 public:
156 DefinePositionCmd(const char *name,
157 Tango::CmdArgType in,
158 Tango::CmdArgType out,
159 const char *in_desc,
160 const char *out_desc,
161 Tango::DispLevel level)
162 :Command(name,in,out,in_desc,out_desc, level) {};
164 DefinePositionCmd(const char *name,
165 Tango::CmdArgType in,
166 Tango::CmdArgType out)
167 :Command(name,in,out) {};
168 ~DefinePositionCmd() {};
170 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
171 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
172 {return (static_cast<PseudoAxis *>(dev))->is_DefinePosition_allowed(any);}
177 class ForwardCmd : public Tango::Command
179 public:
180 ForwardCmd(const char *name,
181 Tango::CmdArgType in,
182 Tango::CmdArgType out,
183 const char *in_desc,
184 const char *out_desc,
185 Tango::DispLevel level)
186 :Command(name,in,out,in_desc,out_desc, level) {};
188 ForwardCmd(const char *name,
189 Tango::CmdArgType in,
190 Tango::CmdArgType out)
191 :Command(name,in,out) {};
192 ~ForwardCmd() {};
194 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
195 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
196 {return (static_cast<PseudoAxis *>(dev))->is_Forward_allowed(any);}
201 class BackwardClass : public Tango::Command
203 public:
204 BackwardClass(const char *name,
205 Tango::CmdArgType in,
206 Tango::CmdArgType out,
207 const char *in_desc,
208 const char *out_desc,
209 Tango::DispLevel level)
210 :Command(name,in,out,in_desc,out_desc, level) {};
212 BackwardClass(const char *name,
213 Tango::CmdArgType in,
214 Tango::CmdArgType out)
215 :Command(name,in,out) {};
216 ~BackwardClass() {};
218 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
219 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
220 {return (static_cast<PseudoAxis *>(dev))->is_Backward_allowed(any);}
225 class ComputeNewOffsetCmd : public Tango::Command
227 public:
228 ComputeNewOffsetCmd(const char *name,
229 Tango::CmdArgType in,
230 Tango::CmdArgType out,
231 const char *in_desc,
232 const char *out_desc,
233 Tango::DispLevel level)
234 :Command(name,in,out,in_desc,out_desc, level) {};
236 ComputeNewOffsetCmd(const char *name,
237 Tango::CmdArgType in,
238 Tango::CmdArgType out)
239 :Command(name,in,out) {};
240 ~ComputeNewOffsetCmd() {};
242 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
243 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
244 {return (static_cast<PseudoAxis *>(dev))->is_ComputeNewOffset_allowed(any);}
249 class MotorInitCmd : public Tango::Command
251 public:
252 MotorInitCmd(const char *name,
253 Tango::CmdArgType in,
254 Tango::CmdArgType out,
255 const char *in_desc,
256 const char *out_desc,
257 Tango::DispLevel level)
258 :Command(name,in,out,in_desc,out_desc, level) {};
260 MotorInitCmd(const char *name,
261 Tango::CmdArgType in,
262 Tango::CmdArgType out)
263 :Command(name,in,out) {};
264 ~MotorInitCmd() {};
266 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
267 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
268 {return (static_cast<PseudoAxis *>(dev))->is_MotorInit_allowed(any);}
273 class MotorONCmd : public Tango::Command
275 public:
276 MotorONCmd(const char *name,
277 Tango::CmdArgType in,
278 Tango::CmdArgType out,
279 const char *in_desc,
280 const char *out_desc,
281 Tango::DispLevel level)
282 :Command(name,in,out,in_desc,out_desc, level) {};
284 MotorONCmd(const char *name,
285 Tango::CmdArgType in,
286 Tango::CmdArgType out)
287 :Command(name,in,out) {};
288 ~MotorONCmd() {};
290 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
291 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
292 {return (static_cast<PseudoAxis *>(dev))->is_MotorON_allowed(any);}
297 class MotorOFFCmd : public Tango::Command
299 public:
300 MotorOFFCmd(const char *name,
301 Tango::CmdArgType in,
302 Tango::CmdArgType out,
303 const char *in_desc,
304 const char *out_desc,
305 Tango::DispLevel level)
306 :Command(name,in,out,in_desc,out_desc, level) {};
308 MotorOFFCmd(const char *name,
309 Tango::CmdArgType in,
310 Tango::CmdArgType out)
311 :Command(name,in,out) {};
312 ~MotorOFFCmd() {};
314 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
315 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
316 {return (static_cast<PseudoAxis *>(dev))->is_MotorOFF_allowed(any);}
321 class StopCmd : public Tango::Command
323 public:
324 StopCmd(const char *name,
325 Tango::CmdArgType in,
326 Tango::CmdArgType out,
327 const char *in_desc,
328 const char *out_desc,
329 Tango::DispLevel level)
330 :Command(name,in,out,in_desc,out_desc, level) {};
332 StopCmd(const char *name,
333 Tango::CmdArgType in,
334 Tango::CmdArgType out)
335 :Command(name,in,out) {};
336 ~StopCmd() {};
338 virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
339 virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
340 {return (static_cast<PseudoAxis *>(dev))->is_Stop_allowed(any);}
346 // The PseudoAxisClass singleton definition
349 class PseudoAxisClass : public Tango::DeviceClass
351 public:
352 // properties member data
354 // add your own data members here
355 //------------------------------------
357 public:
358 Tango::DbData cl_prop;
359 Tango::DbData cl_def_prop;
360 Tango::DbData dev_def_prop;
362 // Method prototypes
363 static PseudoAxisClass *init(const char *);
364 static PseudoAxisClass *instance();
365 ~PseudoAxisClass();
366 Tango::DbDatum get_class_property(string &);
367 Tango::DbDatum get_default_device_property(string &);
368 Tango::DbDatum get_default_class_property(string &);
370 protected:
371 PseudoAxisClass(string &);
372 static PseudoAxisClass *_instance;
373 void command_factory();
374 void get_class_property();
375 void attribute_factory(vector<Tango::Attr *> &);
376 void write_class_property();
377 void set_default_property();
379 private:
380 void device_factory(const Tango::DevVarStringArray *);
384 } // namespace PseudoAxis_ns
386 #endif // _PSEUDOAXISCLASS_H