DDS
ver. 3.5.3.8.g5fe284b
|
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_t > | BYTEVectorHexView_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 > | |
_T * | 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. More... | |
template<typename _T > | |
_T & | trim_right (_T *_pString, const typename _T::value_type &_chWhat) |
trims trailing characters from the string. More... | |
template<typename _T > | |
_T & | trim_left (_T *_pString, const typename _T::value_type &_chWhat) |
trims leading characters from the string. More... | |
template<typename _T > | |
_T & | trim (_T *_pString, const typename _T::value_type &_chWhat) |
trims trailing and leading characters from the string. More... | |
template<typename _T > | |
_T & | replace (_T *_pString, const _T &_what, const _T &_with) |
finds elements in a string match a specified string and replaces it. More... | |
template<typename _T > | |
_T & | to_upper (_T &_str) |
convert string to upper case. More... | |
template<typename _T > | |
_T & | to_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 |
Miscellaneous functions and helpers are located here.
typedef std::vector<unsigned char> MiscCommon::BYTEVector_t |
An STL vector of bytes.
typedef std::vector<char> MiscCommon::CHARVector_t |
An STL vector of char(s).
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.
typedef ci_string MiscCommon::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.
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.
using MiscCommon::crc_optimal_64_t = typedef boost::crc_optimal<64, 0x04C11DB7, 0, 0, false, false> |
typedef CLog<std::ostream> MiscCommon::CSTDOutLog |
ostream specialization of CLog.
typedef int MiscCommon::ERRORCODE |
typedef const ERRORCODE MiscCommon::ERRORCODE_C |
typedef enum MiscCommon::ESeverity MiscCommon::LOG_SEVERITY |
Log's severity's constants.
typedef const char* MiscCommon::LPCSTR |
A long pointer to constant string.
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.
typedef std::set<std::string> MiscCommon::StringSet_t |
An STL set of strings.
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)
typedef std::vector<std::string> MiscCommon::StringVector_t |
An STL vector of strings.
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).
typedef std::basic_string<char> MiscCommon::tstring |
It wraps wchar_t, when _GLIBCPP_USE_WCHAR_T and _UNICODE are defined and char otherwise.
typedef std::basic_stringstream<char> MiscCommon::tstringstream |
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).
typedef std::vector<pid_t> MiscCommon::vectorPid_t |
char* MiscCommon::__cxa_demangle | ( | const char * | mangled, |
char * | buf, | ||
size_t * | len, | ||
int * | status | ||
) |
ERRORCODE_C MiscCommon::BASE_FOR_GENERAL_ERR | ( | 50 | ) |
ERRORCODE_C MiscCommon::BASE_FOR_XML_ERR | ( | 100 | ) |
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
ret_t MiscCommon::crc | ( | const std::string & | _str | ) |
ret_t MiscCommon::crc | ( | std::istream & | _stream | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
ERRORCODE_C MiscCommon::erError | ( | EXIT_FAILURE | ) |
ERRORCODE_C MiscCommon::erFalse | ( | - | 2 | ) |
ERRORCODE_C MiscCommon::erFILE_NOT_FOUND | ( | BASE_FOR_GENERAL_ERR+ | 2 | ) |
ERRORCODE_C MiscCommon::erNotImpl | ( | 3 | ) |
ERRORCODE_C MiscCommon::erNULLArg | ( | BASE_FOR_GENERAL_ERR+ | 1 | ) |
ERRORCODE_C MiscCommon::erOK | ( | EXIT_SUCCESS | ) |
|
inline |
Retrieves a string, which represent the last error.
[in,out] | _msg | - an error message will be written to this buffer, must not be NULL. |
|
inline |
Retrieves a string, which represent the last error.
ERRORCODE_C MiscCommon::erTrue | ( | - | 1 | ) |
ERRORCODE_C MiscCommon::erXMLInit | ( | BASE_FOR_XML_ERR+ | 1 | ) |
ERRORCODE_C MiscCommon::erXMLNullNode | ( | BASE_FOR_XML_ERR+ | 3 | ) |
ERRORCODE_C MiscCommon::erXMLReadConfig | ( | BASE_FOR_XML_ERR+ | 2 | ) |
|
inline |
|
inline |
We do not want the parent process to wait for its child process and we do not want to create a zombie.
|
inline |
|
inline |
|
inline |
The function file_size() retrieves file size of a given file.
[in] | _FileName | - full file name. |
system_error | - thrown if error occurs. |
|
inline |
|
inline |
|
inline |
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." | ) |
const LPCSTR MiscCommon::g_cszLOG_DATETIME_FRMT | ( | "%Y-%m-%d %H:%M:%S" | ) |
Log Date/Time format.
const LPCSTR MiscCommon::g_cszLOG_SEVERITY_CRITICAL_ERROR | ( | "FLT" | ) |
const LPCSTR MiscCommon::g_cszLOG_SEVERITY_DEBUG | ( | "DBG" | ) |
const LPCSTR MiscCommon::g_cszLOG_SEVERITY_FAULT | ( | "ERR" | ) |
const LPCSTR MiscCommon::g_cszLOG_SEVERITY_INFO | ( | "INF" | ) |
const LPCSTR MiscCommon::g_cszLOG_SEVERITY_WARNING | ( | "WRN" | ) |
const LPCSTR MiscCommon::g_cszMODULENAME_CORE | ( | "CORE" | ) |
const LPCSTR MiscCommon::g_cszReportBugsAddr | ( | "Report bugs/comments to fairroot@gsi.de" | ) |
|
inline |
The function returns home directory path of the current user.
[out] | _RetVal | - A pointer to string buffer where path will be stored. Must not be NULL. |
|
inline |
The function returns current user name.
[out] | _RetVal | - A pinter to string buffer where user name will be stored. Must not be NULL. |
|
inline |
|
inline |
The function returns home directory path of the given user.
[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. |
|
inline |
The function returns home directory path of the given user.
[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. |
|
inline |
The function is used to access the host name (with FCDN) of the current processor.
[out] | _RetVal | - The returned buffer string. Must not be NULL. |
|
inline |
the function returns a number of available CPU cores
|
inline |
|
inline |
|
inline |
A system helper, which helps to get a Thread ID of the current thread.
|
inline |
|
inline |
The function checks, whether the process which corresponds to the given _PID can be found.
[in] | _PID | - a process ID to look for. |
const size_t MiscCommon::LOG_DATETIME_BUFF_LEN | ( | 25 | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
_T& MiscCommon::replace | ( | _T * | _pString, |
const _T & | _what, | ||
const _T & | _with | ||
) |
finds elements in a string match a specified string and replaces it.
[in,out] | _pString | - The string to be processed. |
[in] | _what | - String to be replaced. |
[in] | _with | - Replacing string. |
_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.
[in] | _pString | - The string to be processed. |
[in] | _ItemToAdd | - The target characters to be checked and added. |
|
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"
[in,out] | _Path | - A pointer to a string buffer which represents a path to extend. Must not be NULL. |
convert string to lower case.
[in] | _str | - Sting to convert. |
convert string to upper case.
[in] | _str | - Sting to convert. |
_T& MiscCommon::trim | ( | _T * | _pString, |
const typename _T::value_type & | _chWhat | ||
) |
trims trailing and leading characters from the string.
[in] | _pString | - The string to be trimmed. |
[in] | _chWhat | - The target character to be trimmed. |
_T& MiscCommon::trim_left | ( | _T * | _pString, |
const typename _T::value_type & | _chWhat | ||
) |
trims leading characters from the string.
[in] | _pString | - The string to be trimmed. |
[in] | _chWhat | - The target character to be trimmed. |
_T& MiscCommon::trim_right | ( | _T * | _pString, |
const typename _T::value_type & | _chWhat | ||
) |
trims trailing characters from the string.
[in] | _pString | - The string to be trimmed. |
[in] | _chWhat | - The target character to be trimmed. |
const std::array<std::string, 11> MiscCommon::g_LogSeverityLevelString |