cumbia-tango 1.x
C++ multi threaded library based on cumbia and the Tango control system
Public Member Functions | List of all members
CuTangoWorld Class Reference

#include <cutango-world.h>

Public Member Functions

 CuTangoWorld ()
 
virtual ~CuTangoWorld ()
 
std::string strerror (const Tango::DevFailed &e)
 
std::string strerror (const Tango::DevErrorList &e)
 
void fillThreadInfo (CuData &d, const CuActivity *a)
 
void extractData (Tango::DeviceAttribute *p_da, CuData &d)
 
void extractData (Tango::DeviceData *dd, CuData &d)
 extracts data from Tango::DeviceData and puts it into the CuData bundle More...
 
Tango::DeviceData toDeviceData (const CuVariant &argins, const CuData &cmdinfo)
 
Tango::DeviceData toDeviceData (const std::vector< std::string > &argins, const CuData &cmdinfo)
 
Tango::DeviceAttribute toDeviceAttribute (const std::string &name, const CuVariant &argin, const CuData &attinfo)
 
Tango::DeviceAttribute toDeviceAttribute (const std::string &aname, const std::vector< std::string > &argins, const CuData &attinfo)
 
void fillFromAttributeConfig (const Tango::AttributeInfoEx &ai, CuData &d)
 
void fillFromCommandInfo (const Tango::CommandInfo &cu, CuData &d)
 
bool cmd_inout (Tango::DeviceProxy *dev, const std::string &cmd, Tango::DeviceData &din, bool has_argout, CuData &data)
 
bool cmd_inout (Tango::DeviceProxy *dev, const std::string &cmd, CuData &data)
 
bool read_att (Tango::DeviceProxy *dev, const std::string &attribute, CuData &res)
 
bool read_atts (Tango::DeviceProxy *dev, std::vector< std::string > &p_v_an, std::vector< CuData > &v_a, std::vector< CuData > &reslist, int da_updpo)
 
bool write_att (Tango::DeviceProxy *dev, const std::string &attnam, const CuVariant &argins, const CuData &point_info, CuData &data)
 
bool get_att_config (Tango::DeviceProxy *dev, const std::string &attribute, CuData &res, bool skip_read_att=false)
 
bool get_command_info (Tango::DeviceProxy *dev, const std::string &cmd, CuData &cmd_info)
 Get Tango CommandInfo data and save it into a CuData. More...
 
bool get_att_props (Tango::DeviceProxy *dev, const std::string &attribute, CuData &res, const std::vector< std::string > props)
 
bool get_properties (const std::vector< CuData > &in_list, CuData &res, const std::string &dbhost="")
 CuTangoWorld::get_properties. More...
 
bool db_get (const TSource &tsrc, CuData &res)
 
bool source_valid (const std::string &src)
 
const char * source_valid_pattern () const
 
std::string getLastMessage () const
 
std::string formatToStr (Tango::AttrDataFormat f) const
 returns a string representation of the attribute data format to be used in the CuData "dfs" property. More...
 
std::string cmdArgTypeToDataFormat (Tango::CmdArgType t) const
 Returns a string representation of the Tango::CmdArgType. More...
 
bool error () const
 
void setSrcPatterns (const std::vector< std::string > &pat_regex)
 
std::vector< std::string > srcPatterns () const
 
Tango::Database * getTangoDb (const std::string &dbhost)
 
void putDateTime (const Tango::TimeVal &ttv, CuData &data)
 
std::string dateTimeToStr (time_t *tp) const
 if the time_t parameter is not null, use it to format the date/time into a std:string, otherwise get system time and use the current date/time More...
 
CuDataQuality toCuQuality (Tango::AttrQuality q) const
 CuTangoWorld::toCuQuality. More...
 
std::string make_fqdn_src (const std::string &src) const
 given a source, replace the tango host section with its FQDN name More...
 
std::string prepend_tgproto (const std::string &s) const
 prepend "tango://" protocol string to src if not already specified More...
 

Constructor & Destructor Documentation

◆ CuTangoWorld()

CuTangoWorld::CuTangoWorld ( )

◆ ~CuTangoWorld()

CuTangoWorld::~CuTangoWorld ( )
virtual

Member Function Documentation

