180 likes | 323 Views
TANGO Groups. Tango Groups: Motivations. TANGO groups provide a way to … build logical views of the CS logical sub-systems (vacuum, bpm, …) organize those views hierarchically groups of [groups and devices] control a set of devices as a whole Group interface ~ DeviceProxy interface
E N D
Tango Groups: Motivations • TANGO groups provide a way to … • build logical views of the CS • logical sub-systems (vacuum, bpm, …) • organize those views hierarchically • groups of [groups and devices] • control a set of devices as a whole • Group interface ~ DeviceProxy interface • send and manage asynch. requests on several devices • only one “request id” for the whole group
TangoElement TangoDeviceElement TangoGroup DeviceProxy Tango Groups: Design * 1 1 Custom form of the Gamma & al whole/part design pattern 1
TangoElement TangoDeviceElement TangoGroup DeviceProxy Tango Groups: Design * 1 1 User API 1
Tango Groups: Interface • Group management methods • add, remove, find, contains, … • TANGO methods • sub-set of the DeviceProxy interface • ping • sync. & asynch. version of … • command_inout, read/write_attribute • more needed? • Misc. • get_group by (group or device) name -> Group • get_device by name -> DeviceProxy
Tango Groups: Interface • Group management methods • Add • adding device(s) to a group… • by device name (string) • by device name list (vector<string>) • by device name pattern (string – e.g. */admin/*) • adding a group to a group… • by group ref. (pointer in C++)
Tango Groups: Interface • Group management methods • Remove • removing device(s) from a group… • by device name* (string) • by device name* list (vector<string>) • by device name pattern (string – e.g. */admin/*) • removing a group from a group… • by group name* (string) • the forward option • propagate the request to sub-groups • a ref to the root group is enough ! • * fully qualified name supported • e.g. root.remove(“root.g1.g2.tango/test/1”);
Tango Groups: Interface • Group management methods • Contains -> boolean • does the group or* the whole hierarchy contains a specific group or device? • * forward option: limit search to the group or forward the request to sub-groups • object specified by name • (fully qualified) device name or group name
Tango Groups: Interface • Current implemention allows… - SR-Magnets |- Cell-01 | |- Dipole | | |- ANS-C01/AE/DIP.1 | | |- ANS-C01/AE/DIP.2 | | |- Dipole | | |- … | | | |- Quadrupole | |- … | |- Cell-02 | |- Dipole | | |- ANS-C01/AE/DIP.1 | | |- ANS-C02/AE/DIP.2 | | |- … | | | |- Quadrupole | |- … Stupid but allowed!
Tango Groups: Interface • TANGO methods • command_inout • synch/asynch • command_inout_reply (long req_id) • read_attribute • synch/asynch • read_attribute_reply (long req_id) • write_attribute • synch/asynch • write_attribute_reply (long req_id) • more needed? • use and see !
Tango Groups: Interface • TANGO methods • command_inout: obtaining results? • individual result • class GroupReply • has_error : boolean • DevFailed exception • usefull for other cases • class GroupCmdReply : public GroupReply • DeviceData
Tango Groups: Interface • TANGO methods • command_inout: obtaining results? • group result • Class GroupCmdReplyList • has_error : boolean • reset() • std::vector<GroupCmdReply>
Tango Groups: Interface • TANGO methods • read_attribute: obtaining results? • individual result • class GroupReply (previously defined) • has_error : boolean • DevFailed exception • class GroupAttrReply : public GroupReply • DeviceAttribute
Tango Groups: Interface • TANGO methods • read_attribute: obtaining results? • group result • Class GroupAttrReplyList • has_error : boolean • reset() • std::vector<GroupAttrReply>
Tango Groups: Interface • TANGO methods • write_attribute: obtaining results? • individual result • class GroupReply (previously defined) • has_error : boolean • DevFailed exception
Tango Groups: Interface • TANGO methods • write_attribute: obtaining results? • group result • Class GroupReplyList • has_error : boolean • reset() • std::vector<GroupReply>
Tango Groups: done & todo’s • Done… • C++ prototype and test • Tango API : group.h & group.cpp • To Do… • Java implementation • Planned for August 2003
Tango Groups: Interface • A C++ example Tango::Group* g2 = new Tango::Group(“admin“); g2->add(“*/admin/*“); Tango::Group* g1 = new Tango::Group(“root“); g1->add(g2); g1->add(new Tango::Group(“dserver“)); g1->get_group(“dserver“)->add((“dserver/*“); long request_id = g1->command_inout_asynch("Status"); do_some_work(); Tango::GroupCmdReplyList crl = g1->command_inout_reply(request_id); if (crl.has_error) { cout << "at least one error occured" << endl; for (r = 0; r < crl.size(); r++) { if (crl[r].has_error == true) { cout << crl[r].obj_name << " failed for " << crl[r].dev_name << endl; cout << "error: " << crl[r].exception.errors[0].desc.in() << endl; } } } crl.reset();