Tango Core Classes Reference  9.3.4
Tango::Group Class Reference

High level class allowing the user to handle Tango group. More...

#include "tango.h"

Inherits Tango::GroupElement.

Public Member Functions

Constructor and destructor
 Group (const std::string &name)
 Create a Group instance. More...
 
virtual ~Group ()
 Create a Group instance. More...
 

Group management related methods

virtual void add (Group *group, int tmo_ms=-1)
 Attaches a (sub) group. More...
 
virtual void add (const std::string &pattern, int tmo_ms=-1)
 Attaches any device which name matches the specified pattern. More...
 
virtual void add (const std::vector< std::string > &patterns, int tmo_ms=-1)
 Attaches any device which name matches one of the specified pattern. More...
 
virtual void remove (const std::string &pattern, bool fwd=true)
 Removes any group or device which name matches the specified pattern. More...
 
virtual void remove (const std::vector< std::string > &patterns, bool fwd=true)
 Removes any group or device which name matches any of the specified patterns. More...
 
virtual void remove_all ()
 Removes all elements in the group. More...
 
virtual bool contains (const std::string &pattern, bool fwd=true)
 Check if the hierarchy contains groups and/or devices which name matches the specified pattern. More...
 
virtual DeviceProxyget_device (const std::string &device_name)
 Returns a reference to the specified device. More...
 
virtual DeviceProxyget_device (long idx)
 Returns a reference to the "idx-th" device in the hierarchy. More...
 
virtual DeviceProxyoperator[] (long idx)
 Returns a reference to the "idx-th" device in the hierarchy. More...
 
virtual Groupget_group (const std::string &group_name)
 Returns a reference to the specified group. More...
 
long get_size (bool fwd=true)
 Return the number of devices in the hierarchy. More...
 
std::vector< std::string > get_device_list (bool fwd=true)
 Returns the list of devices currently in the hierarchy. More...
 

a la Deviceproxy interface

virtual bool ping (bool fwd=true)
 Ping all devices in a group. More...
 
virtual void set_timeout_millis (int tmo_ms)
 Set client side timeout for all devices in the group. More...
 
GroupCmdReplyList command_inout (const std::string &c, bool fwd=true)
 Executes a Tango command on a group. More...
 
GroupCmdReplyList command_inout (const std::string &c, const DeviceData &d, bool fwd=true)
 Executes a Tango command with the same input data on a group. More...
 
GroupCmdReplyList command_inout (const std::string &c, const std::vector< DeviceData > &d, bool fwd=true)
 Executes a Tango command with the different input data on a group (Using DeviceData class instances) More...
 
template<typename T >
GroupCmdReplyList command_inout (const std::string &c, const std::vector< T > &d, bool fwd=true)
 Executes a Tango command with the different input data on a group. More...
 
long command_inout_asynch (const std::string &c, bool fgt=false, bool fwd=true)
 Executes a Tango command on each device in the group asynchronously. More...
 
long command_inout_asynch (const std::string &c, const DeviceData &d, bool fgt=false, bool fwd=true)
 Executes a Tango command with same input data on each device in the group asynchronously. More...
 
long command_inout_asynch (const std::string &c, const std::vector< DeviceData > &d, bool fgt=false, bool fwd=true)
 Executes a Tango command with different input data (using DeviceData object) on each device in the group asynchronously. More...
 
template<typename T >
long command_inout_asynch (const std::string &c, const std::vector< T > &d, bool fgt=false, bool fwd=true)
 Executes a Tango command with different input data on each device in the group asynchronously. More...
 
GroupCmdReplyList command_inout_reply (long req_id, long tmo_ms=0)
 Returns the results of an asynchronous command. More...
 
GroupAttrReplyList read_attribute (const std::string &a, bool fwd=true)
 Reads an attribute on each device in the group. More...
 
GroupAttrReplyList read_attributes (const std::vector< std::string > &al, bool fwd=true)
 Reads several attributes on each device in the group. More...
 
long read_attribute_asynch (const std::string &a, bool fwd=true)
 Reads an attribute on each device in the group asynchronously. More...
 
long read_attributes_asynch (const std::vector< std::string > &al, bool fwd=true)
 Reads several attributes on each device in the group asynchronously. More...
 
GroupAttrReplyList read_attribute_reply (long req_id, long tmo_ms=0)
 Returns the results of an asynchronous attribute reading. More...
 
GroupAttrReplyList read_attributes_reply (long req_id, long tmo_ms=0)
 Returns the results of an asynchronous attributes reading. More...
 
