DDS  ver. 3.4
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
MiscCommon Namespace Reference

Miscellaneous functions and helpers are located here. More...

Namespaces

 BOOSTHelper
 a BOOST helpers namespace
 
 INet
 INet declares helpers for Socket and Network operations.
 
 stlx
 STL extensions.
 
 XMLHelper
 Helpers for Xerces XML parser.
 

Classes

class  auto_setenv
 A helper class. Helps to automatically track environment variables. More...
 
class  CConditionEvent
 Helper class for conditional events. More...
 
class  CFileLog
 Logging to a file. More...
 
class  CFindCfgFile
 This class helps to find a cfg location with the best match from the given order. More...
 
struct  char_traits_ci_base
 The char_traits_ci_base class is the default character traits class used for case insensitive strings.
. More...
 
struct  char_traits_ci_base< char >
 The char specialization of the char_traits_ci_base class. More...
 
struct  char_traits_ci_base< wchar_t >
 The wchar_t specialization of the char_traits_ci_base class. More...
 
struct  char_traits_ci_t
 The char_traits_ci_t class is the default character traits class used for case insensitive strings.
. More...
 
class  CHexView
 This class helps to represent a given container's data as in a HEX viewer. More...
 
class  CLog
 A simple template class which represents the Log engine of library. More...
 
class  CLogImp
 Template class. High-end helper implementation of CLog, its ofstream specialization. More...
 
class  CLogSingleton
 It represents logbook as a singleton. 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  CTimeoutGuard
 The class, which watches the running time of the process and sends SEGTERM when defined time-out is reached. More...
 
class  custom_istream_iterator
 This custom istream iterator helps to read input line by line without breaking lines after whitespace etc. More...
 
struct  IsDigit
 
struct  IXMLPersistImpl
 The IXMLPersistImpl interface is a class of the XML persistance. More...
 
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

typedef std::basic_string< wchar_t, char_traits_ci_t< wchar_t >, std::allocator< wchar_t > > ci_wstring
 The basic_string class is parameterized by wchar_t and by char_traits_ci_t. Represents case insensitive wide string. More...
 
typedef std::basic_string< char, char_traits_ci_t< char >, std::allocator< char > > ci_string
 The basic_string class is parameterized by char and by char_traits_ci_t. Represents case insensitive string. More...
 
typedef ci_string ci_tstring
 A type definition of case insensitive string. More...
 
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 enum MiscCommon::ESeverity LOG_SEVERITY
 Log's severity's constants. More...
 
typedef CLog< std::ostream > CSTDOutLog
 ostream specialization of CLog. More...
 
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...
 
enum  ESeverity {
  LOG_SEVERITY_INFO = 0x01, LOG_SEVERITY_WARNING = 0x02, LOG_SEVERITY_FAULT = 0x04, LOG_SEVERITY_CRITICAL_ERROR = 0x08,
  LOG_SEVERITY_DEBUG = 0x10
}
 Log's severity's constants. More...
 
enum  { e_FieldSeparator = 0x20, e_WhiteSpace = 0x20 }
 

Functions

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)
 
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
 
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...
 
void parseExe (const std::string &_exeStr, const std::string &_exePrefix, std::string &_filePath, std::string &_filename, std::string &_cmdStr)
 
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)
 
bool is_status_ok (int status)
 
pid_t execute (const std::string &_Command, const std::string &_stdoutFileName, const std::string &_stderrFileName)
 
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
 

Detailed Description

Miscellaneous functions and helpers are located here.

Typedef Documentation

◆ BYTEVector_t

typedef std::vector<unsigned char> MiscCommon::BYTEVector_t

An STL vector of bytes.

◆ BYTEVectorHexView_t

◆ CHARVector_t

typedef std::vector<char> MiscCommon::CHARVector_t

An STL vector of char(s).

◆ ci_string

typedef std::basic_string<char, char_traits_ci_t<char>, std::allocator<char> > MiscCommon::ci_string

The basic_string class is parameterized by char and by char_traits_ci_t. Represents case insensitive string.

◆ ci_tstring

A type definition of case insensitive string.

It represents wide CI string if _GLIBCPP_USE_WCHAR_T and _UNICODE defined, char CI string otherwise.

