* prepare for the removal of the Simulated attribut.
[diffractometer.git] / src / Diffractometer / Diffractometer.cpp
blobb6e301fa4fe570d2918914c219e2c72e8c3e3fae
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_ReflectionsAngles_read) {
169 delete [] attr_ReflectionsAngles_read;
170 attr_ReflectionsAngles_read = NULL;
173 if(attr_Reflections_read){
174 delete[] attr_Reflections_read;
175 attr_Reflections_read = NULL;
178 this->remove_dynamic_attributes();
181 * Do not remove the diffractometer in the delete method
182 * of the Derived classes to avoid a segmentation fault
183 * during the save method call. Indeed the Derived class delete
184 * method is called before this delete method.
186 TangoHKLAdapterFactory::instance()->detach_diffractometer_device(this);
189 //+----------------------------------------------------------------------------
191 // method : Diffractometer::init_device()
193 // description : will be called at device initialization.
195 //-----------------------------------------------------------------------------
196 void Diffractometer::init_device()
198 INFO_STREAM << "Diffractometer::Diffractometer() create device " << device_name << endl;
200 // Initialise variables to default values
201 //--------------------------------------------
202 get_device_property();
204 CREATE_SCALAR_ATTRIBUTE(attr_AnglesIdx_read, (short)-1);
205 CREATE_SCALAR_ATTRIBUTE(attr_WaveLength_read, 0.0);
206 CREATE_SCALAR_ATTRIBUTE(attr_AutoUpdateFromProxies_read, false);
207 CREATE_SCALAR_ATTRIBUTE(attr_Simulated_read, true);
208 CREATE_SCALAR_ATTRIBUTE(attr_A_read, 0.0);
209 CREATE_SCALAR_ATTRIBUTE(attr_B_read, 0.0);
210 CREATE_SCALAR_ATTRIBUTE(attr_C_read, 0.0);
211 CREATE_SCALAR_ATTRIBUTE(attr_Alpha_read, 0.0);
212 CREATE_SCALAR_ATTRIBUTE(attr_Beta_read, 0.0);
213 CREATE_SCALAR_ATTRIBUTE(attr_Gamma_read, 0.0);
214 CREATE_SCALAR_ATTRIBUTE(attr_Ux_read, 0.0);
215 CREATE_SCALAR_ATTRIBUTE(attr_Uy_read, 0.0);
216 CREATE_SCALAR_ATTRIBUTE(attr_Uz_read, 0.0);
217 CREATE_SCALAR_ATTRIBUTE(attr_AStar_read);
218 CREATE_SCALAR_ATTRIBUTE(attr_BStar_read);
219 CREATE_SCALAR_ATTRIBUTE(attr_CStar_read);
220 CREATE_SCALAR_ATTRIBUTE(attr_AlphaStar_read);
221 CREATE_SCALAR_ATTRIBUTE(attr_BetaStar_read);
222 CREATE_SCALAR_ATTRIBUTE(attr_GammaStar_read);
223 CREATE_SCALAR_ATTRIBUTE(attr_AFit_read, false);
224 CREATE_SCALAR_ATTRIBUTE(attr_BFit_read, false);
225 CREATE_SCALAR_ATTRIBUTE(attr_CFit_read, false);
226 CREATE_SCALAR_ATTRIBUTE(attr_AlphaFit_read, false);
227 CREATE_SCALAR_ATTRIBUTE(attr_BetaFit_read, false);
228 CREATE_SCALAR_ATTRIBUTE(attr_GammaFit_read, false);
229 CREATE_SCALAR_ATTRIBUTE(attr_UxFit_read, false);
230 CREATE_SCALAR_ATTRIBUTE(attr_UyFit_read, false);
231 CREATE_SCALAR_ATTRIBUTE(attr_UzFit_read, false);
233 CREATE_DEVSTRING_ATTRIBUTE(attr_Crystal_read, 1, "");
235 attr_UB_read = NULL;
236 attr_ReflectionsAngles_read = NULL;
237 attr_Reflections_read = NULL;
238 attr_AxesNames_read = NULL;
240 // Device is in FAULT state because it was not yet configured.
241 this->set_state(Tango::FAULT);
242 this->set_status("Configure Diffractometer: crystal, wavelength,etc ..");
244 _type = this->get_type_from_property(diffractometerType);
247 * this method must be call after get_device_property() as
248 * TangoHKLAdapter create the axisbuffer from the
249 * realAxisProxies.
251 _hklAdapter = TangoHKLAdapterFactory::instance()->attach_diffractometer_device(this, _type);
252 if (!_hklAdapter) {
253 this->set_state(Tango::FAULT);
254 this->set_status("Fatal can not initialize the hkl library");
255 TANGO_EXCEPTION_THROW("Internal Fatal Error", "Device can't get an instance of TangoHKLAdapter");
256 } else {
257 // Restore the Diffractometer state from the last run.
258 this->load();
260 _hklAdapter->connect_all_proxies();
262 // create an start all the PseudoAxes devices.
263 _hklAdapter->pseudo_axes_create_and_start_devices();
268 //+----------------------------------------------------------------------------
270 // method : Diffractometer::get_device_property()
272 // description : Read the device properties from database.
274 //-----------------------------------------------------------------------------
275 void Diffractometer::get_device_property()
277 // Initialize your default values here (if not done with POGO).
278 //------------------------------------------------------------------
280 // Read device properties from database.(Automatic code generation)
281 //------------------------------------------------------------------
282 Tango::DbData dev_prop;
283 dev_prop.push_back(Tango::DbDatum("TauConstant"));
284 dev_prop.push_back(Tango::DbDatum("RealAxisProxies"));
285 dev_prop.push_back(Tango::DbDatum("LambdaAttributeProxy"));
286 dev_prop.push_back(Tango::DbDatum("DiffractometerType"));
288 // Call database and extract values
289 //--------------------------------------------
290 if (Tango::Util::instance()->_UseDb==true)
291 get_db_device()->get_property(dev_prop);
292 Tango::DbDatum def_prop, cl_prop;
293 DiffractometerClass *ds_class =
294 (static_cast<DiffractometerClass *>(get_device_class()));
295 int i = -1;
297 // Try to initialize TauConstant from class property
298 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
299 if (cl_prop.is_empty()==false) cl_prop >> tauConstant;
300 else {
301 // Try to initialize TauConstant from default device value
302 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
303 if (def_prop.is_empty()==false) def_prop >> tauConstant;
305 // And try to extract TauConstant value from database
306 if (dev_prop[i].is_empty()==false) dev_prop[i] >> tauConstant;
308 // Try to initialize RealAxisProxies from class property
309 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
310 if (cl_prop.is_empty()==false) cl_prop >> realAxisProxies;
311 else {
312 // Try to initialize RealAxisProxies from default device value
313 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
314 if (def_prop.is_empty()==false) def_prop >> realAxisProxies;
316 // And try to extract RealAxisProxies value from database
317 if (dev_prop[i].is_empty()==false) dev_prop[i] >> realAxisProxies;
319 // Try to initialize LambdaAttributeProxy from class property
320 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
321 if (cl_prop.is_empty()==false) cl_prop >> lambdaAttributeProxy;
322 else {
323 // Try to initialize LambdaAttributeProxy from default device value
324 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
325 if (def_prop.is_empty()==false) def_prop >> lambdaAttributeProxy;
327 // And try to extract LambdaAttributeProxy value from database
328 if (dev_prop[i].is_empty()==false) dev_prop[i] >> lambdaAttributeProxy;
330 // Try to initialize DiffractometerType from class property
331 cl_prop = ds_class->get_class_property(dev_prop[++i].name);
332 if (cl_prop.is_empty()==false) cl_prop >> diffractometerType;
333 else {
334 // Try to initialize DiffractometerType from default device value
335 def_prop = ds_class->get_default_device_property(dev_prop[i].name);
336 if (def_prop.is_empty()==false) def_prop >> diffractometerType;
338 // And try to extract DiffractometerType value from database
339 if (dev_prop[i].is_empty()==false) dev_prop[i] >> diffractometerType;
343 // End of Automatic code generation
344 //------------------------------------------------------------------
347 //+----------------------------------------------------------------------------
349 // method : Diffractometer::always_executed_hook()
351 // description : method always executed before any command is executed
353 //-----------------------------------------------------------------------------
354 void Diffractometer::always_executed_hook()
356 if (_hklAdapter)
357 _hklAdapter->connect_all_proxies();
359 //+----------------------------------------------------------------------------
361 // method : Diffractometer::read_attr_hardware
363 // description : Hardware acquisition for attributes.
365 //-----------------------------------------------------------------------------
366 void Diffractometer::read_attr_hardware(vector<long> &attr_list)
368 DEBUG_STREAM << "Diffractometer::read_attr_hardware(vector<long> &attr_list) entering... "<< endl;
369 // Add your own code here
370 if (!_hklAdapter)
371 return;
373 _hklAdapter->update();
374 _hklAdapter->get_diffractometer_config(_config);
375 _hklAdapter->get_sample_lattices(attr_A_read, attr_B_read, attr_C_read,
376 attr_Alpha_read, attr_Beta_read, attr_Gamma_read,
377 attr_AStar_read, attr_BStar_read, attr_CStar_read,
378 attr_AlphaStar_read, attr_BetaStar_read, attr_GammaStar_read);
379 _hklAdapter->get_sample_fit(attr_AFit_read, attr_BFit_read, attr_CFit_read,
380 attr_AlphaFit_read, attr_BetaFit_read, attr_GammaFit_read,
381 attr_UxFit_read, attr_UyFit_read, attr_UzFit_read);
383 //+----------------------------------------------------------------------------
385 // method : Diffractometer::read_AutoUpdateFromProxies
387 // description : Extract real attribute values for AutoUpdateFromProxies acquisition result.
389 //-----------------------------------------------------------------------------
390 void Diffractometer::read_AutoUpdateFromProxies(Tango::Attribute &attr)
392 DEBUG_STREAM << "Diffractometer::read_AutoUpdateFromProxies(Tango::Attribute &attr) entering... "<< endl;
394 if(_hklAdapter)
395 *attr_AutoUpdateFromProxies_read = _hklAdapter->get_auto_update_from_proxies();
396 attr.set_value(attr_AutoUpdateFromProxies_read);
399 //+----------------------------------------------------------------------------
401 // method : Diffractometer::write_AutoUpdateFromProxies
403 // description : Write AutoUpdateFromProxies attribute values to hardware.
405 //-----------------------------------------------------------------------------
406 void Diffractometer::write_AutoUpdateFromProxies(Tango::WAttribute &attr)
408 DEBUG_STREAM << "Diffractometer::write_AutoUpdateFromProxies(Tango::WAttribute &attr) entering... "<< endl;
410 attr.get_write_value(attr_AutoUpdateFromProxies_write);
412 if (_hklAdapter)
413 _hklAdapter->set_auto_update_from_proxies(attr_AutoUpdateFromProxies_write);
416 //+----------------------------------------------------------------------------
418 // method : Diffractometer::read_AFit
420 // description : Extract real attribute values for AFit acquisition result.
422 //-----------------------------------------------------------------------------
423 void Diffractometer::read_AFit(Tango::Attribute &attr)
425 DEBUG_STREAM << "Diffractometer::read_AFit(Tango::Attribute &attr) entering... "<< endl;
426 attr.set_value(attr_AFit_read);
429 //+----------------------------------------------------------------------------
431 // method : Diffractometer::write_AFit
433 // description : Write AFit attribute values to hardware.
435 //-----------------------------------------------------------------------------
436 void Diffractometer::write_AFit(Tango::WAttribute &attr)
438 DEBUG_STREAM << "Diffractometer::write_AFit(Tango::WAttribute &attr) entering... "<< endl;
439 bool fit;
441 attr.get_write_value(fit);
442 if (_hklAdapter){
443 _hklAdapter->set_sample_AFit(fit);
444 this->save();
445 attr_AFit_write = fit;
449 //+----------------------------------------------------------------------------
451 // method : Diffractometer::read_BFit
453 // description : Extract real attribute values for BFit acquisition result.
455 //-----------------------------------------------------------------------------
456 void Diffractometer::read_BFit(Tango::Attribute &attr)
458 DEBUG_STREAM << "Diffractometer::read_BFit(Tango::Attribute &attr) entering... "<< endl;
459 attr.set_value(attr_BFit_read);
462 //+----------------------------------------------------------------------------
464 // method : Diffractometer::write_BFit
466 // description : Write BFit attribute values to hardware.
468 //-----------------------------------------------------------------------------
469 void Diffractometer::write_BFit(Tango::WAttribute &attr)
471 DEBUG_STREAM << "Diffractometer::write_BFit(Tango::WAttribute &attr) entering... "<< endl;
472 bool fit;
474 attr.get_write_value(fit);
475 if (_hklAdapter){
476 _hklAdapter->set_sample_BFit(fit);
477 this->save();
478 attr_BFit_write = fit;
482 //+----------------------------------------------------------------------------
484 // method : Diffractometer::read_CFit
486 // description : Extract real attribute values for CFit acquisition result.
488 //-----------------------------------------------------------------------------
489 void Diffractometer::read_CFit(Tango::Attribute &attr)
491 DEBUG_STREAM << "Diffractometer::read_CFit(Tango::Attribute &attr) entering... "<< endl;
492 attr.set_value(attr_CFit_read);
495 //+----------------------------------------------------------------------------
497 // method : Diffractometer::write_CFit
499 // description : Write CFit attribute values to hardware.
501 //-----------------------------------------------------------------------------
502 void Diffractometer::write_CFit(Tango::WAttribute &attr)
504 DEBUG_STREAM << "Diffractometer::write_CFit(Tango::WAttribute &attr) entering... "<< endl;
505 bool fit;
507 attr.get_write_value(fit);
508 if (_hklAdapter){
509 _hklAdapter->set_sample_CFit(fit);
510 this->save();
511 attr_CFit_write = fit;
515 //+----------------------------------------------------------------------------
517 // method : Diffractometer::read_AlphaFit
519 // description : Extract real attribute values for AlphaFit acquisition result.
521 //-----------------------------------------------------------------------------
522 void Diffractometer::read_AlphaFit(Tango::Attribute &attr)
524 DEBUG_STREAM << "Diffractometer::read_AlphaFit(Tango::Attribute &attr) entering... "<< endl;
525 attr.set_value(attr_AlphaFit_read);
528 //+----------------------------------------------------------------------------
530 // method : Diffractometer::write_AlphaFit
532 // description : Write AlphaFit attribute values to hardware.
534 //-----------------------------------------------------------------------------
535 void Diffractometer::write_AlphaFit(Tango::WAttribute &attr)
537 DEBUG_STREAM << "Diffractometer::write_AlphaFit(Tango::WAttribute &attr) entering... "<< endl;
538 bool fit;
540 attr.get_write_value(fit);
541 if (_hklAdapter){
542 _hklAdapter->set_sample_AlphaFit(fit);
543 this->save();
544 attr_AlphaFit_write = fit;
548 //+----------------------------------------------------------------------------
550 // method : Diffractometer::read_BetaFit
552 // description : Extract real attribute values for BetaFit acquisition result.
554 //-----------------------------------------------------------------------------
555 void Diffractometer::read_BetaFit(Tango::Attribute &attr)
557 DEBUG_STREAM << "Diffractometer::read_BetaFit(Tango::Attribute &attr) entering... "<< endl;
558 attr.set_value(attr_BetaFit_read);
561 //+----------------------------------------------------------------------------
563 // method : Diffractometer::write_BetaFit
565 // description : Write BetaFit attribute values to hardware.
567 //-----------------------------------------------------------------------------
568 void Diffractometer::write_BetaFit(Tango::WAttribute &attr)
570 DEBUG_STREAM << "Diffractometer::write_BetaFit(Tango::WAttribute &attr) entering... "<< endl;
571 bool fit;
573 attr.get_write_value(fit);
574 if (_hklAdapter){
575 _hklAdapter->set_sample_BetaFit(fit);
576 this->save();
577 attr_BetaFit_write = fit;
581 //+----------------------------------------------------------------------------
583 // method : Diffractometer::read_GammaFit
585 // description : Extract real attribute values for GammaFit acquisition result.
587 //-----------------------------------------------------------------------------
588 void Diffractometer::read_GammaFit(Tango::Attribute &attr)
590 DEBUG_STREAM << "Diffractometer::read_GammaFit(Tango::Attribute &attr) entering... "<< endl;
591 attr.set_value(attr_GammaFit_read);
594 //+----------------------------------------------------------------------------
596 // method : Diffractometer::write_GammaFit
598 // description : Write GammaFit attribute values to hardware.
600 //-----------------------------------------------------------------------------
601 void Diffractometer::write_GammaFit(Tango::WAttribute &attr)
603 DEBUG_STREAM << "Diffractometer::write_GammaFit(Tango::WAttribute &attr) entering... "<< endl;
604 bool fit;
606 attr.get_write_value(fit);
607 if (_hklAdapter){
608 _hklAdapter->set_sample_GammaFit(fit);
609 this->save();
610 attr_GammaFit_write = fit;
614 //+----------------------------------------------------------------------------
616 // method : Diffractometer::read_UxFit
618 // description : Extract real attribute values for UxFit acquisition result.
620 //-----------------------------------------------------------------------------
621 void Diffractometer::read_UxFit(Tango::Attribute &attr)
623 DEBUG_STREAM << "Diffractometer::read_UxFit(Tango::Attribute &attr) entering... "<< endl;
624 attr.set_value(attr_UxFit_read);
627 //+----------------------------------------------------------------------------
629 // method : Diffractometer::write_UxFit
631 // description : Write UxFit attribute values to hardware.
633 //-----------------------------------------------------------------------------
634 void Diffractometer::write_UxFit(Tango::WAttribute &attr)
636 DEBUG_STREAM << "Diffractometer::write_UxFit(Tango::WAttribute &attr) entering... "<< endl;
637 bool fit;
639 attr.get_write_value(fit);
640 if (_hklAdapter){
641 _hklAdapter->set_sample_UxFit(fit);
642 this->save();
643 attr_UxFit_write = fit;
647 //+----------------------------------------------------------------------------
649 // method : Diffractometer::read_UyFit
651 // description : Extract real attribute values for UyFit acquisition result.
653 //-----------------------------------------------------------------------------
654 void Diffractometer::read_UyFit(Tango::Attribute &attr)
656 DEBUG_STREAM << "Diffractometer::read_UyFit(Tango::Attribute &attr) entering... "<< endl;
657 attr.set_value(attr_UyFit_read);
660 //+----------------------------------------------------------------------------
662 // method : Diffractometer::write_UyFit
664 // description : Write UyFit attribute values to hardware.
666 //-----------------------------------------------------------------------------
667 void Diffractometer::write_UyFit(Tango::WAttribute &attr)
669 DEBUG_STREAM << "Diffractometer::write_UyFit(Tango::WAttribute &attr) entering... "<< endl;
670 bool fit;
672 attr.get_write_value(fit);
673 if (_hklAdapter){
674 _hklAdapter->set_sample_UyFit(fit);
675 this->save();
676 attr_UyFit_write = fit;
680 //+----------------------------------------------------------------------------
682 // method : Diffractometer::read_UzFit
684 // description : Extract real attribute values for UzFit acquisition result.
686 //-----------------------------------------------------------------------------
687 void Diffractometer::read_UzFit(Tango::Attribute &attr)
689 DEBUG_STREAM << "Diffractometer::read_UzFit(Tango::Attribute &attr) entering... "<< endl;
690 attr.set_value(attr_UzFit_read);
693 //+----------------------------------------------------------------------------
695 // method : Diffractometer::write_UzFit
697 // description : Write UzFit attribute values to hardware.
699 //-----------------------------------------------------------------------------
700 void Diffractometer::write_UzFit(Tango::WAttribute &attr)
702 DEBUG_STREAM << "Diffractometer::write_UzFit(Tango::WAttribute &attr) entering... "<< endl;
703 bool fit;
705 attr.get_write_value(fit);
706 if (_hklAdapter){
707 _hklAdapter->set_sample_UzFit(fit);
708 this->save();
709 attr_UzFit_write = fit;
713 //+----------------------------------------------------------------------------
715 // method : Diffractometer::read_pseudoAxesProxies
717 // description : Extract real attribute values for pseudoAxesProxies acquisition result.
719 //-----------------------------------------------------------------------------
720 void Diffractometer::read_pseudoAxesProxies(Tango::Attribute &attr)
722 DEBUG_STREAM << "Diffractometer::read_pseudoAxesProxies(Tango::Attribute &attr) entering... "<< endl;
723 if(_hklAdapter){
724 Matrix<char *> const & img = _hklAdapter->get_pseudo_axes_proxies();
725 attr.set_value(img.data, img.xdim);
729 //+----------------------------------------------------------------------------
731 // method : Diffractometer::read_AnglesIdx
733 // description : Extract real attribute values for AnglesIdx acquisition result.
735 //-----------------------------------------------------------------------------
736 void Diffractometer::read_AnglesIdx(Tango::Attribute &attr)
738 DEBUG_STREAM << "Diffractometer::read_AnglesIdx(Tango::Attribute &attr) entering... "<< endl;
740 if(_hklAdapter){
741 *attr_AnglesIdx_read = _hklAdapter->get_angles_idx();
742 attr.set_value(attr_AnglesIdx_read);
746 //+----------------------------------------------------------------------------
748 // method : Diffractometer::write_AnglesIdx
750 // description : Write AnglesIdx attribute values to hardware.
752 //-----------------------------------------------------------------------------
753 void Diffractometer::write_AnglesIdx(Tango::WAttribute &attr)
755 DEBUG_STREAM << "Diffractometer::write_AnglesIdx(Tango::WAttribute &attr) entering... "<< endl;
757 attr.get_write_value(attr_AnglesIdx_write);
758 if(_hklAdapter)
759 _hklAdapter->set_angles_idx(attr_AnglesIdx_write);
762 //+----------------------------------------------------------------------------
764 // method : Diffractometer::read_AxesNames
766 // description : Extract real attribute values for AxesNames acquisition result.
768 //-----------------------------------------------------------------------------
769 void Diffractometer::read_AxesNames(Tango::Attribute &attr)
771 if(_hklAdapter){
772 Matrix<char *> const & img = _hklAdapter->get_dynamic_attribute_axes_names();
773 attr.set_value(img.data, img.xdim);
777 //+----------------------------------------------------------------------------
779 // method : Diffractometer::read_Angles
781 // description : Extract real attribute values for Angles acquisition result.
783 //-----------------------------------------------------------------------------
784 void Diffractometer::read_Angles(Tango::Attribute &attr)
786 DEBUG_STREAM << "Diffractometer::read_Angles(Tango::Attribute &attr) entering... "<< endl;
787 if(_hklAdapter){
788 Matrix<double> const & img = _hklAdapter->get_angles();
789 attr.set_value(img.data, img.xdim, img.ydim);
793 //+----------------------------------------------------------------------------
795 // method : Diffractometer::read_AnglesDegenerated
797 // description : Extract real attribute values for AnglesDegenerated acquisition result.
799 //-----------------------------------------------------------------------------
800 void Diffractometer::read_AnglesDegenerated(Tango::Attribute &attr)
802 DEBUG_STREAM << "Diffractometer::read_AnglesDegenerated(Tango::Attribute &attr) entering... "<< endl;
805 //+----------------------------------------------------------------------------
807 // method : Diffractometer::read_AnglesRangeCheck
809 // description : Extract real attribute values for AnglesRangeCheck acquisition result.
811 //-----------------------------------------------------------------------------
812 void Diffractometer::read_AnglesRangeCheck(Tango::Attribute &attr)
814 DEBUG_STREAM << "Diffractometer::read_AnglesRangeCheck(Tango::Attribute &attr) entering... "<< endl;
817 //+----------------------------------------------------------------------------
819 // method : Diffractometer::read_Reflections
821 // description : Extract real attribute values for Reflections acquisition result.
823 //-----------------------------------------------------------------------------
824 void Diffractometer::read_Reflections(Tango::Attribute &attr)
826 DEBUG_STREAM << "Diffractometer::read_Reflections(Tango::Attribute &attr) entering... "<< endl;
827 if(_hklAdapter){
828 Matrix<double> const & img = _hklAdapter->get_reflections();
829 attr.set_value(img.data, img.xdim, img.ydim);
833 //+----------------------------------------------------------------------------
835 // method : Diffractometer::write_Reflections
837 // description : Write Reflections attribute values to hardware.
839 //-----------------------------------------------------------------------------
840 void Diffractometer::write_Reflections(Tango::WAttribute &attr)
842 DEBUG_STREAM << "Diffractometer::write_Reflections(Tango::WAttribute &attr) entering... "<< endl;
844 const Tango::DevDouble *value;
845 attr.get_write_value(value);
847 Matrix<double> img;
848 img.attach_to_const_buffer(value,
849 attr.get_w_dim_x(), attr.get_w_dim_y());
851 if(_hklAdapter)
852 _hklAdapter->set_reflections(img);
855 //+----------------------------------------------------------------------------
857 // method : Diffractometer::read_ReflectionsAngles
859 // description : Extract real attribute values for ReflectionsAngles acquisition result.
861 //-----------------------------------------------------------------------------
862 void Diffractometer::read_ReflectionsAngles(Tango::Attribute &attr)
864 DEBUG_STREAM << "Diffractometer::read_ReflectionsAngles(Tango::Attribute &attr) entering... "<< endl;
866 if (_hklAdapter){
867 Matrix<double> const & img = _hklAdapter->get_reflections_angles();
868 attr.set_value(img.data, img.xdim, img.ydim);
872 //+----------------------------------------------------------------------------
874 // method : Diffractometer::read_AStar
876 // description : Extract real attribute values for AStar acquisition result.
878 //-----------------------------------------------------------------------------
879 void Diffractometer::read_AStar(Tango::Attribute &attr)
881 DEBUG_STREAM << "Diffractometer::read_AStar(Tango::Attribute &attr) entering... "<< endl;
882 attr.set_value(attr_AStar_read);
885 //+----------------------------------------------------------------------------
887 // method : Diffractometer::read_BStar
889 // description : Extract real attribute values for BStar acquisition result.
891 //-----------------------------------------------------------------------------
892 void Diffractometer::read_BStar(Tango::Attribute &attr)
894 DEBUG_STREAM << "Diffractometer::read_BStar(Tango::Attribute &attr) entering... "<< endl;
895 attr.set_value(attr_BStar_read);
898 //+----------------------------------------------------------------------------
900 // method : Diffractometer::read_CStar
902 // description : Extract real attribute values for CStar acquisition result.
904 //-----------------------------------------------------------------------------
905 void Diffractometer::read_CStar(Tango::Attribute &attr)
907 DEBUG_STREAM << "Diffractometer::read_CStar(Tango::Attribute &attr) entering... "<< endl;
908 attr.set_value(attr_CStar_read);
911 //+----------------------------------------------------------------------------
913 // method : Diffractometer::read_AlphaStar
915 // description : Extract real attribute values for AlphaStar acquisition result.
917 //-----------------------------------------------------------------------------
918 void Diffractometer::read_AlphaStar(Tango::Attribute &attr)
920 DEBUG_STREAM << "Diffractometer::read_AlphaStar(Tango::Attribute &attr) entering... "<< endl;
921 attr.set_value(attr_AlphaStar_read);
924 //+----------------------------------------------------------------------------
926 // method : Diffractometer::read_BetaStar
928 // description : Extract real attribute values for BetaStar acquisition result.
930 //-----------------------------------------------------------------------------
931 void Diffractometer::read_BetaStar(Tango::Attribute &attr)
933 DEBUG_STREAM << "Diffractometer::read_BetaStar(Tango::Attribute &attr) entering... "<< endl;
934 attr.set_value(attr_BetaStar_read);
937 //+----------------------------------------------------------------------------
939 // method : Diffractometer::read_GammaStar
941 // description : Extract real attribute values for GammaStar acquisition result.
943 //-----------------------------------------------------------------------------
944 void Diffractometer::read_GammaStar(Tango::Attribute &attr)
946 DEBUG_STREAM << "Diffractometer::read_GammaStar(Tango::Attribute &attr) entering... "<< endl;
947 attr.set_value(attr_GammaStar_read);
950 //+----------------------------------------------------------------------------
952 // method : Diffractometer::read_A
954 // description : Extract real attribute values for A acquisition result.
956 //-----------------------------------------------------------------------------
957 void Diffractometer::read_A(Tango::Attribute &attr)
959 DEBUG_STREAM << "Diffractometer::read_A(Tango::Attribute &attr) entering... "<< endl;
960 attr.set_value(attr_A_read);
963 //+----------------------------------------------------------------------------
965 // method : Diffractometer::read_B
967 // description : Extract real attribute values for B acquisition result.
969 //-----------------------------------------------------------------------------
970 void Diffractometer::read_B(Tango::Attribute &attr)
972 DEBUG_STREAM << "Diffractometer::read_B(Tango::Attribute &attr) entering... "<< endl;
973 attr.set_value(attr_B_read);
976 //+----------------------------------------------------------------------------
978 // method : Diffractometer::read_C
980 // description : Extract real attribute values for C acquisition result.
982 //-----------------------------------------------------------------------------
983 void Diffractometer::read_C(Tango::Attribute &attr)
985 DEBUG_STREAM << "Diffractometer::read_C(Tango::Attribute &attr) entering... "<< endl;
986 attr.set_value(attr_C_read);
989 //+----------------------------------------------------------------------------
991 // method : Diffractometer::read_Alpha
993 // description : Extract real attribute values for Alpha acquisition result.
995 //-----------------------------------------------------------------------------
996 void Diffractometer::read_Alpha(Tango::Attribute &attr)
998 DEBUG_STREAM << "Diffractometer::read_Alpha(Tango::Attribute &attr) entering... "<< endl;
999 attr.set_value(attr_Alpha_read);
1002 //+----------------------------------------------------------------------------
1004 // method : Diffractometer::read_Beta
1006 // description : Extract real attribute values for Beta acquisition result.
1008 //-----------------------------------------------------------------------------
1009 void Diffractometer::read_Beta(Tango::Attribute &attr)
1011 DEBUG_STREAM << "Diffractometer::read_Beta(Tango::Attribute &attr) entering... "<< endl;
1012 attr.set_value(attr_Beta_read);
1015 //+----------------------------------------------------------------------------
1017 // method : Diffractometer::read_Gamma
1019 // description : Extract real attribute values for Gamma acquisition result.
1021 //-----------------------------------------------------------------------------
1022 void Diffractometer::read_Gamma(Tango::Attribute &attr)
1024 DEBUG_STREAM << "Diffractometer::read_Gamma(Tango::Attribute &attr) entering... "<< endl;
1025 attr.set_value(attr_Gamma_read);
1028 //+----------------------------------------------------------------------------
1030 // method : Diffractometer::read_UB
1032 // description : Extract real attribute values for UB acquisition result.
1034 //-----------------------------------------------------------------------------
1035 void Diffractometer::read_UB(Tango::Attribute &attr)
1037 DEBUG_STREAM << "Diffractometer::read_UB(Tango::Attribute &attr) entering... "<< endl;
1039 if(_hklAdapter){
1040 Matrix<double> const & img = _hklAdapter->get_sample_ub();
1041 attr.set_value(img.data, img.xdim, img.ydim);
1045 //+----------------------------------------------------------------------------
1047 // method : Diffractometer::read_Ux
1049 // description : Extract real attribute values for Ux acquisition result.
1051 //-----------------------------------------------------------------------------
1052 void Diffractometer::read_Ux(Tango::Attribute &attr)
1054 DEBUG_STREAM << "Diffractometer::read_Ux(Tango::Attribute &attr) entering... "<< endl;
1056 if(_hklAdapter)
1057 attr.set_value(&_hklAdapter->get_sample_Ux());
1060 //+----------------------------------------------------------------------------
1062 // method : Diffractometer::write_Ux
1064 // description : Write Ux attribute values to hardware.
1066 //-----------------------------------------------------------------------------
1067 void Diffractometer::write_Ux(Tango::WAttribute &attr)
1069 DEBUG_STREAM << "Diffractometer::write_Ux(Tango::WAttribute &attr) entering... "<< endl;
1070 double Ux;
1072 attr.get_write_value(Ux);
1073 if (_hklAdapter){
1074 _hklAdapter->set_sample_Ux(Ux);
1075 attr_Ux_write = Ux;
1079 //+----------------------------------------------------------------------------
1081 // method : Diffractometer::read_Uy
1083 // description : Extract real attribute values for Uy acquisition result.
1085 //-----------------------------------------------------------------------------
1086 void Diffractometer::read_Uy(Tango::Attribute &attr)
1088 DEBUG_STREAM << "Diffractometer::read_Uy(Tango::Attribute &attr) entering... "<< endl;
1089 if(_hklAdapter)
1090 attr.set_value(&_hklAdapter->get_sample_Uy());
1093 //+----------------------------------------------------------------------------
1095 // method : Diffractometer::write_Uy
1097 // description : Write Uy attribute values to hardware.
1099 //-----------------------------------------------------------------------------
1100 void Diffractometer::write_Uy(Tango::WAttribute &attr)
1102 DEBUG_STREAM << "Diffractometer::write_Uy(Tango::WAttribute &attr) entering... "<< endl;
1103 double Uy;
1105 attr.get_write_value(Uy);
1106 if (_hklAdapter){
1107 _hklAdapter->set_sample_Uy(Uy);
1108 attr_Uy_write = Uy;
1112 //+----------------------------------------------------------------------------
1114 // method : Diffractometer::read_Uz
1116 // description : Extract real attribute values for Uz acquisition result.
1118 //-----------------------------------------------------------------------------
1119 void Diffractometer::read_Uz(Tango::Attribute &attr)
1121 DEBUG_STREAM << "Diffractometer::read_Uz(Tango::Attribute &attr) entering... "<< endl;
1122 if(_hklAdapter)
1123 attr.set_value(&_hklAdapter->get_sample_Uz());
1126 //+----------------------------------------------------------------------------
1128 // method : Diffractometer::write_Uz
1130 // description : Write Uz attribute values to hardware.
1132 //-----------------------------------------------------------------------------
1133 void Diffractometer::write_Uz(Tango::WAttribute &attr)
1135 DEBUG_STREAM << "Diffractometer::write_Uz(Tango::WAttribute &attr) entering... "<< endl;
1136 double Uz;
1138 attr.get_write_value(Uz);
1139 if (_hklAdapter){
1140 _hklAdapter->set_sample_Uz(Uz);
1141 attr_Uz_write = Uz;
1146 //+----------------------------------------------------------------------------
1148 // method : Diffractometer::read_Simulated
1150 // description : Extract real attribute values for Simulated acquisition result.
1152 //-----------------------------------------------------------------------------
1153 void Diffractometer::read_Simulated(Tango::Attribute &attr)
1155 DEBUG_STREAM << "Diffractometer::read_Simulated(Tango::Attribute &attr) entering... "<< endl;
1157 if(_hklAdapter)
1158 *attr_Simulated_read = !_hklAdapter->get_auto_update_from_proxies();
1159 attr.set_value(attr_Simulated_read);
1162 //+----------------------------------------------------------------------------
1164 // method : Diffractometer::write_Simulated
1166 // description : Write Simulated attribute values to hardware.
1168 //-----------------------------------------------------------------------------
1169 void Diffractometer::write_Simulated(Tango::WAttribute &attr)
1171 DEBUG_STREAM << "Diffractometer::write_Simulated(Tango::WAttribute &attr) entering... "<< endl;
1172 attr.get_write_value(attr_Simulated_write);
1174 if (_hklAdapter)
1175 _hklAdapter->set_auto_update_from_proxies(!attr_Simulated_write);
1178 //+----------------------------------------------------------------------------
1180 // method : Diffractometer::read_Crystal
1182 // description : Extract real attribute values for Crystal acquisition result.
1184 //-----------------------------------------------------------------------------
1185 void Diffractometer::read_Crystal(Tango::Attribute &attr)
1187 DEBUG_STREAM << "Diffractometer::read_Crystal(Tango::Attribute &attr) entering... "<< endl;
1189 if(*attr_Crystal_read) delete [] *attr_Crystal_read;
1191 if (_hklAdapter)
1192 *attr_Crystal_read = CORBA::string_dup(_hklAdapter->get_sample_name());
1193 else
1194 *attr_Crystal_read = CORBA::string_dup("");
1195 attr.set_value(attr_Crystal_read);
1198 //+----------------------------------------------------------------------------
1200 // method : Diffractometer::write_Crystal
1202 // description : Write Crystal attribute values to hardware.
1204 //-----------------------------------------------------------------------------
1205 void Diffractometer::write_Crystal(Tango::WAttribute &attr)
1207 DEBUG_STREAM << "Diffractometer::write_Crystal(Tango::WAttribute &attr) entering... "<< endl;
1209 attr.get_write_value(attr_Crystal_write);
1210 if(_hklAdapter)
1211 _hklAdapter->set_current_sample(attr_Crystal_write);
1214 //+----------------------------------------------------------------------------
1216 // method : Diffractometer::read_WaveLength
1218 // description : Extract real attribute values for WaveLength acquisition result.
1220 //-----------------------------------------------------------------------------
1221 void Diffractometer::read_WaveLength(Tango::Attribute &attr)
1223 DEBUG_STREAM << "Diffractometer::read_WaveLength(Tango::Attribute &attr) entering... "<< endl;
1225 if(_hklAdapter)
1226 attr.set_value(&_hklAdapter->get_lambda());
1229 //+----------------------------------------------------------------------------
1231 // method : Diffractometer::write_WaveLength
1233 // description : Write WaveLength attribute values to hardware.
1235 //-----------------------------------------------------------------------------
1236 void Diffractometer::write_WaveLength(Tango::WAttribute &attr)
1238 DEBUG_STREAM << "Diffractometer::write_WaveLength(Tango::WAttribute &attr) entering... "<< endl;
1240 attr.get_write_value(attr_WaveLength_write);
1242 if (_hklAdapter) {
1243 _hklAdapter->set_lambda(attr_WaveLength_write);
1244 if (!_hklAdapter->get_auto_update_from_proxies())
1245 *attr_WaveLength_read = attr_WaveLength_write;
1249 //+----------------------------------------------------------------------------
1251 // method : Diffractometer::read_CrystalNames
1253 // description : Extract real attribute values for CrystalNames acquisition result.
1255 //-----------------------------------------------------------------------------
1256 void Diffractometer::read_CrystalNames(Tango::Attribute &attr)
1258 DEBUG_STREAM << "Diffractometer::read_CrystalNames(Tango::Attribute &attr) entering... "<< endl;
1260 std::vector<std::string> names;
1262 if (_hklAdapter)
1263 names = _hklAdapter->get_samples_names();
1265 _crystal_names_dev_varstring_array << names;
1266 attr.set_value(_crystal_names_dev_varstring_array.get_buffer(),
1267 _crystal_names_dev_varstring_array.length());
1270 //+------------------------------------------------------------------
1272 * method: Diffractometer::abort
1274 * description: method to execute "Abort"
1275 * Stops the movement of all axis driven by the Diffractometer
1279 //+------------------------------------------------------------------
1280 void Diffractometer::abort()
1282 DEBUG_STREAM << "Diffractometer::abort(): entering... !" << endl;
1284 // Add your own code to control device here
1287 _hklAdapter->stop_all_axis();
1289 catch (Tango::DevFailed& e )
1291 ERROR_STREAM << e ;
1295 //+------------------------------------------------------------------
1297 * method: Diffractometer::add_new_crystal
1299 * description: method to execute "AddNewCrystal"
1300 * Create a new crystal
1302 * @param argin Name of the new crystal
1305 //+------------------------------------------------------------------
1306 void Diffractometer::add_new_crystal(Tango::DevString argin)
1308 DEBUG_STREAM << "Diffractometer::add_new_crystal(): entering... !" << endl;
1310 // Add your own code to control device here
1312 /* POGO rename SampleNew */
1314 if (_hklAdapter){
1315 _hklAdapter->add_new_sample(argin);
1316 this->save();
1320 //+------------------------------------------------------------------
1322 * method: Diffractometer::add_reflection
1324 * description: method to execute "AddReflection"
1325 * This commands requires the definition of 1 reflection defined by (h,k,l ) coordinates.
1326 * This coodinates are associated with the current angles configuration.
1328 * TODO: d�taill� le commentaire
1329 * reflections i.e : h, k, l, relevance, enable/disable
1331 * @param argin reflections i.e : h, k, l, relevance, enable/disable
1334 //+------------------------------------------------------------------
1335 void Diffractometer::add_reflection(const Tango::DevVarDoubleArray *argin)
1337 DEBUG_STREAM << "Diffractometer::add_reflection(): entering... !" << endl;
1339 // Add your own code to control device here
1341 /* POGO rename SampleReflectionAdd */
1342 if (_hklAdapter){
1343 _hklAdapter->add_reflection();
1344 this->save();
1348 //+------------------------------------------------------------------
1350 * method: Diffractometer::affine_crystal
1352 * description: method to execute "AffineCrystal"
1353 * Compute affinement for the current crystal with available list of reflection.
1355 * @param argin name of the crystal to fit
1356 * @return the fitness of the crystal after the affinement.
1359 //+------------------------------------------------------------------
1360 Tango::DevDouble Diffractometer::affine_crystal(Tango::DevString argin)
1362 Tango::DevDouble argout ;
1363 DEBUG_STREAM << "Diffractometer::affine_crystal(): entering... !" << endl;
1365 // Add your own code to control device here
1367 /* POGO rename SampleAffinement */
1369 if(_hklAdapter){
1370 argout = _hklAdapter->affine_sample(argin);
1371 this->refresh_crystal_parameters();
1372 this->save();
1375 return argout;
1378 //+------------------------------------------------------------------
1380 * method: Diffractometer::configure_crystal
1382 * description: method to execute "ConfigureCrystal"
1383 * Defines crystal lattice parameters.
1384 * This information is mandatory for angles calculations.
1385 * Angles units are degrees
1387 * @param argin Crystal parameters : alpha,beta,gamma, A,B,C
1390 //+------------------------------------------------------------------
1391 void Diffractometer::configure_crystal(const Tango::DevVarDoubleArray *argin)
1393 DEBUG_STREAM << "Diffractometer::configure_crystal(): entering... !" << endl;
1395 // Add your own code to control device here
1397 /* POGO rename SampleConfiguration */
1399 if(_hklAdapter){
1400 _hklAdapter->set_lattice(argin);
1401 this->refresh_crystal_parameters();
1402 this->save();
1406 //+------------------------------------------------------------------
1408 * method: Diffractometer::copy_current_crystal_as
1410 * description: method to execute "CopyCurrentCrystalAs"
1411 * Copy the current crytal as another name
1413 * @param argin
1416 //+------------------------------------------------------------------
1417 void Diffractometer::copy_current_crystal_as(Tango::DevString argin)
1419 DEBUG_STREAM << "Diffractometer::copy_current_crystal_as(): entering... !" << endl;
1421 // Add your own code to control device here
1423 /* POGO rename SampleCopy */
1425 if(_hklAdapter){
1426 _hklAdapter->copy_sample_as(argin);
1427 this->refresh_crystal_parameters();
1428 this->save();
1432 //+------------------------------------------------------------------
1434 * method: Diffractometer::delete_current_crystal
1436 * description: method to execute "DeleteCurrentCrystal"
1437 * Delete the current from this device
1441 //+------------------------------------------------------------------
1442 void Diffractometer::delete_current_crystal()
1444 DEBUG_STREAM << "Diffractometer::delete_current_crystal(): entering... !" << endl;
1446 // Add your own code to control device here
1448 /* POGO rename SampleDelete */
1450 if(_hklAdapter){
1451 _hklAdapter->del_sample();
1452 this->refresh_crystal_parameters();
1453 this->save();
1457 //+------------------------------------------------------------------
1459 * method: Diffractometer::load
1461 * description: method to execute "Load"
1462 * Load all crystals
1466 //+------------------------------------------------------------------
1467 void Diffractometer::load()
1469 DEBUG_STREAM << "Diffractometer::load(): entering... !" << endl;
1471 // Add your own code to control device here
1473 // POGO TO DELETE
1474 if(_hklAdapter)
1475 _hklAdapter->load();
1478 //+------------------------------------------------------------------
1480 * method: Diffractometer::remove_reflection
1482 * description: method to execute "RemoveReflection"
1483 * This commands removes reflection from the current cristal.
1485 * @param argin index of reflection to remove
1488 //+------------------------------------------------------------------
1489 void Diffractometer::remove_reflection(Tango::DevShort argin)
1491 DEBUG_STREAM << "Diffractometer::remove_reflection(): entering... !" << endl;
1493 // Add your own code to control device here
1495 /* POGO rename SampleReflectionDelete */
1496 if(_hklAdapter){
1497 _hklAdapter->del_reflection(argin);
1498 this->refresh_crystal_parameters();
1499 this->save();
1503 //+------------------------------------------------------------------
1505 * method: Diffractometer::save
1507 * description: method to execute "Save"
1508 * Save all crystals
1512 //+------------------------------------------------------------------
1513 void Diffractometer::save()
1515 DEBUG_STREAM << "Diffractometer::save(): entering... !" << endl;
1517 // Add your own code to control device here
1519 // POGO TO DELETE
1520 if(_hklAdapter)
1521 _hklAdapter->save();
1524 //+------------------------------------------------------------------
1526 * method: Diffractometer::set_crystal_parameter_values
1528 * description: method to execute "SetCrystalParameterValues"
1529 * Double : min value, max value, affinement enable
1531 * @param argin String : Name of parameter ; Double : min value, max value, affinement enable
1534 //+------------------------------------------------------------------
1535 void Diffractometer::set_crystal_parameter_values(const Tango::DevVarDoubleStringArray *argin)
1537 DEBUG_STREAM << "Diffractometer::set_crystal_parameter_values(): entering... !" << endl;
1539 // Add your own code to control device here
1541 // check Parameters
1542 if(_hklAdapter)
1543 _hklAdapter->set_sample_parameter_values(argin);
1546 //+------------------------------------------------------------------
1548 * method: Diffractometer::copy_reflection_to
1550 * description: method to execute "CopyReflectionTo"
1551 * Copy one reflection from the current crystal to another crystal
1553 * @param argin Double: Reflection number of the current crystal String : Name of the crystal where copy this reflection
1556 //+------------------------------------------------------------------
1557 void Diffractometer::copy_reflection_to(const Tango::DevVarDoubleStringArray *argin)
1559 DEBUG_STREAM << "Diffractometer::copy_reflection_to(): entering... !" << endl;
1561 // Add your own code to control device here
1563 /* POGO TO DELETE */
1566 //+------------------------------------------------------------------
1568 * method: Diffractometer::dev_state
1570 * description: method to execute "State"
1571 * This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
1573 * @return State Code
1576 //+------------------------------------------------------------------
1577 Tango::DevState Diffractometer::dev_state()
1579 Tango::DevState argout;// = DeviceImpl::dev_state();
1580 DEBUG_STREAM << "Diffractometer::dev_state(): entering... !" << endl;
1582 // Add your own code to control device here
1584 argout = _config.state;
1585 this->set_state(argout);
1587 return argout;
1590 //+------------------------------------------------------------------
1592 * method: Diffractometer::get_crystal_parameter_values
1594 * description: method to execute "GetCrystalParameterValues"
1595 * Return all values of a parameter for the current crystal
1597 * @param argin Name of parameter (see getParametersNames for the complete list of parameters)
1598 * @return In the order : minimum value, maximum value, affinement enable
1601 //+------------------------------------------------------------------
1602 Tango::DevVarDoubleStringArray *Diffractometer::get_crystal_parameter_values(Tango::DevString argin)
1604 // POGO has generated a method core with argout allocation.
1605 // If you would like to use a static reference without copying,
1606 // See "TANGO Device Server Programmer's Manual"
1607 // (chapter : Writing a TANGO DS / Exchanging data)
1608 //------------------------------------------------------------
1609 Tango::DevVarDoubleStringArray *argout = new Tango::DevVarDoubleStringArray();
1610 argout->dvalue.length(3);
1611 argout->dvalue[0] = 0.0;
1612 argout->dvalue[1] = 0.0;
1613 argout->dvalue[2] = 0.0;
1614 argout->svalue.length(1);
1615 argout->svalue[0] = CORBA::string_dup(argin);
1616 DEBUG_STREAM << "Diffractometer::get_crystal_parameter_values(): entering... !" << endl;
1618 // Add your own code to control device here
1619 if(_hklAdapter)
1620 _hklAdapter->get_sample_parameter_values(argout);
1622 return argout;
1625 //+------------------------------------------------------------------
1627 * method: Diffractometer::compute_u
1629 * description: method to execute "ComputeU"
1630 * Compute Matrix U from two reflections
1632 * @param argin a two elements array with the index of reflection to use
1635 //+------------------------------------------------------------------
1636 void Diffractometer::compute_u(const Tango::DevVarLongArray *argin)
1638 DEBUG_STREAM << "Diffractometer::compute_u(): entering... !" << endl;
1640 // Add your own code to control device here
1641 if(_hklAdapter){
1642 _hklAdapter->compute_u(argin);
1643 this->save();
1647 //+------------------------------------------------------------------
1649 * method: Diffractometer::dev_status
1651 * description: method to execute "Status"
1652 * This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
1654 * @return Status description
1657 //+------------------------------------------------------------------
1658 Tango::ConstDevString Diffractometer::dev_status()
1660 //Tango::ConstDevString argout = DeviceImpl::dev_status();
1661 DEBUG_STREAM << "Diffractometer::dev_status(): entering... !" << endl;
1663 // Add your own code to control device here
1664 this->set_status(_config.status);
1665 return _config.status.c_str();
1671 } // namespace