Tango Core Classes Reference  9.3.4
DeviceAttribute Class Reference

Fundamental type for sending an dreceiving data to and from device attributes. More...

#include "tango.h"

Inheritance diagram for DeviceAttribute:

Public Member Functions

Exception and error related methods
void exceptions (bitset< numFlags > fl)
 Set exception flag. More...
 
bitset< numFlags > exceptions ()
 Get exception flag. More...
 
void reset_exceptions (except_flags fl)
 Reset one exception flag. More...
 
void set_exceptions (except_flags fl)
 Set one exception flag. More...
 
bitset< numFlags > state ()
 Get instance extraction state. More...
 
bool has_failed ()
 Check if the call failed. More...
 
const DevErrorList & get_err_stack ()
 Get the error stack. More...
 

Constructors

 DeviceAttribute ()
 Create a DeviceAttribute object. More...
 
 DeviceAttribute (string &name, short val)
 Create a DeviceAttribute object from attribute name and value for scalar attribute. More...
 
 DeviceAttribute (string &name, vector< short > &val)
 Create a DeviceAttribute object from attribute name and value for spectrum attribute. More...
 
 DeviceAttribute (string &name, vector< short > &val, int dim_x, int dim_y)
 Create a DeviceAttribute object from attribute name and value for image attribute. More...
 

Inserters and Extractors

void operator<< (short val)
 Insert attribute data. More...
 
void insert (const char *str, unsigned char *data, unsigned int length)
 Insert attribute data for DevEncoded attribute. More...
 
void insert (vector< short > &datum, int dim_x, int dim_y)
 Insert attribute data for image attribute (from C++ vector) More...
 
void insert (const DevVarShortArray &datum, int dim_x, int dim_y)
 Insert attribute data for image attribute (from CORBA sequence by reference) More...
 
void insert (DevVarShortArray *datum, int dim_x, int dim_y)
 Insert attribute data for image attribute (from CORBA sequence by pointer) More...
 
bool operator>> (short &data)
 Extract attribute data. More...
 
bool extract (const char *&str, unsigned char *&data, unsigned int &length)
 Extract attribute data for DevEncoded attribute. More...
 
bool extract_read (vector< string > &data)
 Extract only read part of attribute data. More...
 
bool extract_set (vector< string > &data)
 Extract only written part of attribute data. More...
 

Miscellaneous methods

bool is_empty ()
 Check is the instance is empty. More...
 
string & get_name ()
 Returns the name of the attribute. More...
 
void set_name (string &na)
 Set attribute name. More...
 
void set_name (const char *na)
 Set attribute name. More...
 
int get_dim_x ()
 Get attribute X dimension. More...
 
int get_dim_y ()
 Get attribute Y dimension. More...
 
int get_written_dim_x ()
 Get the attribute write X dimension. More...
 
int get_written_dim_y ()
 Get the attribute write Y dimension. More...
 
AttributeDimension get_r_dimension ()
 Get the attribute read dimensions. More...
 
AttributeDimension get_w_dimension ()
 Get the attribute write dimensions. More...
 
long get_nb_read ()
 Get the number of read value. More...
 
long get_nb_written ()
 Get the number of written value. More...
 
AttrQuality & get_quality ()
 Get attribute quality factor. More...
 
int get_type ()
 Get attribute data type. More...
 
AttrDataFormat get_data_format ()
 Get attribute data format. More...
 
TimeVal & get_date ()
 Get attribute read date. More...
 

Detailed Description

Fundamental type for sending an dreceiving data to and from device attributes.

This is the fundamental type for sending and receiving data to and from device attributes. The values can be inserted and extracted using the operators << and >> respectively and insert() for mixed data types. There are two ways to check if the extraction operator succeed :

  • 1. By testing the extractor operators return value. All the extractors operator returns a boolean value set to false in case of problem.
  • 2. By asking the DeviceAttribute object to throw exception in case of problem. By default, DeviceAttribute throws exception :
    1. When the user try to extract data and the server reported an error when the attribute was read.
    2. When the user try to extract data from an empty DeviceAttribute

