initialize properly the Angles attribut.
[diffractometer.git] / src / Diffractometer / Diffractometer.cpp
blob39fb219a9910b394f4e483933753e865ca951090
1 static const char *RcsId = "$Header: /cvsroot/tango-ds/Instrumentation/Diffractometer/src/Diffractometer.cpp,v 1.5 2008/11/28 15:46:32 piccaf Exp $";
2 //+=============================================================================
3 //
4 // file : Diffractometer.cpp
5 //
6 // description : C++ source for the Diffractometer and its commands.
7 // The class is derived from Device. It represents the
8 // CORBA servant object which will be accessed from the
9 // network. All commands which can be executed on the
10 // Diffractometer are implemented in this file.
12 // project : TANGO Device Server
14 // $Author: piccaf $
16 // $Revision: 1.5 $
18 // $Log: Diffractometer.cpp,v $
19 // Revision 1.5 2008/11/28 15:46:32 piccaf
20 // * close # mantis: 11051
22 // Revision 1.4 2008/10/16 10:16:55 piccaf
23 // * update to build on windows with vc8
24 // * add the Eulerian6C diffractometer.
25 // * add the dynamic attributes in the factory instead of the init device
27 // Revision 1.3 2008/09/22 16:20:35 vince_soleil
28 // Set first character of attribute name in minus
30 // Revision 1.2 2008/09/22 08:46:23 piccaf
31 // * add files from the new diffractometer Device
34 // copyleft : European Synchrotron Radiation Facility
35 // BP 220, Grenoble 38043
36 // FRANCE
38 //-=============================================================================
40 // This file is generated by POGO
41 // (Program Obviously used to Generate tango Object)
43 // (c) - Software Engineering Group - ESRF
44 //=============================================================================
48 //===================================================================
50 // The following table gives the correspondence
51 // between commands and method name.
53 // Command name | Method name
54 // ----------------------------------------
55 // State | dev_state()
56 // Status | dev_status()
57 // Abort | abort()
58 // AddNewCrystal | add_new_crystal()
59 // AddReflection | add_reflection()
60 // AffineCrystal | affine_crystal()
61 // ComputeU | compute_u()
62 // ConfigureCrystal | configure_crystal()
63 // CopyCurrentCrystalAs | copy_current_crystal_as()
64 // CopyReflectionTo | copy_reflection_to()
65 // DeleteCurrentCrystal | delete_current_crystal()
66 // GetCrystalParameterValues | get_crystal_parameter_values()
67 // Load | load()
68 // RemoveReflection | remove_reflection()
69 // Save | save()
70 // SetCrystalParameterValues | set_crystal_parameter_values()
72 //===================================================================
75 #include <tango.h>
76 #include <Diffractometer.h>
77 #include <DiffractometerClass.h>
79 #include <time.h>
80 #include <sstream>
81 #include <algorithm>
82 #include <cctype>
83 #include <string>
85 #include "macros.h"
86 #include "AxisAttrib.h"
87 #include "TangoHKLAdapterFactory.h"
89 namespace Diffractometer_ns
92 //+----------------------------------------------------------------------------
94 // method : Diffractometer::Diffractometer(string &s)
95 //
96 // description : constructor for simulated Diffractometer
98 // in : - cl : Pointer to the DeviceClass object
99 // - s : Device name
101 //-----------------------------------------------------------------------------
102 Diffractometer::Diffractometer(Tango::DeviceClass *cl,string &s)
103 :Tango::Device_3Impl(cl,s.c_str())
105 init_device();
108 Diffractometer::Diffractometer(Tango::DeviceClass *cl,const char *s)
109 :Tango::Device_3Impl(cl,s)
111 init_device();
114 Diffractometer::Diffractometer(Tango::DeviceClass *cl,const char *s,const char *d)
115 :Tango::Device_3Impl(cl,s,d)
117 init_device();
119 //+----------------------------------------------------------------------------
121 // method : Diffractometer::delete_device()
123 // description : will be called at device destruction or at init command.
125 //-----------------------------------------------------------------------------
126 void Diffractometer::delete_device()
128 // Delete device's allocated object
129 this->save();
131 // Delete device's allocated object
132 DELETE_SCALAR_ATTRIBUTE(attr_AnglesIdx_read);
133 DELETE_SCALAR_ATTRIBUTE(attr_WaveLength_read);
134 DELETE_SCALAR_ATTRIBUTE(attr_AutoUpdateFromProxies_read);
135 DELETE_SCALAR_ATTRIBUTE(attr_Simulated_read);
136 DELETE_SCALAR_ATTRIBUTE(attr_A_read);
137 DELETE_SCALAR_ATTRIBUTE(attr_B_read);
138 DELETE_SCALAR_ATTRIBUTE(attr_C_read);
139 DELETE_SCALAR_ATTRIBUTE(attr_Alpha_read);
140 DELETE_SCALAR_ATTRIBUTE(attr_Beta_read);
141 DELETE_SCALAR_ATTRIBUTE(attr_Gamma_read);
142 DELETE_SCALAR_ATTRIBUTE(attr_Ux_read);
143 DELETE_SCALAR_ATTRIBUTE(attr_Uy_read);
144 DELETE_SCALAR_ATTRIBUTE(attr_Uz_read);
145 DELETE_SCALAR_ATTRIBUTE(attr_AStar_read);
146 DELETE_SCALAR_ATTRIBUTE(attr_BStar_read);
147 DELETE_SCALAR_ATTRIBUTE(attr_CStar_read);
148 DELETE_SCALAR_ATTRIBUTE(attr_AlphaStar_read);
149 DELETE_SCALAR_ATTRIBUTE(attr_BetaStar_read);
150 DELETE_SCALAR_ATTRIBUTE(attr_GammaStar_read);
151 DELETE_SCALAR_ATTRIBUTE(attr_AFit_read);
152 DELETE_SCALAR_ATTRIBUTE(attr_BFit_read);
153 DELETE_SCALAR_ATTRIBUTE(attr_CFit_read);
154 DELETE_SCALAR_ATTRIBUTE(attr_AlphaFit_read);
155 DELETE_SCALAR_ATTRIBUTE(attr_BetaFit_read);
156 DELETE_SCALAR_ATTRIBUTE(attr_GammaFit_read);
157 DELETE_SCALAR_ATTRIBUTE(attr_UxFit_read);
158 DELETE_SCALAR_ATTRIBUTE(attr_UyFit_read);
159 DELETE_SCALAR_ATTRIBUTE(attr_UzFit_read);
161 DELETE_DEVSTRING_ATTRIBUTE(attr_Crystal_read);
163 if(attr_UB_read) {
164 delete[] attr_UB_read;
165 attr_UB_read = NULL;
168 if(attr_Angles_read) {
169 delete[] attr_Angles_read;
170 attr_Angles_read = NULL;
173 if(attr_ReflectionsAngles_read) {
174 delete [] attr_ReflectionsAngles_read;
175 attr_ReflectionsAngles_read = NULL;
178 if(attr_Reflections_read){
179 delete[] attr_Reflections_read;
180 attr_Reflections_read = NULL;
183 this->remove_dynamic_attributes();
186 * Do not remove the diffractometer in the delete method
187 * of the Derived classes to avoid a segmentation fault
188 * during the save method call. Indeed the Derived class delete
189 * method is called before this delete method.
191 TangoHKLAdapterFactory::instance()->detach_diffractometer_device(this);
194 //+----------------------------------------------------------------------------
196 // method : Diffractometer::init_device()
198 // description : will be called at device initialization.
200 //-----------------------------------------------------------------------------
201 void Diffractometer::init_device()
203 INFO_STREAM << "Diffractometer::Diffractometer() create device " << device_name << endl;
205 // Initialise variables to default values
206 //--------------------------------------------
207 get_device_property();
209 CREATE_SCALAR_ATTRIBUTE(attr_AnglesIdx_read, (short)-1);
210 CREATE_SCALAR_ATTRIBUTE(attr_WaveLength_read, 0.0);
211 CREATE_SCALAR_ATTRIBUTE(attr_AutoUpdateFromProxies_read, false);
212 CREATE_SCALAR_ATTRIBUTE(attr_Simulated_read, true);
213 CREATE_SCALAR_ATTRIBUTE(attr_A_read, 0.0);
214 CREATE_SCALAR_ATTRIBUTE(attr_B_read, 0.0);
215 CREATE_SCALAR_ATTRIBUTE(attr_C_read, 0.0);
216 CREATE_SCALAR_ATTRIBUTE(attr_Alpha_read, 0.0);
217 CREATE_SCALAR_ATTRIBUTE(attr_Beta_read, 0.0);
218 CREATE_SCALAR_ATTRIBUTE(attr_Gamma_read, 0.0);
219 CREATE_SCALAR_ATTRIBUTE(attr_Ux_read, 0.0);
220 CREATE_SCALAR_ATTRIBUTE(attr_Uy_read, 0.0);
221 CREATE_SCALAR_ATTRIBUTE(attr_Uz_read, 0.0);
222 CREATE_SCALAR_ATTRIBUTE(attr_AStar_read);
223 CREATE_SCALAR_ATTRIBUTE(attr_BStar_read);
224 CREATE_SCALAR_ATTRIBUTE(attr_CStar_read);
225 CREATE_SCALAR_ATTRIBUTE(attr_AlphaStar_read);
226 CREATE_SCALAR_ATTRIBUTE(attr_BetaStar_read);
227 CREATE_SCALAR_ATTRIBUTE(attr_GammaStar_read);
228 CREATE_SCALAR_ATTRIBUTE(attr_AFit_read, false);
229 CREATE_SCALAR_ATTRIBUTE(attr_BFit_read, false);
230 CREATE_SCALAR_ATTRIBUTE(attr_CFit_read, false);
231 CREATE_SCALAR_ATTRIBUTE(attr_AlphaFit_read, false);
232 CREATE_SCALAR_ATTRIBUTE(attr_BetaFit_read, false);
233 CREATE_SCALAR_ATTRIBUTE(attr_GammaFit_read, false);
234 CREATE_SCALAR_ATTRIBUTE(attr_UxFit_read, false);
235 CREATE_SCALAR_ATTRIBUTE(attr_UyFit_read, false);
236 CREATE_SCALAR_ATTRIBUTE(attr_UzFit_read, false);
238 CREATE_DEVSTRING_ATTRIBUTE(attr_Crystal_read, 1, "");
240 attr_UB_read = NULL;
241 attr_Angles_read = NULL;
242 attr_ReflectionsAngles_read = NULL;
243 attr_Reflections_read = NULL;
244 attr_AxesNames_read = NULL;
246 // Device is in FAULT state because it was not yet configured.
247 this->set_state(Tango::FAULT);
248 this->set_status("Configure Diffractometer: crystal, wavelength,etc ..");
250 _type = this->get_type_from_property(diffractometerType);
253 * this method must be call after get_device_property() as
254 * TangoHKLAdapter create the axisbuffer from the
255 * realAxisProxies.
257 _hklAdapter = TangoHKLAdapterFactory::instance()->attach_diffractometer_device(this, _type);
258 if (!_hklAdapter) {
259 this->set_state(Tango::FAULT);
260 this->set_status("Fatal can not initialize the hkl library");
261 TANGO_EXCEPTION_THROW("Internal Fatal Error", "Device can't get an instance of TangoHKLAdapter");
262 } else {
263 // Restore the Diffractometer state from the last run.
264 this->load();
266 _hklAdapter->connect_all_proxies();
268 // create an start all the PseudoAxes devices.
269 _hklAdapter->pseudo_axes_create_and_start_devices();
274 //+----------------------------------------------------------------------------
276 // method : Diffractometer::get_device_property()
278 // description : Read the device properties from database.
280 //-----------------------------------------------------------------------------
281 void Diffractometer::get_device_property()
283 // Initialize your default values here (if not done with POGO).
284 //------------------------------------------------------------------
286 // Read device properties from database.(Automatic code generation)
287 //------------------------------------------------------------------
288 Tango::DbData dev_prop;
289 dev_prop.push_back(Tango::DbDatum("TauConstant"));
290 dev_prop.push_back(Tango::DbDatum("RealAxisProxies"));
291 dev_prop.push_back(Tango::DbDatum("LambdaAttributeProxy"));
292 dev_prop.push_back(Tango::DbDatum("DiffractometerType"));
293 dev_prop.push_back(Tango::DbDatum("ProtectReflectionAxes"));
295 // Call database and extract values
296 //--------------------------------------------
297 if (Tango::Util::instance()->_UseDb==true)
298 get_db_device()->get_property(dev_prop);
299 Tango::DbDatum def_prop, cl_prop;
300 DiffractometerClass *ds_class =
301 (static_cast<DiffractometerClass *>(get_device_class()));
302 int i = -1;
304 // Try to initialize TauConstant from class property
305 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
306 if (cl_prop.is_empty()==false) cl_prop >> tauConstant;
307 else {
308 // Try to initialize TauConstant from default device value
309 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
310 if (def_prop.is_empty()==false) def_prop >> tauConstant;
312 // And try to extract TauConstant value from database
313 if (dev_prop[i].is_empty()==false) dev_prop[i] >> tauConstant;
315 // Try to initialize RealAxisProxies from class property
316 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
317 if (cl_prop.is_empty()==false) cl_prop >> realAxisProxies;
318 else {
319 // Try to initialize RealAxisProxies from default device value
320 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
321 if (def_prop.is_empty()==false) def_prop >> realAxisProxies;
323 // And try to extract RealAxisProxies value from database
324 if (dev_prop[i].is_empty()==false) dev_prop[i] >> realAxisProxies;
326 // Try to initialize LambdaAttributeProxy from class property
327 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
328 if (cl_prop.is_empty()==false) cl_prop >> lambdaAttributeProxy;
329 else {
330 // Try to initialize LambdaAttributeProxy from default device value
331 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
332 if (def_prop.is_empty()==false) def_prop >> lambdaAttributeProxy;
334 // And try to extract LambdaAttributeProxy value from database
335 if (dev_prop[i].is_empty()==false) dev_prop[i] >> lambdaAttributeProxy;
337 // Try to initialize DiffractometerType from class property
338 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
339 if (cl_prop.is_empty()==false) cl_prop >> diffractometerType;
340 else {
341 // Try to initialize DiffractometerType from default device value
342 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
343 if (def_prop.is_empty()==false) def_prop >> diffractometerType;
345 // And try to extract DiffractometerType value from database
346 if (dev_prop[i].is_empty()==false) dev_prop[i] >> diffractometerType;
348 // Try to initialize ProtectReflectionAxes from class property
349 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
350 if (cl_prop.is_empty()==false) cl_prop >> protectReflectionAxes;
351 else {
352 // Try to initialize ProtectReflectionAxes from default device value
353 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
354 if (def_prop.is_empty()==false) def_prop >> protectReflectionAxes;
356 // And try to extract ProtectReflectionAxes value from database
357 if (dev_prop[i].is_empty()==false) dev_prop[i] >> protectReflectionAxes;
361 // End of Automatic code generation
362 //------------------------------------------------------------------
365 //+----------------------------------------------------------------------------
367 // method : Diffractometer::always_executed_hook()
369 // description : method always executed before any command is executed
371 //-----------------------------------------------------------------------------
372 void Diffractometer::always_executed_hook()
374 if (_hklAdapter)
375 _hklAdapter->connect_all_proxies();
377 //+----------------------------------------------------------------------------
379 // method : Diffractometer::read_attr_hardware
381 // description : Hardware acquisition for attributes.
383 //-----------------------------------------------------------------------------
384 void Diffractometer::read_attr_hardware(vector<long> &attr_list)
386 DEBUG_STREAM << "Diffractometer::read_attr_hardware(vector<long> &attr_list) entering... "<< endl;
387 // Add your own code here
388 if (!_hklAdapter)
389 return;
391 _hklAdapter->update();
392 _hklAdapter->get_diffractometer_config(_config);
393 _hklAdapter->get_sample_lattices(attr_A_read, attr_B_read, attr_C_read,
394 attr_Alpha_read, attr_Beta_read, attr_Gamma_read,
395 attr_AStar_read, attr_BStar_read, attr_CStar_read,
396 attr_AlphaStar_read, attr_BetaStar_read, attr_GammaStar_read);
397 _hklAdapter->get_sample_fit(attr_AFit_read, attr_BFit_read, attr_CFit_read,
398 attr_AlphaFit_read, attr_BetaFit_read, attr_GammaFit_read,
399 attr_UxFit_read, attr_UyFit_read, attr_UzFit_read);
401 //+----------------------------------------------------------------------------
403 // method : Diffractometer::read_AutoUpdateFromProxies
405 // description : Extract real attribute values for AutoUpdateFromProxies acquisition result.
407 //-----------------------------------------------------------------------------
408 void Diffractometer::read_AutoUpdateFromProxies(Tango::Attribute &attr)
410 DEBUG_STREAM << "Diffractometer::read_AutoUpdateFromProxies(Tango::Attribute &attr) entering... "<< endl;
412 if(_hklAdapter)
413 *attr_AutoUpdateFromProxies_read = _hklAdapter->get_auto_update_from_proxies();
414 attr.set_value(attr_AutoUpdateFromProxies_read);
417 //+----------------------------------------------------------------------------
419 // method : Diffractometer::write_AutoUpdateFromProxies
421 // description : Write AutoUpdateFromProxies attribute values to hardware.
423 //-----------------------------------------------------------------------------
424 void Diffractometer::write_AutoUpdateFromProxies(Tango::WAttribute &attr)
426 DEBUG_STREAM << "Diffractometer::write_AutoUpdateFromProxies(Tango::WAttribute &attr) entering... "<< endl;
428 attr.get_write_value(attr_AutoUpdateFromProxies_write);
430 if (_hklAdapter)
431 _hklAdapter->set_auto_update_from_proxies(attr_AutoUpdateFromProxies_write);
434 //+----------------------------------------------------------------------------
436 // method : Diffractometer::read_AFit
438 // description : Extract real attribute values for AFit acquisition result.
440 //-----------------------------------------------------------------------------
441 void Diffractometer::read_AFit(Tango::Attribute &attr)
443 DEBUG_STREAM << "Diffractometer::read_AFit(Tango::Attribute &attr) entering... "<< endl;
444 attr.set_value(attr_AFit_read);
447 //+----------------------------------------------------------------------------
449 // method : Diffractometer::write_AFit
451 // description : Write AFit attribute values to hardware.
453 //-----------------------------------------------------------------------------
454 void Diffractometer::write_AFit(Tango::WAttribute &attr)
456 DEBUG_STREAM << "Diffractometer::write_AFit(Tango::WAttribute &attr) entering... "<< endl;
457 bool fit;
459 attr.get_write_value(fit);
460 if (_hklAdapter){
461 _hklAdapter->set_sample_AFit(fit);
462 this->save();
463 attr_AFit_write = fit;
467 //+----------------------------------------------------------------------------
469 // method : Diffractometer::read_BFit
471 // description : Extract real attribute values for BFit acquisition result.
473 //-----------------------------------------------------------------------------
474 void Diffractometer::read_BFit(Tango::Attribute &attr)
476 DEBUG_STREAM << "Diffractometer::read_BFit(Tango::Attribute &attr) entering... "<< endl;
477 attr.set_value(attr_BFit_read);
480 //+----------------------------------------------------------------------------
482 // method : Diffractometer::write_BFit
484 // description : Write BFit attribute values to hardware.
486 //-----------------------------------------------------------------------------
487 void Diffractometer::write_BFit(Tango::WAttribute &attr)
489 DEBUG_STREAM << "Diffractometer::write_BFit(Tango::WAttribute &attr) entering... "<< endl;
490 bool fit;
492 attr.get_write_value(fit);
493 if (_hklAdapter){
494 _hklAdapter->set_sample_BFit(fit);
495 this->save();
496 attr_BFit_write = fit;
500 //+----------------------------------------------------------------------------
502 // method : Diffractometer::read_CFit
504 // description : Extract real attribute values for CFit acquisition result.
506 //-----------------------------------------------------------------------------
507 void Diffractometer::read_CFit(Tango::Attribute &attr)
509 DEBUG_STREAM << "Diffractometer::read_CFit(Tango::Attribute &attr) entering... "<< endl;
510 attr.set_value(attr_CFit_read);
513 //+----------------------------------------------------------------------------
515 // method : Diffractometer::write_CFit
517 // description : Write CFit attribute values to hardware.
519 //-----------------------------------------------------------------------------
520 void Diffractometer::write_CFit(Tango::WAttribute &attr)
522 DEBUG_STREAM << "Diffractometer::write_CFit(Tango::WAttribute &attr) entering... "<< endl;
523 bool fit;
525 attr.get_write_value(fit);
526 if (_hklAdapter){
527 _hklAdapter->set_sample_CFit(fit);
528 this->save();
529 attr_CFit_write = fit;
533 //+----------------------------------------------------------------------------
535 // method : Diffractometer::read_AlphaFit
537 // description : Extract real attribute values for AlphaFit acquisition result.
539 //-----------------------------------------------------------------------------
540 void Diffractometer::read_AlphaFit(Tango::Attribute &attr)
542 DEBUG_STREAM << "Diffractometer::read_AlphaFit(Tango::Attribute &attr) entering... "<< endl;
543 attr.set_value(attr_AlphaFit_read);
546 //+----------------------------------------------------------------------------
548 // method : Diffractometer::write_AlphaFit
550 // description : Write AlphaFit attribute values to hardware.
552 //-----------------------------------------------------------------------------
553 void Diffractometer::write_AlphaFit(Tango::WAttribute &attr)
555 DEBUG_STREAM << "Diffractometer::write_AlphaFit(Tango::WAttribute &attr) entering... "<< endl;
556 bool fit;
558 attr.get_write_value(fit);
559 if (_hklAdapter){
560 _hklAdapter->set_sample_AlphaFit(fit);
561 this->save();
562 attr_AlphaFit_write = fit;
566 //+----------------------------------------------------------------------------
568 // method : Diffractometer::read_BetaFit
570 // description : Extract real attribute values for BetaFit acquisition result.
572 //-----------------------------------------------------------------------------
573 void Diffractometer::read_BetaFit(Tango::Attribute &attr)
575 DEBUG_STREAM << "Diffractometer::read_BetaFit(Tango::Attribute &attr) entering... "<< endl;
576 attr.set_value(attr_BetaFit_read);
579 //+----------------------------------------------------------------------------
581 // method : Diffractometer::write_BetaFit
583 // description : Write BetaFit attribute values to hardware.
585 //-----------------------------------------------------------------------------
586 void Diffractometer::write_BetaFit(Tango::WAttribute &attr)
588 DEBUG_STREAM << "Diffractometer::write_BetaFit(Tango::WAttribute &attr) entering... "<< endl;
589 bool fit;
591 attr.get_write_value(fit);
592 if (_hklAdapter){
593 _hklAdapter->set_sample_BetaFit(fit);
594 this->save();
595 attr_BetaFit_write = fit;
599 //+----------------------------------------------------------------------------
601 // method : Diffractometer::read_GammaFit
603 // description : Extract real attribute values for GammaFit acquisition result.
605 //-----------------------------------------------------------------------------
606 void Diffractometer::read_GammaFit(Tango::Attribute &attr)
608 DEBUG_STREAM << "Diffractometer::read_GammaFit(Tango::Attribute &attr) entering... "<< endl;
609 attr.set_value(attr_GammaFit_read);
612 //+----------------------------------------------------------------------------
614 // method : Diffractometer::write_GammaFit
616 // description : Write GammaFit attribute values to hardware.
618 //-----------------------------------------------------------------------------
619 void Diffractometer::write_GammaFit(Tango::WAttribute &attr)
621 DEBUG_STREAM << "Diffractometer::write_GammaFit(Tango::WAttribute &attr) entering... "<< endl;
622 bool fit;
624 attr.get_write_value(fit);
625 if (_hklAdapter){
626 _hklAdapter->set_sample_GammaFit(fit);
627 this->save();
628 attr_GammaFit_write = fit;
632 //+----------------------------------------------------------------------------
634 // method : Diffractometer::read_UxFit
636 // description : Extract real attribute values for UxFit acquisition result.
638 //-----------------------------------------------------------------------------
639 void Diffractometer::read_UxFit(Tango::Attribute &attr)
641 DEBUG_STREAM << "Diffractometer::read_UxFit(Tango::Attribute &attr) entering... "<< endl;
642 attr.set_value(attr_UxFit_read);
645 //+----------------------------------------------------------------------------
647 // method : Diffractometer::write_UxFit
649 // description : Write UxFit attribute values to hardware.
651 //-----------------------------------------------------------------------------
652 void Diffractometer::write_UxFit(Tango::WAttribute &attr)
654 DEBUG_STREAM << "Diffractometer::write_UxFit(Tango::WAttribute &attr) entering... "<< endl;
655 bool fit;
657 attr.get_write_value(fit);
658 if (_hklAdapter){
659 _hklAdapter->set_sample_UxFit(fit);
660 this->save();
661 attr_UxFit_write = fit;
665 //+----------------------------------------------------------------------------
667 // method : Diffractometer::read_UyFit
669 // description : Extract real attribute values for UyFit acquisition result.
671 //-----------------------------------------------------------------------------
672 void Diffractometer::read_UyFit(Tango::Attribute &attr)
674 DEBUG_STREAM << "Diffractometer::read_UyFit(Tango::Attribute &attr) entering... "<< endl;
675 attr.set_value(attr_UyFit_read);
678 //+----------------------------------------------------------------------------
680 // method : Diffractometer::write_UyFit
682 // description : Write UyFit attribute values to hardware.
684 //-----------------------------------------------------------------------------
685 void Diffractometer::write_UyFit(Tango::WAttribute &attr)
687 DEBUG_STREAM << "Diffractometer::write_UyFit(Tango::WAttribute &attr) entering... "<< endl;
688 bool fit;
690 attr.get_write_value(fit);
691 if (_hklAdapter){
692 _hklAdapter->set_sample_UyFit(fit);
693 this->save();
694 attr_UyFit_write = fit;
698 //+----------------------------------------------------------------------------
700 // method : Diffractometer::read_UzFit
702 // description : Extract real attribute values for UzFit acquisition result.
704 //-----------------------------------------------------------------------------
705 void Diffractometer::read_UzFit(Tango::Attribute &attr)
707 DEBUG_STREAM << "Diffractometer::read_UzFit(Tango::Attribute &attr) entering... "<< endl;
708 attr.set_value(attr_UzFit_read);
711 //+----------------------------------------------------------------------------
713 // method : Diffractometer::write_UzFit
715 // description : Write UzFit attribute values to hardware.
717 //-----------------------------------------------------------------------------
718 void Diffractometer::write_UzFit(Tango::WAttribute &attr)
720 DEBUG_STREAM << "Diffractometer::write_UzFit(Tango::WAttribute &attr) entering... "<< endl;
721 bool fit;
723 attr.get_write_value(fit);
724 if (_hklAdapter){
725 _hklAdapter->set_sample_UzFit(fit);
726 this->save();
727 attr_UzFit_write = fit;
731 //+----------------------------------------------------------------------------
733 // method : Diffractometer::read_pseudoAxesProxies
735 // description : Extract real attribute values for pseudoAxesProxies acquisition result.
737 //-----------------------------------------------------------------------------
738 void Diffractometer::read_pseudoAxesProxies(Tango::Attribute &attr)
740 DEBUG_STREAM << "Diffractometer::read_pseudoAxesProxies(Tango::Attribute &attr) entering... "<< endl;
741 if(_hklAdapter){
742 Matrix<char *> const & img = _hklAdapter->get_pseudo_axes_proxies();
743 attr.set_value(img.data, img.xdim);
747 //+----------------------------------------------------------------------------
749 // method : Diffractometer::read_AnglesIdx
751 // description : Extract real attribute values for AnglesIdx acquisition result.
753 //-----------------------------------------------------------------------------
754 void Diffractometer::read_AnglesIdx(Tango::Attribute &attr)
756 DEBUG_STREAM << "Diffractometer::read_AnglesIdx(Tango::Attribute &attr) entering... "<< endl;
758 if(_hklAdapter){
759 *attr_AnglesIdx_read = _hklAdapter->get_angles_idx();
760 attr.set_value(attr_AnglesIdx_read);
764 //+----------------------------------------------------------------------------
766 // method : Diffractometer::write_AnglesIdx
768 // description : Write AnglesIdx attribute values to hardware.
770 //-----------------------------------------------------------------------------
771 void Diffractometer::write_AnglesIdx(Tango::WAttribute &attr)
773 DEBUG_STREAM << "Diffractometer::write_AnglesIdx(Tango::WAttribute &attr) entering... "<< endl;
775 attr.get_write_value(attr_AnglesIdx_write);
776 if(_hklAdapter)
777 _hklAdapter->set_angles_idx(attr_AnglesIdx_write);
780 //+----------------------------------------------------------------------------
782 // method : Diffractometer::read_AxesNames
784 // description : Extract real attribute values for AxesNames acquisition result.
786 //-----------------------------------------------------------------------------
787 void Diffractometer::read_AxesNames(Tango::Attribute &attr)
789 if(_hklAdapter){
790 Matrix<char *> const & img = _hklAdapter->get_dynamic_attribute_axes_names();
791 attr.set_value(img.data, img.xdim);
795 //+----------------------------------------------------------------------------
797 // method : Diffractometer::read_Angles
799 // description : Extract real attribute values for Angles acquisition result.
801 //-----------------------------------------------------------------------------
802 void Diffractometer::read_Angles(Tango::Attribute &attr)
804 DEBUG_STREAM << "Diffractometer::read_Angles(Tango::Attribute &attr) entering... "<< endl;
805 if(_hklAdapter){
806 Matrix<double> const & img = _hklAdapter->get_angles();
807 attr.set_value(img.data, img.xdim, img.ydim);
811 //+----------------------------------------------------------------------------
813 // method : Diffractometer::read_AnglesDegenerated
815 // description : Extract real attribute values for AnglesDegenerated acquisition result.
817 //-----------------------------------------------------------------------------
818 void Diffractometer::read_AnglesDegenerated(Tango::Attribute &attr)
820 DEBUG_STREAM << "Diffractometer::read_AnglesDegenerated(Tango::Attribute &attr) entering... "<< endl;
823 //+----------------------------------------------------------------------------
825 // method : Diffractometer::read_AnglesRangeCheck
827 // description : Extract real attribute values for AnglesRangeCheck acquisition result.
829 //-----------------------------------------------------------------------------
830 void Diffractometer::read_AnglesRangeCheck(Tango::Attribute &attr)
832 DEBUG_STREAM << "Diffractometer::read_AnglesRangeCheck(Tango::Attribute &attr) entering... "<< endl;
835 //+----------------------------------------------------------------------------
837 // method : Diffractometer::read_Reflections
839 // description : Extract real attribute values for Reflections acquisition result.
841 //-----------------------------------------------------------------------------
842 void Diffractometer::read_Reflections(Tango::Attribute &attr)
844 DEBUG_STREAM << "Diffractometer::read_Reflections(Tango::Attribute &attr) entering... "<< endl;
845 if(_hklAdapter){
846 Matrix<double> const & img = _hklAdapter->get_reflections();
847 attr.set_value(img.data, img.xdim, img.ydim);
851 //+----------------------------------------------------------------------------
853 // method : Diffractometer::write_Reflections
855 // description : Write Reflections attribute values to hardware.
857 //-----------------------------------------------------------------------------
858 void Diffractometer::write_Reflections(Tango::WAttribute &attr)
860 DEBUG_STREAM << "Diffractometer::write_Reflections(Tango::WAttribute &attr) entering... "<< endl;
862 const Tango::DevDouble *value;
863 attr.get_write_value(value);
865 Matrix<double> img;
866 img.attach_to_const_buffer(value,
867 attr.get_w_dim_x(), attr.get_w_dim_y());
869 if(_hklAdapter)
870 _hklAdapter->set_reflections(img);
873 //+----------------------------------------------------------------------------
875 // method : Diffractometer::read_ReflectionsAngles
877 // description : Extract real attribute values for ReflectionsAngles acquisition result.
879 //-----------------------------------------------------------------------------
880 void Diffractometer::read_ReflectionsAngles(Tango::Attribute &attr)
882 DEBUG_STREAM << "Diffractometer::read_ReflectionsAngles(Tango::Attribute &attr) entering... "<< endl;
884 if (_hklAdapter){
885 Matrix<double> const & img = _hklAdapter->get_reflections_angles();
886 attr.set_value(img.data, img.xdim, img.ydim);
890 //+----------------------------------------------------------------------------
892 // method : Diffractometer::read_AStar
894 // description : Extract real attribute values for AStar acquisition result.
896 //-----------------------------------------------------------------------------
897 void Diffractometer::read_AStar(Tango::Attribute &attr)
899 DEBUG_STREAM << "Diffractometer::read_AStar(Tango::Attribute &attr) entering... "<< endl;
900 attr.set_value(attr_AStar_read);
903 //+----------------------------------------------------------------------------
905 // method : Diffractometer::read_BStar
907 // description : Extract real attribute values for BStar acquisition result.
909 //-----------------------------------------------------------------------------
910 void Diffractometer::read_BStar(Tango::Attribute &attr)
912 DEBUG_STREAM << "Diffractometer::read_BStar(Tango::Attribute &attr) entering... "<< endl;
913 attr.set_value(attr_BStar_read);
916 //+----------------------------------------------------------------------------
918 // method : Diffractometer::read_CStar
920 // description : Extract real attribute values for CStar acquisition result.
922 //-----------------------------------------------------------------------------
923 void Diffractometer::read_CStar(Tango::Attribute &attr)
925 DEBUG_STREAM << "Diffractometer::read_CStar(Tango::Attribute &attr) entering... "<< endl;
926 attr.set_value(attr_CStar_read);
929 //+----------------------------------------------------------------------------
931 // method : Diffractometer::read_AlphaStar
933 // description : Extract real attribute values for AlphaStar acquisition result.
935 //-----------------------------------------------------------------------------
936 void Diffractometer::read_AlphaStar(Tango::Attribute &attr)
938 DEBUG_STREAM << "Diffractometer::read_AlphaStar(Tango::Attribute &attr) entering... "<< endl;
939 attr.set_value(attr_AlphaStar_read);
942 //+----------------------------------------------------------------------------
944 // method : Diffractometer::read_BetaStar
946 // description : Extract real attribute values for BetaStar acquisition result.
948 //-----------------------------------------------------------------------------
949 void Diffractometer::read_BetaStar(Tango::Attribute &attr)
951 DEBUG_STREAM << "Diffractometer::read_BetaStar(Tango::Attribute &attr) entering... "<< endl;
952 attr.set_value(attr_BetaStar_read);
955 //+----------------------------------------------------------------------------
957 // method : Diffractometer::read_GammaStar
959 // description : Extract real attribute values for GammaStar acquisition result.
961 //-----------------------------------------------------------------------------
962 void Diffractometer::read_GammaStar(Tango::Attribute &attr)
964 DEBUG_STREAM << "Diffractometer::read_GammaStar(Tango::Attribute &attr) entering... "<< endl;
965 attr.set_value(attr_GammaStar_read);
968 //+----------------------------------------------------------------------------
970 // method : Diffractometer::read_A
972 // description : Extract real attribute values for A acquisition result.
974 //-----------------------------------------------------------------------------
975 void Diffractometer::read_A(Tango::Attribute &attr)
977 DEBUG_STREAM << "Diffractometer::read_A(Tango::Attribute &attr) entering... "<< endl;
978 attr.set_value(attr_A_read);
981 //+----------------------------------------------------------------------------
983 // method : Diffractometer::read_B
985 // description : Extract real attribute values for B acquisition result.
987 //-----------------------------------------------------------------------------
988 void Diffractometer::read_B(Tango::Attribute &attr)
990 DEBUG_STREAM << "Diffractometer::read_B(Tango::Attribute &attr) entering... "<< endl;
991 attr.set_value(attr_B_read);
994 //+----------------------------------------------------------------------------
996 // method : Diffractometer::read_C
998 // description : Extract real attribute values for C acquisition result.
1000 //-----------------------------------------------------------------------------
1001 void Diffractometer::read_C(Tango::Attribute &attr)
1003 DEBUG_STREAM << "Diffractometer::read_C(Tango::Attribute &attr) entering... "<< endl;
1004 attr.set_value(attr_C_read);
1007 //+----------------------------------------------------------------------------
1009 // method : Diffractometer::read_Alpha
1011 // description : Extract real attribute values for Alpha acquisition result.
1013 //-----------------------------------------------------------------------------
1014 void Diffractometer::read_Alpha(Tango::Attribute &attr)
1016 DEBUG_STREAM << "Diffractometer::read_Alpha(Tango::Attribute &attr) entering... "<< endl;
1017 attr.set_value(attr_Alpha_read);
1020 //+----------------------------------------------------------------------------
1022 // method : Diffractometer::read_Beta
1024 // description : Extract real attribute values for Beta acquisition result.
1026 //-----------------------------------------------------------------------------
1027 void Diffractometer::read_Beta(Tango::Attribute &attr)
1029 DEBUG_STREAM << "Diffractometer::read_Beta(Tango::Attribute &attr) entering... "<< endl;
1030 attr.set_value(attr_Beta_read);
1033 //+----------------------------------------------------------------------------
1035 // method : Diffractometer::read_Gamma
1037 // description : Extract real attribute values for Gamma acquisition result.
1039 //-----------------------------------------------------------------------------
1040 void Diffractometer::read_Gamma(Tango::Attribute &attr)
1042 DEBUG_STREAM << "Diffractometer::read_Gamma(Tango::Attribute &attr) entering... "<< endl;
1043 attr.set_value(attr_Gamma_read);
1046 //+----------------------------------------------------------------------------
1048 // method : Diffractometer::read_UB
1050 // description : Extract real attribute values for UB acquisition result.
1052 //-----------------------------------------------------------------------------
1053 void Diffractometer::read_UB(Tango::Attribute &attr)
1055 DEBUG_STREAM << "Diffractometer::read_UB(Tango::Attribute &attr) entering... "<< endl;
1057 if(_hklAdapter){
1058 Matrix<double> const & img = _hklAdapter->get_sample_ub();
1059 attr.set_value(img.data, img.xdim, img.ydim);
1063 //+----------------------------------------------------------------------------
1065 // method : Diffractometer::read_Ux
1067 // description : Extract real attribute values for Ux acquisition result.
1069 //-----------------------------------------------------------------------------
1070 void Diffractometer::read_Ux(Tango::Attribute &attr)
1072 DEBUG_STREAM << "Diffractometer::read_Ux(Tango::Attribute &attr) entering... "<< endl;
1074 if(_hklAdapter)
1075 attr.set_value(&_hklAdapter->get_sample_Ux());
1078 //+----------------------------------------------------------------------------
1080 // method : Diffractometer::write_Ux
1082 // description : Write Ux attribute values to hardware.
1084 //-----------------------------------------------------------------------------
1085 void Diffractometer::write_Ux(Tango::WAttribute &attr)
1087 DEBUG_STREAM << "Diffractometer::write_Ux(Tango::WAttribute &attr) entering... "<< endl;
1088 double Ux;
1090 attr.get_write_value(Ux);
1091 if (_hklAdapter){
1092 _hklAdapter->set_sample_Ux(Ux);
1093 attr_Ux_write = Ux;
1097 //+----------------------------------------------------------------------------
1099 // method : Diffractometer::read_Uy
1101 // description : Extract real attribute values for Uy acquisition result.
1103 //-----------------------------------------------------------------------------
1104 void Diffractometer::read_Uy(Tango::Attribute &attr)
1106 DEBUG_STREAM << "Diffractometer::read_Uy(Tango::Attribute &attr) entering... "<< endl;
1107 if(_hklAdapter)
1108 attr.set_value(&_hklAdapter->get_sample_Uy());
1111 //+----------------------------------------------------------------------------
1113 // method : Diffractometer::write_Uy
1115 // description : Write Uy attribute values to hardware.
1117 //-----------------------------------------------------------------------------
1118 void Diffractometer::write_Uy(Tango::WAttribute &attr)
1120 DEBUG_STREAM << "Diffractometer::write_Uy(Tango::WAttribute &attr) entering... "<< endl;
1121 double Uy;
1123 attr.get_write_value(Uy);
1124 if (_hklAdapter){
1125 _hklAdapter->set_sample_Uy(Uy);
1126 attr_Uy_write = Uy;
1130 //+----------------------------------------------------------------------------
1132 // method : Diffractometer::read_Uz
1134 // description : Extract real attribute values for Uz acquisition result.
1136 //-----------------------------------------------------------------------------
1137 void Diffractometer::read_Uz(Tango::Attribute &attr)
1139 DEBUG_STREAM << "Diffractometer::read_Uz(Tango::Attribute &attr) entering... "<< endl;
1140 if(_hklAdapter)
1141 attr.set_value(&_hklAdapter->get_sample_Uz());
1144 //+----------------------------------------------------------------------------
1146 // method : Diffractometer::write_Uz
1148 // description : Write Uz attribute values to hardware.
1150 //-----------------------------------------------------------------------------
1151 void Diffractometer::write_Uz(Tango::WAttribute &attr)
1153 DEBUG_STREAM << "Diffractometer::write_Uz(Tango::WAttribute &attr) entering... "<< endl;
1154 double Uz;
1156 attr.get_write_value(Uz);
1157 if (_hklAdapter){
1158 _hklAdapter->set_sample_Uz(Uz);
1159 attr_Uz_write = Uz;
1164 //+----------------------------------------------------------------------------
1166 // method : Diffractometer::read_Simulated
1168 // description : Extract real attribute values for Simulated acquisition result.
1170 //-----------------------------------------------------------------------------
1171 void Diffractometer::read_Simulated(Tango::Attribute &attr)
1173 DEBUG_STREAM << "Diffractometer::read_Simulated(Tango::Attribute &attr) entering... "<< endl;
1175 if(_hklAdapter)
1176 *attr_Simulated_read = !_hklAdapter->get_auto_update_from_proxies();
1177 attr.set_value(attr_Simulated_read);
1180 //+----------------------------------------------------------------------------
1182 // method : Diffractometer::write_Simulated
1184 // description : Write Simulated attribute values to hardware.
1186 //-----------------------------------------------------------------------------
1187 void Diffractometer::write_Simulated(Tango::WAttribute &attr)
1189 DEBUG_STREAM << "Diffractometer::write_Simulated(Tango::WAttribute &attr) entering... "<< endl;
1190 attr.get_write_value(attr_Simulated_write);
1192 if (_hklAdapter)
1193 _hklAdapter->set_auto_update_from_proxies(!attr_Simulated_write);
1196 //+----------------------------------------------------------------------------
1198 // method : Diffractometer::read_Crystal
1200 // description : Extract real attribute values for Crystal acquisition result.
1202 //-----------------------------------------------------------------------------
1203 void Diffractometer::read_Crystal(Tango::Attribute &attr)
1205 DEBUG_STREAM << "Diffractometer::read_Crystal(Tango::Attribute &attr) entering... "<< endl;
1207 if(*attr_Crystal_read) delete [] *attr_Crystal_read;
1209 if (_hklAdapter)
1210 *attr_Crystal_read = CORBA::string_dup(_hklAdapter->get_sample_name());
1211 else
1212 *attr_Crystal_read = CORBA::string_dup("");
1213 attr.set_value(attr_Crystal_read);
1216 //+----------------------------------------------------------------------------
1218 // method : Diffractometer::write_Crystal
1220 // description : Write Crystal attribute values to hardware.
1222 //-----------------------------------------------------------------------------
1223 void Diffractometer::write_Crystal(Tango::WAttribute &attr)
1225 DEBUG_STREAM << "Diffractometer::write_Crystal(Tango::WAttribute &attr) entering... "<< endl;
1227 attr.get_write_value(attr_Crystal_write);
1228 if(_hklAdapter)
1229 _hklAdapter->set_current_sample(attr_Crystal_write);
1232 //+----------------------------------------------------------------------------
1234 // method : Diffractometer::read_WaveLength
1236 // description : Extract real attribute values for WaveLength acquisition result.
1238 //-----------------------------------------------------------------------------
1239 void Diffractometer::read_WaveLength(Tango::Attribute &attr)
1241 DEBUG_STREAM << "Diffractometer::read_WaveLength(Tango::Attribute &attr) entering... "<< endl;
1243 if(_hklAdapter)
1244 attr.set_value(&_hklAdapter->get_lambda());
1247 //+----------------------------------------------------------------------------
1249 // method : Diffractometer::write_WaveLength
1251 // description : Write WaveLength attribute values to hardware.
1253 //-----------------------------------------------------------------------------
1254 void Diffractometer::write_WaveLength(Tango::WAttribute &attr)
1256 DEBUG_STREAM << "Diffractometer::write_WaveLength(Tango::WAttribute &attr) entering... "<< endl;
1258 attr.get_write_value(attr_WaveLength_write);
1260 if (_hklAdapter) {
1261 _hklAdapter->set_lambda(attr_WaveLength_write);
1262 if (!_hklAdapter->get_auto_update_from_proxies())
1263 *attr_WaveLength_read = attr_WaveLength_write;
1267 //+----------------------------------------------------------------------------
1269 // method : Diffractometer::read_CrystalNames
1271 // description : Extract real attribute values for CrystalNames acquisition result.
1273 //-----------------------------------------------------------------------------
1274 void Diffractometer::read_CrystalNames(Tango::Attribute &attr)
1276 DEBUG_STREAM << "Diffractometer::read_CrystalNames(Tango::Attribute &attr) entering... "<< endl;
1278 std::vector<std::string> names;
1280 if (_hklAdapter)
1281 names = _hklAdapter->get_samples_names();
1283 _crystal_names_dev_varstring_array << names;
1284 attr.set_value(_crystal_names_dev_varstring_array.get_buffer(),
1285 _crystal_names_dev_varstring_array.length());
1288 //+------------------------------------------------------------------
1290 * method: Diffractometer::abort
1292 * description: method to execute "Abort"
1293 * Stops the movement of all axis driven by the Diffractometer
1297 //+------------------------------------------------------------------
1298 void Diffractometer::abort()
1300 DEBUG_STREAM << "Diffractometer::abort(): entering... !" << endl;
1302 // Add your own code to control device here
1305 _hklAdapter->stop_all_axis();
1307 catch (Tango::DevFailed& e )
1309 ERROR_STREAM << e ;
1313 //+------------------------------------------------------------------
1315 * method: Diffractometer::add_new_crystal
1317 * description: method to execute "AddNewCrystal"
1318 * Create a new crystal
1320 * @param argin Name of the new crystal
1323 //+------------------------------------------------------------------
1324 void Diffractometer::add_new_crystal(Tango::DevString argin)
1326 DEBUG_STREAM << "Diffractometer::add_new_crystal(): entering... !" << endl;
1328 // Add your own code to control device here
1330 /* POGO rename SampleNew */
1332 if (_hklAdapter){
1333 _hklAdapter->add_new_sample(argin);
1334 this->save();
1338 //+------------------------------------------------------------------
1340 * method: Diffractometer::add_reflection
1342 * description: method to execute "AddReflection"
1343 * This commands requires the definition of 1 reflection defined by (h,k,l ) coordinates.
1344 * This coodinates are associated with the current angles configuration.
1346 * TODO: d�taill� le commentaire
1347 * reflections i.e : h, k, l, relevance, enable/disable
1349 * @param argin reflections i.e : h, k, l, relevance, enable/disable
1352 //+------------------------------------------------------------------
1353 void Diffractometer::add_reflection(const Tango::DevVarDoubleArray *argin)
1355 DEBUG_STREAM << "Diffractometer::add_reflection(): entering... !" << endl;
1357 // Add your own code to control device here
1359 /* POGO rename SampleReflectionAdd */
1360 if (_hklAdapter){
1361 _hklAdapter->add_reflection();
1362 this->save();
1366 //+------------------------------------------------------------------
1368 * method: Diffractometer::affine_crystal
1370 * description: method to execute "AffineCrystal"
1371 * Compute affinement for the current crystal with available list of reflection.
1373 * @param argin name of the crystal to fit
1374 * @return the fitness of the crystal after the affinement.
1377 //+------------------------------------------------------------------
1378 Tango::DevDouble Diffractometer::affine_crystal(Tango::DevString argin)
1380 Tango::DevDouble argout ;
1381 DEBUG_STREAM << "Diffractometer::affine_crystal(): entering... !" << endl;
1383 // Add your own code to control device here
1385 /* POGO rename SampleAffinement */
1387 if(_hklAdapter){
1388 argout = _hklAdapter->affine_sample(argin);
1389 this->refresh_crystal_parameters();
1390 this->save();
1393 return argout;
1396 //+------------------------------------------------------------------
1398 * method: Diffractometer::configure_crystal
1400 * description: method to execute "ConfigureCrystal"
1401 * Defines crystal lattice parameters.
1402 * This information is mandatory for angles calculations.
1403 * Angles units are degrees
1405 * @param argin Crystal parameters : alpha,beta,gamma, A,B,C
1408 //+------------------------------------------------------------------
1409 void Diffractometer::configure_crystal(const Tango::DevVarDoubleArray *argin)
1411 DEBUG_STREAM << "Diffractometer::configure_crystal(): entering... !" << endl;
1413 // Add your own code to control device here
1415 /* POGO rename SampleConfiguration */
1417 if(_hklAdapter){
1418 _hklAdapter->set_lattice(argin);
1419 this->refresh_crystal_parameters();
1420 this->save();
1424 //+------------------------------------------------------------------
1426 * method: Diffractometer::copy_current_crystal_as
1428 * description: method to execute "CopyCurrentCrystalAs"
1429 * Copy the current crytal as another name
1431 * @param argin
1434 //+------------------------------------------------------------------
1435 void Diffractometer::copy_current_crystal_as(Tango::DevString argin)
1437 DEBUG_STREAM << "Diffractometer::copy_current_crystal_as(): entering... !" << endl;
1439 // Add your own code to control device here
1441 /* POGO rename SampleCopy */
1443 if(_hklAdapter){
1444 _hklAdapter->copy_sample_as(argin);
1445 this->refresh_crystal_parameters();
1446 this->save();
1450 //+------------------------------------------------------------------
1452 * method: Diffractometer::delete_current_crystal
1454 * description: method to execute "DeleteCurrentCrystal"
1455 * Delete the current from this device
1459 //+------------------------------------------------------------------
1460 void Diffractometer::delete_current_crystal()
1462 DEBUG_STREAM << "Diffractometer::delete_current_crystal(): entering... !" << endl;
1464 // Add your own code to control device here
1466 /* POGO rename SampleDelete */
1468 if(_hklAdapter){
1469 _hklAdapter->del_sample();
1470 this->refresh_crystal_parameters();
1471 this->save();
1475 //+------------------------------------------------------------------
1477 * method: Diffractometer::load
1479 * description: method to execute "Load"
1480 * Load all crystals
1484 //+------------------------------------------------------------------
1485 void Diffractometer::load()
1487 DEBUG_STREAM << "Diffractometer::load(): entering... !" << endl;
1489 // Add your own code to control device here
1491 // POGO TO DELETE
1492 if(_hklAdapter)
1493 _hklAdapter->load();
1496 //+------------------------------------------------------------------
1498 * method: Diffractometer::remove_reflection
1500 * description: method to execute "RemoveReflection"
1501 * This commands removes reflection from the current cristal.
1503 * @param argin index of reflection to remove
1506 //+------------------------------------------------------------------
1507 void Diffractometer::remove_reflection(Tango::DevShort argin)
1509 DEBUG_STREAM << "Diffractometer::remove_reflection(): entering... !" << endl;
1511 // Add your own code to control device here
1513 /* POGO rename SampleReflectionDelete */
1514 if(_hklAdapter){
1515 _hklAdapter->del_reflection(argin);
1516 this->refresh_crystal_parameters();
1517 this->save();
1521 //+------------------------------------------------------------------
1523 * method: Diffractometer::save
1525 * description: method to execute "Save"
1526 * Save all crystals
1530 //+------------------------------------------------------------------
1531 void Diffractometer::save()
1533 DEBUG_STREAM << "Diffractometer::save(): entering... !" << endl;
1535 // Add your own code to control device here
1537 // POGO TO DELETE
1538 if(_hklAdapter)
1539 _hklAdapter->save();
1542 //+------------------------------------------------------------------
1544 * method: Diffractometer::set_crystal_parameter_values
1546 * description: method to execute "SetCrystalParameterValues"
1547 * Double : min value, max value, affinement enable
1549 * @param argin String : Name of parameter ; Double : min value, max value, affinement enable
1552 //+------------------------------------------------------------------
1553 void Diffractometer::set_crystal_parameter_values(const Tango::DevVarDoubleStringArray *argin)
1555 DEBUG_STREAM << "Diffractometer::set_crystal_parameter_values(): entering... !" << endl;
1557 // Add your own code to control device here
1559 // check Parameters
1560 if(_hklAdapter)
1561 _hklAdapter->set_sample_parameter_values(argin);
1564 //+------------------------------------------------------------------
1566 * method: Diffractometer::copy_reflection_to
1568 * description: method to execute "CopyReflectionTo"
1569 * Copy one reflection from the current crystal to another crystal
1571 * @param argin Double: Reflection number of the current crystal String : Name of the crystal where copy this reflection
1574 //+------------------------------------------------------------------
1575 void Diffractometer::copy_reflection_to(const Tango::DevVarDoubleStringArray *argin)
1577 DEBUG_STREAM << "Diffractometer::copy_reflection_to(): entering... !" << endl;
1579 // Add your own code to control device here
1581 /* POGO TO DELETE */
1584 //+------------------------------------------------------------------
1586 * method: Diffractometer::dev_state
1588 * description: method to execute "State"
1589 * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
1591 * @return State Code
1594 //+------------------------------------------------------------------
1595 Tango::DevState Diffractometer::dev_state()
1597 Tango::DevState argout;// = DeviceImpl::dev_state();
1598 DEBUG_STREAM << "Diffractometer::dev_state(): entering... !" << endl;
1600 // Add your own code to control device here
1602 argout = _config.state;
1603 this->set_state(argout);
1605 return argout;
1608 //+------------------------------------------------------------------
1610 * method: Diffractometer::get_crystal_parameter_values
1612 * description: method to execute "GetCrystalParameterValues"
1613 * Return all values of a parameter for the current crystal
1615 * @param argin Name of parameter (see getParametersNames for the complete list of parameters)
1616 * @return In the order : minimum value, maximum value, affinement enable
1619 //+------------------------------------------------------------------
1620 Tango::DevVarDoubleStringArray *Diffractometer::get_crystal_parameter_values(Tango::DevString argin)
1622 // POGO has generated a method core with argout allocation.
1623 // If you would like to use a static reference without copying,
1624 // See "TANGO Device Server Programmer's Manual"
1625 // (chapter : Writing a TANGO DS / Exchanging data)
1626 //------------------------------------------------------------
1627 Tango::DevVarDoubleStringArray *argout = new Tango::DevVarDoubleStringArray();
1628 argout->dvalue.length(3);
1629 argout->dvalue[0] = 0.0;
1630 argout->dvalue[1] = 0.0;
1631 argout->dvalue[2] = 0.0;
1632 argout->svalue.length(1);
1633 argout->svalue[0] = CORBA::string_dup(argin);
1634 DEBUG_STREAM << "Diffractometer::get_crystal_parameter_values(): entering... !" << endl;
1636 // Add your own code to control device here
1637 if(_hklAdapter)
1638 _hklAdapter->get_sample_parameter_values(argout);
1640 return argout;
1643 //+------------------------------------------------------------------
1645 * method: Diffractometer::compute_u
1647 * description: method to execute "ComputeU"
1648 * Compute Matrix U from two reflections
1650 * @param argin a two elements array with the index of reflection to use
1653 //+------------------------------------------------------------------
1654 void Diffractometer::compute_u(const Tango::DevVarLongArray *argin)
1656 DEBUG_STREAM << "Diffractometer::compute_u(): entering... !" << endl;
1658 // Add your own code to control device here
1659 if(_hklAdapter){
1660 _hklAdapter->compute_u(argin);
1661 this->save();
1665 //+------------------------------------------------------------------
1667 * method: Diffractometer::dev_status
1669 * description: method to execute "Status"
1670 * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
1672 * @return Status description
1675 //+------------------------------------------------------------------
1676 Tango::ConstDevString Diffractometer::dev_status()
1678 //Tango::ConstDevString argout = DeviceImpl::dev_status();
1679 DEBUG_STREAM << "Diffractometer::dev_status(): entering... !" << endl;
1681 // Add your own code to control device here
1682 this->set_status(_config.status);
1683 return _config.status.c_str();
1690 } // namespace