Tango Core Classes Reference
9.3.4
|
This class is a used to store TANGO device server process data and to provide the user with a set of utilities method. More...
#include "tango.h"
Public Member Functions | |
Destructor | |
Only one destructor is defined for this class | |
~Util () | |
The class destructor. | |
Get/Set instance data | |
CORBA::ORB_ptr | get_orb () |
Get a reference to the CORBA ORB. More... | |
PortableServer::POA_ptr | get_poa () |
Get a reference to the CORBA Portable Object Adapter (POA) More... | |
void | set_trace_level (int level) |
Set the process trace level. More... | |
int | get_trace_level () |
Get the process trace level. More... | |
string & | get_ds_inst_name () |
Get the device server instance name. More... | |
string & | get_ds_exec_name () |
Get the device server executable name. More... | |
string & | get_ds_name () |
Get the device server name. More... | |
string & | get_host_name () |
Get the host name where the device server process is running. More... | |
string & | get_pid_str () |
Get the device server process identifier as a String. More... | |
TangoSys_Pid | get_pid () |
Get the device server process identifier. More... | |
long | get_tango_lib_release () |
Get the TANGO library version number. More... | |
string & | get_version_str () |
Get the IDL TANGO version. More... | |
string & | get_server_version () |
Get the device server version. More... | |
void | set_server_version (const char *vers) |
Set the device server version. More... | |
void | set_class_list (vector< DeviceClass * > *list) |
Set the DeviceClass list pointer. More... | |
void | add_class_to_list (DeviceClass *cl) |
Add a DeviceClass to the DeviceClass list pointer. More... | |
const vector< DeviceClass * > * | get_class_list () |
Get the DeviceClass list pointer. More... | |
void | set_serial_model (SerialModel ser) |
Set the serialization model. More... | |
SerialModel | get_serial_model () |
Get the serialization model. More... | |
NotifdEventSupplier * | get_notifd_event_supplier () |
Get a reference to the notifd TANGO EventSupplier object. More... | |
ZmqEventSupplier * | get_zmq_event_supplier () |
Get a reference to the ZMQ TANGO EventSupplier object. More... | |
void | set_ds_event_buffer_hwm (DevLong val) |
Set device server process event buffer high water mark (HWM) More... | |
Polling related methods | |
void | trigger_cmd_polling (DeviceImpl *dev, const string &name) |
Trigger polling for polled command. More... | |
void | trigger_attr_polling (DeviceImpl *dev, const string &name) |
Trigger polling for polled attribute. More... | |
template<typename T > | |
void | fill_attr_polling_buffer (DeviceImpl *dev, string &att_name, AttrHistoryStack< T > &data) |
Fill polling buffer for polled attribute. More... | |
template<typename T > | |
void | fill_cmd_polling_buffer (DeviceImpl *dev, string &cmd_name, CmdHistoryStack< T > &data) |
Fill polling buffer for polled command. More... | |
void | set_polling_threads_pool_size (unsigned long thread_nb) |
Set the polling threads pool size. More... | |
unsigned long | get_polling_threads_pool_size () |
Get the polling threads pool size. More... | |
void | set_polling_before_9 (bool val) |
Set the polling thread algorithm to the algorithum used before Tango 9. More... | |
Miscellaneous methods | |
bool | is_svr_starting () |
Check if the device server process is in its starting phase. More... | |
bool | is_svr_shutting_down () |
Check if the device server process is in its shutting down sequence. More... | |
bool | is_device_restarting (string &d_name) |
Check if the device is actually restarted by the device server process admin device with its DevRestart command. More... | |
Database related methods | |
void | connect_db () |
Connect the process to the TANGO database. More... | |
void | reset_filedatabase () |
Reread the file database. | |
Database * | get_database () |
Get a reference to the TANGO database object. More... | |
void | unregister_server () |
Unregister a device server process from the TANGO database. More... | |
Device reference related methods | |
vector< DeviceImpl * > & | get_device_list_by_class (const string &class_name) |
Get the list of device references for a given TANGO class. More... | |
vector< DeviceImpl * > & | get_device_list_by_class (const char *class_name) |
Get the list of device references for a given TANGO class. More... | |
DeviceImpl * | get_device_by_name (const string &dev_name) |
Get a device reference from its name. More... | |
DeviceImpl * | get_device_by_name (const char *dev_name) |
Get a device reference from its name. More... | |
DServer * | get_dserver_device () |
Get a reference to the dserver device attached to the device server process. More... | |
vector< DeviceImpl * > | get_device_list (const string &name) |
Get DeviceList from name. More... | |
Device pattern related methods | |
void | server_init (bool with_window=false) |
Initialise all the device server pattern(s) embedded in a device server process. More... | |
void | server_run () |
Run the CORBA event loop. More... | |
void | server_cleanup () |
Cleanup a Tango device server process before exit. More... | |
void | server_set_event_loop (bool(*f_ptr)()) |
Set the server event loop. More... | |
Static Public Member Functions | |
Singleton related methods | |
These methods follow the singleton design pattern (only one instance of a class) | |
static Util * | init (int argc, char *argv[]) |
Create and get the singleton object reference. More... | |
static TANGO_IMP_EXP Util * | instance (bool exit=true) |
Get the singleton object reference. More... | |
Class data members | |
static int | _tracelevel |
The process trace level. | |
static TANGO_IMP bool | _UseDb |
The database use flag (Use with extreme care). More... | |
static TANGO_IMP bool | _daemon |
A daemon process flag. More... | |
static TANGO_IMP long | _sleep_between_connect |
The loop sleeping time in case of the _daemon flag set to true. More... | |
Util (int argc, char *argv[]) | |
Constructs a newly allocated Util object. More... | |
This class is a used to store TANGO device server process data and to provide the user with a set of utilities method.
This class is implemented using the singleton design pattern. Therefore a device server process can have only one instance of this class and its constructor is not public.
$Author$ $Revision$
|
protected |
Constructs a newly allocated Util object.
This constructor is protected following the singleton pattern
argc | The process command line argument number |
argv | The process commandline arguments |
|
inline |
Add a DeviceClass to the DeviceClass list pointer.
cl | The DeviceClass ptr |
void Tango::Util::connect_db | ( | ) |
Connect the process to the TANGO database.
If the connection to the database failed, a message is displayed on the screen and the process is aborted
void Tango::Util::fill_attr_polling_buffer | ( | DeviceImpl * | dev, |
string & | att_name, | ||
AttrHistoryStack< T > & | data | ||
) |
Fill polling buffer for polled attribute.
This method fills the polling buffer for one polled attribute registered with an update period defined as "externally triggerred" (polling period set to 0)
dev | The TANGO device |
att_name | The attribute name which must be polled |
data | The data stack with one element for each history element |
DevFailed | If the call failed Click here to read DevFailed exception specification |
void Tango::Util::fill_cmd_polling_buffer | ( | DeviceImpl * | dev, |
string & | cmd_name, | ||
CmdHistoryStack< T > & | data | ||
) |
Fill polling buffer for polled command.
This method fills the polling buffer for one polled command registered with an update period defined as "externally triggerred" (polling period set to 0)
dev | The TANGO device |
cmd_name | The command name which must be polled |
data | The data stack with one element for each history element |
DevFailed | If the call failed Click here to read DevFailed exception specification |
|
inline |
Get the DeviceClass list pointer.
|
inline |
Get a reference to the TANGO database object.
DeviceImpl* Tango::Util::get_device_by_name | ( | const char * | dev_name | ) |
Get a device reference from its name.
dev_name | The TANGO device name |
DevFailed | If in the device is not served by one device pattern implemented in this process. Click here to read DevFailed exception specification |
DeviceImpl* Tango::Util::get_device_by_name | ( | const string & | dev_name | ) |
Get a device reference from its name.
dev_name | The TANGO device name |
DevFailed | If in the device is not served by one device pattern implemented in this process. Click here to read DevFailed exception specification |
vector<DeviceImpl *> Tango::Util::get_device_list | ( | const string & | name | ) |
Get DeviceList from name.
It is possible to use a wild card ('*') in the name parameter (e.g. "*", "/tango/tangotest/n*", ...)
name | The device name |
vector<DeviceImpl *>& Tango::Util::get_device_list_by_class | ( | const char * | class_name | ) |
Get the list of device references for a given TANGO class.
Return the list of references for all devices served by one implementation of the TANGO device pattern implemented in the process
class_name | The TANGO device class name |
DevFailed | If in the device server process there is no TANGO device pattern implemented the TANGO device class given as parameter Click here to read DevFailed exception specification |
vector<DeviceImpl *>& Tango::Util::get_device_list_by_class | ( | const string & | class_name | ) |
Get the list of device references for a given TANGO class.
Return the list of references for all devices served by one implementation of the TANGO device pattern implemented in the process
class_name | The TANGO device class name |
DevFailed | If in the device server process there is no TANGO device pattern implemented the TANGO device class given as parameter Click here to read DevFailed exception specification |
|
inline |
Get the device server executable name.
|
inline |
Get the device server instance name.
|
inline |
Get the device server name.
The device server name is the device server executable name/the device server instance name
DServer* Tango::Util::get_dserver_device | ( | ) |
Get a reference to the dserver device attached to the device server process.
|
inline |
Get the host name where the device server process is running.
|
inline |
Get a reference to the notifd TANGO EventSupplier object.
|
inline |
Get a reference to the CORBA ORB.
This is a CORBA _duplicate of the original reference
|
inline |
Get the device server process identifier.
|
inline |
Get the device server process identifier as a String.
|
inline |
Get a reference to the CORBA Portable Object Adapter (POA)
This is a CORBA _dupilcate of the original reference to the object POA. For classical device server, thisis the root POA. For no database device server, this is a specific POA with the USER_ID policy.
|
inline |
Get the polling threads pool size.
|
inline |
Get the serialization model.
|
inline |
Get the device server version.
long Tango::Util::get_tango_lib_release | ( | ) |
Get the TANGO library version number.
|
inline |
|
inline |
Get the IDL TANGO version.
|
inline |
Get a reference to the ZMQ TANGO EventSupplier object.
|
static |
Create and get the singleton object reference.
This method returns a reference to the object of the Util class. If the class singleton object has not been created, it will be instantiated
argc | The process command line argument number |
argv | The process commandline arguments |
|
static |
|
inline |
Check if the device is actually restarted by the device server process admin device with its DevRestart command.
|
inline |
Check if the device server process is in its shutting down sequence.
|
inline |
Check if the device server process is in its starting phase.
void Tango::Util::server_cleanup | ( | ) |
void Tango::Util::server_init | ( | bool | with_window = false | ) |
Initialise all the device server pattern(s) embedded in a device server process.
DevFailed | If the device pattern initialisation failed Click here to read DevFailed exception specification |
void Tango::Util::server_run | ( | ) |
Run the CORBA event loop.
This method runs the CORBA event loop. For UNIX or Linux operating system, this method does not return. For Windows in a non-console mode, this method start a thread which enter the CORBA event loop.
|
inline |
Set the server event loop.
This method registers an event loop function in a Tango server. This function will be called by the process main thread in an infinite loop The process will not use the classical ORB blocking event loop. It is the user responsability to code this function in a way that it implements some kind of blocking in order not to load the computer CPU
f_ptr | The event loop function pointer. This function will not receive any argument. It returns a boolean value. If this boolean is set to true, the device server process exit. |
|
inline |
Set the DeviceClass list pointer.
list | The DeviceClass ptr vector address |
|
inline |
Set device server process event buffer high water mark (HWM)
val | The new event buffer high water mark in number of events |
|
inline |
Set the polling thread algorithm to the algorithum used before Tango 9.
val | Polling algorithm flag |
|
inline |
Set the polling threads pool size.
thread_nb | The maximun number of threads in the polling threads pool |
|
inline |
Set the serialization model.
ser | The new serialization model. The serialization model must be one of BY_DEVICE, BY_CLASS, BY_PROCESS or NO_SYNC |
|
inline |
Set the device server version.
vers | The device server version |
|
inline |
void Tango::Util::trigger_attr_polling | ( | DeviceImpl * | dev, |
const string & | name | ||
) |
Trigger polling for polled attribute.
This method send the order to the polling thread to poll one object registered with an update period defined as "externally triggerred"
dev | The TANGO device |
name | The attribute name which must be polled |
DevFailed | If the call failed Click here to read DevFailed exception specification |
void Tango::Util::trigger_cmd_polling | ( | DeviceImpl * | dev, |
const string & | name | ||
) |
Trigger polling for polled command.
This method send the order to the polling thread to poll one object registered with an update period defined as "externally triggerred"
dev | The TANGO device |
name | The command name which must be polled |
DevFailed | If the call failed Click here to read DevFailed exception specification |
void Tango::Util::unregister_server | ( | ) |
Unregister a device server process from the TANGO database.
If the database call fails, a message is displayed on the screen and the process is aborted
|
static |
A daemon process flag.
If this flag is set to true, the server process will not exit if it not able to connect to the database. Instead, it will loop until the connection suceeds. The default value is false.
|
static |
The loop sleeping time in case of the _daemon flag set to true.
This sleeping time is the number of seconds the process will sleep before it tries again to connect to the database. The default value is 60 seconds.
|
static |
The database use flag (Use with extreme care).
Implemented for device server started without database usage.
Referenced by Tango::DeviceImpl::get_db_device().