◆ ci_wstring

typedef std::basic_string<wchar_t, char_traits_ci_t<wchar_t>, std::allocator<wchar_t> > MiscCommon::ci_wstring

The basic_string class is parameterized by wchar_t and by char_traits_ci_t. Represents case insensitive wide string.

◆ crc_optimal_64_t

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

◆ CSTDOutLog

typedef CLog<std::ostream> MiscCommon::CSTDOutLog

ostream specialization of CLog.

◆ ERRORCODE

typedef int MiscCommon::ERRORCODE

◆ ERRORCODE_C

◆ LOG_SEVERITY

Log's severity's constants.

◆ LPCSTR

typedef const char* MiscCommon::LPCSTR

A long pointer to constant string.

◆ LPCTSTR

typedef const char* MiscCommon::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> MiscCommon::StringSet_t

An STL set of strings.

◆ StringUIntMap_t

typedef std::map<std::string, size_t> MiscCommon::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> MiscCommon::StringVector_t

An STL vector of strings.

◆ TCHAR

typedef char MiscCommon::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> MiscCommon::tstring

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

◆ tstringstream

typedef std::basic_stringstream<char> MiscCommon::tstringstream

◆ UIntStringMap_t

typedef std::map<size_t, std::string> MiscCommon::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> MiscCommon::vectorPid_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
e_FieldSeparator 
e_WhiteSpace 

◆ ELogSeverityLevel

Log Severity levels.

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

◆ ESeverity

Log's severity's constants.

Enumerator
LOG_SEVERITY_INFO 
LOG_SEVERITY_WARNING 
LOG_SEVERITY_FAULT 
LOG_SEVERITY_CRITICAL_ERROR 
LOG_SEVERITY_DEBUG 

Function Documentation

◆ __cxa_demangle()

char* MiscCommon::__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 MiscCommon::BASE_FOR_GENERAL_ERR ( 50  )

◆ BASE_FOR_XML_ERR()

ERRORCODE_C MiscCommon::BASE_FOR_XML_ERR ( 100  )

◆ BOOST_LOG_ATTRIBUTE_KEYWORD()

MiscCommon::BOOST_LOG_ATTRIBUTE_KEYWORD ( severity  ,
"Severity"  ,
ELogSeverityLevel   
)

Return singleton instance

Initialization of log. Has to be called in main.

Main logger object

File sink

◆ crc() [1/2]

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

◆ crc() [2/2]

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

◆ crc32() [1/2]

uint32_t MiscCommon::crc32 ( const std::string &  _str)
inline

◆ crc32() [2/2]

uint32_t MiscCommon::crc32 ( std::istream &  _stream)
inline

◆ crc64() [1/2]

uint64_t MiscCommon::crc64 ( const std::string &  _str)
inline

◆ crc64() [2/2]

uint64_t MiscCommon::crc64 ( std::istream &  _stream)
inline

◆ demangle()

std::string MiscCommon::demangle ( const std::type_info &  ti)
inline

◆ erError()

ERRORCODE_C MiscCommon::erError ( EXIT_FAILURE  )

◆ erFalse()

ERRORCODE_C MiscCommon::erFalse ( 2)

◆ erFILE_NOT_FOUND()

ERRORCODE_C MiscCommon::erFILE_NOT_FOUND ( BASE_FOR_GENERAL_ERR 2)

◆ erNotImpl()

ERRORCODE_C MiscCommon::erNotImpl ( )

◆ erNULLArg()

ERRORCODE_C MiscCommon::erNULLArg ( BASE_FOR_GENERAL_ERR 1)

◆ erOK()

ERRORCODE_C MiscCommon::erOK ( EXIT_SUCCESS  )

◆ errno2str() [1/2]

int MiscCommon::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 MiscCommon::errno2str ( )
inline

Retrieves a string, which represent the last error.

Returns
string, which represent the last error.

◆ erTrue()

ERRORCODE_C MiscCommon::erTrue ( 1)

◆ erXMLInit()

ERRORCODE_C MiscCommon::erXMLInit ( BASE_FOR_XML_ERR 1)