GroupReplyList write_attribute (const DeviceAttribute &d, bool fwd=true)
 Writes an attribute on each device in the group. More...
 
GroupReplyList write_attribute (const std::vector< DeviceAttribute > &d, bool fwd=true)
 Writes several attributes on each device in the group (using DeviceAttribute) More...
 
template<typename T >
GroupReplyList write_attribute (const std::string &n, const std::vector< T > &d, bool fwd=true)
 Writes one attributes on each device in the group with specific value per device. More...
 
long write_attribute_asynch (const DeviceAttribute &d, bool fwd=true)
 Writes an attribute on each device in the group asynchronously. More...
 
long write_attribute_asynch (const std::vector< DeviceAttribute > &d, bool fwd=true)
 Writes several attributes on each device in the group asynchronously. More...
 
template<typename T >
long write_attribute_asynch (const std::string &a, const std::vector< T > &d, bool fwd=true)
 Writes an attribute on each device in the group asynchronously (Without DeviceAttribute data) More...
 
GroupReplyList write_attribute_reply (long req_id, long tmo_ms=0)
 Returns the acknowledgements of an asynchronous attribute writing. More...
 

Detailed Description

High level class allowing the user to handle Tango group.

$Author$ $Revision$

Constructor & Destructor Documentation

◆ Group()

Tango::Group::Group ( const std::string &  name)

Create a Group instance.

Instanciate an empty group. The group name allows retrieving a sub-group in the hierarchy.

Parameters
nameThe group name

◆ ~Group()

virtual Tango::Group::~Group ( )
virtual

Create a Group instance.

Delete a group and all its elements. Be aware that a group always gets the ownership of its children and deletes themwhen it is itself deleted. Therefore, never try to delete a Group (respectively a DeviceProxy) returned by a call to Tango::Group::get_group() (respectively to Tango::Group::get_device()). Use the Tango::Group::remove() method instead.

Member Function Documentation

◆ add() [1/3]

virtual void Tango::Group::add ( const std::string &  pattern,
int  tmo_ms = -1 
)
virtual

Attaches any device which name matches the specified pattern.

The pattern parameter can be a simple device name or a device name pattern (e.g. domain_* / family/ member_*). This method first asks to the Tango database the list of device names matching the pattern. Devices are then attached to the group in the order in which they are returned by the database. Any device already present in the hierarchy (i.e. a device belonging to the group or to one of its subgroups) is silently ignored but its client side timeout is set to timeout_ms milliseconds if timeout_ms is different from -1. Set the client side timeout of each device matching the specified pattern to timeout_ms milliseconds if timeout_ms is different from -1.

Parameters
[in]patternThe device selection pattern
[in]tmo_msThe timeout value

◆ add() [2/3]

virtual void Tango::Group::add ( const std::vector< std::string > &  patterns,
int  tmo_ms = -1 
)
virtual

Attaches any device which name matches one of the specified pattern.

The patterns parameter can be an array of device names and/or device name patterns. Thismethod first asks to the Tango database the list of device namesmatching one the patterns. Devices are then attached to the group in the order in which they are returned by the database. Any device already present in the hierarchy (i.e. a device belonging to the group or to one of its subgroups), is silently ignored but its client side timeout is set to timeout_ms milliseconds if timeout_ms is different from -1. If timeout_ms is different from -1, the client side timeouts of all devices matching the specified patterns are set to timeout_ms milliseconds.

Parameters
[in]patternsThe device selection pattern list
[in]tmo_msThe timeout value

◆ add() [3/3]

virtual void Tango::Group::add ( Group group,
int  tmo_ms = -1 
)
virtual

Attaches a (sub) group.

Be aware that a group always gets the ownership of its children and deletes them when it is itself deleted. Therefore, never try to delete a Group attached to a Group. Use the Group::remove() method instead. If timeout_ms parameter is different from -1, the client side timeout associated to each device composing the group added is set to timeout_ms milliseconds. If timeout_ms is -1, timeouts are not changed. This method does nothing if the specified group is already attached (i.e. it is silently ignored) and timeout_ms = -1. If the specified group is already attached and timeout_ms is different from -1, the client side timeout of each device composing the group given in parameter is set to timeout_ms milliseconds.

Parameters
[in]groupThe group to be attached
[in]tmo_msThe timeout value

◆ command_inout() [1/4]

GroupCmdReplyList Tango::Group::command_inout ( const std::string &  c,
bool  fwd = true 
)

