DDS  ver. 3.6
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
dds::misc Namespace Reference

Namespaces

 impl
 
 INet
 INet declares helpers for Socket and Network operations.
 
 stlx
 STL extensions.
 

Classes

class  auto_setenv
 A helper class. Helps to automatically track environment variables. More...
 
class  CConditionEvent
 Helper class for conditional events. More...
 
class  CFindCfgFile
 This class helps to find a cfg location with the best match from the given order. More...
 
class  CHexView
 This class helps to represent a given container's data as in a HEX viewer. More...
 
class  CMutex
 A Mutex wrapper. Based on pthread calls. More...
 
class  CPIDFile
 A PID-file helper. More...
 
class  CProcList
 This class is used to quarry a list of currently running processes. More...
 
class  CProcStatus
 This class helps to retrieve process's information from /proc/<pid>/status. More...
 
class  CSessionIDFile
 
class  custom_istream_iterator
 This custom istream iterator helps to read input line by line without breaking lines after whitespace etc. More...
 
struct  HumanReadable
 
struct  IsDigit
 
class  NONCopyable
 Class which makes child to be non-copyable object. More...
 
class  NullType
 
struct  SFileExists
 The SFileExists functor helps to check whether the file by a given full path exists or not. More...
 
struct  SFindName
 
class  smart_mutex
 A smart CMutex helper. More...
 
struct  STimeMeasure
 
class  system_error
 The system_error exception class retrieves a string, which represent the last error. More...
 
struct  ToLower
 
struct  ToUpper
 

Typedefs

using crc_optimal_64_t = boost::crc_optimal< 64, 0x04C11DB7, 0, 0, false, false >
 
typedef const char * LPCTSTR
 Long Pointer to a Constant null-Terminated String. More...
 
typedef std::basic_string< char > tstring
 It wraps wchar_t, when _GLIBCPP_USE_WCHAR_T and _UNICODE are defined and char otherwise. More...
 
typedef std::basic_stringstream< char > tstringstream
 
typedef char TCHAR
 Use TCHAR instead of char or wchar_t. It will be appropriately translated. More...
 
typedef const char * LPCSTR
 A long pointer to constant string. More...
 
typedef std::set< std::string > StringSet_t
 An STL set of strings. More...
 
typedef std::vector< std::string > StringVector_t
 An STL vector of strings. More...
 
typedef std::vector< char > CHARVector_t
 An STL vector of char(s). More...
 
typedef std::vector< unsigned char > BYTEVector_t
 An STL vector of bytes. More...
 
typedef std::map< size_t, std::string > UIntStringMap_t
 An STL map, which is mapping pairs of size_t (as a key) and string (as a value). More...
 
typedef std::map< std::string, size_t > StringUIntMap_t
 An STL map, which is mapping pairs of string (as a key) and size_t (as a value) More...
 
typedef int ERRORCODE
 
typedef const ERRORCODE ERRORCODE_C
 
typedef CHexView< BYTEVector_tBYTEVectorHexView_t
 
typedef std::vector< pid_t > vectorPid_t
 

Enumerations

enum  ELogSeverityLevel {
  proto_low, proto_mid, proto_high, debug,
  info, warning, error, fatal,
  log_stdout, log_stdout_clean, log_stderr
}
 Log Severity levels. More...
 

Functions

std::string get_temp_dir (const std::string &_prefix)
 
void conflicting_options (const boost::program_options::variables_map &_vm, const char *_opt1, const char *_opt2)
 The conflicting_options function used to check that 'opt1' and 'opt2' are not specified at the same time. More...
 
void option_dependency (const boost::program_options::variables_map &_vm, const char *_for_what, const char *_required_option)
 The option_dependency function used to check that if 'for_what' is specified, then 'required_option' is specified too. More...
 
template<class ret_t , class crc_t >
ret_t crc (const std::string &_str)
 
uint32_t crc32 (const std::string &_str)
 
uint64_t crc64 (const std::string &_str)
 
template<class ret_t , class crc_t >
ret_t crc (std::istream &_stream)
 