◆ erXMLNullNode()

ERRORCODE_C MiscCommon::erXMLNullNode ( BASE_FOR_XML_ERR 3)

◆ erXMLReadConfig()

ERRORCODE_C MiscCommon::erXMLReadConfig ( BASE_FOR_XML_ERR 2)

◆ execute() [1/3]

pid_t MiscCommon::execute ( const std::string &  _Command,
const std::string &  _stdoutFileName,
const std::string &  _stderrFileName 
)
inline

◆ execute() [2/3]

void MiscCommon::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 MiscCommon::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 MiscCommon::file_exists ( const std::string &  _FileName)
inline

◆ file_size()

off_t MiscCommon::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 MiscCommon::findCommanderServer ( std::string *  _host,
std::string *  _port 
)
inline

◆ findCommanderServerImpl()

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

◆ findCommanderUI()

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

◆ g_cszDDSServerIsNotFound_StartIt()

const LPCSTR MiscCommon::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 MiscCommon::g_cszLOG_DATETIME_FRMT ( "%Y-%m-%d %H:%M:%S"  )

Log Date/Time format.

◆ g_cszLOG_SEVERITY_CRITICAL_ERROR()

const LPCSTR MiscCommon::g_cszLOG_SEVERITY_CRITICAL_ERROR ( "FLT"  )

◆ g_cszLOG_SEVERITY_DEBUG()

const LPCSTR MiscCommon::g_cszLOG_SEVERITY_DEBUG ( "DBG"  )

◆ g_cszLOG_SEVERITY_FAULT()

const LPCSTR MiscCommon::g_cszLOG_SEVERITY_FAULT ( "ERR"  )

◆ g_cszLOG_SEVERITY_INFO()

const LPCSTR MiscCommon::g_cszLOG_SEVERITY_INFO ( "INF"  )

◆ g_cszLOG_SEVERITY_WARNING()

const LPCSTR MiscCommon::g_cszLOG_SEVERITY_WARNING ( "WRN"  )

◆ g_cszMODULENAME_CORE()

const LPCSTR MiscCommon::g_cszMODULENAME_CORE ( "CORE"  )

◆ g_cszReportBugsAddr()

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

◆ get_cuser_homedir()

void MiscCommon::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 MiscCommon::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 MiscCommon::get_env ( const std::string &  _EnvVarName,
std::string *  _RetVal 
)
inline

◆ get_homedir() [1/2]

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

◆ getNCores()

size_t MiscCommon::getNCores ( )
inline

the function returns a number of available CPU cores

◆ getprocbyname()

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

◆ getProgressDisplayString()

std::string MiscCommon::getProgressDisplayString ( int  _completed,
int  _total 
)
inline

◆ gettid()

unsigned long MiscCommon::gettid ( )
inline

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

Returns
Current thread ID.

◆ is_status_ok()

bool MiscCommon::is_status_ok ( int  status)
inline

◆ IsProcessRunning()

bool MiscCommon::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 MiscCommon::LOG_DATETIME_BUFF_LEN ( 25  )

◆ operator!=()

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

◆ operator<<()

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

◆ operator==()

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

◆ operator>>()

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

◆ parseExe()

void MiscCommon::parseExe ( const std::string &  _exeStr,
const std::string &  _exePrefix,
std::string &  _filePath,
std::string &  _filename,
std::string &  _cmdStr 
)
inline

◆ replace()

template<typename _T >
_T& MiscCommon::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.

◆ smart_append()

template<typename _T >
_T* MiscCommon::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 MiscCommon::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 MiscCommon::smart_path ( const _T _Path)
inline

◆ to_lower()

template<typename _T >
_T& MiscCommon::to_lower ( _T _str)

convert string to lower case.

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

◆ to_upper()

template<typename _T >
_T& MiscCommon::to_upper ( _T _str)

convert string to upper case.

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

◆ trim()

template<typename _T >
_T& MiscCommon::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& MiscCommon::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& MiscCommon::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> MiscCommon::g_LogSeverityLevelString
Initial value:
{
{ "p_l", "p_m", "p_h", "dbg", "inf", "wrn", "err", "fat", "cout", "cout", "cerr" }
}