Executes a Tango command on a group.

Executes a Tango command on a group. This method is synchronous and does not return until replies are obtained or timeouts occurred. The parameter c is the name of the command. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Command results are returned in a GroupCmdReplyList. See Obtaining command result for details (Chapter 4.7.3.1 in Tango book). See also Case 1 of executing a command (Chapter 4.7.3.2 in Tango book) for an example.

Parameters
[in]cThe command name
[in]fwdThe forward flag
Returns
The group command result

◆ command_inout() [2/4]

GroupCmdReplyList Tango::Group::command_inout ( const std::string &  c,
const DeviceData d,
bool  fwd = true 
)

Executes a Tango command with the same input data on a group.

Executes a Tango command on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. The parameter c is the name of the command. The second parameter d is a Tango generic container for command carrying the command argument. See the Tango::DeviceData documentation. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Command results are returned in a GroupCmdReplyList. See Obtaining command results (Chapter 4.7.3.1 in Tango book) for details. See also Case 2 of executing a command (Chapter 4.7.3.4 in Tango book) for an example.

Parameters
[in]cThe command name
[in]dThe command data
[in]fwdThe forward flag
Returns
The group command result

◆ command_inout() [3/4]

GroupCmdReplyList Tango::Group::command_inout ( const std::string &  c,
const std::vector< DeviceData > &  d,
bool  fwd = true 
)

Executes a Tango command with the different input data on a group (Using DeviceData class instances)

Executes a Tango command on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. This implementation of command_inout allows passing a specific input argument to each device in the group. In order to use this form of command_inout, the user must have an "a priori" and "perfect" knowledge of the devices order in the group.
The parameter c is the name of the command. The std::vector d contains a specific argument value for each device in the group. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the argument values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Command results are returned in a GroupCmdReplyList. See Obtaining command results (Chpater 4.7.3.1 in Tango book) for details. See also Case 3 of executing a command (Chapter 4.7.3.5 in Tango book) for an example of this special form of command_inout.

Parameters
[in]cThe command name
[in]dThe command data
[in]fwdThe forward flag
Returns
The group command result

◆ command_inout() [4/4]

template<typename T >
GroupCmdReplyList Tango::Group::command_inout ( const std::string &  c,
const std::vector< T > &  d,
bool  fwd = true 
)

Executes a Tango command with the different input data on a group.

Executes a Tango command on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. This implementation of command_inout allows passing a specific input argument to each device in the group. In order to use this form of command_inout, the user must have an "a priori" and "perfect" knowledge of the devices order in the group.
The parameter c is the name of the command. The std::vector d contains a specific argument value for each device in the group. Since this method is a template, d is able to contain any Tango command argument type. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the argument values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Command results are returned in a GroupCmdReplyList. See Obtaining command results (Chpater 4.7.3.1 in Tango book) for details. See also Case 3 of executing a command (Chapter 4.7.3.5 in Tango book) for an example of this special form of command_inout.

Template Parameters
TThe command input data type
Parameters
[in]cThe command name
[in]dThe command data
[in]fwdThe forward flag
Returns
The group command result

◆ command_inout_asynch() [1/4]

long Tango::Group::command_inout_asynch ( const std::string &  c,
bool  fgt = false,
bool  fwd = true 
)

Executes a Tango command on each device in the group asynchronously.

Executes a Tango command on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::command_inout_reply() to obtain the results. The parameter c is the name of the command. The parameter fgt is a fire and forget flag. If set to true, it means that no reply is expected (i.e. the caller does not care about it and will not even try to get it). A false default value is provided. If the parameter fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 1 of Executing a command (Chapter 4.7.3.2 in Tango book) for an example.

Parameters
[in]cThe command name
[in]fgtThe command data
[in]fwdThe forward flag
Returns
The call identifier

◆ command_inout_asynch() [2/4]

long Tango::Group::command_inout_asynch ( const std::string &  c,
const DeviceData d,
bool  fgt = false,
bool  fwd = true 
)

Executes a Tango command with same input data on each device in the group asynchronously.

Executes a Tango command on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::command_inout_reply() to obtain the results. The parameter c is the name of the command. The second parameter d is a Tango generic container for command carrying the command argument. See the Tango::DeviceData documentation for details. The parameter fgt is a fire and forget flag. If set to true, it means that no reply is expected (i.e. the caller does not care about it and will not even try to get it). A false default value is provided. If the parameter fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 2 of Executing a command (Chapter 4.7.3.4 in Tango book) for an example.