uint32_t crc32 (std::istream &_stream)
 
uint64_t crc64 (std::istream &_stream)
 
template<class T , class Ch , class Tr , class Dist >
bool operator== (const custom_istream_iterator< T, Ch, Tr, Dist > &lhs, const custom_istream_iterator< T, Ch, Tr, Dist > &rhs)
 
template<class T , class Ch , class Tr , class Dist >
bool operator!= (const custom_istream_iterator< T, Ch, Tr, Dist > &lhs, const custom_istream_iterator< T, Ch, Tr, Dist > &rhs)
 
void findCommanderServerImpl (std::string *_host, std::string *_port, const std::string &_name)
 
void findCommanderServer (std::string *_host, std::string *_port)
 
void findCommanderUI (std::string *_host, std::string *_port)
 
std::istream & operator>> (std::istream &_in, ELogSeverityLevel &_logSeverityLevel)
 
std::ostream & operator<< (std::ostream &_out, ELogSeverityLevel _logSeverityLevel)
 
void setupEnv ()
 
ERRORCODE_C erOK (EXIT_SUCCESS)
 
ERRORCODE_C erTrue (-1)
 
ERRORCODE_C erFalse (-2)
 
ERRORCODE_C erError (EXIT_FAILURE)
 
ERRORCODE_C erNotImpl (3)
 
ERRORCODE_C BASE_FOR_GENERAL_ERR (50)
 
ERRORCODE_C erNULLArg (BASE_FOR_GENERAL_ERR+1)
 
ERRORCODE_C erFILE_NOT_FOUND (BASE_FOR_GENERAL_ERR+2)
 
ERRORCODE_C BASE_FOR_XML_ERR (100)
 
ERRORCODE_C erXMLInit (BASE_FOR_XML_ERR+1)
 
ERRORCODE_C erXMLReadConfig (BASE_FOR_XML_ERR+2)
 
ERRORCODE_C erXMLNullNode (BASE_FOR_XML_ERR+3)
 
int errno2str (std::string *_msg)
 Retrieves a string, which represent the last error. More...
 
std::string errno2str ()
 Retrieves a string, which represent the last error. More...
 
 BOOST_LOG_ATTRIBUTE_KEYWORD (severity, "Severity", ELogSeverityLevel) class Logger
 
void parseExe (const std::string &_exeStr, const std::string &_exePrefix, std::string &_filepath, std::string &_filename, std::string &_cmdStr)
 
template<class Options_t >
int defaultExecSetup (int _argc, char *_argv[], Options_t *_options, std::function< bool(int argc, char *argv[], Options_t *)> _parseFunc)
 
int defaultExecReinit (const boost::uuids::uuid &_sid)
 
template<typename _T >
_Tsmart_append (_T *_pString, const typename _T::value_type _ItemToAdd)
 appends character _ItemToAdd to the string _pString if there is no such suffix on the end of _pString. More...
 
template<typename _T >
_Ttrim_right (_T *_pString, const typename _T::value_type &_chWhat)
 trims trailing characters from the string. More...
 
template<typename _T >
_Ttrim_left (_T *_pString, const typename _T::value_type &_chWhat)
 trims leading characters from the string. More...
 
template<typename _T >
_Ttrim (_T *_pString, const typename _T::value_type &_chWhat)
 trims trailing and leading characters from the string. More...
 
template<typename _T >
_Treplace (_T *_pString, const _T &_what, const _T &_with)
 finds elements in a string match a specified string and replaces it. More...
 
template<typename _T >
_Tto_upper (_T &_str)
 convert string to upper case. More...
 
template<typename _T >
_Tto_lower (_T &_str)
 convert string to lower case. More...
 
bool IsProcessRunning (pid_t _PID)
 The function checks, whether the process which corresponds to the given _PID can be found. More...
 
vectorPid_t getprocbyname (const std::string &_Srv, bool _filterForRealUserID=false)
 _filterForRealUserID is an OS X specific argument More...
 
bool is_status_ok (int status)
 
pid_t execute (const std::string &_Command, const std::string &_stdoutFileName, const std::string &_stderrFileName, std::string *_outputFilesAccessPermissions=nullptr)
 
