class Util

This class is a used to store TANGO device server process data and to provide the user with a set of utilities method

Public

Singleton related methods
static Util* init(int argc, char *argv[])
Create and get the singleton object reference
static Util* init(HINSTANCE AppInst, int CmdShow)
Create and get the singleton object reference
static Util* instance()
Get the singleton object reference
Destructor
~Util()
The class desctructor
Get/Set instance data
CORBA::ORB_ptr get_orb()
Get a reference to the CORBA ORB This is a CORBA _duplicate of the original reference
PortableServer::POA_ptr get_root_poa()
Get a reference to the CORBA root Portable Object Adapter (POA) This is a CORBA _dupilcate of the original reference
OB::BootManager_ptr get_boot_manager()
Get a reference to the CORBA Boot Manager This is a CORBA _duplicate of the original reference
long get_trace_level()
Get the process trace level
void set_trace_output(string &trace)
Set the process trace output
string& get_trace_output()
Get the process trace output
TangoSys_Cout& get_out()
Get the temporary process output print stream
void set_trace_output_stream(ofstream *in)
Set the process trace output stream
ofstream* get_trace_output_stream()
Get the process output print stream
string& get_ds_inst_name()
Get the device server instance name
string& get_ds_exec_name()
Get the device server executable name
string& get_ds_name()
Get the device server name
string& get_host_name()
Get the host name where the device server process is running
string& get_pid_str()
Get the device server process identifier as a String
TangoSys_Pid get_pid()
Get the device server process identifier
string& get_version_str()
Get the IDL TANGO version
string& get_server_version()
Get the device server version
void set_server_version(const char *vers)
Set the device server version
Database related methods
void connect_db()
Connect the process to the TANGO database
Database* get_database()
Get a reference to the TANGO database object
void unregister_server()
Unregister a device server process from the TANGO database
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
vector <DeviceImpl *> & get_device_list_by_class(const char *class_name)
Get the list of device references for a given TANGO class
DeviceImpl* get_device_by_name(const string &dev_name)
Get a device reference from its name
DeviceImpl* get_device_by_name(const char *dev_name)
Get a device reference from its name
DServer* get_dserver_device()
Get a reference to the dserver device attached to the device server process
Device pattern related methods
void server_init(bool with_window = false)
Initialise all the device server pattern(s) embedded in a device server process
void server_run()
Run the CORBA event loop This method runs the CORBA event loop
Class data members
static long _tracelevel
The process trace level
static bool _UseDb
The database use flag (Use with extreme care
static bool _daemon
A daemon process flag
static long _sleep_between_connect
The loop sleeping time in case of the _daemon flag set to true
Windows specific methods
HWND get_console_window()
Get the console window instance
HWND get_ds_main_window()
Get the main window instance
CoutBuf* get_debug_object()
Get a pointer to the debug object
string& get_main_window_text()
Get the text displayed on main server window
void set_main_window_text(string &txt)
Set the text displayed on main server window

Protected Methods

Util(int argc, char *argv[])
Constructs a newly allocated Util object
Util(HINSTANCE AppInst, int CmdShow)
Constructs a newly allocated Util object for Windows non-console device server

Documentation

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.
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. This method returns a reference to the object of the Util class. If the class singleton object has not been created, it will be instanciated
Returns:
The Util object reference
Parameters:
argc - The process command line argument number
argv - The process commandline arguments

static Util* init(HINSTANCE AppInst, int CmdShow)
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 instanciated. This method must be used only for non-console mode windows device server
Returns:
The Util object reference
Parameters:
AppInst - The application instance
CmdShow - The display window flag

static Util* instance()
Get the singleton object reference. This method returns a reference to the object of the Util class. If the class has not been initialised with it's init method, this method print a message and abort the device server process
Returns:
The Util object reference

Destructor
Only one destructor is defined for this class

~Util()
The class desctructor

Get/Set instance data

CORBA::ORB_ptr get_orb()
Get a reference to the CORBA ORB This is a CORBA _duplicate of the original reference
Returns:
The CORBA ORB

PortableServer::POA_ptr get_root_poa()
Get a reference to the CORBA root Portable Object Adapter (POA) This is a CORBA _dupilcate of the original reference
Returns:
The CORBA root POA

OB::BootManager_ptr get_boot_manager()
Get a reference to the CORBA Boot Manager This is a CORBA _duplicate of the original reference
Returns:
The CORBA boot manager

long get_trace_level()
Get the process trace level.
Returns:
The process trace level

void set_trace_output(string &trace)
Set the process trace output .
Parameters:
level - The new process output

string& get_trace_output()
Get the process trace output.
Returns:
The process trace output

TangoSys_Cout& get_out()
Get the temporary process output print stream
Returns:
The process output print stream

void set_trace_output_stream(ofstream *in)
Set the process trace output stream.
Parameters:
in - The new process output stream

ofstream* get_trace_output_stream()
Get the process output print stream
Returns:
The process output print stream

string& get_ds_inst_name()
Get the device server instance name.
Returns:
The device server instance name

string& get_ds_exec_name()
Get the device server executable name.
Returns:
The device server executable name

string& get_ds_name()
Get the device server name. The device server name is the device server executable name/the device server instance name
Returns:
The device server name

string& get_host_name()
Get the host name where the device server process is running.
Returns:
The host name

string& get_pid_str()
Get the device server process identifier as a String
Returns:
The device server process identifier as a string

TangoSys_Pid get_pid()
Get the device server process identifier
Returns:
The device server process identifier

string& get_version_str()
Get the IDL TANGO version.
Returns:
The device server version

string& get_server_version()
Get the device server version.
Returns:
The device server version

void set_server_version(const char *vers)
Set the device server version.
Parameters:
The - device server version

Database related methods

void 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

Database* get_database()
Get a reference to the TANGO database object
Returns:
The database object

void 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

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. Return the list of references for all devices served by one implementation of the TANGO device pattern implemented in the process
Throws:
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
Returns:
The device reference list
Parameters:
class_name - The TANGO device class name

vector <DeviceImpl *> & 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
Throws:
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
Returns:
The device reference list
Parameters:
class_name - The TANGO device class name

DeviceImpl* get_device_by_name(const string &dev_name)
Get a device reference from its name
Throws:
DevFailed If in the device is not served by one device pattern implemented in this process. Click here to read DevFailed exception specification
Returns:
The device reference
Parameters:
dev_name - The TANGO device name

DeviceImpl* get_device_by_name(const char *dev_name)
Get a device reference from its name
Throws:
DevFailed If in the device is not served by one device pattern implemented in this process. Click here to read DevFailed exception specification
Returns:
The device reference
Parameters:
dev_name - The TANGO device name

DServer* get_dserver_device()
Get a reference to the dserver device attached to the device server process
Returns:
A reference to the dserver device

Device pattern related methods

void server_init(bool with_window = false)
Initialise all the device server pattern(s) embedded in a device server process.
Throws:
DevFailed If the device pattern initialistaion failed Click here to read DevFailed exception specification

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

Class data members

static long _tracelevel
The process trace level

static bool _UseDb
The database use flag (Use with extreme care. Implemented mainly for the database device server)

static bool _daemon
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 long _sleep_between_connect
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.

Windows specific methods

HWND get_console_window()
Get the console window instance
Returns:
The device server graphical interface console window instance

HWND get_ds_main_window()
Get the main window instance
Returns:
The device server graphical interface main window instance

CoutBuf* get_debug_object()
Get a pointer to the debug object
Returns:
A pointer to the debug object

string& get_main_window_text()
Get the text displayed on main server window.
Returns:
The text to be displayed

void set_main_window_text(string &txt)
Set the text displayed on main server window.
Parameters:
txt - The new text to be displayed at the bottom of the main window

Util(int argc, char *argv[])
Constructs a newly allocated Util object. This constructor is protected following the singleton pattern
Parameters:
argc - The process command line argument number
argv - The process commandline arguments

Util(HINSTANCE AppInst, int CmdShow)
Constructs a newly allocated Util object for Windows non-console device server. This constructor is protected following the singleton pattern
Parameters:
AppInst - The applicationinstance
CmdShow - The display window flag


This class has no child classes.
Author:
$Author: taurel $
Version:
$Revision: 1.3 $

alphabetic index hierarchy of classes


generated by doc++