For insertion into DeviceAttribute instance from TANGO CORBA sequence pointers, the DeviceAttribute object takes ownership of the pointed to memory. This means that the pointed to memory will be freed when the DeviceAttribute object is destroyed or when another data is inserted into it. The insertion into DeviceAttribute instance from TANGO CORBA sequence reference copy the data into the DeviceAttribute object.
For extraction into TANGO CORBA sequence types, the extraction method consumes the memory allocated to store the data and it is the caller responsibility to delete this memory.

Author
taurel
Revision
1

Constructor & Destructor Documentation

◆ DeviceAttribute() [1/4]

DeviceAttribute::DeviceAttribute ( )

Create a DeviceAttribute object.

Default constructor. The instance is empty

◆ DeviceAttribute() [2/4]

◆ DeviceAttribute() [3/4]

DeviceAttribute::DeviceAttribute ( string &  name,
vector< short > &  val 
)

◆ DeviceAttribute() [4/4]

DeviceAttribute::DeviceAttribute ( string &  name,
vector< short > &  val,
int  dim_x,
int  dim_y 
)

Create a DeviceAttribute object from attribute name and value for image attribute.

Create a DeviceAttribute object from attribute name and value for image attribute. These constructors have two more parameters allowing the user to define the x and y image dimensions. These constructors exists for the following data type:

Parameters
[in]nameThe attribute name
[in]valThe attribute value
[in]dim_xThe attribute X dimension
[in]dim_yThe attribute Y dimension

Member Function Documentation

◆ exceptions() [1/2]

bitset<numFlags> DeviceAttribute::exceptions ( )
inline

Get exception flag.

Returns the whole exception flags. The following is an example of how to use these exceptions related methods

bitset<DeviceAttribute::numFlags> bs = da.exceptions();
cout << "bs = " << bs << endl;
da.set_exceptions(DeviceAttribute::wrongtype_flag);
bs = da.exceptions();
cout << "bs = " << bs << endl;
Returns
The exception flag

◆ exceptions() [2/2]

void DeviceAttribute::exceptions ( bitset< numFlags >  fl)
inline

Set exception flag.

Is a method which allows the user to switch on/off exception throwing when trying to extract data from a DeviceAttribute object. The following flags are supported :

  • isempty_flag - throw a WrongData exception (reason = API_EmptyDbDatum) if user tries to extract data from an empty DeviceAttribute object. By default, this flag is set
  • wrongtype_flag - throw a WrongData exception (reason = API_IncompatibleArgumentType) if user tries to extract data with a type different than the type used for insertion. By default, this flag is not set
  • failed_flag - throw an exception when the user try to extract data from the DeviceAttribute object and an error was reported by the server when the user try to read the attribute. The type of the exception thrown is the type of the error reported by the server. By default, this flag is set.
  • unknown_format_flag - throw an exception when the user try to get the attribute data format from the DeviceAttribute object when this information is not yet available. This information is available only after the read_attribute call has been sucessfully executed. The type of the exception thrown is WrongData exception (reason = API_EmptyDeviceAttribute). By default, this flag is not set.
Parameters
[in]flThe exception flag

Referenced by Tango::GroupAttrReply::operator>>().

◆ extract()

bool DeviceAttribute::extract ( const char *&  str,
unsigned char *&  data,
unsigned int &  length 
)

Extract attribute data for DevEncoded attribute.

Extract attribute data when the attribute data type is DevEncoded It's the user responsability to release the memory pointed to by the two pointers method parameter.
Similar method with following signature also exist extract(string &,vector<unsigned char> &);
See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[out]strThe DevEncoded string
[out]dataThe DevEncoded data pointer
[out]lengthThe DevEncoded data length
Exceptions
WrongDataif requested, DevFailed from device

◆ extract_read()

bool DeviceAttribute::extract_read ( vector< string > &  data)

Extract only read part of attribute data.