Parameters
[in]cThe command name
[in]dThe command input data
[in]fgtThe command data
[in]fwdThe forward flag
Returns
The call identifier

◆ command_inout_asynch() [3/4]

long Tango::Group::command_inout_asynch ( const std::string &  c,
const std::vector< DeviceData > &  d,
bool  fgt = false,
bool  fwd = true 
)

Executes a Tango command with different input data (using DeviceData object) on each device in the group asynchronously.

Executes a Tango command on each device in the group asynchronously. The method send the request to all devices and return immediately. Pass the returned request id to Group::command_inout_reply to obtain the results. This implementation of command_inout allows passing a specific input argument to each device in the group. In order to use this form of command_inout_asynch, the user must have an "a priori" and "perfect" knowledge of the devices order in the group. The parameter c is the name of the command. The std::vector d contains a specific argument value for each device in the group. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the argument values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). The parameter fgt is a fire and forget flag. If set to true, it means that no reply is expected (i.e. the caller does not care about it and will not even try to get it). A false default value is provided. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 3 of Executing a command (Chapter 4.7.3.5 in Tango book) for an example of this special form of command_inout.

Parameters
[in]cThe command name
[in]dThe command input data
[in]fgtThe command data
[in]fwdThe forward flag
Returns
The call identifier

◆ command_inout_asynch() [4/4]

template<typename T >
long Tango::Group::command_inout_asynch ( const std::string &  c,
const std::vector< T > &  d,
bool  fgt = false,
bool  fwd = true 
)

Executes a Tango command with different input data on each device in the group asynchronously.

Executes a Tango command on each device in the group asynchronously. The method send the request to all devices and return immediately. Pass the returned request id to Group::command_inout_reply to obtain the results. This implementation of command_inout allows passing a specific input argument to each device in the group. In order to use this form of command_inout_asynch, the user must have an "a priori" and "perfect" knowledge of the devices order in the group. The parameter c is the name of the command. The std::vector d contains a specific argument value for each device in the group. Since it's a template data type, d is able to contain any Tango command argument type. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the argument values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). The parameter fgt is a fire and forget flag. If set to true, it means that no reply is expected (i.e. the caller does not care about it and will not even try to get it). A false default value is provided. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 3 of Executing a command (Chapter 4.7.3.5 in Tango book) for an example of this special form of command_inout.

Template Parameters
TThe command input data type
Parameters
[in]cThe command name
[in]dThe command input data
[in]fgtThe command data
[in]fwdThe forward flag
Returns
The call identifier

◆ command_inout_reply()

GroupCmdReplyList Tango::Group::command_inout_reply ( long  req_id,
long  tmo_ms = 0 
)

Returns the results of an asynchronous command.

Returns the results of an asynchronous command. The first parameter req_id is a request identifier previously returned by one of the command_inout_asynch methods. For each device in the hierarchy, if the command result is not yet available, command_inout_replywait timeout_ms milliseconds before throwing an exception. This exception will be part of the global reply. If timeout_ms is set to 0, command_inout_reply waits "indefinitely". Command results are returned in a GroupCmdReplyList. See Obtaining command results (Chapter 4.7.3.1 in Tango book) for details.

Parameters
[in]req_idThe request identifier
[in]tmo_msThe timeout value
Returns
The group command result

◆ contains()

virtual bool Tango::Group::contains ( const std::string &  pattern,
bool  fwd = true 
)
virtual

Check if the hierarchy contains groups and/or devices which name matches the specified pattern.

Returns true if the hierarchy contains groups and/or devices which name matches the specified pattern. Returns false otherwise. The pattern can be a fully qualified or simple group name, a device name or a device name pattern. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of elements.

Parameters
[in]patternThe device selection pattern
[in]fwdThe forward flag
Returns
True if the hierarchy contains the element

◆ get_device() [1/2]

virtual DeviceProxy* Tango::Group::get_device ( const std::string &  device_name)
virtual

Returns a reference to the specified device.

Returns a reference to the specified device or NULL if there is no device by that name in the group. This method may throw an exception in case the specified device belongs to the group but can’t be reached (not registered, down...). See example below. See also the Tango::DeviceProxy class documentation for details.

try
{
Tango::DeviceProxy *dp = g->get_device("my/device/01");
if (dp == 0)
{
// my/device/01 does not belongs to the group
}
}
catch (const Tango::DevFailed &df)
{
// my/device/01 belongs to the group but can’t be reached
}

