Tango Core Classes Reference  9.3.3
Tango::DevicePipe Class Reference

Fundamental type for sending/receiving data from device pipes. More...

#include "tango.h"

Public Member Functions

Constructors
 DevicePipe ()
 Create a DevicePipe object. More...
 
 DevicePipe (const string &pipe_name)
 Create a DevicePipe object with name. More...
 
 DevicePipe (const string &pipe_name, const string &root_blob_name)
 Create a DevicePipe object with name and root blob name. More...
 
Get/Set methods
void set_name (const string &pipe_name)
 Set pipe name. More...
 
const string & get_name ()
 Get pipe name. More...
 
void set_root_blob_name (const string &root_blob_name)
 Set root blob name. More...
 
const string & get_root_blob_name ()
 Get root blob name. More...
 
Inserting data into a DevicePipe
DevicePipeoperator<< (short &datum)
 Insert data into a device pipe. 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 DevicePipe
DevicePipeoperator>> (short &datum)
 Extract data from a device pipe. More...
 
size_t get_data_elt_nb ()
 Get root blob data element number. More...
 
vector< string > get_data_elt_names ()
 Get root blob data elements name. More...
 
string get_data_elt_name (size_t ind)
 Get root blob data element name. More...
 
int get_data_elt_type (size_t ind)
 Get root blob data element value type. More...
 
Exception and error related methods methods
void exceptions (bitset< DevicePipeBlob::numFlags > fl)
 Set exception flag. More...
 
bitset< DevicePipeBlob::numFlags > exceptions ()
 Get exception flag. More...
 
void reset_exceptions (DevicePipeBlob::except_flags fl)
 Reset one exception flag. More...
 
void set_exceptions (DevicePipeBlob::except_flags fl)
 Set one exception flag. More...
 
bool has_failed ()
 Check insertion/extraction success. More...
 
bitset< DevicePipeBlob::numFlags > state ()
 Get instance insertion/extraction state. More...
 

Friends

ostream & operator<< (ostream &str, DevicePipe &dd)
 Print a DevicePipe instance. More...
 

Detailed Description

Fundamental type for sending/receiving data from device pipes.

This is the fundamental type for sending/receiving data to/from device pipe.

$Author$ $Revision$

Constructor & Destructor Documentation

◆ DevicePipe() [1/3]

Tango::DevicePipe::DevicePipe ( )

Create a DevicePipe object.

Default constructor. The instance is empty

◆ DevicePipe() [2/3]

Tango::DevicePipe::DevicePipe ( const string &  pipe_name)

Create a DevicePipe object with name.

Create one instance of the DevicePipe class and set its name

Parameters
[in]pipe_nameThe pipe name

◆ DevicePipe() [3/3]

Tango::DevicePipe::DevicePipe ( const string &  pipe_name,
const string &  root_blob_name 
)

Create a DevicePipe object with name and root blob name.

Create one instance of the DevicePipe class and set its name and its root blob name

Parameters
[in]pipe_nameThe pipe name
[in]root_blob_nameThe root blob name

Member Function Documentation

◆ exceptions() [1/2]

bitset<DevicePipeBlob::numFlags> Tango::DevicePipe::exceptions ( )
inline

Get exception flag.

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

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

◆ exceptions() [2/2]

void Tango::DevicePipe::exceptions ( bitset< DevicePipeBlob::numFlags >  fl)
inline

Set exception flag.

It's a method which allows the user to switch on/off exception throwing when trying to insert/extract data from a DevicePipe object. The following flags are supported :

  • isempty_flag - throw a WrongData exception (reason = API_EmptyDataElement) if user tries to extract data from one empty pipe data element. 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 set
  • notenoughde_flag - throw a WrongData exception (reason = API_PipeWrongArg) if user tries to extract data from a DevicePipe for a data element which does not exist. By default, this flag is set
  • blobdenamenotset_flag - Throw a WrongData exception (reason = API_PipeNoDataElement) if user tries to insert data into the blob while the name or number of data element has not been set with methods set_data_elt_nb() or set_data_elt_names()
  • mixing_flag - Throw a WrongData exception (reason = API_NotSupportedFeature) if user tries to mix insertion/extraction method (<< or >>) with operator[]
Parameters
[in]flThe exception flag

◆ get_data_elt_name()

string Tango::DevicePipe::get_data_elt_name ( size_t  ind)
inline

Get root blob data element name.

Get root blob data element name for a single data element

Parameters
[in]indThe data element index within the root blob
Returns
The root blob data element name

◆ get_data_elt_names()

vector<string> Tango::DevicePipe::get_data_elt_names ( )
inline

Get root blob data elements name.