Extract methods to extract only the read value of an attribute into a C++ vector. The dimension of the read value can be read by using the methods get_dim_x() and get_dim_y() or get_r_dimension(). The methods use the same return values as the extraction operators with exceptions triggered by the exception flags. This method exist for the following data type:

  • bool DeviceAttribute::extract_read (vector<bool>&);
  • bool DeviceAttribute::extract_read (vector<short>&);
  • bool DeviceAttribute::extract_read (vector<DevLong>&);
  • bool DeviceAttribute::extract_read (vector<DevLong64>&);
  • bool DeviceAttribute::extract_read (vector<float>&);
  • bool DeviceAttribute::extract_read (vector<double>&);
  • bool DeviceAttribute::extract_read (vector<unsigned char>&);
  • bool DeviceAttribute::extract_read (vector<unsigned short>&);
  • bool DeviceAttribute::extract_read (vector<DevULong>&);
  • bool DeviceAttribute::extract_read (vector<DevULong64>&);
  • bool DeviceAttribute::extract_read (vector<string>&);
  • bool DeviceAttribute::extract_read (vector<DevState>&);
  • bool DeviceAttribute::extract_read(string&, vector<unsigned char> &);

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[out]dataThe attribute data
Exceptions
WrongDataif requested, DevFailed from device

◆ extract_set()

bool DeviceAttribute::extract_set ( vector< string > &  data)

Extract only written part of attribute data.

Extract methods to extract only the set value of an attribute into a C++ vector. The dimension of the set value can be read by using the methods get_written_dim_x() and get_written_dim_y() or get_w_dimension(). The methods use the same return values as the extraction operators with exceptions triggered by the exception flags. This method exist for the following data type:

  • bool DeviceAttribute::extract_set (vector<bool>&);
  • bool DeviceAttribute::extract_set (vector<short>&);
  • bool DeviceAttribute::extract_set (vector<DevLong>&);
  • bool DeviceAttribute::extract_set (vector<DevLong64>&);
  • bool DeviceAttribute::extract_set (vector<float>&);
  • bool DeviceAttribute::extract_set (vector<double>&);
  • bool DeviceAttribute::extract_set (vector<unsigned char>&);
  • bool DeviceAttribute::extract_set (vector<unsigned short>&);
  • bool DeviceAttribute::extract_set (vector<DevULong>&);
  • bool DeviceAttribute::extract_set (vector<DevULong64>&);
  • bool DeviceAttribute::extract_set (vector<string>&);
  • bool DeviceAttribute::extract_set (vector<DevState>&);
  • bool DeviceAttribute::extract_set(string &, vector<unsigned char> &);

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[out]dataThe attribute data
Exceptions
WrongDataif requested, DevFailed from device

◆ get_data_format()

AttrDataFormat DeviceAttribute::get_data_format ( )

Get attribute data format.

Returns the attribute data format. Note that this information is valid only after the call to the device has been executed. Otherwise the FMT_UNKNOWN value of the AttrDataFormat enumeration is returned or an exception is thrown according to the object exception flags.

Returns
The attribute data format

◆ get_date()

TimeVal& DeviceAttribute::get_date ( )
inline

Get attribute read date.

Returns a reference to the time when the attribute was read in server

Returns
The attribute read date

◆ get_dim_x()

int DeviceAttribute::get_dim_x ( )
inline

Get attribute X dimension.

Returns the attribute read x dimension

Returns
The attribute X dimension

◆ get_dim_y()

int DeviceAttribute::get_dim_y ( )
inline

Get attribute Y dimension.

Returns the attribute read y dimension

Returns
The attribute Y dimension

◆ get_err_stack()

const DevErrorList& DeviceAttribute::get_err_stack ( )
inline

Get the error stack.

Returns the error stack reported by the server when the attribute was read. The following is an example of the three available ways to get data out of a DeviceAttribute object

vector<short> attr_data;
try
{
da = device->read_attribute("Attr");
da >> attr_data;
}
catch (DevFailed &e)
{
....
}
------------------------------------------------------------------------
vector<short> attr_data;
da.reset_exceptions(DeviceAttribute::failed_flag);
try
{
da = device->read_attribute("Attr");
}
catch (DevFailed &e)
{
.....
}
if (!(da >> attr_data))
{
DevErrorList &err = da.get_err_stack();
.....
}
else
{
.....
}
----------------------------------------------------------------------
vector<short> attr_data;
try
{
da = device->read_attribute("Attr");
}
catch (DevFailed &e)
{
......
}
if (da.has_failed())
{
DevErrorList &err = da.get_err_stack();
....
}
else
{
da >> attr_data;
}