The request is systematically forwarded to subgroups (i.e. if no device named device_name could be found in the local set of devices, the request is forwarded to subgroups). Be aware that a group always gets the ownership of its children and deletes them when it is itself deleted. Therefore, never try to delete a DeviceProxy returned by the Group::get_device()method. Use the Tango::Group::remove() method instead.

Parameters
[in]device_nameThe device name
Returns
True if the hierarchy contains the element

◆ get_device() [2/2]

virtual DeviceProxy* Tango::Group::get_device ( long  idx)
virtual

Returns a reference to the "idx-th" device in the hierarchy.

Returns a reference to the "idx-th" device in the hierarchy or NULL if the hierarchy contains less than "idx" devices. This method may throw an exception in case the specified device belongs to the group but can’t be reached (not registered, down...). See previous example. See also the Tango::DeviceProxy class documentation for details. The request is systematically forwarded to subgroups (i.e. if the local set of devices contains less than "idx" devices, the request is forwarded to subgroups). Be aware that a group always gets the ownership of its children and deletes them when it is itself deleted. Therefore, never try to delete a DeviceProxy returned by the Group::get_device()method. Use the Tango::Group::remove() method instead.

Parameters
[in]idxThe device name
Returns
device reference

◆ get_device_list()

std::vector<std::string> Tango::Group::get_device_list ( bool  fwd = true)

Returns the list of devices currently in the hierarchy.

Returns the list of devices currently in the hierarchy. If fwd is set to true (the default) the request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Considering the following hierarchy:

g2->add("my/device/04"); g2->add("my/device/05");
g4->add("my/device/08"); g4->add("my/device/09");
g3->add("my/device/06");
g3->addg(g4);
g3->add("my/device/07");
g1->add("my/device/01");
g1->add(g2);
g1->add("my/device/03");
g1->add(g3);
g1->add("my/device/02");

The returned vector content depends on the value of the forward option. If set to true, the results will be organized as follows:

std::vector<std::string> dl = g1->get_device_list(true);

dl[0] contains "my/device/01" which belongs to g1
dl[1] contains "my/device/04" which belongs to g1.g2
dl[2] contains "my/device/05" which belongs to g1.g2
dl[3] contains "my/device/03" which belongs to g1
dl[4] contains "my/device/06" which belongs to g1.g3
dl[5] contains "my/device/08" which belongs to g1.g3.g4
dl[6] contains "my/device/09" which belongs to g1.g3.g4
dl[7] contains "my/device/07" which belongs to g1.g3
dl[8] contains "my/device/02" which belongs to g1

If the forward option is set to false, the results are:

std::vector<std::string> dl = g1->get_device_list(false);

dl[0] contains "my/device/01" which belongs to g1
dl[1] contains "my/device/03" which belongs to g1
dl[2] contains "my/device/02" which belongs to g1

Parameters
[in]fwdThe forward flag
Returns
group size

◆ get_group()

virtual Group* Tango::Group::get_group ( const std::string &  group_name)
virtual

Returns a reference to the specified group.

Returns a reference to the specified group or NULL if there is no group by that name. The group_name can be a fully qualified name. Considering the following group:

-> gauges
   | -> cell-01
   |     | -> penning
   |     |     | -> ...
   |     | -> pirani
   |     |     | -> ...
   | -> cell-02
   |     | -> penning
   |     |     | -> ...
   |     | -> pirani
   |     |     | -> ...
   | -> cell-03
   |     | -> ...