Get the root blob data elements name

Returns
The root blob data elements name

◆ get_data_elt_nb()

size_t Tango::DevicePipe::get_data_elt_nb ( )
inline

Get root blob data element number.

Get the root blob data element number

Returns
The root blob data element number

◆ get_data_elt_type()

int Tango::DevicePipe::get_data_elt_type ( size_t  ind)
inline

Get root blob data element value type.

Get root blob data element value type for a single data element

Parameters
[in]indThe data element index within the root blob
Returns
The root blob data element value type

◆ get_name()

const string& Tango::DevicePipe::get_name ( )
inline

Get pipe name.

Set the device pipe name

Returns
The pipe name

◆ get_root_blob_name()

const string& Tango::DevicePipe::get_root_blob_name ( )
inline

Get root blob name.

Get the root blob name

Returns
The root blob name

◆ has_failed()

bool Tango::DevicePipe::has_failed ( )
inline

Check insertion/extraction success.

Allow the user to check if insertion/extraction into/from DevicePipe instance was successfull. This method has to be used when exceptions are disabled.

Returns
True if insertion/extraction has failed

◆ operator<<()

DevicePipe& Tango::DevicePipe::operator<< ( short &  datum)

Insert data into a device pipe.

Inserting data into a DevicePipe instance is simlar to inserting data into a DevicePipeBlob class instance. See doc of DevicePipeBlob class insertion methods (DevicePipeBlob::operator<<) to get a complete documentation on how to insert data into a DevicePipe

Parameters
[in]datumThe data to be inserted into the DevicePipe
Exceptions
WrongDataif requested

◆ operator>>()

DevicePipe& Tango::DevicePipe::operator>> ( short &  datum)

Extract data from a device pipe.

Extracting data from a DevicePipe instance is simlar to extracting data from a DevicePipeBlob class instance. See doc of DevicePipeBlob class extraction methods (DevicePipeBlob::operator>>) to get a complete documentation on how to extract data from a DevicePipe

Parameters
[in]datumThe pipe data
Exceptions
WrongDataif requested

◆ reset_exceptions()

void Tango::DevicePipe::reset_exceptions ( DevicePipeBlob::except_flags  fl)
inline

Reset one exception flag.

Resets one exception flag

Parameters
[in]flThe exception flag

◆ set_data_elt_names()

void Tango::DevicePipe::set_data_elt_names ( vector< string > &  names)
inline

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.

Parameters
[in]namesThe blob data element names

◆ set_data_elt_nb()

void Tango::DevicePipe::set_data_elt_nb ( size_t  nb)
inline

Set blob data element number.

Set the blob data element number

Parameters
[in]nbThe blob data element number

◆ set_exceptions()

void Tango::DevicePipe::set_exceptions ( DevicePipeBlob::except_flags  fl)
inline

Set one exception flag.

Sets one exception flag. See DevicePipe::exceptions() for a usage example.

Parameters
[in]flThe exception flag

◆ set_name()

void Tango::DevicePipe::set_name ( const string &  pipe_name)
inline

Set pipe name.

Set the device pipe name

Parameters
[in]pipe_nameThe pipe name

◆ set_root_blob_name()

void Tango::DevicePipe::set_root_blob_name ( const string &  root_blob_name)
inline

Set root blob name.

Set the root blob name

Parameters
[in]root_blob_nameThe root blob name

◆ state()

bitset<DevicePipeBlob::numFlags> Tango::DevicePipe::state ( )
inline

Get instance insertion/extraction state.

Allow the user to find out what was the reason of insertion/extraction into/from DevicePipe 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

DevicePipe dpb = ....
bitset<DevicePipeBlob::numFlags> bs;
bs.reset();
dpb.exceptions(bs);
DevLong dl;
dpb >> dl;
if (dpb.has_failed() == true)
{
bitset<DevicePipeBlob::numFlags> bs_err = dpb.state();
if (dpb.test(DevicePipeBlob::isempty_flag) == true)
.....
}
Returns
The error bit set.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  str,
DevicePipe dd 
)
friend

Print a DevicePipe instance.

Is an utility function to easily print the contents of a DevicePipe object. This function knows all types which could be inserted in a DevicePipe object and print them accordingly. A special string is printed if the DevicePipe object is empty

DeviceProxy *dev = new DeviceProxy(“...”);
out = dev->read_pipe(“MyPipe”);
cout << “Pipe content: ” << out << endl;
Parameters
[in]strThe printing stream
[in]ddThe instance to be printed

The documentation for this class was generated from the following file:
Tango::DevicePipe::DevicePipe
DevicePipe()
Create a DevicePipe object.