Tango Core Classes Reference
9.3.4
|
A device pipe blob. More...
#include "tango.h"
Public Member Functions | |
Constructors | |
DevicePipeBlob () | |
Create a DevicePipeBlob object. More... | |
DevicePipeBlob (const string &blob_name) | |
Create a DevicePipeBlob object with name. More... | |
Get/Set methods | |
void | set_name (const string &blob_name) |
Set blob name. More... | |
const string & | get_name () |
Get blob name. More... | |
Inserting data into a DevicePipeBlob | |
DevicePipeBlob & | operator<< (short &datum) |
Insert data into a data blob. More... | |
void | set_data_elt_nb (size_t nb) |
Set blob data element number. More... | |
void | set_data_elt_names (vector< string > &names) |
Set blob data element number and names. More... | |
Extracting data from a DevicePipeBlob | |
DevicePipeBlob & | operator>> (short &datum) |
Extract data from a data blob. More... | |
size_t | get_data_elt_nb () |
Get blob data element number. More... | |
vector< string > | get_data_elt_names () |
Get blob data elements name. More... | |
string | get_data_elt_name (size_t ind) |
Get blob data element name. More... | |
int | get_data_elt_type (size_t ind) |
Get blob data element value type. More... | |
Exception and error related methods 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... | |
bool | has_failed () |
Check insertion/extraction success. More... | |
bitset< numFlags > | state () |
Get instance insertion/extraction state. More... | |
A device pipe blob.
A device pipe blob. A blob is used to pack data to be sent through device pipe
$Author$ $Revision$
DevicePipeBlob::DevicePipeBlob | ( | ) |
Create a DevicePipeBlob object.
Default constructor.
DevicePipeBlob::DevicePipeBlob | ( | const string & | blob_name | ) |
Create a DevicePipeBlob object with name.
Create one instance of the DevicePipeBlob class and set its name
[in] | blob_name | The blob name |
|
inline |
Get exception flag.
Returns the whole exception flags. The following is an example of how to use these exceptions related methods
|
inline |
Set exception flag.
It's a method which allows the user to switch on/off exception throwing when trying to extract data from a DevicePipeBlob object. The following flags are supported :
[in] | fl | The exception flag |
Referenced by Tango::Pipe::exceptions().
string DevicePipeBlob::get_data_elt_name | ( | size_t | ind | ) |
Get blob data element name.
Get the blob data element name for a single data element
[in] | ind | The data element index within the blob |
Referenced by Tango::WPipe::get_data_elt_name().
vector<string> DevicePipeBlob::get_data_elt_names | ( | ) |
Get blob data elements name.
Get the blob data elements name
Referenced by Tango::WPipe::get_data_elt_names().
size_t DevicePipeBlob::get_data_elt_nb | ( | ) |
Get blob data element number.
Get the blob data element number
Referenced by Tango::Pipe::get_data_elt_nb(), and Tango::WPipe::get_data_elt_nb().
int DevicePipeBlob::get_data_elt_type | ( | size_t | ind | ) |
Get blob data element value type.
Get the blob data element value type for a single data element
[in] | ind | The data element index within the blob |
Referenced by Tango::WPipe::get_data_elt_type().
|
inline |
Get blob name.
Get the blob name
Referenced by Tango::Pipe::get_root_blob_name(), and Tango::WPipe::get_root_blob_name().
bool DevicePipeBlob::has_failed | ( | ) |
Check insertion/extraction success.
Allow the user to check if insertion/extraction into/from DevicePipeBlob instance was successfull. This method has to be used when exceptions are disabled.
Referenced by Tango::Pipe::has_failed().
DevicePipeBlob& DevicePipeBlob::operator<< | ( | short & | datum | ) |
Insert data into a data blob.
According to the data to be inserted into the blob data element, several kinds of insetor methods have been implemented. You can insert data from:
When inserting data using a DataElement<T> instance, the data element name is also set. For insertion from TANGO CORBA sequence type pointer, the insertion method consumes the memory allocated to store the data and it will be freed by the Tango layer.
Insert operators for the following scalar C++ types (and DataElement<T>)
Insert operators for the following C++ vector types (and DataElement<T>)
Insert operators for the following CORBA sequence types (and DataElement<T>):
Insert operators for the following CORBA sequence types with memory consumption (and DataElement<T>):
Here is an example of inserting data into a DevicePipeBlob instance. We insert 3 data element into the pipe blob with a DevLong, a vector of doubles and finally an array of 100 unsigned short
The same example of inserting data into a DevicePipeBlob instance when we want to set the data element name.
It is also possible to do the insertion in a third way
[in] | datum | The data to be inserted into the DevicePipeBlob |
WrongData | if requested |
DevicePipeBlob& DevicePipeBlob::operator>> | ( | short & | datum | ) |
Extract data from a data blob.
According to the data inside blob data element, several kinds of extractor methods have been implemented. You can extract data into:
When extracting data using a DataElement<T> instance, the data element name is also returned. For extraction into C++ vector, data are copied into the vector. It is not the case for extraction into TANGO CORBA sequence type. 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 (and DataElement<T>)
Extract operators for the following C++ vector types (and DataElement<T>)
Extract operators for the following CORBA sequence types with memory consumption (and DataElement<T>):
Here is an example of extracting data from a DevicePipeBlob instance. We know that the DevicePipeBlob contains 3 data element with a DevLong, an array of doubles and finally an array of unsigned short
The same example of extracting data from a DevicePipeBlob instance when we want to retrieve the data element name.
It is also possible to do the extraction in a generic way
Note that instead of using DevLong and vector<double> data, the extraction can be done using DataElement<T> instances. In this case, the call to the get_data_elt_name() method becomes useless.
[out] | datum | The blob data |
WrongData | if requested |
|
inline |
Reset one exception flag.
Resets one exception flag
[in] | fl | The exception flag |
Referenced by Tango::Pipe::reset_exceptions().
void DevicePipeBlob::set_data_elt_names | ( | vector< string > & | names | ) |
Set blob data element number and names.
Set the blob data element number and names. The data element number is the number of names in the input parameter.
[in] | names | The blob data element names |
Referenced by Tango::Pipe::set_data_elt_names().
void DevicePipeBlob::set_data_elt_nb | ( | size_t | nb | ) |
Set blob data element number.
Set the blob data element number
[in] | nb | The blob data element number |
Referenced by Tango::Pipe::set_data_elt_nb().
|
inline |
Set one exception flag.
Sets one exception flag. See DevicePipeBlob::exceptions() for a usage example.
[in] | fl | The exception flag |
Referenced by Tango::Pipe::set_exceptions().
|
inline |
Set blob name.
Set the blob name
[in] | blob_name | The blob name |
Referenced by Tango::Pipe::set_root_blob_name().
|
inline |
Get instance insertion/extraction state.
Allow the user to find out what was the reason of insertion/extraction into/from DevicePipeBlob failure. This method has to be used when exceptions are disabled. Here is an example of how methods has_failed() and state() could be used
Referenced by Tango::Pipe::state().