◆ cmd_inout() [1/2]

bool CuTangoWorld::cmd_inout ( Tango::DeviceProxy *  dev,
const std::string &  cmd,
CuData &  data 
)

References cmd_inout(), and toDeviceData().

◆ cmd_inout() [2/2]

bool CuTangoWorld::cmd_inout ( Tango::DeviceProxy *  dev,
const std::string &  cmd,
Tango::DeviceData &  din,
bool  has_argout,
CuData &  data 
)

◆ cmdArgTypeToDataFormat()

string CuTangoWorld::cmdArgTypeToDataFormat ( Tango::CmdArgType  t) const

Returns a string representation of the Tango::CmdArgType.

valid values for compatibility: scalar, vector

CuData "dfs" property

Referenced by db_get(), and extractData().

◆ dateTimeToStr()

std::string CuTangoWorld::dateTimeToStr ( time_t *  tp) const

if the time_t parameter is not null, use it to format the date/time into a std:string, otherwise get system time and use the current date/time

Parameters
tpif not null, it is used to provide a string representation of the local time, otherwise get the system date and time
Returns
a string with the date and time. strftime with "%c" format is used. From man strftime: c The preferred date and time representation for the current locale

◆ db_get()

bool CuTangoWorld::db_get ( const TSource tsrc,
CuData &  res 
)

◆ error()

bool CuTangoWorld::error ( ) const

◆ extractData() [1/2]

void CuTangoWorld::extractData ( Tango::DeviceAttribute *  p_da,
CuData &  d 
)

◆ extractData() [2/2]

void CuTangoWorld::extractData ( Tango::DeviceData *  data,
CuData &  da 
)

extracts data from Tango::DeviceData and puts it into the CuData bundle

Note
"timestamp_ms" and "timestamp_us" are not set by extractData. It must be set manually by the caller. There is no date/time information in Tango::DeviceData.

References cmdArgTypeToDataFormat(), CuTangoWorldConfig::stateColorName(), CuTangoWorldConfig::stateString(), and strerror().

◆ fillFromAttributeConfig()

void CuTangoWorld::fillFromAttributeConfig ( const Tango::AttributeInfoEx &  ai,
CuData &  d 
)

References formatToStr().

Referenced by get_att_config().

◆ fillFromCommandInfo()

void CuTangoWorld::fillFromCommandInfo ( const Tango::CommandInfo &  cu,
CuData &  d 
)

References formatToStr().

Referenced by get_command_info().

◆ fillThreadInfo()

void CuTangoWorld::fillThreadInfo ( CuData &  d,
const CuActivity *  a 
)

◆ formatToStr()

string CuTangoWorld::formatToStr ( Tango::AttrDataFormat  f) const

returns a string representation of the attribute data format to be used in the CuData "dfs" property.

Valid return values are scalar, vector and matrix

Referenced by extractData(), fillFromAttributeConfig(), and fillFromCommandInfo().

◆ get_att_config()

bool CuTangoWorld::get_att_config ( Tango::DeviceProxy *  dev,
const std::string &  attribute,
CuData &  res,
bool  skip_read_att = false 
)

◆ get_att_props()

bool CuTangoWorld::get_att_props ( Tango::DeviceProxy *  dev,
const std::string &  attribute,
CuData &  res,
const std::vector< std::string >  props 
)

References strerror().

Referenced by CuTConfigActivity::execute().

◆ get_command_info()

bool CuTangoWorld::get_command_info ( Tango::DeviceProxy *  dev,
const std::string &  cmd,
CuData &  cmd_info 
)

Get Tango CommandInfo data and save it into a CuData.

Parameters
deva pre allocated DeviceProxy
cmdthe name of the command
cmd_infoa non const reference to a CuData that will contain the Tango::CommandInfo fields. If an error occurs, the exception message is stored into the error parameter and cmd_info is left untouched.
Returns
true if successful, false otherwise.

References fillFromCommandInfo(), and strerror().

Referenced by CuPollingActivity::execute(), CuWriteActivity::execute(), and CuTConfigActivityExecutor_Default::get_command_info().

◆ get_properties()

bool CuTangoWorld::get_properties ( const std::vector< CuData > &  in_list,
CuData &  res,
const std::string &  dbhost = "" 
)