The first way uses the default behaviour of the DeviceAttribute object which is to throw an exception when the user try to extract data when the server reports an error when the attribute was read. In the second way, the DeviceAttribute object now does not throw "DevFailed" exception any more and the return value of the extractor operator is checked. IN the last case, the attribute data validity is checked before trying to extract them.

Returns
The error stack

◆ get_name()

string& DeviceAttribute::get_name ( )
inline

Returns the name of the attribute.

Returns the name of the attribute

Returns
The attribute name

◆ get_nb_read()

long DeviceAttribute::get_nb_read ( )

Get the number of read value.

Returns the number of read values

Returns
The read value number

◆ get_nb_written()

long DeviceAttribute::get_nb_written ( )

Get the number of written value.

Returns the number of written values. Here is an example of these last methods usage.

vector<short> attr_data;
try
{
da = device->read_attribute("Attr");
da >> attr_data;
}
catch (DevFailed &e)
{
....
}
long read = da.get_nb_read();
long written = da.get_nb_written();
for (long i = 0;i < read;i++)
cout << "Read value " << i+1 << " = " << attr_data[i] << endl;
for (long j = 0; j < written;j++)
cout << "Last written value " << j+1 << " = " << attr_data[j + read] << endl;
Returns
The read value number

◆ get_quality()

AttrQuality& DeviceAttribute::get_quality ( )
inline

Get attribute quality factor.

Returns the quality of the attribute: an enumerate type which can be one of:

  • ATTR_VALID
  • ATTR_INVALID
  • ATTR_ALARM
  • ATTR_CHANGING
  • ATTR_WARNING
Returns
The attribute quality

◆ get_r_dimension()

AttributeDimension DeviceAttribute::get_r_dimension ( )

Get the attribute read dimensions.

Returns the attribute read dimensions

Returns
The attribute read dimensions

◆ get_type()

int DeviceAttribute::get_type ( )

Get attribute data type.

Returns the type of the attribute data.

Returns
The attribute data type

◆ get_w_dimension()

AttributeDimension DeviceAttribute::get_w_dimension ( )

Get the attribute write dimensions.

Returns the attribute write dimensions

Returns
The attribute write dimensions

◆ get_written_dim_x()

int DeviceAttribute::get_written_dim_x ( )
inline

Get the attribute write X dimension.

Returns the attribute write x dimension

Returns
The attribute write X dimension

◆ get_written_dim_y()

int DeviceAttribute::get_written_dim_y ( )
inline

Get the attribute write Y dimension.

Returns the attribute write y dimension

Returns
The attribute write Y dimension

◆ has_failed()

bool DeviceAttribute::has_failed ( )
inline

Check if the call failed.

Returns a boolean set to true if the server report an error when the attribute was read.

Returns
A boolean set to true if the call failed

◆ insert() [1/4]

void DeviceAttribute::insert ( const char *  str,
unsigned char *  data,
unsigned int  length 
)

Insert attribute data for DevEncoded attribute.

Insert attribute data when the attribute data type is DevEncoded
Similar methods with following signature also exist

  • insert(const string &str, vector<unsigned char> &data);
  • insert(const char *str, DevVarCharArray *data);

These three methods do not take ownership of the memory used for the data buffer.
See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[in]strThe DevEncoded string
[in]dataThe DevEncoded data pointer
[in]lengthThe DevEncoded data length
Exceptions
WrongDataif requested

◆ insert() [2/4]

void DeviceAttribute::insert ( const DevVarShortArray &  datum,
int  dim_x,
int  dim_y 
)

Insert attribute data for image attribute (from CORBA sequence by reference)

Insert methods for image attribute and for the following types by reference. These method allow the programmer to define the x and y image dimensions. The following methods are defined :

  • insert(const DevVarBooleanArray &,int, int)
  • insert(const DevVarShortArray &,int, int)
  • insert(const DevVarLongArray &,int, int)
  • insert(const DevVarLong64Array&,int, int)
  • insert(const DevVarFloatArray &,int, int)
  • insert(const DevVarDoubleArray &,int, int)
  • insert(const DevVarUCharArray &,int, int)
  • insert(const DevVarUShortArray &,int, int)
  • insert(const DevVarULongArray &,int, int)
  • insert(const DevVarULong64Array&,int, int)
  • insert(const DevVarStringArray &,int, int)
  • insert(const DevVarStateArray &,int, int)

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[in]datumThe attribute data
[in]dim_xThe attribute X dimension
[in]dim_yThe attribute Y dimension
Exceptions
WrongDataif requested

