Tango Core Classes Reference  9.3.4
ApiUtil Class Reference

Miscellaneous utility methods usefull in a Tango client. More...

#include "tango.h"

Public Member Functions

cb_sub_model get_asynch_cb_sub_model ()
 Get asynchronous callback sub-model. More...
 
void get_asynch_replies ()
 Fire callback methods for asynchronous request(s) More...
 
void get_asynch_replies (long timeout)
 Fire callback methods for asynchronous request(s) with timeout. More...
 
size_t pending_asynch_call (asyn_req_type ty)
 Get pending asynchronous requets number. More...
 
void set_asynch_cb_sub_model (cb_sub_model csm)
 Set asynchronous callback sub-model. More...
 

Static Public Member Functions

static TANGO_IMP_EXP void cleanup ()
 Destroy the ApiUtil instance. More...
 
static TANGO_IMP_EXP int get_env_var (const char *name, string &value)
 Get environment variable. More...
 
static TANGO_IMP_EXP ApiUtilinstance ()
 Retrieve the ApiUtil instance. More...
 

Detailed Description

Miscellaneous utility methods usefull in a Tango client.

This class is a singleton. Therefore, it is not necessary to create it. It will be automatically done. A static method allows a user to retrieve the instance

Author
taurel
Revision
1

Member Function Documentation

◆ cleanup()

static TANGO_IMP_EXP void ApiUtil::cleanup ( void  )
inlinestatic

Destroy the ApiUtil instance.

Destroy the ApiUtil singleton instance.

◆ get_asynch_cb_sub_model()

cb_sub_model ApiUtil::get_asynch_cb_sub_model ( )
inline

Get asynchronous callback sub-model.

Get the asynchronous callback sub-model

Returns
The asynchronous callback sub-model

◆ get_asynch_replies() [1/2]

void ApiUtil::get_asynch_replies ( )

Fire callback methods for asynchronous request(s)

Fire callback methods for all (any device) asynchronous requests (command and attribute) with already arrived replied. Returns immediately if there is no replies already arrived or if there is no asynchronous requests.

◆ get_asynch_replies() [2/2]

void ApiUtil::get_asynch_replies ( long  timeout)

Fire callback methods for asynchronous request(s) with timeout.

Fire callback methods for all (any device) asynchronous requests (command and attributes) with already arrived replied. Wait and block the caller for timeout milliseconds if they are some device asynchronous requests which are not yet arrived. Returns immediately if there is no asynchronous request. If timeout is set to 0, the call waits until all the asynchronous requests sent has received a reply.

Parameters
[in]timeoutThe timeout value

◆ get_env_var()

static TANGO_IMP_EXP int ApiUtil::get_env_var ( const char *  name,
string &  value 
)
static

Get environment variable.

Get environment variable. On Unixes OS, this call tries to get the variable in the caller environment then in a file .tangorc in the user home directory and finally in a file /etc/tangorc. On Windows, this call looks in the user environment then in a file stored in TANGO_HOME%/tangorc. This method returns 0 of the environment variable is found. Otherwise, it returns -1.

Parameters
[in]nameThe environment variable name
[out]valueThe environment variable value
Returns
Set to -1 if the environment varaibel is not found

◆ instance()

ApiUtil * ApiUtil::instance ( )
inlinestatic

Retrieve the ApiUtil instance.

Return the ApiUtil singleton instance

Returns
The singleton instance

Some inline methods

◆ pending_asynch_call()

size_t ApiUtil::pending_asynch_call ( asyn_req_type  ty)
inline

Get pending asynchronous requets number.

Return number of asynchronous pending requests (any device).

Parameters
[in]tyAsynchronous request type
Returns
Pending asynchronous request number

◆ set_asynch_cb_sub_model()

void ApiUtil::set_asynch_cb_sub_model ( cb_sub_model  csm)

Set asynchronous callback sub-model.

Set the asynchronous callback sub-model between the pull and push sub-model. See Tango book chapter 4.5 to read the definition of these sub-models. By default, all Tango client using asynchronous callback model are in pull sub-model. This call must be used to switch to the push sub-model. NOTE that in push sub-model, a separate thread is spawned to deal with server replies.

Parameters
[in]csmThe asynchronous callback sub-model

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