Change label name in forwarded attributes created with yat4tango

Dear all,

I would like to change the default label name of dynamical attributes created with yat4tango:


//Create fwd attr info
yat4tango::ForwardedAttributeInfo dai;
dai.dev = this;
dai.url = attr_url;
dai.lan = attr_name;
dai.rdo= false;

//Create dyn attr manager
dam = new yat4tango::DynamicAttributeManager(this);
dam->add_attribute(dai);

//Try to change the attr label prop (e.g. set to local attr name for example)
Tango::UserDefaultAttrProp attr_prop;
attr_prop.set_label(attr_name.c_str());

Tango::FwdAttr& fwd_attr= static_cast<Tango::FwdAttr&>(this->get_device_class()->get_class_attr()->get_attr(attr_name));
fwd_attr.set_default_properties(attr_prop);

//or as alternatives (not working either…)
//Tango::Attr& attr= this->get_device_class()->get_class_attr()->get_attr(attr_name);
//attr.set_default_properties(attr_prop);

The fwd attribute is created with success but I cannot change the label property which is by default set to the remote attr name.
I would like to do that to have local names in the ATK panel instead of the remote name.
What I'm doing wrong?

Many thanks for your help.

Simone
****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
Hi Simone,
The forwarded attribute implementation provided by yat4tango is considered deprecated since Tango 9. It's still there for backward compatibility. I admit this deprecation should be clearly specified at compilation time. Sorry for that. The feature you're trying to use certainly doesn't exist and will not be added. I definitively recommend to switch to the official Tango implementation.
Cheers,
Nicolas.
Hi Nicolas,

many thanks for the info. I was not aware of the deprecation. It's a pity because, if I understood correctly, yat4tango allows me at present to add forwarded attributes dynamically (with the reported limitations), while Tango9 does not provide this feature yet (see my old post on this). Also for standard attributes I have found the yat4tango approach more flexible than the approach suggested in the Tango How-To section.
Hopefully this feature will be available for the next Tango release.

Thanks again for your support,

Cheers,

Simone
****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
Hi Simone,

The forwarded attribute implementation provided by yat4tango is not as optimized as the Tango one. In the Tango core, the client request is redirected to the actual (i.e. remote) attribute. In yat4tango, we can't act at this level and the request is first executed "locally" then the associated result is forwarded to the client. In clear terms, there's a copy behind the scene. Moreover, this copy is quite slow when you write the forwarded attribute (reading is faster). In short, the implementation is currently not really adapted to the "huge attribute" case.

BTW, the 'lan' field of the yat4tango::ForwardedAttributeInfo stands for 'local attribute name'. It provides you with a way to rename the forwarded attribute - notably when you want to forward the same attribute from several devices of the same class. Thus, using a device property, you san easily control the name of you forwarded attribute(s). Ok, this trick doesn't fix the 'label problem' but should work as a workaround.

N.
Edited 1 year ago
 
Register or login to create to post a reply.