A call to gauges->get_group("penning") returns the first group named "penning" in the hierarchy (i.e. gauges.cell-01.penning)while gauges->get_group("gauges.cell-02.penning”) returns the specified group. The request is systematically forwarded to subgroups (i.e. if no group named group_name could be found in the local set of elements, the request is forwarded to subgroups). Be aware that a group always gets the ownership of its children and deletes them when it is itself deleted. Therefore, never try to delete a Group returned by the Group::get_group() method. Use the Tango::Group::remove() method instead.

Parameters
[in]group_nameThe group name
Returns
group pointer

◆ get_size()

long Tango::Group::get_size ( bool  fwd = true)

Return the number of devices in the hierarchy.

Return the number of devices in the hierarchy (respectively the number of device in the group) if the forward option is set to true (respectively set to false)

Parameters
[in]fwdThe forward flag
Returns
group size

◆ operator[]()

virtual DeviceProxy* Tango::Group::operator[] ( long  idx)
virtual

Returns a reference to the "idx-th" device in the hierarchy.

Returns a reference to the "idx-th" device in the hierarchy or NULL if the hierarchy contains less than "idx" devices. See the Tango::DeviceProxy class documentation for details. The request is systematically forwarded to subgroups (i.e. if the local set of devices contains less than "idx" devices, the request is forwarded to subgroups). Be aware that a group always gets the ownership of its children and deletes them when it is itself deleted. Therefore, never try to delete a DeviceProxy returned by the Group::get_device()method. Use the Tango::Group::remove() method instead.

Parameters
[in]idxThe device name
Returns
device reference

◆ ping()

virtual bool Tango::Group::ping ( bool  fwd = true)
virtual

Ping all devices in a group.

Ping all devices in a group. This method returns true if all devices in the group are alive, false otherwise. If fwd is set to true (the default), the request is also forwarded to subgroups. Otherwise, it is only applied to the local set of devices.

Parameters
[in]fwdThe forward flag
Returns
True if all devices are alive

◆ read_attribute()

GroupAttrReplyList Tango::Group::read_attribute ( const std::string &  a,
bool  fwd = true 
)

Reads an attribute on each device in the group.

Reads an attribute on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. The parameter a is the name of the attribute to read. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Attribute values are returned in a GroupAttrReplyList. See Obtaining attribute values (Chapter 4.7.4.1 in Tango book) for details. See also Reading an attribute (Chapter 4.7.4 in Tango book) for an example.

Parameters
[in]aThe attribute name
[in]fwdThe forward flag
Returns
The group attribute data

◆ read_attribute_asynch()

long Tango::Group::read_attribute_asynch ( const std::string &  a,
bool  fwd = true 
)

Reads an attribute on each device in the group asynchronously.

Reads an attribute on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::read_attribute_reply() to obtain the results. The parameter a is the name of the attribute to read. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. The last parameter (rsv) is reserved for internal purpose and should not be modify. It may disappear in a near future. See Reading an attribute (Chapter 4.7.4 in Tango book) for an example.

Parameters
[in]aThe attribute name
[in]fwdThe forward flag
Returns
The call identifier

◆ read_attribute_reply()

GroupAttrReplyList Tango::Group::read_attribute_reply ( long  req_id,
long  tmo_ms = 0 
)

Returns the results of an asynchronous attribute reading.

Returns the results of an asynchronous attribute reading. The first parameter req_id is a request identifier previously returned by read_attribute_asynch. For each device in the hierarchy, if the attribute value is not yet available, read_attribute_reply wait timeout_ms milliseconds before throwing an exception. This exception will be part of the global reply. If timeout_ms is set to 0, read_attribute_reply waits "indefinitely". Replies are returned in a GroupAttrReplyList. See Obtaining attribute values (Chapter 4.7.4.1 in Tango book) for details

Parameters
[in]req_idThe attribute name list
[in]tmo_msThe timeout value
Returns
The group attribute data

◆ read_attributes()

GroupAttrReplyList Tango::Group::read_attributes ( const std::vector< std::string > &  al,
bool  fwd = true 
)

Reads several attributes on each device in the group.

Reads several attributes on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. The parameter al is the list of attributes to be read. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Attribute values are returned in a GroupAttrReplyList. See Obtaining attribute values (Chapter 4.7.4.1 in Tango book) for details. See also Reading an attribute (Chapter 4.7.4 in Tango book) for an example.

Parameters
[in]alThe attribute name list
[in]fwdThe forward flag
Returns
The group attribute data

◆ read_attributes_asynch()

long Tango::Group::read_attributes_asynch ( const std::vector< std::string > &  al,
bool  fwd = true 
)

Reads several attributes on each device in the group asynchronously.

Reads several attribute on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::read_attribute_reply() to obtain the results. The parameter a is the name of the attribute to read. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. The last parameter (rsv) is reserved for internal purpose and should not be modify. It may disappear in a near future. See Reading an attribute (Chapter 4.7.4 in Tango book) for an example.

Parameters
[in]alThe attribute name list
[in]fwdThe forward flag
Returns
The call identifier

◆ read_attributes_reply()

GroupAttrReplyList Tango::Group::read_attributes_reply ( long  req_id,
long  tmo_ms = 0 
)

Returns the results of an asynchronous attributes reading.

Returns the results of an asynchronous attributes reading. The first parameter req_id is a request identifier previously returned by read_attribute_asynch. For each device in the hierarchy, if the attribute value is not yet available, read_attribute_reply wait timeout_ms milliseconds before throwing an exception. This exception will be part of the global reply. If timeout_ms is set to 0, read_attribute_reply waits "indefinitely". Replies are returned in a GroupAttrReplyList. See Obtaining attribute values (Chapter 4.7.4.1 in Tango book) for details

Parameters
[in]req_idThe attribute name list
[in]tmo_msThe timeout value
Returns
The group attribute data

◆ remove() [1/2]

virtual void Tango::Group::remove ( const std::string &  pattern,
bool  fwd = true 
)
virtual

Removes any group or device which name matches the specified pattern.

The pattern parameter can be a group name, a device name or a device name pattern (e.g domain_* /family/member_*). Since we can have groups with the same name in the hierarchy, a group name can be fully qualified to specify which group should be removed. Considering the following group:

 -> gauges
    | -> cell-01
    |     | -> penning
    |     |     | -> ...
    |     | -> pirani
    |     |     | -> ...
    | -> cell-02
    |     | -> penning
    |     |     | -> ...
    |     | -> pirani
    |     |     | -> ...
    | -> cell-03
    |     | -> ...

A call to gauges->remove("penning") will remove any group named "penning" in the hierarchy while gauges->remove("gauges.cell-02.penning") will only remove the specified group. If fwd is set to true (the default), the remove request is also forwarded to subgroups. Otherwise, it is only applied to the local set of elements. For instance, the following code remove any stepper motor in the hierarchy:

root_group->remove("*/stepper_motor/*");
*
Parameters
[in]patternThe device selection pattern
[in]fwdThe forward flag

◆ remove() [2/2]

virtual void Tango::Group::remove ( const std::vector< std::string > &  patterns,
bool  fwd = true 
)
virtual

Removes any group or device which name matches any of the specified patterns.

The patterns parameter can be an array of group names and/or device names and/or device name patterns. Since we can have groups with the same name in the hierarchy, a group name can be fully qualified to specify which group should be removed. See previous method for details. If fwd is set to true (the default), the remove request is also forwarded to subgroups. Otherwise, it is only applied to the local set of elements.

Parameters
[in]patternsThe device selection patterns
[in]fwdThe forward flag

◆ remove_all()

virtual void Tango::Group::remove_all ( )
virtual

Removes all elements in the group.

Removes all elements in the group. After such a call, the group is empty.

◆ set_timeout_millis()

virtual void Tango::Group::set_timeout_millis ( int  tmo_ms)
virtual

Set client side timeout for all devices in the group.

Set client side timeout for all devices composing the group in milliseconds. Any method which takes longer than this time to execute will throw an exception.

Parameters
[in]tmo_msThe timeout value

◆ write_attribute() [1/3]

GroupReplyList Tango::Group::write_attribute ( const DeviceAttribute d,
bool  fwd = true 
)

Writes an attribute on each device in the group.

Writes an attribute on each device in the group. This method is synchronous and does not return until acknowledgements are obtained or timeouts occurred. The first parameter d is a Tango generic container for attribute carrying both the attribute name and the value. See the Tango::DeviceAttribute documentation for details. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Acknowledgements are returned in a GroupReplyList. See Obtaining acknowledgements (Chapter 4.7.5.1 in Tango book) for details. See also Case 1 of Writing an attribute (Chapter 4.7.5.2 in Tango book) for an example.

Parameters
[in]dThe attribute name and value
[in]fwdThe forward flag
Returns
The group reply

◆ write_attribute() [2/3]

template<typename T >
GroupReplyList Tango::Group::write_attribute ( const std::string &  n,
const std::vector< T > &  d,
bool  fwd = true 
)

Writes one attributes on each device in the group with specific value per device.

Writes an attribute on each device in the group. This method is synchronous and does not return until replies are obtained or timeouts occurred. This implementation of write_attribute allows writing a specific value to each device in the group. In order to use this form of write_attribute, the user must have an "a priori" and "perfect" knowledge of the devices order in the group. The parameter a is the name of the attribute. The std::vector d contains a specific value for each device in the group. Since this method is a template, d is able to contain any Tango attribute type. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the attribute values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Acknowledgements are returned in a GroupReplyList. See Obtaining acknowledgements (Chapter 4.7.5.1 in Tango book) for details. See also Case 2 of Writing an attribute (Chapter 4.7.5.3 in Tango book) for an example.

Template Parameters
TThe attribute data type
Parameters
[in]nThe attribute name
[in]dThe attribute names and values
[in]fwdThe forward flag
Returns
The group reply

References write_attribute_reply().

◆ write_attribute() [3/3]

GroupReplyList Tango::Group::write_attribute ( const std::vector< DeviceAttribute > &  d,
bool  fwd = true 
)

Writes several attributes on each device in the group (using DeviceAttribute)

Writes several attributes on each device in the group. This method is synchronous and does not return until acknowledgements are obtained or timeouts occurred. The first parameter d is a vector of Tango generic container for attribute carrying both the attribute name and the value. See the Tango::DeviceAttribute documentation for details. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. Acknowledgements are returned in a GroupReplyList. See Obtaining acknowledgements (Chapter 4.7.5.1 in Tango book) for details. See also Case 2 of Writing an attribute (Chapter 4.7.5.3 in Tango book) for an example.

Parameters
[in]dThe attribute names and values
[in]fwdThe forward flag
Returns
The group reply

◆ write_attribute_asynch() [1/3]

long Tango::Group::write_attribute_asynch ( const DeviceAttribute d,
bool  fwd = true 
)

Writes an attribute on each device in the group asynchronously.

Write an attribute on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::write_attribute_reply() to obtain the acknowledgements. The first parameter d is a Tango generic container for attribute carrying both the attribute name and the value. See the Tango::DeviceAttribute documentation for details. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 1 of Writing an attribute (Chapter 4.7.5.2 in Tango book) for an example.

Parameters
[in]dThe attribute name and value
[in]fwdThe forward flag
Returns
The call identifier

◆ write_attribute_asynch() [2/3]

template<typename T >
long Tango::Group::write_attribute_asynch ( const std::string &  a,
const std::vector< T > &  d,
bool  fwd = true 
)

Writes an attribute on each device in the group asynchronously (Without DeviceAttribute data)

Writes an attribute on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::write_attribute_reply() to obtain the acknowledgements. This implementation of write_attribute_asynch allows writing a specific value to each device in the group. In order to use this form of write_attribute_asynch, the user must have an "a priori" and "perfect" knowledge of the devices order in the group. The parameter a is the name of the attribute. The std::vector d contains a specific value for each device in the group. Since this method is a template, d is able to contain any Tango attribute type. Its size must equal Group::get_size(fwd). Otherwise, an exception is thrown. The order of the attribute values must follows the order of the devices in the group (d[0] => 1st device, d[1] => 2nd device and so on). If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case2 of Writing an attribute (Chapter 4.7.5.3 in Tango book) for an example.

Template Parameters
TThe attribute data type
Parameters
[in]aThe attribute name
[in]dThe attribute value(s)
[in]fwdThe forward flag
Returns
The call identifier

◆ write_attribute_asynch() [3/3]

long Tango::Group::write_attribute_asynch ( const std::vector< DeviceAttribute > &  d,
bool  fwd = true 
)

Writes several attributes on each device in the group asynchronously.

Write several attributes on each device in the group asynchronously. The method sends the request to all devices and returns immediately. Pass the returned request id to Group::write_attribute_reply() to obtain the acknowledgements. The first parameter d is a vector of Tango generic container for attribute carrying both the attribute name and the value. See the Tango::DeviceAttribute documentation for details. If fwd is set to true (the default) request is forwarded to subgroups. Otherwise, it is only applied to the local set of devices. See Case 1 of Writing an attribute (Chapter 4.7.5.2 in Tango book) for an example.

Parameters
[in]dThe attribute name and value
[in]fwdThe forward flag
Returns
The call identifier

◆ write_attribute_reply()

GroupReplyList Tango::Group::write_attribute_reply ( long  req_id,
long  tmo_ms = 0 
)

Returns the acknowledgements of an asynchronous attribute writing.

Returns the acknowledgements of an asynchronous attribute writing. The first parameter req_id is a request identifier previously returned by one of the write_attribute_asynch implementation. For each device in the hierarchy, if the acknowledgement is not yet available, write_attribute_replywait timeout_ms milliseconds before throwing an exception. This exception will be part of the global reply. If timeout_ms is set to 0, write_attribute_reply waits "indefinitely". Acknowledgements are returned in a GroupReplyList. See Obtaining acknowledgements (Chapter 4.7.5.1 in Tango book) for details.

Parameters
[in]req_idThe request identifier
[in]tmo_msThe timeout value
Returns
The attribute writing acknowledgements

Referenced by write_attribute().


The documentation for this class was generated from the following file: