Tango Core Classes Reference  9.3.4
Tango::Pipe Class Reference

This class is a class representing a pipe in the TANGO device server pattern. More...

#include "tango.h"

Inheritance diagram for Tango::Pipe:
Collaboration diagram for Tango::Pipe:

Public Member Functions

Constructors

Miscellaneous constructors

 Pipe ()
 Constructs a newly allocated Pipe object. More...
 
 Pipe (const string &name, const Tango::DispLevel level, const PipeWriteType pwt=PIPE_READ)
 Constructs a newly allocated Pipe object from its name and its display level. More...
 
Destructor

Only one destructor is defined for this class

virtual ~Pipe ()
 The object desctructor.
 
Get/Set object members.

These methods allows the external world to get/set Pipe instance data members

string & get_name ()
 Return the pipe name. More...
 
void set_name (string &new_name)
 Set the pipe name. More...
 
void set_default_properties (UserDefaultPipeProp &prop)
 Set default attribute properties. More...
 
string & get_lower_name ()
 Return the pipe name in lower case letters. More...
 
const string & get_root_blob_name ()
 Return the root data blob name. More...
 
void set_root_blob_name (const string &name)
 Set the root data blob name. More...
 
string & get_desc ()
 Return the pipe description. More...
 
string & get_label ()
 Return the pipe label. More...
 
Tango::DispLevel get_disp_level ()
 Return the pipe display level. More...
 
Tango::PipeWriteType get_writable ()
 Get the pipe writable type (RO/RW). More...
 
void set_pipe_serial_model (PipeSerialModel ser_model)
 Set pipe serialization model. More...
 
PipeSerialModel get_pipe_serial_model ()
 Get pipe serialization model. More...
 
void set_user_pipe_mutex (omni_mutex *mut_ptr)
 Set pipe user mutex. More...
 
Inserting data into a DevicePipe
Pipeoperator<< (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...
 
size_t get_data_elt_nb ()
 Get blob data element number. 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...
 

Class data members

string name
 The pipe name.
 
string lower_name
 The pipe name in lower case.
 
string desc
 The pipe description.
 
string label
 The pipe label.
 
Tango::DispLevel disp_level
 The pipe display level.
 
Tango::PipeWriteType writable
 The pipe R/W type.
 
DevicePipeBlob the_blob
 

Detailed Description

This class is a class representing a pipe in the TANGO device server pattern.

It is an abstract class. It is the root class for all pipe related classes.

$Author$ $Revision$

Constructor & Destructor Documentation

◆ Pipe() [1/2]

Tango::Pipe::Pipe ( )
inline

Constructs a newly allocated Pipe object.

The default constructor

◆ Pipe() [2/2]

Tango::Pipe::Pipe ( const string &  name,
const Tango::DispLevel  level,
const PipeWriteType  pwt = PIPE_READ 
)

Constructs a newly allocated Pipe object from its name and its display level.

Parameters
nameThe pipe name
levelThe pipe display level
pwtThe pipe R/W type (default to READ)

Member Function Documentation

◆ exceptions() [1/2]

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

Get exception flag.

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

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

References DevicePipeBlob::exceptions().

◆ exceptions() [2/2]

void Tango::Pipe::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 Pipe object. The following flags are supported :

  • isempty_flag - throw a WrongData exception (reason = API_EmptyDataElement) if user tries to extract data from one empty blob 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 DevicePipeBlob 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

References DevicePipeBlob::exceptions().

◆ get_data_elt_nb()

size_t Tango::Pipe::get_data_elt_nb ( )
inline

Get blob data element number.

Get the blob data element number

Returns
The blob data element number

References DevicePipeBlob::get_data_elt_nb().

◆ get_desc()

string& Tango::Pipe::get_desc ( )
inline

Return the pipe description.

Returns
The pipe description

References desc.

◆ get_disp_level()

Tango::DispLevel Tango::Pipe::get_disp_level ( )
inline

Return the pipe display level.

Returns
The pipe display level

References disp_level.

◆ get_label()

string& Tango::Pipe::get_label ( )
inline

Return the pipe label.

Returns
The pipe label

References label.

◆ get_lower_name()

string& Tango::Pipe::get_lower_name ( )
inline

Return the pipe name in lower case letters.

Returns
The pipe name

References lower_name.

◆ get_name()

string& Tango::Pipe::get_name ( )
inline

Return the pipe name.

Returns
The pipe name

References name.

◆ get_pipe_serial_model()

PipeSerialModel Tango::Pipe::get_pipe_serial_model ( )
inline

Get pipe serialization model.

Get the pipe serialization model

Returns
The pipe serialization model

◆ get_root_blob_name()

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

Return the root data blob name.

Returns
The data blob name

References DevicePipeBlob::get_name().

◆ get_writable()

Tango::PipeWriteType Tango::Pipe::get_writable ( )
inline

Get the pipe writable type (RO/RW).

Returns
The pipe write type.

References writable.

◆ has_failed()

bool Tango::Pipe::has_failed ( )
inline

Check insertion/extraction success.

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

Returns
True if insertion/extraction has failed

References DevicePipeBlob::has_failed().

◆ operator<<()

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

Insert data into a device pipe.

Inserting data into a Pipe 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 Pipe object

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

◆ reset_exceptions()

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

Reset one exception flag.

Resets one exception flag

Parameters
[in]flThe exception flag

References DevicePipeBlob::reset_exceptions().

◆ set_data_elt_names()

void Tango::Pipe::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

References DevicePipeBlob::set_data_elt_names().

◆ set_data_elt_nb()

void Tango::Pipe::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

References DevicePipeBlob::set_data_elt_nb().

◆ set_default_properties()

void Tango::Pipe::set_default_properties ( UserDefaultPipeProp prop)

Set default attribute properties.

Parameters
propThe user default property class

◆ set_exceptions()

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

Set one exception flag.

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

Parameters
[in]flThe exception flag

References DevicePipeBlob::set_exceptions().

◆ set_name()

void Tango::Pipe::set_name ( string &  new_name)
inline

Set the pipe name.

Parameters
new_nameThe new pipe name

References name.

◆ set_pipe_serial_model()

void Tango::Pipe::set_pipe_serial_model ( PipeSerialModel  ser_model)

Set pipe serialization model.

This method allows the user to choose the pipe serialization model.

Parameters
[in]ser_modelThe new serialisation model. The serialization model must be one of PIPE_BY_KERNEL, PIPE_BY_USER or PIPE_NO_SYNC

◆ set_root_blob_name()

void Tango::Pipe::set_root_blob_name ( const string &  name)
inline

Set the root data blob name.

Parameters
[in]nameThe root data blob name

References name, and DevicePipeBlob::set_name().

◆ set_user_pipe_mutex()

void Tango::Pipe::set_user_pipe_mutex ( omni_mutex *  mut_ptr)
inline

Set pipe user mutex.

This method allows the user to give to the pipe object the pointer to the omni_mutex used to protect its buffer. The mutex has to be locked when passed to this method. The Tango kernel will unlock it when the data will be transferred to the client.

Parameters
[in]mut_ptrThe user mutex pointer

◆ state()

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

Get instance insertion/extraction state.

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

Pipe 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.

References DevicePipeBlob::state().


The documentation for this class was generated from the following file:
DevicePipeBlob::exceptions
void exceptions(bitset< numFlags > fl)
Set exception flag.
Definition: DevicePipe.h:542
Tango::Pipe::Pipe
Pipe()
Constructs a newly allocated Pipe object.
Definition: pipe.h:89