2 #include "PseudoAxesAttrib.h"
4 namespace Diffractometer_ns
10 PseudoAxesAxisAttrib::PseudoAxesAxisAttrib(char const *name
, PseudoAxesAdapter
& adapter
, size_t idx
):
11 Tango::Attr(name
, Tango::DEV_DOUBLE
, Tango::READ_WRITE
),
15 Tango::UserDefaultAttrProp axis_prop
;
16 axis_prop
.set_label(name
);
17 axis_prop
.set_format("%7.4f");
19 std::string description
;
20 description
+= "The ";
22 description
+= " pseudo axes axis of the diffractometer";
23 axis_prop
.set_description(description
.c_str());
24 axis_prop
.set_unit("°");
25 this->set_default_properties(axis_prop
);
28 void PseudoAxesAxisAttrib::read(Tango::DeviceImpl
*dev
, Tango::Attribute
&att
)
30 // use Tango to aknowledge for the write part.
31 Tango::WAttribute
& att_w
= dev
->get_device_attr()->get_w_attr_by_name(att
.get_name().c_str());
32 Matrix
<double> const & img
= _adapter
.get_write();
33 att_w
.set_write_value(img
.data
[_idx
]);
35 att
.set_value(&_adapter
.get_axis_value(_idx
));
38 void PseudoAxesAxisAttrib::write(Tango::DeviceImpl
*dev
, Tango::WAttribute
&att
)
41 att
.get_write_value(value
);
43 _adapter
.set_axis_value(_idx
, value
);
46 bool PseudoAxesAxisAttrib::is_allowed(Tango::DeviceImpl
*dev
,Tango::AttReqType type
)
48 if (dev
->get_state() == Tango::FAULT
||
49 dev
->get_state() == Tango::ALARM
)
50 if (type
== Tango::READ_REQ
)