void execute (const std::string &_Command)
 We do not want the parent process to wait for its child process and we do not want to create a zombie. More...
 
pid_t execute (const std::string &_Command, const std::chrono::seconds &_Timeout, std::string *_output=nullptr, std::string *_errout=nullptr, int *_exitCode=nullptr)
 
std::string getProgressDisplayString (int _completed, int _total)
 
const LPCSTR g_cszLOG_DATETIME_FRMT ("%Y-%m-%d %H:%M:%S")
 Log Date/Time format. More...
 
const size_t LOG_DATETIME_BUFF_LEN (25)
 
const LPCSTR g_cszLOG_SEVERITY_INFO ("INF")
 
const LPCSTR g_cszLOG_SEVERITY_WARNING ("WRN")
 
const LPCSTR g_cszLOG_SEVERITY_FAULT ("ERR")
 
const LPCSTR g_cszLOG_SEVERITY_CRITICAL_ERROR ("FLT")
 
const LPCSTR g_cszLOG_SEVERITY_DEBUG ("DBG")
 
const LPCSTR g_cszMODULENAME_CORE ("CORE")
 
const LPCSTR g_cszReportBugsAddr ("Report bugs/comments to fairroot@gsi.de")
 
const LPCSTR g_cszDDSServerIsNotFound_StartIt ("Looks like we can't find any suitable DDS commander server to " "connect. Use \"dds-session start\" to start one.")
 
void get_cuser_name (std::string *_RetVal)
 The function returns current user name. More...
 
void get_homedir (uid_t _uid, std::string *_RetVal)
 The function returns home directory path of the given user. More...
 
void get_homedir (const char *_UName, std::string *_RetVal)
 The function returns home directory path of the given user. More...
 
void get_cuser_homedir (std::string *_RetVal)
 The function returns home directory path of the current user. More...
 
template<class _T >
void smart_path (_T *_Path)
 The function extends any environment variable found in the give path to its value. More...
 
template<class _T >
_T smart_path (const _T &_Path)
 
void get_hostname (std::string *_RetVal)
 The function is used to access the host name (with FCDN) of the current processor. More...
 
unsigned long gettid ()
 A system helper, which helps to get a Thread ID of the current thread. More...
 
char * __cxa_demangle (const char *mangled, char *buf, size_t *len, int *status)
 demangling C++ symbols. More...
 
std::string demangle (const std::type_info &ti)
 
void get_env (const std::string &_EnvVarName, std::string *_RetVal)
 
off_t file_size (const std::string &_FileName)
 The function file_size() retrieves file size of a given file. More...
 
bool file_exists (const std::string &_FileName)
 
size_t getNCores ()
 the function returns a number of available CPU cores More...
 

Variables

const std::array< std::string, 11 > g_LogSeverityLevelString
 

Typedef Documentation

◆ BYTEVector_t

typedef std::vector<unsigned char> dds::misc::BYTEVector_t

An STL vector of bytes.

◆ BYTEVectorHexView_t

◆ CHARVector_t

typedef std::vector<char> dds::misc::CHARVector_t

An STL vector of char(s).

◆ crc_optimal_64_t

using dds::misc::crc_optimal_64_t = typedef boost::crc_optimal<64, 0x04C11DB7, 0, 0, false, false>

◆ ERRORCODE

typedef int dds::misc::ERRORCODE

◆ ERRORCODE_C

◆ LPCSTR

typedef const char* dds::misc::LPCSTR

A long pointer to constant string.

◆ LPCTSTR

typedef const char* dds::misc::LPCTSTR

Long Pointer to a Constant null-Terminated String.

It wraps wchar_t, when _GLIBCPP_USE_WCHAR_T and _UNICODE are defined and char otherwise.

◆ StringSet_t

typedef std::set<std::string> dds::misc::StringSet_t

An STL set of strings.

◆ StringUIntMap_t

typedef std::map<std::string, size_t> dds::misc::StringUIntMap_t

An STL map, which is mapping pairs of string (as a key) and size_t (as a value)

◆ StringVector_t

typedef std::vector<std::string> dds::misc::StringVector_t

An STL vector of strings.

◆ TCHAR

typedef char dds::misc::TCHAR

Use TCHAR instead of char or wchar_t. It will be appropriately translated.

if _GLIBCPP_USE_WCHAR_T and _UNICODE are correctly defined (or not).

◆ tstring

typedef std::basic_string<char> dds::misc::tstring

It wraps wchar_t, when _GLIBCPP_USE_WCHAR_T and _UNICODE are defined and char otherwise.

◆ tstringstream

typedef std::basic_stringstream<char> dds::misc::tstringstream

◆ UIntStringMap_t

typedef std::map<size_t, std::string> dds::misc::UIntStringMap_t

An STL map, which is mapping pairs of size_t (as a key) and string (as a value).

◆ vectorPid_t

typedef std::vector<pid_t> dds::misc::vectorPid_t

Enumeration Type Documentation

◆ ELogSeverityLevel

Log Severity levels.

Enumerator
proto_low 
proto_mid 
proto_high 
debug 
info 
warning 
error 
fatal 
log_stdout 
log_stdout_clean 
log_stderr 

Function Documentation

◆ __cxa_demangle()

char* dds::misc::__cxa_demangle ( const char *  mangled,
char *  buf,
size_t *  len,
int *  status 
)

demangling C++ symbols.

cout << demangle(typeid(*this)) << endl;
cout << demangle(typeid(int)) << endl;

◆ BASE_FOR_GENERAL_ERR()

ERRORCODE_C dds::misc::BASE_FOR_GENERAL_ERR ( 50  )

◆ BASE_FOR_XML_ERR()

ERRORCODE_C dds::misc::BASE_FOR_XML_ERR ( 100  )

◆ BOOST_LOG_ATTRIBUTE_KEYWORD()

dds::misc::BOOST_LOG_ATTRIBUTE_KEYWORD ( severity  ,
"Severity"  ,
ELogSeverityLevel   
)

Return singleton instance

Initialization of log. Has to be called in main.

Main logger object

File sink

◆ conflicting_options()

void dds::misc::conflicting_options ( const boost::program_options::variables_map &  _vm,
const char *  _opt1,
const char *  _opt2 
)
inline

The conflicting_options function used to check that 'opt1' and 'opt2' are not specified at the same time.

Parameters
[in]_vm- a BOOST program options variable map.
[in]_opt1- the first option to check.
[in]_opt2- the second option to check.
Exceptions
std::runtime_error- thrown if the 'opt1' and 'opt2' are specified at the same time.
Returns
no return value.

◆ crc() [1/2]

template<class ret_t , class crc_t >
ret_t dds::misc::crc ( const std::string &  _str)

◆ crc() [2/2]

template<class ret_t , class crc_t >
ret_t dds::misc::crc ( std::istream &  _stream)

◆ crc32() [1/2]

uint32_t dds::misc::crc32 ( const std::string &  _str)
inline

◆ crc32() [2/2]

uint32_t dds::misc::crc32 ( std::istream &  _stream)
inline

◆ crc64() [1/2]

uint64_t dds::misc::crc64 ( const std::string &  _str)
inline

◆ crc64() [2/2]

uint64_t dds::misc::crc64 ( std::istream &  _stream)
inline

◆ defaultExecReinit()

int dds::misc::defaultExecReinit ( const boost::uuids::uuid &  _sid)
inline

◆ defaultExecSetup()

template<class Options_t >
int dds::misc::defaultExecSetup ( int  _argc,
char *  _argv[],
Options_t *  _options,
std::function< bool(int argc, char *argv[], Options_t *)>  _parseFunc 
)
inline

◆ demangle()

std::string dds::misc::demangle ( const std::type_info &  ti)
inline

◆ erError()

ERRORCODE_C dds::misc::erError ( EXIT_FAILURE  )

◆ erFalse()

ERRORCODE_C dds::misc::erFalse ( 2)

◆ erFILE_NOT_FOUND()

ERRORCODE_C dds::misc::erFILE_NOT_FOUND ( BASE_FOR_GENERAL_ERR 2)

◆ erNotImpl()

ERRORCODE_C dds::misc::erNotImpl ( )

◆ erNULLArg()

ERRORCODE_C dds::misc::erNULLArg ( BASE_FOR_GENERAL_ERR 1)

◆ erOK()

ERRORCODE_C dds::misc::erOK ( EXIT_SUCCESS  )

◆ errno2str() [1/2]

int dds::misc::errno2str ( std::string *  _msg)
inline

Retrieves a string, which represent the last error.

Parameters
[in,out]_msg- an error message will be written to this buffer, must not be NULL.
Returns
errno - system error code.

◆ errno2str() [2/2]

std::string dds::misc::errno2str ( )
inline

Retrieves a string, which represent the last error.

Returns
string, which represent the last error.

◆ erTrue()

ERRORCODE_C dds::misc::erTrue ( 1)

◆ erXMLInit()

ERRORCODE_C dds::misc::erXMLInit ( BASE_FOR_XML_ERR 1)

◆ erXMLNullNode()

ERRORCODE_C dds::misc::erXMLNullNode ( BASE_FOR_XML_ERR 3)

◆ erXMLReadConfig()

ERRORCODE_C dds::misc::erXMLReadConfig ( BASE_FOR_XML_ERR 2)

◆ execute() [1/3]

pid_t dds::misc::execute ( const std::string &  _Command,
const std::string &  _stdoutFileName,
const std::string &  _stderrFileName,
std::string *  _outputFilesAccessPermissions = nullptr 
)
inline

◆ execute() [2/3]

void dds::misc::execute ( const std::string &  _Command)
inline

We do not want the parent process to wait for its child process and we do not want to create a zombie.

◆ execute() [3/3]

pid_t dds::misc::execute ( const std::string &  _Command,
const std::chrono::seconds &  _Timeout,
std::string *  _output = nullptr,
std::string *  _errout = nullptr,
int *  _exitCode = nullptr 
)
inline

◆ file_exists()

bool dds::misc::file_exists ( const std::string &  _FileName)
inline

◆ file_size()

off_t dds::misc::file_size ( const std::string &  _FileName)
inline

The function file_size() retrieves file size of a given file.

Parameters
[in]_FileName- full file name.
Exceptions
system_error- thrown if error occurs.

◆ findCommanderServer()

void dds::misc::findCommanderServer ( std::string *  _host,
std::string *  _port 
)
inline

◆ findCommanderServerImpl()

void dds::misc::findCommanderServerImpl ( std::string *  _host,
std::string *  _port,
const std::string &  _name 
)
inline

◆ findCommanderUI()

void dds::misc::findCommanderUI ( std::string *  _host,
std::string *  _port 
)
inline

◆ g_cszDDSServerIsNotFound_StartIt()

const LPCSTR dds::misc::g_cszDDSServerIsNotFound_StartIt ( "Looks like we can't find any suitable DDS commander server to " "connect. Use \"dds-session start\" to start one."  )

◆ g_cszLOG_DATETIME_FRMT()

const LPCSTR dds::misc::g_cszLOG_DATETIME_FRMT ( "%Y-%m-%d %H:%M:%S"  )

Log Date/Time format.

◆ g_cszLOG_SEVERITY_CRITICAL_ERROR()

const LPCSTR dds::misc::g_cszLOG_SEVERITY_CRITICAL_ERROR ( "FLT"  )

◆ g_cszLOG_SEVERITY_DEBUG()

const LPCSTR dds::misc::g_cszLOG_SEVERITY_DEBUG ( "DBG"  )

◆ g_cszLOG_SEVERITY_FAULT()

const LPCSTR dds::misc::g_cszLOG_SEVERITY_FAULT ( "ERR"  )

◆ g_cszLOG_SEVERITY_INFO()

const LPCSTR dds::misc::g_cszLOG_SEVERITY_INFO ( "INF"  )

◆ g_cszLOG_SEVERITY_WARNING()

const LPCSTR dds::misc::g_cszLOG_SEVERITY_WARNING ( "WRN"  )

◆ g_cszMODULENAME_CORE()

const LPCSTR dds::misc::g_cszMODULENAME_CORE ( "CORE"  )

◆ g_cszReportBugsAddr()

const LPCSTR dds::misc::g_cszReportBugsAddr ( "Report bugs/comments to fairroot@gsi.de"  )

◆ get_cuser_homedir()

void dds::misc::get_cuser_homedir ( std::string *  _RetVal)
inline

The function returns home directory path of the current user.

Parameters
[out]_RetVal- A pointer to string buffer where path will be stored. Must not be NULL.
Returns
In case of error, function returns an empty buffer.

◆ get_cuser_name()

void dds::misc::get_cuser_name ( std::string *  _RetVal)
inline

The function returns current user name.

Parameters
[out]_RetVal- A pinter to string buffer where user name will be stored. Must not be NULL.

◆ get_env()

void dds::misc::get_env ( const std::string &  _EnvVarName,
std::string *  _RetVal 
)
inline

◆ get_homedir() [1/2]

void dds::misc::get_homedir ( uid_t  _uid,
std::string *  _RetVal 
)
inline

The function returns home directory path of the given user.

Parameters
[in]_uid- user id the home directory of which should be returned.
[out]_RetVal- A pointer to string buffer where path will be stored. Must not be NULL.
Returns
In case of error, function returns an empty buffer.

◆ get_homedir() [2/2]

void dds::misc::get_homedir ( const char *  _UName,
std::string *  _RetVal 
)
inline

The function returns home directory path of the given user.

Parameters
[in]_UName- a name of the user the home directory of which should be returned.
[out]_RetVal- A pointer to string buffer where path will be stored. Must not be NULL.
Returns
In case of error, function returns an empty buffer.

◆ get_hostname()

void dds::misc::get_hostname ( std::string *  _RetVal)
inline

The function is used to access the host name (with FCDN) of the current processor.

Parameters
[out]_RetVal- The returned buffer string. Must not be NULL.

◆ get_temp_dir()

std::string dds::misc::get_temp_dir ( const std::string &  _prefix)
inline

◆ getNCores()

size_t dds::misc::getNCores ( )
inline

the function returns a number of available CPU cores

◆ getprocbyname()

vectorPid_t dds::misc::getprocbyname ( const std::string &  _Srv,
bool  _filterForRealUserID = false 
)
inline

_filterForRealUserID is an OS X specific argument

◆ getProgressDisplayString()

std::string dds::misc::getProgressDisplayString ( int  _completed,
int  _total 
)
inline

◆ gettid()

unsigned long dds::misc::gettid ( )
inline

A system helper, which helps to get a Thread ID of the current thread.

Returns
Current thread ID.

◆ is_status_ok()

bool dds::misc::is_status_ok ( int  status)
inline

◆ IsProcessRunning()

bool dds::misc::IsProcessRunning ( pid_t  _PID)
inline

The function checks, whether the process which corresponds to the given _PID can be found.

Parameters
[in]_PID- a process ID to look for.
Returns
true when the process is found, otherwise return value is false.
Note
This function will not be able to check existence of a zombie process

◆ LOG_DATETIME_BUFF_LEN()

const size_t dds::misc::LOG_DATETIME_BUFF_LEN ( 25  )

◆ operator!=()

template<class T , class Ch , class Tr , class Dist >
bool dds::misc::operator!= ( const custom_istream_iterator< T, Ch, Tr, Dist > &  lhs,
const custom_istream_iterator< T, Ch, Tr, Dist > &  rhs 
)
inline

◆ operator<<()

std::ostream& dds::misc::operator<< ( std::ostream &  _out,
ELogSeverityLevel  _logSeverityLevel 
)
inline

◆ operator==()

template<class T , class Ch , class Tr , class Dist >
bool dds::misc::operator== ( const custom_istream_iterator< T, Ch, Tr, Dist > &  lhs,
const custom_istream_iterator< T, Ch, Tr, Dist > &  rhs 
)
inline

◆ operator>>()

std::istream& dds::misc::operator>> ( std::istream &  _in,
ELogSeverityLevel _logSeverityLevel 
)
inline

◆ option_dependency()

void dds::misc::option_dependency ( const boost::program_options::variables_map &  _vm,
const char *  _for_what,
const char *  _required_option 
)
inline

The option_dependency function used to check that if 'for_what' is specified, then 'required_option' is specified too.

Parameters
[in]_vm- a BOOST program options variable map.
[in]_for_what- option to check.
[in]_required_option- required option.
Exceptions
std::runtime_error- thrown if 'for_what' is specified but there is no 'required_option' found.
Returns
no return value.

◆ parseExe()

void dds::misc::parseExe ( const std::string &  _exeStr,
const std::string &  _exePrefix,
std::string &  _filepath,
std::string &  _filename,
std::string &  _cmdStr 
)
inline

◆ replace()

template<typename _T >
_T& dds::misc::replace ( _T _pString,
const _T _what,
const _T _with 
)

finds elements in a string match a specified string and replaces it.

Parameters
[in,out]_pString- The string to be processed.
[in]_what- String to be replaced.
[in]_with- Replacing string.
Returns
A reference to the string object from which the elements have been replaced.

◆ setupEnv()

void dds::misc::setupEnv ( )
inline

◆ smart_append()

template<typename _T >
_T* dds::misc::smart_append ( _T _pString,
const typename _T::value_type  _ItemToAdd 
)

appends character _ItemToAdd to the string _pString if there is no such suffix on the end of _pString.

Parameters
[in]_pString- The string to be processed.
[in]_ItemToAdd- The target characters to be checked and added.
Returns
A pointer to the processed string object.

◆ smart_path() [1/2]

template<class _T >
void dds::misc::smart_path ( _T _Path)
inline

The function extends any environment variable found in the give path to its value.

This function also extends "~/" or "~user_name/" to a real user's home directory path. When, for example, there is a variable $GLITE_LOCATE = /opt/glite and the given path is "$GLITE_LOCATION/etc/test.xml", the return value will be a path "/opt/glite/etc/test.xml"

Parameters
[in,out]_Path- A pointer to a string buffer which represents a path to extend. Must not be NULL.

◆ smart_path() [2/2]

template<class _T >
_T dds::misc::smart_path ( const _T _Path)
inline

◆ to_lower()

template<typename _T >
_T& dds::misc::to_lower ( _T _str)

convert string to lower case.

Parameters
[in]_str- Sting to convert.
Returns
Converted string.

◆ to_upper()

template<typename _T >
_T& dds::misc::to_upper ( _T _str)

convert string to upper case.

Parameters
[in]_str- Sting to convert.
Returns
Converted string.

◆ trim()

template<typename _T >
_T& dds::misc::trim ( _T _pString,
const typename _T::value_type &  _chWhat 
)

trims trailing and leading characters from the string.

Parameters
[in]_pString- The string to be trimmed.
[in]_chWhat- The target character to be trimmed.
Returns
A reference to the string object from which the elements have been trimmed.

◆ trim_left()

template<typename _T >
_T& dds::misc::trim_left ( _T _pString,
const typename _T::value_type &  _chWhat 
)

trims leading characters from the string.

Parameters
[in]_pString- The string to be trimmed.
[in]_chWhat- The target character to be trimmed.
Returns
A reference to the string object from which the elements have been trimmed.

◆ trim_right()

template<typename _T >
_T& dds::misc::trim_right ( _T _pString,
const typename _T::value_type &  _chWhat 
)

trims trailing characters from the string.

Parameters
[in]_pString- The string to be trimmed.
[in]_chWhat- The target character to be trimmed.
Returns
A reference to the string object from which the elements have been trimmed.

Variable Documentation

◆ g_LogSeverityLevelString

const std::array<std::string, 11> dds::misc::g_LogSeverityLevelString
Initial value:
{
{ "p_l", "p_m", "p_h", "dbg", "inf", "wrn", "err", "fat", "cout", "cout", "cerr" }
}