◆ insert() [3/4]

void DeviceAttribute::insert ( DevVarShortArray *  datum,
int  dim_x,
int  dim_y 
)

Insert attribute data for image attribute (from CORBA sequence by pointer)

Insert methods for image attribute and pointers. The DeviceAttribute object takes ownership of the given memory. These method allow the programmer to define the x and y image dimensions. The following methods are defined :

  • insert(DevVarBooleanArray *, int , int )
  • insert(DevVarShortArray *, int , int )
  • insert(DevVarLongArray *, int , int )
  • insert(DevVarLong64Array *, int, int )
  • insert(DevVarFloatArray *, int , int )
  • insert(DevVarDoubleArray *, int , int )
  • insert(DevVarUCharArray *, int , int )
  • insert(DevVarUShortArray *, int , int )
  • insert(DevVarULongArray *, int , int )
  • insert(DevVarULong64Array *, int, int )
  • insert(DevVarStringArray *, int , int )
  • insert(DevVarStateArray *, int, int)

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[in]datumThe attribute data
[in]dim_xThe attribute X dimension
[in]dim_yThe attribute Y dimension
Exceptions
WrongDataif requested

◆ insert() [4/4]

void DeviceAttribute::insert ( vector< short > &  datum,
int  dim_x,
int  dim_y 
)

Insert attribute data for image attribute (from C++ vector)

Insert methods for the following C++ vector types for image attributes allowing the specification of the x and y image dimensions :

  • insert(vector<bool> &,int, int)
  • insert(vector<short> &,int, int)
  • insert(vector<DevLong>&,int, int)
  • insert(vector<DevLong64>&,int, int)
  • insert(vector<float> &,int, int)
  • insert(vector<double> &,int, int)
  • insert(vector<unsigned char> &,int, int)
  • insert(vector<unsigned short> &,int, int)
  • insert(vector<DevULong>&,int, int)
  • insert(vector<DevULong64>&,int, int)
  • insert(vector<string> &,int, int)
  • insert(vector<DevState> &,int, int)

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[in]datumThe attribute data
[in]dim_xThe attribute X dimension
[in]dim_yThe attribute Y dimension
Exceptions
WrongDataif requested

◆ is_empty()

bool DeviceAttribute::is_empty ( )

Check is the instance is empty.

is_empty() is a boolean method which returns true or false depending on whether the DeviceAttribute object contains data or not. Note that by default, a DeviceAttribute object throws exception if it is empty (See DeviceAttribute::exceptions() method). If you want to use this method, you have to change this default behavior. It can be used to test whether the DeviceAttribute has been initialized or not e.g.

string parity;
DeviceAttribute sl_parity = my_device->read_attribute("parity");
sl_parity.reset_exceptions(DeviceAttribute::isempty_flag);
if (! sl_parity.is_empty())
{
sl_parity >> parity;
}
else
{
cout << " no parity attribute defined for serial line !" << endl;
}
Returns
Boolean set to true if the instance is empty
Exceptions
WrongDataif requested

◆ operator<<()

void DeviceAttribute::operator<< ( short  val)

Insert attribute data.

Special care has been taken to avoid memory copy between the network layer and the user application. Nevertheless, C++ vector types are not the CORBA native type and one copy is unavoidable when using vectors. Using the native TANGO CORBA sequence types in most cases avoid any copy but needs some more care about memory usage.

  • For insertion into DeviceAttribute instance from TANGO CORBA sequence pointers, the DeviceAttribute object takes ownership of the pointed to memory. This means that the pointed to memory will be freed when the DeviceAttribute object is destroyed or when another data is inserted into it.
  • The insertion into DeviceAttribute instance from TANGO CORBA sequence reference copy the data into the DeviceAttribute object.

Insert operators for the following scalar C++ types

  • bool
  • short
  • DevLong
  • DevLong64
  • float
  • double
  • unsigned char
  • unsigned short
  • DevULong
  • DevULong64
  • string
  • DevState
  • DevEncoded
  • DevString
  • const char *

Insert operators for the following C++ vector types for spectrum attributes :

  • vector<bool>
  • vector<short>
  • vector<DevLong>
  • vector<DevLong64>
  • vector<float>
  • vector<double>
  • vector<unsigned char>
  • vector<unsigned short>
  • vector<DevULong>
  • vector<DevULong64>
  • vector<string>
  • vector<DevState>

Insert operators for spectrum attribute and for the following types by pointer (with memory ownership transfert) :

  • DevVarBooleanArray *
  • DevVarShortArray *
  • DevVarLongArray *
  • DevVarLong64Array *
  • DevVarFloatArray *
  • DevVarDoubleArray *
  • DevVarUCharArray *
  • DevVarUShortArray *
  • DevVarULongArray *
  • DevVarULong64Array *
  • DevVarStringArray *
  • DevVarStateArray *

Insert operators for spectrum attribute and for the following types by reference :

  • const DevVarBooleanArray &
  • const DevVarShortArray &
  • const DevVarLongArray &
  • const DevVarLong64Array&
  • const DevVarFloatArray &
  • const DevVarDoubleArray &
  • const DevVarUCharArray &
  • const DevVarUShortArray &
  • const DevVarULongArray &
  • const DevVarULong64Array&
  • const DevVarStringArray &
  • const DevVarStateArray &

Here is an example of creating, inserting and extracting some DeviceAttribute types :

DeviceAttribute my_short, my_long, my_string;
DeviceAttribute my_float_vector, my_double_vector;
string a_string;
short a_short;
DevLong a_long;
vector<float> a_float_vector;
vector<double> a_double_vector;
my_short << 100; // insert a short
my_short >> a_short; // extract a short
my_long << 1000; // insert a long
my_long >> a_long; // extract a DevLong
my_string << string("estas lista a bailar el tango ?"); // insert a string
my_string >> a_string; // extract a string
my_float_vector << a_float_vector // insert a vector of floats
my_float_vector >> a_float_vector; // extract a vector of floats
my_double_vector << a_double_vector; // insert a vector of doubles
my_double_vector >> a_double_vector; // extract a vector of doubles
//
// Extract read and set value of an attribute separately
// and get their dimensions
//
vector<float> r_float_vector, w_float_vector;
my_float_vector.extract_read (r_float_vector) // extract read values
int dim_x = my_float_vector.get_dim_x(); // get x dimension
int dim_y = my_float_vector.get_dim_y(); // get y dimension
my_float_vector.extract_set (w_float_vector) // extract set values
int w_dim_x = my_float_vector.get_written_dim_x(); // get x dimension
int W_dim_y = my_float_vector.get_written_dim_y(); // get y dimension
//
// Example of memory management with TANGO sequence types without memory leaks
//
for (int i = 0;i < 10;i++)
{
DevVarLongArray *out;
try
{
da = device->read_attribute("Attr");
da >> out;
}
catch(DevFailed &e)
{
....
}
cout << "Received value = " << (*out)[0];
delete out;
}
Parameters
[in]valThe attribute value
Exceptions
WrongDataif requested

◆ operator>>()

bool DeviceAttribute::operator>> ( short &  data)

Extract attribute data.

Special care has been taken to avoid memory copy between the network layer and the user application. Nevertheless, C++ vector types are not the CORBA native type and one copy is unavoidable when using vectors. Using the native TANGO CORBA sequence types in most cases avoid any copy but needs some more care about memory usage.

  • For extraction into TANGO CORBA sequence types, the extraction method consumes the memory allocated to store the data and it is the caller responsibility to delete this memory.

Extract operators for the following scalar C++ types

  • bool
  • short
  • DevLong
  • DevLong64
  • float
  • double
  • unsigned char
  • unsigned short
  • DevULong
  • DevULong64
  • string
  • DevState
  • DevEncoded

Extract operators for the following C++ vector types for spectrum and image attributes :

  • vector<bool>
  • vector<short>
  • vector<DevLong>
  • vector<DevLong64>
  • vector<float>
  • vector<double>
  • vector<unsigned char>
  • vector<unsigned short>
  • vector<DevULong>
  • vector<DevULong64>
  • vector<string>
  • vector<DevState>

Extract operators for the following CORBA sequence types with memory consumption :

  • DevVarBooleanArray *
  • DevVarShortArray *
  • DevVarLongArray *
  • DevVarLong64Array *
  • DevVarFloatArray *
  • DevVarDoubleArray *
  • DevVarUCharArray *
  • DevVarUShortArray *
  • DevVarULongArray *
  • DevVarULong64Array *
  • DevVarStringArray *
  • DevVarStateArray *
  • DevVarEncodedArray *

See DeviceAttribute::operator<< for example of inserting and extracting data to/from DeviceAttribute instance

Parameters
[out]dataThe attribute data
Exceptions
WrongDataif requested, DevFailed from device

◆ reset_exceptions()

void DeviceAttribute::reset_exceptions ( except_flags  fl)
inline

Reset one exception flag.

Resets one exception flag

Parameters
[in]flThe exception flag

◆ set_exceptions()

void DeviceAttribute::set_exceptions ( except_flags  fl)
inline

Set one exception flag.

Sets one exception flag. The following is an example of how to use this exceptions related methods

DeviceAttribute da = dev.read_attribute("MyAttr");
da.set_exceptions(DeviceAttribute::wrongtype_flag);
DevLong dl;
try
{
da >> dl;
}
catch (DevFailed &e)
{
....

There is another usage example in the DeviceAttribute::exceptions() method documentation.

Parameters
[in]flThe exception flag

◆ set_name() [1/2]

void DeviceAttribute::set_name ( const char *  na)
inline

Set attribute name.

Set attribute name

Parameters
naThe attribute name

◆ set_name() [2/2]

void DeviceAttribute::set_name ( string &  na)
inline

Set attribute name.

Set attribute name

Parameters
naThe attribute name

◆ state()

bitset<numFlags> DeviceAttribute::state ( )
inline

Get instance extraction state.

Allow the user to find out what was the reason of extraction from DeviceAttribute failure. This method has to be used when exceptions are disabled. Here is an example of how method state() could be used

DeviceAttribute da = ....
bitset<DeviceAttribute::numFlags> bs;
da.exceptions(bs);
DevLong dl;
if ((da >> dl) == false)
{
bitset<DeviceAttribute::numFlags> bs_err = da.state();
if (bs_err.test(DeviceAttribute::isempty_flag) == true)
.....
}
Returns
The error bit set.

The documentation for this class was generated from the following file:
DeviceAttribute::get_nb_written
long get_nb_written()
Get the number of written value.
DeviceAttribute::set_exceptions
void set_exceptions(except_flags fl)
Set one exception flag.
Definition: DeviceAttribute.h:1005
DeviceAttribute::state
bitset< numFlags > state()
Get instance extraction state.
Definition: DeviceAttribute.h:1029
DeviceAttribute::get_dim_x
int get_dim_x()
Get attribute X dimension.
Definition: DeviceAttribute.h:1179
DeviceAttribute::get_dim_y
int get_dim_y()
Get attribute Y dimension.
Definition: DeviceAttribute.h:1187
DeviceAttribute::exceptions
void exceptions(bitset< numFlags > fl)
Set exception flag.
Definition: DeviceAttribute.h:955
DeviceAttribute::get_err_stack
const DevErrorList & get_err_stack()
Get the error stack.
Definition: DeviceAttribute.h:1117
DeviceAttribute::is_empty
bool is_empty()
Check is the instance is empty.
DeviceAttribute
Fundamental type for sending an dreceiving data to and from device attributes.
Definition: DeviceAttribute.h:73
DeviceAttribute::has_failed
bool has_failed()
Check if the call failed.
Definition: DeviceAttribute.h:1037
DeviceAttribute::reset_exceptions
void reset_exceptions(except_flags fl)
Reset one exception flag.
Definition: DeviceAttribute.h:983
DeviceAttribute::get_nb_read
long get_nb_read()
Get the number of read value.
DeviceAttribute::get_written_dim_x
int get_written_dim_x()
Get the attribute write X dimension.
Definition: DeviceAttribute.h:1195
DeviceAttribute::get_written_dim_y
int get_written_dim_y()
Get the attribute write Y dimension.
Definition: DeviceAttribute.h:1203