Tango Core Classes Reference  9.3.3
Tango::DeviceClass Class Referenceabstract

Base class for all TANGO device-class class. More...

#include "tango.h"

Collaboration diagram for Tango::DeviceClass:

Public Member Functions

Destructor

Only one desctructor is defined for this class

virtual ~DeviceClass ()
 The device destructor.
 
Miscellaneous methods
CORBA::Any * command_handler (DeviceImpl *device, string &command, const CORBA::Any &in_any)
 Execute a command. More...
 
virtual void command_factory ()=0
 Create command objects for all command supported by this class of device. More...
 
virtual void attribute_factory (vector< Attr * > &)
 Create all the attributes name supported by this class of device. More...
 
virtual void pipe_factory ()
 Create all the pipes supported by this class of device. More...
 
virtual void device_factory (const Tango::DevVarStringArray *dev_list)=0
 Create device(s). More...
 
virtual void device_name_factory (vector< string > &list)
 Create device(s) name list (for no database device server). More...
 
void device_destroyer (const string &dev_name)
 Delete device. More...
 
void device_destroyer (const char *dev_name)
 Delete device. More...
 
Get/Set object members.

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

string & get_name ()
 Get the TANGO device class name. More...
 
string & get_doc_url ()
 Get the TANGO device class documentation URL. More...
 
string & get_type ()
 Get the TANGO device type name. More...
 
vector< DeviceImpl * > & get_device_list ()
 Get the device object vector. More...
 
vector< Command * > & get_command_list ()
 Get the command object vector. More...
 
vector< Pipe * > & get_pipe_list (const string &dev_name)
 Get the pipe object vector. More...
 
Commandget_cmd_by_name (const string &)
 Get a reference to a command object. More...
 
Pipeget_pipe_by_name (const string &pipe_name, const string &dev_name)
 Get a reference to a pipe object. More...
 
DbClassget_db_class ()
 Get a pointer to the associated DbClass object. More...
 
MultiClassAttribute * get_class_attr ()
 Get a pointer to the class attributes object. More...
 
MultiClassPipe * get_class_pipe ()
 Get a pointer to the class pipes object. More...
 
void set_type (string &dev_type)
 Set the TANGO device type name. More...
 
void set_type (const char *dev_type)
 Set the TANGO device type name. More...
 
Signal related methods

These methods allow a signal management at device level

void register_signal (long signo, bool own_handler=false)
 Register a signal. More...
 
void unregister_signal (long signo)
 Unregister a signal. More...
 
virtual void signal_handler (long signo)
 Signal handler. More...
 

Protected Member Functions

Constructor

Only one constructot for this class which is a singleton

 DeviceClass (string &s)
 Construct a newly allocated DeviceClass object. More...
 
Miscellaneous protected methods
void export_device (DeviceImpl *dev, const char *corba_dev_name="Unused")
 Export a device. More...
 
void set_default_command (Command *cmd)
 Set a Tango classs default command. More...
 

Protected Attributes

Class data members
string name
 The TANGO device class name.
 
string doc_url
 The TANGO device class documentation URL.
 
string type
 The TANGO device type name.
 
vector< Command * > command_list
 The command(s) list.
 
vector< DeviceImpl * > device_list
 The device(s) list.
 
DbClassdb_class
 The associated DbClass object.
 
MultiClassAttribute * class_attr
 Pointer to the class multi attribute object.
 
MultiClassPipe * class_pipe
 Pointer to the class multi pipe object.
 
vector< Pipe * > pipe_list
 The pipe(s) list.
 

Detailed Description

Base class for all TANGO device-class class.

A TANGO device-class class is a class where is stored all data/method common to all devices of a TANGO device class

$Author$ $Revision$

Constructor & Destructor Documentation

◆ DeviceClass()

Tango::DeviceClass::DeviceClass ( string &  s)
protected

Construct a newly allocated DeviceClass object.

Parameters
sThe Tango device class name

Member Function Documentation

◆ attribute_factory()

virtual void Tango::DeviceClass::attribute_factory ( vector< Attr * > &  )
inlinevirtual

Create all the attributes name supported by this class of device.

In the DeviceClass class, this method does nothing and must be re-defined in sub-class if the sub-class supports attributes. Its rule is to create and store the supported attributes in a vector.

◆ command_factory()

virtual void Tango::DeviceClass::command_factory ( )
pure virtual

Create command objects for all command supported by this class of device.

In the DeviceClass class, this method is pure abstract and must be defined in sub-class. Its rule is to create the command object and to store them in a vector of command objects

◆ command_handler()

CORBA::Any* Tango::DeviceClass::command_handler ( DeviceImpl device,
string &  command,
const CORBA::Any &  in_any 
)

Execute a command.

It looks for the correct command object in the command object vector. If the command is found, it invoke the always_executed_hook method. Check if the command is allowed by invoking the is_allowed method If the command is allowed, invokes the execute method.

Parameters
deviceThe device on which the command must be executed
commandThe command name
in_anyThe command input data still packed in a CORBA Any object
Returns
A CORBA Any object with the output data packed in
Exceptions
DevFailedIf the command is not found, if the command is not allowed in the actual device state and re-throws of all the exception thrown by the always_executed_hook, is_alloed and execute methods. Click here to read DevFailed exception specification

◆ device_destroyer() [1/2]

void Tango::DeviceClass::device_destroyer ( const char *  dev_name)

Delete device.

The rule of this method is to delete a device from the running device belonging to the Tango class. It does change anything in the database

Parameters
dev_nameReference to the device name

◆ device_destroyer() [2/2]

void Tango::DeviceClass::device_destroyer ( const string &  dev_name)

Delete device.

The rule of this method is to delete a device from the running server belonging to the Tango class. It does change anything in the database

Parameters
dev_nameReference to the device name

◆ device_factory()

virtual void Tango::DeviceClass::device_factory ( const Tango::DevVarStringArray *  dev_list)
pure virtual

Create device(s).

In the DeviceClass class, this method is pure abstract and must be defined in sub-class. Its rule is to create all the class devices and to store them in a vector of device

Parameters
dev_listThe device name list
Exceptions
DevFailedThis method does not throw exception but a redefined method can. Click here to read DevFailed exception specification

◆ device_name_factory()

virtual void Tango::DeviceClass::device_name_factory ( vector< string > &  list)
inlinevirtual

Create device(s) name list (for no database device server).

This method can be re-defined in DeviceClass sub-class for device server started without database. Its rule is to initialise class device name. The default method does nothing.

Parameters
listReference to the device name list

◆ export_device()

void Tango::DeviceClass::export_device ( DeviceImpl dev,
const char *  corba_dev_name = "Unused" 
)
protected

Export a device.

Associate the servant to a CORBA object and send device network parameter to TANGO database. The main parameter sent to database is the CORBA object stringified device IOR.

Parameters
devThe device to be exported (CORBA servant)
corba_dev_nameThe name to be used in the CORBA object key. This parameter does not need to be set in most of cases and has a default value. It is used for special device server like the database device server.
Exceptions
DevFailedIf the command sent to the database failed. Click here to read DevFailed exception specification

◆ get_class_attr()

MultiClassAttribute* Tango::DeviceClass::get_class_attr ( )
inline

Get a pointer to the class attributes object.

Returns
A pointer to the instance of the MultiClassAttribute

◆ get_class_pipe()

MultiClassPipe* Tango::DeviceClass::get_class_pipe ( )
inline

Get a pointer to the class pipes object.

Returns
A pointer to the instance of the MultiClassPipe

◆ get_cmd_by_name()

Command& Tango::DeviceClass::get_cmd_by_name ( const string &  )

Get a reference to a command object.

Returns
A reference to the command object

◆ get_command_list()

vector<Command *>& Tango::DeviceClass::get_command_list ( )
inline

Get the command object vector.

Returns
A reference to the command vector

◆ get_db_class()

DbClass* Tango::DeviceClass::get_db_class ( )
inline

Get a pointer to the associated DbClass object.

Returns
Pointer to the DbClas object

◆ get_device_list()

vector<DeviceImpl *>& Tango::DeviceClass::get_device_list ( )
inline

Get the device object vector.

Returns
A reference to the device vector

◆ get_doc_url()

string& Tango::DeviceClass::get_doc_url ( )
inline

Get the TANGO device class documentation URL.

Returns
The TANGO device class documentation

◆ get_name()

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

Get the TANGO device class name.

Returns
The TANGO device class name

◆ get_pipe_by_name()

Pipe& Tango::DeviceClass::get_pipe_by_name ( const string &  pipe_name,
const string &  dev_name 
)

Get a reference to a pipe object.

Parameters
pipe_nameThe pipe name
dev_nameThe device name
Returns
A reference to the pipe object

◆ get_pipe_list()

vector<Pipe *>& Tango::DeviceClass::get_pipe_list ( const string &  dev_name)

Get the pipe object vector.

Parameters
dev_nameThe device name
Returns
A reference to the pipe vector containing all device pipes

◆ get_type()

string& Tango::DeviceClass::get_type ( )
inline

Get the TANGO device type name.

Returns
The TANGO device type name

◆ pipe_factory()

virtual void Tango::DeviceClass::pipe_factory ( )
inlinevirtual

Create all the pipes supported by this class of device.

In the DeviceClass class, this method does nothing and must be re-defined in sub-class if the sub-class supports pipes. Its rule is to create and store the supported pipes in a vector.

◆ register_signal()

void Tango::DeviceClass::register_signal ( long  signo,
bool  own_handler = false 
)

Register a signal.

Register this class as class to be informed when signal signo is sent to to the device server process. This method is available only under Linux.

Parameters
signoThe signal number
own_handlerA boolean set to true if you want the device signal handler to be executed in its own handler instead of being executed by the signal thread. If this parameter is set to true, care should be taken on how the handler is written. A default false value is provided *
Exceptions
DevFailedThrown if the signal number is out of range or if the operating system failed to register a signal for the process. Click here to read DevFailed exception specification

◆ set_default_command()

void Tango::DeviceClass::set_default_command ( Command cmd)
inlineprotected

Set a Tango classs default command.

Define one command to be the Tango class default command The default command is the command which will be exceuted when an unknown command is sent to one of the Tango class device By default, there is no default class

Parameters
cmdThe command object

◆ set_type() [1/2]

void Tango::DeviceClass::set_type ( const char *  dev_type)
inline

Set the TANGO device type name.

Parameters
dev_typeThe new TANGO device type name

◆ set_type() [2/2]

void Tango::DeviceClass::set_type ( string &  dev_type)
inline

Set the TANGO device type name.

Parameters
dev_typeThe new TANGO device type name

◆ signal_handler()

virtual void Tango::DeviceClass::signal_handler ( long  signo)
virtual

Signal handler.

The method executed when the signal arrived in the device server process. This method is defined as virtual and then, can be redefined following device class needs.

Parameters
signoThe signal number

◆ unregister_signal()

void Tango::DeviceClass::unregister_signal ( long  signo)

Unregister a signal.

Unregister this class as class to be informed when signal signo is sent to to the device server process

Parameters
signoThe signal number
Exceptions
DevFailedThrown if the signal number is out of range or if the operating system failed to unregister a signal for the process. Unregister a device for a signal number for a device not previously registered is not an error. This simply will do nothing. Click here to read DevFailed exception specification

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