1 //=============================================================================
3 // file : Diffractometer.h
5 // description : Include for the Diffractometer class.
7 // project : Diffractometer
13 // $Log: Diffractometer.h,v $
14 // Revision 1.3 2008/10/16 10:16:55 piccaf
15 // * update to build on windows with vc8
16 // * add the Eulerian6C diffractometer.
17 // * add the dynamic attributes in the factory instead of the init device
19 // Revision 1.2 2008/09/22 08:46:23 piccaf
20 // * add files from the new diffractometer Device
23 // copyleft : European Synchrotron Radiation Facility
24 // BP 220, Grenoble 38043
27 //=============================================================================
29 // This file is generated by POGO
30 // (Program Obviously used to Generate tango Object)
32 // (c) - Software Engineering Group - ESRF
33 //=============================================================================
34 #ifndef _DIFFRACTOMETER_H
35 #define _DIFFRACTOMETER_H
38 //using namespace Tango;
41 * @author $Author: piccaf $
42 * @version $Revision: 1.3 $
45 // Add your own constants definitions here.
46 //-----------------------------------------------
48 #include "PogoHelper.h"
49 #include "TangoHKLAdapter.h"
51 namespace Diffractometer_ns
56 * This class can be used to compute cristallography computation
60 * Device States Description:
61 * Tango::FAULT : HKLlibrary not initialised or at least 1 of the motor is in FAULT state
62 * Tango::ALARM : At least 1 of the motor is in ALARM state
63 * Tango::STANDBY : All motors are in STANDBY state
64 * Tango::MOVING : At least one motor is in MOVING state
65 * Tango::OFF : At least one motor is in OFF state
69 class Diffractometer
: public Tango::Device_3Impl
72 // Add your own data members here
73 //-----------------------------------------
76 // Here is the Start of the automatic code generation part
77 //-------------------------------------------------------------
80 * Attributs member data.
83 Tango::DevShort
*attr_AnglesIdx_read
;
84 Tango::DevShort attr_AnglesIdx_write
;
85 Tango::DevBoolean
*attr_AutoUpdateFromProxies_read
;
86 Tango::DevBoolean attr_AutoUpdateFromProxies_write
;
87 Tango::DevDouble
*attr_WaveLength_read
;
88 Tango::DevDouble attr_WaveLength_write
;
89 Tango::DevString
*attr_Crystal_read
;
90 Tango::DevString attr_Crystal_write
;
91 Tango::DevDouble
*attr_A_read
;
92 Tango::DevBoolean
*attr_AFit_read
;
93 Tango::DevBoolean attr_AFit_write
;
94 Tango::DevDouble
*attr_B_read
;
95 Tango::DevBoolean
*attr_BFit_read
;
96 Tango::DevBoolean attr_BFit_write
;
97 Tango::DevDouble
*attr_C_read
;
98 Tango::DevBoolean
*attr_CFit_read
;
99 Tango::DevBoolean attr_CFit_write
;
100 Tango::DevDouble
*attr_Alpha_read
;
101 Tango::DevBoolean
*attr_AlphaFit_read
;
102 Tango::DevBoolean attr_AlphaFit_write
;
103 Tango::DevDouble
*attr_Beta_read
;
104 Tango::DevBoolean
*attr_BetaFit_read
;
105 Tango::DevBoolean attr_BetaFit_write
;
106 Tango::DevDouble
*attr_Gamma_read
;
107 Tango::DevBoolean
*attr_GammaFit_read
;
108 Tango::DevBoolean attr_GammaFit_write
;
109 Tango::DevDouble
*attr_Ux_read
;
110 Tango::DevDouble attr_Ux_write
;
111 Tango::DevBoolean
*attr_UxFit_read
;
112 Tango::DevBoolean attr_UxFit_write
;
113 Tango::DevDouble
*attr_Uy_read
;
114 Tango::DevDouble attr_Uy_write
;
115 Tango::DevBoolean
*attr_UyFit_read
;
116 Tango::DevBoolean attr_UyFit_write
;
117 Tango::DevDouble
*attr_Uz_read
;
118 Tango::DevDouble attr_Uz_write
;
119 Tango::DevBoolean
*attr_UzFit_read
;
120 Tango::DevBoolean attr_UzFit_write
;
121 Tango::DevDouble
*attr_AStar_read
;
122 Tango::DevDouble
*attr_BStar_read
;
123 Tango::DevDouble
*attr_CStar_read
;
124 Tango::DevDouble
*attr_AlphaStar_read
;
125 Tango::DevDouble
*attr_BetaStar_read
;
126 Tango::DevDouble
*attr_GammaStar_read
;
127 Tango::DevBoolean
*attr_Simulated_read
;
128 Tango::DevBoolean attr_Simulated_write
;
129 Tango::DevString
*attr_CrystalNames_read
;
130 Tango::DevString
*attr_AxesNames_read
;
131 Tango::DevString
*attr_pseudoAxesProxies_read
;
132 Tango::DevDouble
*attr_Angles_read
;
133 Tango::DevBoolean
*attr_AnglesDegenerated_read
;
134 Tango::DevBoolean
*attr_AnglesRangeCheck_read
;
135 Tango::DevDouble
*attr_Reflections_read
;
136 Tango::DevDouble attr_Reflections_write
;
137 Tango::DevDouble
*attr_ReflectionsAngles_read
;
138 Tango::DevDouble
*attr_UB_read
;
142 * @name Device properties
143 * Device properties member data.
147 * Definition of the Tau constant .
148 * Possible values are pi or 1 .
151 Tango::DevDouble tauConstant
;
155 vector
<string
> realAxisProxies
;
157 * The name of the lambda attribute proxy.
159 * The diffractometer use it to read the lambda value from another Device
161 string lambdaAttributeProxy
;
163 * The Type of the diffractometer
167 string diffractometerType
;
169 * allow or not to change the values of the axes in the Reflections attribute.
171 * set this properties to false to allow writting on the axes values.
173 Tango::DevBoolean protectReflectionAxes
;
176 /**@name Constructors
177 * Miscellaneous constructors */
180 * Constructs a newly allocated Command object.
183 * @param s Device Name
185 Diffractometer(Tango::DeviceClass
*cl
,string
&s
);
187 * Constructs a newly allocated Command object.
190 * @param s Device Name
192 Diffractometer(Tango::DeviceClass
*cl
,const char *s
);
194 * Constructs a newly allocated Command object.
197 * @param s Device name
198 * @param d Device description.
200 Diffractometer(Tango::DeviceClass
*cl
,const char *s
,const char *d
);
204 * Only one desctructor is defined for this class */
207 * The object desctructor.
209 ~Diffractometer() {delete_device();};
211 * will be called at device destruction or at init command.
213 void delete_device();
217 /**@name Miscellaneous methods */
220 * Initialize the device
222 virtual void init_device();
224 * Always executed method befor execution command method.
226 virtual void always_executed_hook();
231 * @name Diffractometer methods prototypes
236 * Hardware acquisition for attributes.
238 virtual void read_attr_hardware(vector
<long> &attr_list
);
240 * Extract real attribute values for AnglesIdx acquisition result.
242 virtual void read_AnglesIdx(Tango::Attribute
&attr
);
244 * Write AnglesIdx attribute values to hardware.
246 virtual void write_AnglesIdx(Tango::WAttribute
&attr
);
248 * Extract real attribute values for AutoUpdateFromProxies acquisition result.
250 virtual void read_AutoUpdateFromProxies(Tango::Attribute
&attr
);
252 * Write AutoUpdateFromProxies attribute values to hardware.
254 virtual void write_AutoUpdateFromProxies(Tango::WAttribute
&attr
);
256 * Extract real attribute values for WaveLength acquisition result.
258 virtual void read_WaveLength(Tango::Attribute
&attr
);
260 * Write WaveLength attribute values to hardware.
262 virtual void write_WaveLength(Tango::WAttribute
&attr
);
264 * Extract real attribute values for Crystal acquisition result.
266 virtual void read_Crystal(Tango::Attribute
&attr
);
268 * Write Crystal attribute values to hardware.
270 virtual void write_Crystal(Tango::WAttribute
&attr
);
272 * Extract real attribute values for A acquisition result.
274 virtual void read_A(Tango::Attribute
&attr
);
276 * Extract real attribute values for AFit acquisition result.
278 virtual void read_AFit(Tango::Attribute
&attr
);
280 * Write AFit attribute values to hardware.
282 virtual void write_AFit(Tango::WAttribute
&attr
);
284 * Extract real attribute values for B acquisition result.
286 virtual void read_B(Tango::Attribute
&attr
);
288 * Extract real attribute values for BFit acquisition result.
290 virtual void read_BFit(Tango::Attribute
&attr
);
292 * Write BFit attribute values to hardware.
294 virtual void write_BFit(Tango::WAttribute
&attr
);
296 * Extract real attribute values for C acquisition result.
298 virtual void read_C(Tango::Attribute
&attr
);
300 * Extract real attribute values for CFit acquisition result.
302 virtual void read_CFit(Tango::Attribute
&attr
);
304 * Write CFit attribute values to hardware.
306 virtual void write_CFit(Tango::WAttribute
&attr
);
308 * Extract real attribute values for Alpha acquisition result.
310 virtual void read_Alpha(Tango::Attribute
&attr
);
312 * Extract real attribute values for AlphaFit acquisition result.
314 virtual void read_AlphaFit(Tango::Attribute
&attr
);
316 * Write AlphaFit attribute values to hardware.
318 virtual void write_AlphaFit(Tango::WAttribute
&attr
);
320 * Extract real attribute values for Beta acquisition result.
322 virtual void read_Beta(Tango::Attribute
&attr
);
324 * Extract real attribute values for BetaFit acquisition result.
326 virtual void read_BetaFit(Tango::Attribute
&attr
);
328 * Write BetaFit attribute values to hardware.
330 virtual void write_BetaFit(Tango::WAttribute
&attr
);
332 * Extract real attribute values for Gamma acquisition result.
334 virtual void read_Gamma(Tango::Attribute
&attr
);
336 * Extract real attribute values for GammaFit acquisition result.
338 virtual void read_GammaFit(Tango::Attribute
&attr
);
340 * Write GammaFit attribute values to hardware.
342 virtual void write_GammaFit(Tango::WAttribute
&attr
);
344 * Extract real attribute values for Ux acquisition result.
346 virtual void read_Ux(Tango::Attribute
&attr
);
348 * Write Ux attribute values to hardware.
350 virtual void write_Ux(Tango::WAttribute
&attr
);
352 * Extract real attribute values for UxFit acquisition result.
354 virtual void read_UxFit(Tango::Attribute
&attr
);
356 * Write UxFit attribute values to hardware.
358 virtual void write_UxFit(Tango::WAttribute
&attr
);
360 * Extract real attribute values for Uy acquisition result.
362 virtual void read_Uy(Tango::Attribute
&attr
);
364 * Write Uy attribute values to hardware.
366 virtual void write_Uy(Tango::WAttribute
&attr
);
368 * Extract real attribute values for UyFit acquisition result.
370 virtual void read_UyFit(Tango::Attribute
&attr
);
372 * Write UyFit attribute values to hardware.
374 virtual void write_UyFit(Tango::WAttribute
&attr
);
376 * Extract real attribute values for Uz acquisition result.
378 virtual void read_Uz(Tango::Attribute
&attr
);
380 * Write Uz attribute values to hardware.
382 virtual void write_Uz(Tango::WAttribute
&attr
);
384 * Extract real attribute values for UzFit acquisition result.
386 virtual void read_UzFit(Tango::Attribute
&attr
);
388 * Write UzFit attribute values to hardware.
390 virtual void write_UzFit(Tango::WAttribute
&attr
);
392 * Extract real attribute values for AStar acquisition result.
394 virtual void read_AStar(Tango::Attribute
&attr
);
396 * Extract real attribute values for BStar acquisition result.
398 virtual void read_BStar(Tango::Attribute
&attr
);
400 * Extract real attribute values for CStar acquisition result.
402 virtual void read_CStar(Tango::Attribute
&attr
);
404 * Extract real attribute values for AlphaStar acquisition result.
406 virtual void read_AlphaStar(Tango::Attribute
&attr
);
408 * Extract real attribute values for BetaStar acquisition result.
410 virtual void read_BetaStar(Tango::Attribute
&attr
);
412 * Extract real attribute values for GammaStar acquisition result.
414 virtual void read_GammaStar(Tango::Attribute
&attr
);
416 * Extract real attribute values for Simulated acquisition result.
418 virtual void read_Simulated(Tango::Attribute
&attr
);
420 * Write Simulated attribute values to hardware.
422 virtual void write_Simulated(Tango::WAttribute
&attr
);
424 * Extract real attribute values for CrystalNames acquisition result.
426 virtual void read_CrystalNames(Tango::Attribute
&attr
);
428 * Extract real attribute values for AxesNames acquisition result.
430 virtual void read_AxesNames(Tango::Attribute
&attr
);
432 * Extract real attribute values for pseudoAxesProxies acquisition result.
434 virtual void read_pseudoAxesProxies(Tango::Attribute
&attr
);
436 * Extract real attribute values for Angles acquisition result.
438 virtual void read_Angles(Tango::Attribute
&attr
);
440 * Extract real attribute values for AnglesDegenerated acquisition result.
442 virtual void read_AnglesDegenerated(Tango::Attribute
&attr
);
444 * Extract real attribute values for AnglesRangeCheck acquisition result.
446 virtual void read_AnglesRangeCheck(Tango::Attribute
&attr
);
448 * Extract real attribute values for Reflections acquisition result.
450 virtual void read_Reflections(Tango::Attribute
&attr
);
452 * Write Reflections attribute values to hardware.
454 virtual void write_Reflections(Tango::WAttribute
&attr
);
456 * Extract real attribute values for ReflectionsAngles acquisition result.
458 virtual void read_ReflectionsAngles(Tango::Attribute
&attr
);
460 * Extract real attribute values for UB acquisition result.
462 virtual void read_UB(Tango::Attribute
&attr
);
464 * Read/Write allowed for AnglesIdx attribute.
466 virtual bool is_AnglesIdx_allowed(Tango::AttReqType type
);
468 * Read/Write allowed for AutoUpdateFromProxies attribute.
470 virtual bool is_AutoUpdateFromProxies_allowed(Tango::AttReqType type
);
472 * Read/Write allowed for WaveLength attribute.
474 virtual bool is_WaveLength_allowed(Tango::AttReqType type
);
476 * Read/Write allowed for Crystal attribute.
478 virtual bool is_Crystal_allowed(Tango::AttReqType type
);
480 * Read/Write allowed for A attribute.
482 virtual bool is_A_allowed(Tango::AttReqType type
);
484 * Read/Write allowed for AFit attribute.
486 virtual bool is_AFit_allowed(Tango::AttReqType type
);
488 * Read/Write allowed for B attribute.
490 virtual bool is_B_allowed(Tango::AttReqType type
);
492 * Read/Write allowed for BFit attribute.
494 virtual bool is_BFit_allowed(Tango::AttReqType type
);
496 * Read/Write allowed for C attribute.
498 virtual bool is_C_allowed(Tango::AttReqType type
);
500 * Read/Write allowed for CFit attribute.
502 virtual bool is_CFit_allowed(Tango::AttReqType type
);
504 * Read/Write allowed for Alpha attribute.
506 virtual bool is_Alpha_allowed(Tango::AttReqType type
);
508 * Read/Write allowed for AlphaFit attribute.
510 virtual bool is_AlphaFit_allowed(Tango::AttReqType type
);
512 * Read/Write allowed for Beta attribute.
514 virtual bool is_Beta_allowed(Tango::AttReqType type
);
516 * Read/Write allowed for BetaFit attribute.
518 virtual bool is_BetaFit_allowed(Tango::AttReqType type
);
520 * Read/Write allowed for Gamma attribute.
522 virtual bool is_Gamma_allowed(Tango::AttReqType type
);
524 * Read/Write allowed for GammaFit attribute.
526 virtual bool is_GammaFit_allowed(Tango::AttReqType type
);
528 * Read/Write allowed for Ux attribute.
530 virtual bool is_Ux_allowed(Tango::AttReqType type
);
532 * Read/Write allowed for UxFit attribute.
534 virtual bool is_UxFit_allowed(Tango::AttReqType type
);
536 * Read/Write allowed for Uy attribute.
538 virtual bool is_Uy_allowed(Tango::AttReqType type
);
540 * Read/Write allowed for UyFit attribute.
542 virtual bool is_UyFit_allowed(Tango::AttReqType type
);
544 * Read/Write allowed for Uz attribute.
546 virtual bool is_Uz_allowed(Tango::AttReqType type
);
548 * Read/Write allowed for UzFit attribute.
550 virtual bool is_UzFit_allowed(Tango::AttReqType type
);
552 * Read/Write allowed for AStar attribute.
554 virtual bool is_AStar_allowed(Tango::AttReqType type
);
556 * Read/Write allowed for BStar attribute.
558 virtual bool is_BStar_allowed(Tango::AttReqType type
);
560 * Read/Write allowed for CStar attribute.
562 virtual bool is_CStar_allowed(Tango::AttReqType type
);
564 * Read/Write allowed for AlphaStar attribute.
566 virtual bool is_AlphaStar_allowed(Tango::AttReqType type
);
568 * Read/Write allowed for BetaStar attribute.
570 virtual bool is_BetaStar_allowed(Tango::AttReqType type
);
572 * Read/Write allowed for GammaStar attribute.
574 virtual bool is_GammaStar_allowed(Tango::AttReqType type
);
576 * Read/Write allowed for Simulated attribute.
578 virtual bool is_Simulated_allowed(Tango::AttReqType type
);
580 * Read/Write allowed for CrystalNames attribute.
582 virtual bool is_CrystalNames_allowed(Tango::AttReqType type
);
584 * Read/Write allowed for AxesNames attribute.
586 virtual bool is_AxesNames_allowed(Tango::AttReqType type
);
588 * Read/Write allowed for pseudoAxesProxies attribute.
590 virtual bool is_pseudoAxesProxies_allowed(Tango::AttReqType type
);
592 * Read/Write allowed for Angles attribute.
594 virtual bool is_Angles_allowed(Tango::AttReqType type
);
596 * Read/Write allowed for AnglesDegenerated attribute.
598 virtual bool is_AnglesDegenerated_allowed(Tango::AttReqType type
);
600 * Read/Write allowed for AnglesRangeCheck attribute.
602 virtual bool is_AnglesRangeCheck_allowed(Tango::AttReqType type
);
604 * Read/Write allowed for Reflections attribute.
606 virtual bool is_Reflections_allowed(Tango::AttReqType type
);
608 * Read/Write allowed for ReflectionsAngles attribute.
610 virtual bool is_ReflectionsAngles_allowed(Tango::AttReqType type
);
612 * Read/Write allowed for UB attribute.
614 virtual bool is_UB_allowed(Tango::AttReqType type
);
616 * Execution allowed for Abort command.
618 virtual bool is_Abort_allowed(const CORBA::Any
&any
);
620 * Execution allowed for AddNewCrystal command.
622 virtual bool is_AddNewCrystal_allowed(const CORBA::Any
&any
);
624 * Execution allowed for AddReflection command.
626 virtual bool is_AddReflection_allowed(const CORBA::Any
&any
);
628 * Execution allowed for AffineCrystal command.
630 virtual bool is_AffineCrystal_allowed(const CORBA::Any
&any
);
632 * Execution allowed for ComputeU command.
634 virtual bool is_ComputeU_allowed(const CORBA::Any
&any
);
636 * Execution allowed for ConfigureCrystal command.
638 virtual bool is_ConfigureCrystal_allowed(const CORBA::Any
&any
);
640 * Execution allowed for CopyCurrentCrystalAs command.
642 virtual bool is_CopyCurrentCrystalAs_allowed(const CORBA::Any
&any
);
644 * Execution allowed for CopyReflectionTo command.
646 virtual bool is_CopyReflectionTo_allowed(const CORBA::Any
&any
);
648 * Execution allowed for DeleteCurrentCrystal command.
650 virtual bool is_DeleteCurrentCrystal_allowed(const CORBA::Any
&any
);
652 * Execution allowed for GetCrystalParameterValues command.
654 virtual bool is_GetCrystalParameterValues_allowed(const CORBA::Any
&any
);
656 * Execution allowed for Load command.
658 virtual bool is_Load_allowed(const CORBA::Any
&any
);
660 * Execution allowed for RemoveReflection command.
662 virtual bool is_RemoveReflection_allowed(const CORBA::Any
&any
);
664 * Execution allowed for Save command.
666 virtual bool is_Save_allowed(const CORBA::Any
&any
);
668 * Execution allowed for SetCrystalParameterValues command.
670 virtual bool is_SetCrystalParameterValues_allowed(const CORBA::Any
&any
);
672 * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
674 * @exception DevFailed
676 virtual Tango::DevState
dev_state();
678 * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
679 * @return Status description
680 * @exception DevFailed
682 virtual Tango::ConstDevString
dev_status();
684 * Stops the movement of all axis driven by the Diffractometer
685 * @exception DevFailed
689 * Create a new crystal
690 * @param argin Name of the new crystal
691 * @exception DevFailed
693 void add_new_crystal(Tango::DevString
);
695 * This commands requires the definition of 1 reflection defined by (h,k,l ) coordinates.
696 * This coodinates are associated with the current angles configuration.
698 * TODO: d�taill� le commentaire
699 * reflections i.e : h, k, l, relevance, enable/disable
700 * @param argin reflections i.e : h, k, l, relevance, enable/disable
701 * @exception DevFailed
703 void add_reflection(const Tango::DevVarDoubleArray
*);
705 * Compute affinement for the current crystal with available list of reflection.
706 * @param argin name of the crystal to fit
707 * @return the fitness of the crystal after the affinement.
708 * @exception DevFailed
710 Tango::DevDouble
affine_crystal(Tango::DevString
);
712 * Compute Matrix U from two reflections
713 * @param argin a two elements array with the index of reflection to use
714 * @exception DevFailed
716 void compute_u(const Tango::DevVarLongArray
*);
718 * Defines crystal lattice parameters.
719 * This information is mandatory for angles calculations.
720 * Angles units are degrees
721 * @param argin Crystal parameters : alpha,beta,gamma, A,B,C
722 * @exception DevFailed
724 void configure_crystal(const Tango::DevVarDoubleArray
*);
726 * Copy the current crytal as another name
728 * @exception DevFailed
730 void copy_current_crystal_as(Tango::DevString
);
732 * Copy one reflection from the current crystal to another crystal
733 * @param argin Double: Reflection number of the current crystal String : Name of the crystal where copy this reflection
734 * @exception DevFailed
736 void copy_reflection_to(const Tango::DevVarDoubleStringArray
*);
738 * Delete the current from this device
739 * @exception DevFailed
741 void delete_current_crystal();
743 * Return all values of a parameter for the current crystal
744 * @param argin Name of parameter (see getParametersNames for the complete list of parameters)
745 * @return In the order : minimum value, maximum value, affinement enable
746 * @exception DevFailed
748 Tango::DevVarDoubleStringArray
*get_crystal_parameter_values(Tango::DevString
);
751 * @exception DevFailed
755 * This commands removes reflection from the current cristal.
756 * @param argin index of reflection to remove
757 * @exception DevFailed
759 void remove_reflection(Tango::DevShort
);
762 * @exception DevFailed
766 * Double : min value, max value, affinement enable
767 * @param argin String : Name of parameter ; Double : min value, max value, affinement enable
768 * @exception DevFailed
770 void set_crystal_parameter_values(const Tango::DevVarDoubleStringArray
*);
773 * Read the device properties from database
775 void get_device_property();
778 // Here is the end of the automatic code generation part
779 //-------------------------------------------------------------
784 // Add your own data members here
785 //-----------------------------------------
786 bool _helper_not_initialized
;
788 TangoHKLAdapter
* _hklAdapter
;
789 HklGeometryType _type
;
791 Tango::DevVarStringArray _crystal_names_dev_varstring_array
;
793 DiffractometerConfig _config
;
795 // thoses methods are declared in the DiffractometerExtra.cpp
797 // refresh crystal parameters
798 void refresh_crystal_parameters(void);
800 bool get_type_from_property(std::string
const & name
, HklGeometryType
&type
);
802 void remove_dynamic_attributes(void);
806 void create_dynamic_attributes(void);
811 #endif // _DIFFRACTOMETER_H