1 static const char *RcsId
= "$Header: $";
2 static const char *TagName
= "$Name: $";
3 static const char *HttpServer
= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
4 //+=============================================================================
6 // file : DiffractometerClass.cpp
8 // description : C++ source for the DiffractometerClass. A singleton
9 // class derived from DeviceClass. It implements the
10 // command list and all properties and methods required
11 // by the Diffractometer once per process.
13 // project : TANGO Device Server
21 // copyleft : European Synchrotron Radiation Facility
22 // BP 220, Grenoble 38043
25 //-=============================================================================
27 // This file is generated by POGO
28 // (Program Obviously used to Generate tango Object)
30 // (c) - Software Engineering Group - ESRF
31 //=============================================================================
36 #include <Diffractometer.h>
37 #include <DiffractometerClass.h>
40 //+----------------------------------------------------------------------------
42 * Create DiffractometerClass singleton and return it in a C function for Python usage
44 //+----------------------------------------------------------------------------
52 Tango::DeviceClass
*_create_Diffractometer_class(const char *name
) {
53 return Diffractometer_ns::DiffractometerClass::init(name
);
58 namespace Diffractometer_ns
61 //+----------------------------------------------------------------------------
63 // method : AbortCmd::execute()
65 // description : method to trigger the execution of the command.
66 // PLEASE DO NOT MODIFY this method core without pogo
68 // in : - device : The device on which the command must be excuted
69 // - in_any : The command input data
71 // returns : The command output data (packed in the Any object)
73 //-----------------------------------------------------------------------------
74 CORBA::Any
*AbortCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
77 cout2
<< "AbortCmd::execute(): arrived" << endl
;
79 ((static_cast<Diffractometer
*>(device
))->abort());
80 return new CORBA::Any();
83 //+----------------------------------------------------------------------------
85 // method : AddNewCrystalClass::execute()
87 // description : method to trigger the execution of the command.
88 // PLEASE DO NOT MODIFY this method core without pogo
90 // in : - device : The device on which the command must be excuted
91 // - in_any : The command input data
93 // returns : The command output data (packed in the Any object)
95 //-----------------------------------------------------------------------------
96 CORBA::Any
*AddNewCrystalClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
99 cout2
<< "AddNewCrystalClass::execute(): arrived" << endl
;
101 Tango::DevString argin
;
102 extract(in_any
, argin
);
104 ((static_cast<Diffractometer
*>(device
))->add_new_crystal(argin
));
105 return new CORBA::Any();
108 //+----------------------------------------------------------------------------
110 // method : AddReflectionClass::execute()
112 // description : method to trigger the execution of the command.
113 // PLEASE DO NOT MODIFY this method core without pogo
115 // in : - device : The device on which the command must be excuted
116 // - in_any : The command input data
118 // returns : The command output data (packed in the Any object)
120 //-----------------------------------------------------------------------------
121 CORBA::Any
*AddReflectionClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
124 cout2
<< "AddReflectionClass::execute(): arrived" << endl
;
126 const Tango::DevVarDoubleArray
*argin
;
127 extract(in_any
, argin
);
129 ((static_cast<Diffractometer
*>(device
))->add_reflection(argin
));
130 return new CORBA::Any();
133 //+----------------------------------------------------------------------------
135 // method : AffineCrystalCmd::execute()
137 // description : method to trigger the execution of the command.
138 // PLEASE DO NOT MODIFY this method core without pogo
140 // in : - device : The device on which the command must be excuted
141 // - in_any : The command input data
143 // returns : The command output data (packed in the Any object)
145 //-----------------------------------------------------------------------------
146 CORBA::Any
*AffineCrystalCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
149 cout2
<< "AffineCrystalCmd::execute(): arrived" << endl
;
151 Tango::DevString argin
;
152 extract(in_any
, argin
);
154 return insert((static_cast<Diffractometer
*>(device
))->affine_crystal(argin
));
157 //+----------------------------------------------------------------------------
159 // method : ComputeUCmd::execute()
161 // description : method to trigger the execution of the command.
162 // PLEASE DO NOT MODIFY this method core without pogo
164 // in : - device : The device on which the command must be excuted
165 // - in_any : The command input data
167 // returns : The command output data (packed in the Any object)
169 //-----------------------------------------------------------------------------
170 CORBA::Any
*ComputeUCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
173 cout2
<< "ComputeUCmd::execute(): arrived" << endl
;
175 const Tango::DevVarLongArray
*argin
;
176 extract(in_any
, argin
);
178 ((static_cast<Diffractometer
*>(device
))->compute_u(argin
));
179 return new CORBA::Any();
182 //+----------------------------------------------------------------------------
184 // method : ConfigureCrystalCmd::execute()
186 // description : method to trigger the execution of the command.
187 // PLEASE DO NOT MODIFY this method core without pogo
189 // in : - device : The device on which the command must be excuted
190 // - in_any : The command input data
192 // returns : The command output data (packed in the Any object)
194 //-----------------------------------------------------------------------------
195 CORBA::Any
*ConfigureCrystalCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
198 cout2
<< "ConfigureCrystalCmd::execute(): arrived" << endl
;
200 const Tango::DevVarDoubleArray
*argin
;
201 extract(in_any
, argin
);
203 ((static_cast<Diffractometer
*>(device
))->configure_crystal(argin
));
204 return new CORBA::Any();
207 //+----------------------------------------------------------------------------
209 // method : CopyCurrentCrystalAsClass::execute()
211 // description : method to trigger the execution of the command.
212 // PLEASE DO NOT MODIFY this method core without pogo
214 // in : - device : The device on which the command must be excuted
215 // - in_any : The command input data
217 // returns : The command output data (packed in the Any object)
219 //-----------------------------------------------------------------------------
220 CORBA::Any
*CopyCurrentCrystalAsClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
223 cout2
<< "CopyCurrentCrystalAsClass::execute(): arrived" << endl
;
225 Tango::DevString argin
;
226 extract(in_any
, argin
);
228 ((static_cast<Diffractometer
*>(device
))->copy_current_crystal_as(argin
));
229 return new CORBA::Any();
232 //+----------------------------------------------------------------------------
234 // method : CopyReflectionToCmd::execute()
236 // description : method to trigger the execution of the command.
237 // PLEASE DO NOT MODIFY this method core without pogo
239 // in : - device : The device on which the command must be excuted
240 // - in_any : The command input data
242 // returns : The command output data (packed in the Any object)
244 //-----------------------------------------------------------------------------
245 CORBA::Any
*CopyReflectionToCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
248 cout2
<< "CopyReflectionToCmd::execute(): arrived" << endl
;
250 const Tango::DevVarDoubleStringArray
*argin
;
251 extract(in_any
, argin
);
253 ((static_cast<Diffractometer
*>(device
))->copy_reflection_to(argin
));
254 return new CORBA::Any();
257 //+----------------------------------------------------------------------------
259 // method : DeleteCurrentCrystalClass::execute()
261 // description : method to trigger the execution of the command.
262 // PLEASE DO NOT MODIFY this method core without pogo
264 // in : - device : The device on which the command must be excuted
265 // - in_any : The command input data
267 // returns : The command output data (packed in the Any object)
269 //-----------------------------------------------------------------------------
270 CORBA::Any
*DeleteCurrentCrystalClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
273 cout2
<< "DeleteCurrentCrystalClass::execute(): arrived" << endl
;
275 ((static_cast<Diffractometer
*>(device
))->delete_current_crystal());
276 return new CORBA::Any();
280 //+----------------------------------------------------------------------------
282 // method : GetCrystalParameterValuesCmd::execute()
284 // description : method to trigger the execution of the command.
285 // PLEASE DO NOT MODIFY this method core without pogo
287 // in : - device : The device on which the command must be excuted
288 // - in_any : The command input data
290 // returns : The command output data (packed in the Any object)
292 //-----------------------------------------------------------------------------
293 CORBA::Any
*GetCrystalParameterValuesCmd::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
296 cout2
<< "GetCrystalParameterValuesCmd::execute(): arrived" << endl
;
298 Tango::DevString argin
;
299 extract(in_any
, argin
);
301 return insert((static_cast<Diffractometer
*>(device
))->get_crystal_parameter_values(argin
));
304 //+----------------------------------------------------------------------------
306 // method : LoadClass::execute()
308 // description : method to trigger the execution of the command.
309 // PLEASE DO NOT MODIFY this method core without pogo
311 // in : - device : The device on which the command must be excuted
312 // - in_any : The command input data
314 // returns : The command output data (packed in the Any object)
316 //-----------------------------------------------------------------------------
317 CORBA::Any
*LoadClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
320 cout2
<< "LoadClass::execute(): arrived" << endl
;
322 ((static_cast<Diffractometer
*>(device
))->load());
323 return new CORBA::Any();
326 //+----------------------------------------------------------------------------
328 // method : RemoveReflectionClass::execute()
330 // description : method to trigger the execution of the command.
331 // PLEASE DO NOT MODIFY this method core without pogo
333 // in : - device : The device on which the command must be excuted
334 // - in_any : The command input data
336 // returns : The command output data (packed in the Any object)
338 //-----------------------------------------------------------------------------
339 CORBA::Any
*RemoveReflectionClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
342 cout2
<< "RemoveReflectionClass::execute(): arrived" << endl
;
344 Tango::DevShort argin
;
345 extract(in_any
, argin
);
347 ((static_cast<Diffractometer
*>(device
))->remove_reflection(argin
));
348 return new CORBA::Any();
351 //+----------------------------------------------------------------------------
353 // method : SaveClass::execute()
355 // description : method to trigger the execution of the command.
356 // PLEASE DO NOT MODIFY this method core without pogo
358 // in : - device : The device on which the command must be excuted
359 // - in_any : The command input data
361 // returns : The command output data (packed in the Any object)
363 //-----------------------------------------------------------------------------
364 CORBA::Any
*SaveClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
367 cout2
<< "SaveClass::execute(): arrived" << endl
;
369 ((static_cast<Diffractometer
*>(device
))->save());
370 return new CORBA::Any();
374 //+----------------------------------------------------------------------------
376 // method : SetCrystalParameterValuesClass::execute()
378 // description : method to trigger the execution of the command.
379 // PLEASE DO NOT MODIFY this method core without pogo
381 // in : - device : The device on which the command must be excuted
382 // - in_any : The command input data
384 // returns : The command output data (packed in the Any object)
386 //-----------------------------------------------------------------------------
387 CORBA::Any
*SetCrystalParameterValuesClass::execute(Tango::DeviceImpl
*device
,const CORBA::Any
&in_any
)
390 cout2
<< "SetCrystalParameterValuesClass::execute(): arrived" << endl
;
392 const Tango::DevVarDoubleStringArray
*argin
;
393 extract(in_any
, argin
);
395 ((static_cast<Diffractometer
*>(device
))->set_crystal_parameter_values(argin
));
396 return new CORBA::Any();
401 //----------------------------------------------------------------
402 // Initialize pointer for singleton pattern
403 //----------------------------------------------------------------
405 DiffractometerClass
*DiffractometerClass::_instance
= NULL
;
407 //+----------------------------------------------------------------------------
409 // method : DiffractometerClass::DiffractometerClass(string &s)
411 // description : constructor for the DiffractometerClass
413 // in : - s : The class name
415 //-----------------------------------------------------------------------------
416 DiffractometerClass::DiffractometerClass(string
&s
):DeviceClass(s
)
419 cout2
<< "Entering DiffractometerClass constructor" << endl
;
420 set_default_property();
421 get_class_property();
422 write_class_property();
424 cout2
<< "Leaving DiffractometerClass constructor" << endl
;
427 //+----------------------------------------------------------------------------
429 // method : DiffractometerClass::~DiffractometerClass()
431 // description : destructor for the DiffractometerClass
433 //-----------------------------------------------------------------------------
434 DiffractometerClass::~DiffractometerClass()
439 //+----------------------------------------------------------------------------
441 // method : DiffractometerClass::instance
443 // description : Create the object if not already done. Otherwise, just
444 // return a pointer to the object
446 // in : - name : The class name
448 //-----------------------------------------------------------------------------
449 DiffractometerClass
*DiffractometerClass::init(const char *name
)
451 if (_instance
== NULL
)
456 _instance
= new DiffractometerClass(s
);
466 DiffractometerClass
*DiffractometerClass::instance()
468 if (_instance
== NULL
)
470 cerr
<< "Class is not initialised !!" << endl
;
476 //+----------------------------------------------------------------------------
478 // method : DiffractometerClass::command_factory
480 // description : Create the command object(s) and store them in the
483 //-----------------------------------------------------------------------------
484 void DiffractometerClass::command_factory()
486 command_list
.push_back(new AbortCmd("Abort",
487 Tango::DEV_VOID
, Tango::DEV_VOID
,
491 command_list
.push_back(new AddNewCrystalClass("AddNewCrystal",
492 Tango::DEV_STRING
, Tango::DEV_VOID
,
493 "Name of the new crystal",
496 command_list
.push_back(new AddReflectionClass("AddReflection",
497 Tango::DEVVAR_DOUBLEARRAY
, Tango::DEV_VOID
,
498 "reflections i.e : h, k, l, relevance, enable/disable",
501 command_list
.push_back(new AffineCrystalCmd("AffineCrystal",
502 Tango::DEV_STRING
, Tango::DEV_DOUBLE
,
503 "name of the crystal to fit",
504 "the fitness of the crystal after the affinement.",
506 command_list
.push_back(new ComputeUCmd("ComputeU",
507 Tango::DEVVAR_LONGARRAY
, Tango::DEV_VOID
,
508 "a two elements array with the index of reflection to use",
511 command_list
.push_back(new ConfigureCrystalCmd("ConfigureCrystal",
512 Tango::DEVVAR_DOUBLEARRAY
, Tango::DEV_VOID
,
513 "Crystal parameters : alpha,beta,gamma, A,B,C",
516 command_list
.push_back(new CopyCurrentCrystalAsClass("CopyCurrentCrystalAs",
517 Tango::DEV_STRING
, Tango::DEV_VOID
,
521 command_list
.push_back(new CopyReflectionToCmd("CopyReflectionTo",
522 Tango::DEVVAR_DOUBLESTRINGARRAY
, Tango::DEV_VOID
,
523 "Double: Reflection number of the current crystal String : Name of the crystal where copy this reflection",
526 command_list
.push_back(new DeleteCurrentCrystalClass("DeleteCurrentCrystal",
527 Tango::DEV_VOID
, Tango::DEV_VOID
,
531 command_list
.push_back(new GetCrystalParameterValuesCmd("GetCrystalParameterValues",
532 Tango::DEV_STRING
, Tango::DEVVAR_DOUBLESTRINGARRAY
,
533 "Name of parameter (see getParametersNames for the complete list of parameters)",
534 "In the order : minimum value, maximum value, affinement enable",
536 command_list
.push_back(new LoadClass("Load",
537 Tango::DEV_VOID
, Tango::DEV_VOID
,
541 command_list
.push_back(new RemoveReflectionClass("RemoveReflection",
542 Tango::DEV_SHORT
, Tango::DEV_VOID
,
543 "index of reflection to remove",
546 command_list
.push_back(new SaveClass("Save",
547 Tango::DEV_VOID
, Tango::DEV_VOID
,
551 command_list
.push_back(new SetCrystalParameterValuesClass("SetCrystalParameterValues",
552 Tango::DEVVAR_DOUBLESTRINGARRAY
, Tango::DEV_VOID
,
553 "String : Name of parameter ; Double : min value, max value, affinement enable",
557 // add polling if any
558 for (unsigned int i
=0 ; i
<command_list
.size(); i
++)
563 //+----------------------------------------------------------------------------
565 // method : DiffractometerClass::get_class_property
567 // description : Get the class property for specified name.
569 // in : string name : The property name
571 //+----------------------------------------------------------------------------
572 Tango::DbDatum
DiffractometerClass::get_class_property(string
&prop_name
)
574 for (unsigned int i
=0 ; i
<cl_prop
.size() ; i
++)
575 if (cl_prop
[i
].name
== prop_name
)
577 // if not found, return an empty DbDatum
578 return Tango::DbDatum(prop_name
);
580 //+----------------------------------------------------------------------------
582 // method : DiffractometerClass::get_default_device_property()
584 // description : Return the default value for device property.
586 //-----------------------------------------------------------------------------
587 Tango::DbDatum
DiffractometerClass::get_default_device_property(string
&prop_name
)
589 for (unsigned int i
=0 ; i
<dev_def_prop
.size() ; i
++)
590 if (dev_def_prop
[i
].name
== prop_name
)
591 return dev_def_prop
[i
];
592 // if not found, return an empty DbDatum
593 return Tango::DbDatum(prop_name
);
596 //+----------------------------------------------------------------------------
598 // method : DiffractometerClass::get_default_class_property()
600 // description : Return the default value for class property.
602 //-----------------------------------------------------------------------------
603 Tango::DbDatum
DiffractometerClass::get_default_class_property(string
&prop_name
)
605 for (unsigned int i
=0 ; i
<cl_def_prop
.size() ; i
++)
606 if (cl_def_prop
[i
].name
== prop_name
)
607 return cl_def_prop
[i
];
608 // if not found, return an empty DbDatum
609 return Tango::DbDatum(prop_name
);
611 //+----------------------------------------------------------------------------
613 // method : DiffractometerClass::device_factory
615 // description : Create the device object(s) and store them in the
618 // in : Tango::DevVarStringArray *devlist_ptr : The device name list
620 //-----------------------------------------------------------------------------
621 void DiffractometerClass::device_factory(const Tango::DevVarStringArray
*devlist_ptr
)
624 // Create all devices.(Automatic code generation)
625 //-------------------------------------------------------------
626 for (unsigned long i
=0 ; i
< devlist_ptr
->length() ; i
++)
628 cout4
<< "Device name : " << (*devlist_ptr
)[i
].in() << endl
;
630 // Create devices and add it into the device list
631 //----------------------------------------------------
632 device_list
.push_back(new Diffractometer(this, (*devlist_ptr
)[i
]));
634 // Export device to the outside world
635 // Check before if database used.
636 //---------------------------------------------
637 if ((Tango::Util::_UseDb
== true) && (Tango::Util::_FileDb
== false))
638 export_device(device_list
.back());
640 export_device(device_list
.back(), (*devlist_ptr
)[i
]);
642 // End of Automatic code generation
643 //-------------------------------------------------------------
645 //+----------------------------------------------------------------------------
646 // Method: DiffractometerClass::attribute_factory(vector<Tango::Attr *> &att_list)
647 //-----------------------------------------------------------------------------
648 void DiffractometerClass::attribute_factory(vector
<Tango::Attr
*> &att_list
)
650 // Attribute : AnglesIdx
651 AnglesIdxAttrib
*angles_idx
= new AnglesIdxAttrib();
652 Tango::UserDefaultAttrProp angles_idx_prop
;
653 angles_idx_prop
.set_description("this attribut select the solution used to set the axes after an angle computation.");
654 angles_idx
->set_default_properties(angles_idx_prop
);
655 att_list
.push_back(angles_idx
);
657 // Attribute : AutoUpdateFromProxies
658 AutoUpdateFromProxiesAttrib
*auto_update_from_proxies
= new AutoUpdateFromProxiesAttrib();
659 Tango::UserDefaultAttrProp auto_update_from_proxies_prop
;
660 auto_update_from_proxies_prop
.set_format("%1d");
661 auto_update_from_proxies_prop
.set_max_value("1");
662 auto_update_from_proxies_prop
.set_min_value("0");
663 auto_update_from_proxies_prop
.set_description("0 : Device do not update the simulated part using proxies\n1 : Device update all the times the simulated part from the proxies\n");
664 auto_update_from_proxies
->set_default_properties(auto_update_from_proxies_prop
);
665 att_list
.push_back(auto_update_from_proxies
);
667 // Attribute : WaveLength
668 WaveLengthAttrib
*wave_length
= new WaveLengthAttrib();
669 Tango::UserDefaultAttrProp wave_length_prop
;
670 wave_length_prop
.set_label("wavelength");
671 wave_length_prop
.set_format("%8.3f");
672 wave_length_prop
.set_description("The wave length used by the diffractometer.\nUsually connected to an AttributeProxy.");
673 wave_length
->set_default_properties(wave_length_prop
);
674 wave_length
->set_memorized();
675 wave_length
->set_memorized_init(true);
676 att_list
.push_back(wave_length
);
678 // Attribute : Crystal
679 CrystalAttrib
*crystal
= new CrystalAttrib();
680 Tango::UserDefaultAttrProp crystal_prop
;
681 crystal_prop
.set_label("crystal");
682 crystal_prop
.set_description("The name of the crystal used by the diffractometer.\n\nthe list of the available crystals is in the attribut crystals \n");
683 crystal
->set_default_properties(crystal_prop
);
684 att_list
.push_back(crystal
);
687 AAttrib
*a
= new AAttrib();
688 Tango::UserDefaultAttrProp a_prop
;
689 a_prop
.set_format("%8.3f");
690 a_prop
.set_description("crystal lattice a parameter");
691 a
->set_default_properties(a_prop
);
692 att_list
.push_back(a
);
695 AFitAttrib
*afit
= new AFitAttrib();
696 Tango::UserDefaultAttrProp afit_prop
;
697 afit_prop
.set_description("Activate/UnActivate the fit of the parameter");
698 afit
->set_default_properties(afit_prop
);
699 att_list
.push_back(afit
);
702 BAttrib
*b
= new BAttrib();
703 Tango::UserDefaultAttrProp b_prop
;
704 b_prop
.set_format("%8.3f");
705 b_prop
.set_description("crystal lattice b parameter");
706 b
->set_default_properties(b_prop
);
707 att_list
.push_back(b
);
710 BFitAttrib
*bfit
= new BFitAttrib();
711 Tango::UserDefaultAttrProp bfit_prop
;
712 bfit_prop
.set_description("Activate/UnActivate the fit of the parameter");
713 bfit
->set_default_properties(bfit_prop
);
714 att_list
.push_back(bfit
);
717 CAttrib
*c
= new CAttrib();
718 Tango::UserDefaultAttrProp c_prop
;
719 c_prop
.set_format("%8.3f");
720 c_prop
.set_description("crystal lattice c parameter");
721 c
->set_default_properties(c_prop
);
722 att_list
.push_back(c
);
725 CFitAttrib
*cfit
= new CFitAttrib();
726 Tango::UserDefaultAttrProp cfit_prop
;
727 cfit_prop
.set_description("Activate/UnActivate the fit of the parameter");
728 cfit
->set_default_properties(cfit_prop
);
729 att_list
.push_back(cfit
);
732 AlphaAttrib
*alpha
= new AlphaAttrib();
733 Tango::UserDefaultAttrProp alpha_prop
;
734 alpha_prop
.set_unit("degree");
735 alpha_prop
.set_format("%8.3f");
736 alpha_prop
.set_description("crystal lattice alpha parameter");
737 alpha
->set_default_properties(alpha_prop
);
738 att_list
.push_back(alpha
);
740 // Attribute : AlphaFit
741 AlphaFitAttrib
*alpha_fit
= new AlphaFitAttrib();
742 Tango::UserDefaultAttrProp alpha_fit_prop
;
743 alpha_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
744 alpha_fit
->set_default_properties(alpha_fit_prop
);
745 att_list
.push_back(alpha_fit
);
748 BetaAttrib
*beta
= new BetaAttrib();
749 Tango::UserDefaultAttrProp beta_prop
;
750 beta_prop
.set_unit("degree");
751 beta_prop
.set_format("%8.3f");
752 beta_prop
.set_description("crystal lattice beta parameter");
753 beta
->set_default_properties(beta_prop
);
754 att_list
.push_back(beta
);
756 // Attribute : BetaFit
757 BetaFitAttrib
*beta_fit
= new BetaFitAttrib();
758 Tango::UserDefaultAttrProp beta_fit_prop
;
759 beta_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
760 beta_fit
->set_default_properties(beta_fit_prop
);
761 att_list
.push_back(beta_fit
);
764 GammaAttrib
*gamma
= new GammaAttrib();
765 Tango::UserDefaultAttrProp gamma_prop
;
766 gamma_prop
.set_unit("degree");
767 gamma_prop
.set_format("%8.3f");
768 gamma_prop
.set_description("crystal lattice gamma parameter");
769 gamma
->set_default_properties(gamma_prop
);
770 att_list
.push_back(gamma
);
772 // Attribute : GammaFit
773 GammaFitAttrib
*gamma_fit
= new GammaFitAttrib();
774 Tango::UserDefaultAttrProp gamma_fit_prop
;
775 gamma_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
776 gamma_fit
->set_default_properties(gamma_fit_prop
);
777 att_list
.push_back(gamma_fit
);
780 UxAttrib
*ux
= new UxAttrib();
781 Tango::UserDefaultAttrProp ux_prop
;
782 ux_prop
.set_unit("degree");
783 ux_prop
.set_description("The x coordinate of the U matrix");
784 ux
->set_default_properties(ux_prop
);
785 att_list
.push_back(ux
);
788 UxFitAttrib
*ux_fit
= new UxFitAttrib();
789 Tango::UserDefaultAttrProp ux_fit_prop
;
790 ux_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
791 ux_fit
->set_default_properties(ux_fit_prop
);
792 att_list
.push_back(ux_fit
);
795 UyAttrib
*uy
= new UyAttrib();
796 Tango::UserDefaultAttrProp uy_prop
;
797 uy_prop
.set_unit("degree");
798 uy_prop
.set_description("The y coordinate of the U matrix");
799 uy
->set_default_properties(uy_prop
);
800 att_list
.push_back(uy
);
803 UyFitAttrib
*uy_fit
= new UyFitAttrib();
804 Tango::UserDefaultAttrProp uy_fit_prop
;
805 uy_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
806 uy_fit
->set_default_properties(uy_fit_prop
);
807 att_list
.push_back(uy_fit
);
810 UzAttrib
*uz
= new UzAttrib();
811 Tango::UserDefaultAttrProp uz_prop
;
812 uz_prop
.set_unit("degree");
813 uz_prop
.set_description("The z coordinate of the U matrix");
814 uz
->set_default_properties(uz_prop
);
815 att_list
.push_back(uz
);
818 UzFitAttrib
*uz_fit
= new UzFitAttrib();
819 Tango::UserDefaultAttrProp uz_fit_prop
;
820 uz_fit_prop
.set_description("Activate/UnActivate the fit of the parameter");
821 uz_fit
->set_default_properties(uz_fit_prop
);
822 att_list
.push_back(uz_fit
);
825 AStarAttrib
*astar
= new AStarAttrib();
826 Tango::UserDefaultAttrProp astar_prop
;
827 astar_prop
.set_description("The a* crystal parameter");
828 astar
->set_default_properties(astar_prop
);
829 att_list
.push_back(astar
);
832 BStarAttrib
*bstar
= new BStarAttrib();
833 Tango::UserDefaultAttrProp bstar_prop
;
834 bstar_prop
.set_description("The b* crystal parameter");
835 bstar
->set_default_properties(bstar_prop
);
836 att_list
.push_back(bstar
);
839 CStarAttrib
*cstar
= new CStarAttrib();
840 Tango::UserDefaultAttrProp cstar_prop
;
841 cstar_prop
.set_description("The c* crystal parameter");
842 cstar
->set_default_properties(cstar_prop
);
843 att_list
.push_back(cstar
);
845 // Attribute : AlphaStar
846 AlphaStarAttrib
*alpha_star
= new AlphaStarAttrib();
847 Tango::UserDefaultAttrProp alpha_star_prop
;
848 alpha_star_prop
.set_description("The alpha* crystal parameter");
849 alpha_star
->set_default_properties(alpha_star_prop
);
850 att_list
.push_back(alpha_star
);
852 // Attribute : BetaStar
853 BetaStarAttrib
*beta_star
= new BetaStarAttrib();
854 Tango::UserDefaultAttrProp beta_star_prop
;
855 beta_star_prop
.set_description("The beta* crystal parameter");
856 beta_star
->set_default_properties(beta_star_prop
);
857 att_list
.push_back(beta_star
);
859 // Attribute : GammaStar
860 GammaStarAttrib
*gamma_star
= new GammaStarAttrib();
861 Tango::UserDefaultAttrProp gamma_star_prop
;
862 gamma_star_prop
.set_description("The beta* crystal parameter");
863 gamma_star
->set_default_properties(gamma_star_prop
);
864 att_list
.push_back(gamma_star
);
866 // Attribute : Simulated
867 SimulatedAttrib
*simulated
= new SimulatedAttrib();
868 Tango::UserDefaultAttrProp simulated_prop
;
869 simulated_prop
.set_label("simulated");
870 simulated_prop
.set_format("%1d");
871 simulated_prop
.set_max_value("1");
872 simulated_prop
.set_min_value("0");
873 simulated_prop
.set_description("0 : Device REALLY moves diffractometers motors\n1 : Device only simulates calculations and DOES NOT move any motor\n");
874 simulated
->set_default_properties(simulated_prop
);
875 att_list
.push_back(simulated
);
877 // Attribute : CrystalNames
878 CrystalNamesAttrib
*crystal_names
= new CrystalNamesAttrib();
879 att_list
.push_back(crystal_names
);
881 // Attribute : AxesNames
882 AxesNamesAttrib
*axes_names
= new AxesNamesAttrib();
883 Tango::UserDefaultAttrProp axes_names_prop
;
884 axes_names_prop
.set_description("the names of the Dynamic axis attributes");
885 axes_names
->set_default_properties(axes_names_prop
);
886 att_list
.push_back(axes_names
);
888 // Attribute : pseudoAxesProxies
889 pseudoAxesProxiesAttrib
*pseudo_axes_proxies
= new pseudoAxesProxiesAttrib();
890 att_list
.push_back(pseudo_axes_proxies
);
892 // Attribute : Angles
893 AnglesAttrib
*angles
= new AnglesAttrib();
894 Tango::UserDefaultAttrProp angles_prop
;
895 angles_prop
.set_description("containe all the hkl computed values.\nsimulated (0/1) h, k, l, axies angles");
896 angles
->set_default_properties(angles_prop
);
897 att_list
.push_back(angles
);
899 // Attribute : AnglesDegenerated
900 AnglesDegeneratedAttrib
*angles_degenerated
= new AnglesDegeneratedAttrib();
901 Tango::UserDefaultAttrProp angles_degenerated_prop
;
902 angles_degenerated_prop
.set_description("containe all the hkl computed values.\nsimulated (0/1) h, k, l, axies angles");
903 angles_degenerated
->set_default_properties(angles_degenerated_prop
);
904 att_list
.push_back(angles_degenerated
);
906 // Attribute : AnglesRangeCheck
907 AnglesRangeCheckAttrib
*angles_range_check
= new AnglesRangeCheckAttrib();
908 Tango::UserDefaultAttrProp angles_range_check_prop
;
909 angles_range_check_prop
.set_description("containe all the hkl computed values.\nsimulated (0/1) h, k, l, axies angles");
910 angles_range_check
->set_default_properties(angles_range_check_prop
);
911 att_list
.push_back(angles_range_check
);
913 // Attribute : Reflections
914 ReflectionsAttrib
*reflections
= new ReflectionsAttrib();
915 att_list
.push_back(reflections
);
917 // Attribute : ReflectionsAngles
918 ReflectionsAnglesAttrib
*reflections_angles
= new ReflectionsAnglesAttrib();
919 Tango::UserDefaultAttrProp reflections_angles_prop
;
920 reflections_angles_prop
.set_description("matrix with the theoretical (lower triangular part) and\nmesured angles (upper triangular part) between\nreflections.");
921 reflections_angles
->set_default_properties(reflections_angles_prop
);
922 att_list
.push_back(reflections_angles
);
925 UBAttrib
*ub
= new UBAttrib();
926 Tango::UserDefaultAttrProp ub_prop
;
927 ub_prop
.set_description("The UB matrix of the current crystal");
928 ub
->set_default_properties(ub_prop
);
929 att_list
.push_back(ub
);
931 // End of Automatic code generation
932 //-------------------------------------------------------------
935 //+----------------------------------------------------------------------------
937 // method : DiffractometerClass::get_class_property()
939 // description : Read the class properties from database.
941 //-----------------------------------------------------------------------------
942 void DiffractometerClass::get_class_property()
944 // Initialize your default values here (if not done with POGO).
945 //------------------------------------------------------------------
947 // Read class properties from database.(Automatic code generation)
948 //------------------------------------------------------------------
950 // Call database and extract values
951 //--------------------------------------------
952 if (Tango::Util::instance()->_UseDb
==true)
953 get_db_class()->get_property(cl_prop
);
954 Tango::DbDatum def_prop
;
958 // End of Automatic code generation
959 //------------------------------------------------------------------
963 //+----------------------------------------------------------------------------
965 // method : DiffractometerClass::set_default_property
967 // description: Set default property (class and device) for wizard.
968 // For each property, add to wizard property name and description
969 // If default value has been set, add it to wizard property and
970 // store it in a DbDatum.
972 //-----------------------------------------------------------------------------
973 void DiffractometerClass::set_default_property()
979 vector
<string
> vect_data
;
980 // Set Default Class Properties
981 // Set Default Device Properties
982 prop_name
= "TauConstant";
983 prop_desc
= "Definition of the Tau constant .\nPossible values are pi or 1 .\nDefault : 1";
985 if (prop_def
.length()>0)
987 Tango::DbDatum
data(prop_name
);
989 dev_def_prop
.push_back(data
);
990 add_wiz_dev_prop(prop_name
, prop_desc
, prop_def
);
993 add_wiz_dev_prop(prop_name
, prop_desc
);
995 prop_name
= "RealAxisProxies";
997 prop_def
= "mu:tests/diffabs/mu\nkomega:tests/diffabs/komega\nkappa:tests/diffabs/kappa\nkphi:tests/diffabs/kphi\ndelta:tests/diffabs/delta\ngamma:tests/diffabs/gamma";
999 vect_data
.push_back("mu:tests/diffabs/mu");
1000 vect_data
.push_back("komega:tests/diffabs/komega");
1001 vect_data
.push_back("kappa:tests/diffabs/kappa");
1002 vect_data
.push_back("kphi:tests/diffabs/kphi");
1003 vect_data
.push_back("delta:tests/diffabs/delta");
1004 vect_data
.push_back("gamma:tests/diffabs/gamma");
1005 if (prop_def
.length()>0)
1007 Tango::DbDatum
data(prop_name
);
1009 dev_def_prop
.push_back(data
);
1010 add_wiz_dev_prop(prop_name
, prop_desc
, prop_def
);
1013 add_wiz_dev_prop(prop_name
, prop_desc
);
1015 prop_name
= "LambdaAttributeProxy";
1016 prop_desc
= "The name of the lambda attribute proxy.\n\nThe diffractometer use it to read the lambda value from another Device";
1018 if (prop_def
.length()>0)
1020 Tango::DbDatum
data(prop_name
);
1022 dev_def_prop
.push_back(data
);
1023 add_wiz_dev_prop(prop_name
, prop_desc
, prop_def
);
1026 add_wiz_dev_prop(prop_name
, prop_desc
);
1028 prop_name
= "DiffractometerType";
1029 prop_desc
= "The Type of the diffractometer\n\n";
1031 if (prop_def
.length()>0)
1033 Tango::DbDatum
data(prop_name
);
1035 dev_def_prop
.push_back(data
);
1036 add_wiz_dev_prop(prop_name
, prop_desc
, prop_def
);
1039 add_wiz_dev_prop(prop_name
, prop_desc
);
1041 prop_name
= "ProtectReflectionAxes";
1042 prop_desc
= "allow or not to change the values of the axes in the Reflections attribute.\n\nset this properties to false to allow writting on the axes values.";
1045 vect_data
.push_back("true");
1046 if (prop_def
.length()>0)
1048 Tango::DbDatum
data(prop_name
);
1050 dev_def_prop
.push_back(data
);
1051 add_wiz_dev_prop(prop_name
, prop_desc
, prop_def
);
1054 add_wiz_dev_prop(prop_name
, prop_desc
);
1057 //+----------------------------------------------------------------------------
1059 // method : DiffractometerClass::write_class_property
1061 // description : Set class description as property in database
1063 //-----------------------------------------------------------------------------
1064 void DiffractometerClass::write_class_property()
1066 // First time, check if database used
1067 //--------------------------------------------
1068 if (Tango::Util::_UseDb
== false)
1072 string classname
= get_name();
1074 string::size_type start
, end
;
1077 Tango::DbDatum
title("ProjectTitle");
1078 string
str_title("Diffractometer");
1080 data
.push_back(title
);
1083 Tango::DbDatum
description("Description");
1084 vector
<string
> str_desc
;
1085 str_desc
.push_back("This class can be used to compute cristallography computation");
1086 description
<< str_desc
;
1087 data
.push_back(description
);
1090 string
rcsId(RcsId
);
1091 string
filename(classname
);
1092 start
= rcsId
.find("/");
1093 if (start
!=string::npos
)
1095 filename
+= "Class.cpp";
1096 end
= rcsId
.find(filename
);
1099 string strloc
= rcsId
.substr(start
, end
-start
);
1100 // Check if specific repository
1101 start
= strloc
.find("/cvsroot/");
1102 if (start
!=string::npos
&& start
>0)
1104 string repository
= strloc
.substr(0, start
);
1105 if (repository
.find("/segfs/")!=string::npos
)
1106 strloc
= "ESRF:" + strloc
.substr(start
, strloc
.length()-start
);
1108 Tango::DbDatum
cvs_loc("cvs_location");
1110 data
.push_back(cvs_loc
);
1114 // Get CVS tag revision
1115 string
tagname(TagName
);
1117 start
= header
.length();
1118 string
endstr(" $");
1119 end
= tagname
.find(endstr
);
1120 if (end
!=string::npos
&& end
>start
)
1122 string strtag
= tagname
.substr(start
, end
-start
);
1123 Tango::DbDatum
cvs_tag("cvs_tag");
1125 data
.push_back(cvs_tag
);
1129 string
httpServ(HttpServer
);
1130 if (httpServ
.length()>0)
1132 Tango::DbDatum
db_doc_url("doc_url");
1133 db_doc_url
<< httpServ
;
1134 data
.push_back(db_doc_url
);
1138 Tango::DbDatum
inher_datum("InheritedFrom");
1139 vector
<string
> inheritance
;
1140 inheritance
.push_back("Device_4Impl");
1141 inher_datum
<< inheritance
;
1142 data
.push_back(inher_datum
);
1144 // Call database and and values
1145 //--------------------------------------------
1146 get_db_class()->put_property(data
);