CuTangoWorld::get_properties.

Parameters
in_listlist of properties to fetch, described with a CuData bundle
resthe result of the database query
Returns
true if no errors occurred.
Results
Results are stored into the res CuData passed as reference.
  • device attribute properties: res["the/device/name/attname/property_name"] = property as std vector of strings
  • device properties: res["the/device/name/property_name"] = property as std vector of strings
  • class properties: res["classname/property_name"] = property as std vector of strings

References getTangoDb(), and strerror().

Referenced by CuGetTDbPropActivity::execute().

◆ getLastMessage()

string CuTangoWorld::getLastMessage ( ) const

◆ getTangoDb()

Tango::Database * CuTangoWorld::getTangoDb ( const std::string &  dbhost)

References strerror().

Referenced by db_get(), and get_properties().

◆ make_fqdn_src()

std::string CuTangoWorld::make_fqdn_src ( const std::string &  src) const

given a source, replace the tango host section with its FQDN name

Parameters
srcany source
Returns
a string with the FQDN tango host name

if

  • no tango host is found in src
  • the detected tango host may be already a FQDN name (one or more `.'s are found) then the method returns a string equal to the input string

The returned string will leave intact the "tango://" protocol prefix in the source, if present.

◆ prepend_tgproto()

std::string CuTangoWorld::prepend_tgproto ( const std::string &  src) const

prepend "tango://" protocol string to src if not already specified

Parameters
srcthe input source
Returns
"tango://" + src, unless src already contains "tango://" at some point

◆ putDateTime()

void CuTangoWorld::putDateTime ( const Tango::TimeVal &  ttv,
CuData &  data 
)

Referenced by extractData().

◆ read_att()

bool CuTangoWorld::read_att ( Tango::DeviceProxy *  dev,
const std::string &  attribute,
CuData &  res 
)

◆ read_atts()

bool CuTangoWorld::read_atts ( Tango::DeviceProxy *  dev,
std::vector< std::string > &  p_v_an,
std::vector< CuData > &  v_a,
std::vector< CuData > &  reslist,
int  da_updpo 
)

References extractData(), and strerror().

Referenced by CuPollingActivity::execute().

◆ setSrcPatterns()

void CuTangoWorld::setSrcPatterns ( const std::vector< std::string > &  pat_regex)

◆ source_valid()

bool CuTangoWorld::source_valid ( const std::string &  src)

◆ source_valid_pattern()

const char * CuTangoWorld::source_valid_pattern ( ) const

◆ srcPatterns()

std::vector< string > CuTangoWorld::srcPatterns ( ) const

◆ strerror() [1/2]

std::string CuTangoWorld::strerror ( const Tango::DevErrorList &  e)

◆ strerror() [2/2]

std::string CuTangoWorld::strerror ( const Tango::DevFailed &  e)

◆ toCuQuality()

CuDataQuality CuTangoWorld::toCuQuality ( Tango::AttrQuality  q) const

CuTangoWorld::toCuQuality.

Parameters
qthe input Tango::AttrQuality enum value
Returns
The engine independent data quality
See also
CuDataQuality

Referenced by extractData().

◆ toDeviceAttribute() [1/2]

Tango::DeviceAttribute CuTangoWorld::toDeviceAttribute ( const std::string &  aname,
const std::vector< std::string > &  argins,
const CuData &  attinfo 
)

◆ toDeviceAttribute() [2/2]

Tango::DeviceAttribute CuTangoWorld::toDeviceAttribute ( const std::string &  name,
const CuVariant &  argin,
const CuData &  attinfo 
)

Referenced by write_att().

◆ toDeviceData() [1/2]

Tango::DeviceData CuTangoWorld::toDeviceData ( const CuVariant &  argins,
const CuData &  cmdinfo 
)

◆ toDeviceData() [2/2]

Tango::DeviceData CuTangoWorld::toDeviceData ( const std::vector< std::string > &  argins,
const CuData &  cmdinfo 
)

◆ write_att()

bool CuTangoWorld::write_att ( Tango::DeviceProxy *  dev,
const std::string &  attnam,
const CuVariant &  argins,
const CuData &  point_info,
CuData &  data 
)

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