ARC SDK
|
Data Structures | |
class | Arc::Config |
Configuration element - represents (sub)tree of ARC XML configuration. More... | |
class | Arc::BaseConfig |
Configuration for client interface. More... | |
class | Arc::ArcLocation |
Determines ARC installation location. More... | |
class | Arc::RegularExpression |
A regular expression class. More... | |
class | Arc::ArcVersion |
Determines ARC HED libraries version at runtime. More... | |
class | Arc::Base64 |
Base64 encoding and decoding. More... | |
class | Arc::CheckSum |
Interface for checksum manipulations. More... | |
class | Arc::CRC32Sum |
Implementation of CRC32 checksum. More... | |
class | Arc::MD5Sum |
Implementation of MD5 checksum. More... | |
class | Arc::Adler32Sum |
Implementation of Adler32 checksum. More... | |
class | Arc::CheckSumAny |
Wrapper for CheckSum class. More... | |
class | Arc::Counter |
A class defining a common interface for counters. More... | |
class | Arc::CounterTicket |
A class for "tickets" that correspond to counter reservations. More... | |
class | Arc::ExpirationReminder |
A class intended for internal use within counters. More... | |
class | Arc::Period |
A Period represents a length of time. More... | |
class | Arc::Time |
A class for storing and manipulating times. More... | |
class | Arc::FileAccess |
Defines interface for accessing filesystems. More... | |
class | Arc::FileAccessContainer |
Container for shared FileAccess objects. More... | |
class | Arc::FileLock |
A general file locking class. More... | |
class | Arc::IniConfig |
Class representing "ini-style" configuration. More... | |
class | Arc::IntraProcessCounter |
A class for counters used by threads within a single process. More... | |
class | Arc::IString |
Class used for localised output of log messages. More... | |
struct | Arc::LoggerFormat |
Struct to contain LogFormat, to use with operator<<(std::ostream&, const LoggerFormat&) More... | |
class | Arc::LogMessage |
A class for log messages. More... | |
class | Arc::LogDestination |
A base class for log destinations. More... | |
class | Arc::LogStream |
A class for logging to ostreams. More... | |
class | Arc::LogFile |
A class for logging to files. More... | |
class | Arc::Logger |
A logger class. More... | |
class | Arc::MySQLDatabase |
Implements a MySQL version of the Database interface. More... | |
class | Arc::MySQLQuery |
Implements a MySQL version of the Query database query class. More... | |
class | Arc::OptionParser |
Command line option parser used by ARC command line tools. More... | |
class | Arc::Profile |
Class used to convert human-friendly ini-style configuration to XML. More... | |
class | Arc::Run |
This class runs an external executable. More... | |
class | Arc::ThreadDataItem |
Base class for per-thread object. More... | |
class | Arc::SimpleCondition |
Simple triggered condition. More... | |
class | Arc::SimpleCounter |
Thread-safe counter with capability to wait for zero value. More... | |
class | Arc::TimedMutex |
Mutex which allows a timeout on locking. More... | |
class | Arc::SharedMutex |
Mutex which allows shared and exclusive locking. More... | |
class | Arc::ThreadedPointer< T > |
Wrapper for pointer with automatic destruction and multiple references. More... | |
class | Arc::ThreadRegistry |
A set of conditions, mutexes, etc. conveniently exposed to monitor running child threads and to wait till they exit. More... | |
class | Arc::ThreadInitializer |
This class initializes the glibmm thread system. More... | |
class | Arc::URL |
Class to represent general URLs. More... | |
class | Arc::URLLocation |
Class to hold a resolved URL location. More... | |
class | Arc::PathIterator |
Class to iterate through elements of a path. More... | |
class | Arc::User |
Platform independent representation of system user. More... | |
class | Arc::UserSwitch |
Class for temporary switching of user id. More... | |
class | Arc::ConfigEndpoint |
Represents the endpoint of service with a given type and GLUE2 InterfaceName. More... | |
class | Arc::initializeCredentialsType |
Defines how user credentials are looked for. More... | |
class | Arc::UserConfig |
User configuration class More... | |
class | Arc::CertEnvLocker |
Class for handling X509* variables in a multi-threaded environment. More... | |
class | Arc::EnvLockWrapper |
Class to provide automatic locking/unlocking of environment on creation/destruction. More... | |
class | Arc::InterruptGuard |
Marks off a section of code which should not be interrupted by signals. More... | |
class | Arc::AutoPointer< T > |
Wrapper for pointer with automatic destruction. More... | |
class | Arc::CountedPointer< T > |
Wrapper for pointer with automatic destruction and multiple references. More... | |
class | Arc::WatchdogListener |
This class is meant to provide interface for Watchdog executor part. More... | |
class | Arc::WatchdogChannel |
This class is meant to be used in code which provides "I'm alive" ticks to watchdog. More... | |
class | Arc::NS |
Class to represent an XML namespace. More... | |
class | Arc::XMLNode |
Wrapper for LibXML library Tree interface. More... | |
class | Arc::XMLNodeContainer |
Container for multiple XMLNode elements. More... | |
Namespaces | |
namespace | Arc |
Arc namespace contains all core ARC classes. | |
Macros | |
#define | ARC_VERSION "4.0.0" |
#define | ARC_VERSION_NUM 0x040000 |
#define | ARC_VERSION_MAJOR 4 |
#define | ARC_VERSION_MINOR 0 |
#define | ARC_VERSION_PATCH 0 |
#define | stringtoi(A) stringto < int > ((A)) |
#define | stringtoui(A) stringto < unsigned int > ((A)) |
#define | stringtol(A) stringto < long > ((A)) |
#define | stringtoll(A) stringto < long long > ((A)) |
#define | stringtoul(A) stringto < unsigned long > ((A)) |
#define | stringtoull(A) stringto < unsigned long long > ((A)) |
#define | stringtof(A) stringto < float > ((A)) |
#define | stringtod(A) stringto < double > ((A)) |
#define | stringtold(A) stringto < long double > ((A)) |
Typedefs | |
typedef std::list< XMLNode > | Arc::XMLNodeList |
Functions | |
std::ostream & | Arc::operator<< (std::ostream &, const Period &) |
Prints a Period-object to the given ostream – typically cout. More... | |
std::ostream & | Arc::operator<< (std::ostream &, const Time &) |
Prints a Time-object to the given ostream – typically cout. More... | |
std::string | Arc::TimeStamp (const TimeFormat &=Time::GetFormat()) |
Returns a time-stamp of the current time in some format. More... | |
std::string | Arc::TimeStamp (Time, const TimeFormat &=Time::GetFormat()) |
Returns a time-stamp of some specified time in some format. More... | |
bool | Arc::FileCopy (const std::string &source_path, const std::string &destination_path, uid_t uid, gid_t gid) |
Copy file source_path to file destination_path. More... | |
bool | Arc::FileCopy (const std::string &source_path, const std::string &destination_path) |
Copy file source_path to file destination_path. More... | |
bool | Arc::FileCopy (const std::string &source_path, int destination_handle) |
Copy file source_path to file handle destination_handle. More... | |
bool | Arc::FileCopy (int source_handle, const std::string &destination_path) |
Copy from file handle source_handle to file destination_path. More... | |
bool | Arc::FileCopy (int source_handle, int destination_handle) |
Copy from file handle source_handle to file handle destination_handle. More... | |
bool | Arc::FileRead (const std::string &filename, std::list< std::string > &data, uid_t uid=0, gid_t gid=0) |
Simple method to read file content from filename. More... | |
bool | Arc::FileRead (const std::string &filename, std::string &data, uid_t uid=0, gid_t gid=0) |
Simple method to read whole file content from filename. More... | |
bool | Arc::FileCreate (const std::string &filename, const std::string &data, uid_t uid=0, gid_t gid=0, mode_t mode=0) |
Simple method to create a new file containing given data. More... | |
bool | Arc::FileStat (const std::string &path, struct stat *st, bool follow_symlinks) |
Stat a file and put info into the st struct. More... | |
bool | Arc::FileStat (const std::string &path, struct stat *st, uid_t uid, gid_t gid, bool follow_symlinks) |
Stat a file using the specified uid and gid and put info into the st struct. More... | |
bool | Arc::FileLink (const std::string &oldpath, const std::string &newpath, bool symbolic) |
Make symbolic or hard link of file. More... | |
bool | Arc::FileLink (const std::string &oldpath, const std::string &newpath, uid_t uid, gid_t gid, bool symbolic) |
Make symbolic or hard link of file using the specified uid and gid. More... | |
std::string | Arc::FileReadLink (const std::string &path) |
Returns path at which symbolic link is pointing. More... | |
std::string | Arc::FileReadLink (const std::string &path, uid_t uid, gid_t gid) |
Returns path at which symbolic link is pointing using the specified uid and gid. More... | |
bool | Arc::FileDelete (const std::string &path) |
Deletes file at path. More... | |
bool | Arc::FileDelete (const std::string &path, uid_t uid, gid_t gid) |
Deletes file at path using the specified uid and gid. More... | |
bool | Arc::DirCreate (const std::string &path, mode_t mode, bool with_parents=false) |
Create a new directory. More... | |
bool | Arc::DirCreate (const std::string &path, uid_t uid, gid_t gid, mode_t mode, bool with_parents=false) |
Create a new directory using the specified uid and gid. More... | |
bool | Arc::DirDelete (const std::string &path, bool recursive=true) |
Delete a directory, and its content if recursive is true. More... | |
bool | Arc::DirDelete (const std::string &path, bool recursive, uid_t uid, gid_t gid) |
Delete a directory, and its content if recursive is true. More... | |
bool | Arc::TmpDirCreate (std::string &path) |
Create a temporary directory under the system defined temp location, and return its path. More... | |
bool | Arc::TmpFileCreate (std::string &filename, const std::string &data, uid_t uid=0, gid_t gid=0, mode_t mode=0) |
Simple method to create a temporary file containing given data. More... | |
bool | Arc::CanonicalDir (std::string &name, bool leading_slash=true) |
Removes /../ from 'name'. More... | |
void | Arc::GUID (std::string &guid) |
Generates a unique identifier using information such as IP address, current time etc. More... | |
std::string | Arc::UUID (void) |
Generates a unique identifier using the system uuid libraries. More... | |
const char * | Arc::FindTrans (const char *p) |
Return the translation of the given string. More... | |
const char * | Arc::FindNTrans (const char *s, const char *p, unsigned long n) |
Return the plural form translation of the given string when it refers to multiple n. More... | |
std::ostream & | Arc::operator<< (std::ostream &os, const LoggerFormat &format) |
Allows printing of messages to streams using ARC Logger formatting. More... | |
std::ostream & | Arc::operator<< (std::ostream &os, LogLevel level) |
Printing of LogLevel values to ostreams. More... | |
LogLevel | Arc::string_to_level (const std::string &str) |
Convert string to a LogLevel. More... | |
LogLevel | Arc::istring_to_level (const std::string &llStr) |
Convert string case-insensitively to a LogLevel. More... | |
bool | Arc::istring_to_level (const std::string &llStr, LogLevel &ll) |
Case-insensitive parsing of a string to a LogLevel with error response. More... | |
bool | Arc::string_to_level (const std::string &str, LogLevel &ll) |
Same as istring_to_level except it is case-sensitive. More... | |
std::string | Arc::level_to_string (const LogLevel &level) |
Convert LogLevel to a string. More... | |
LogLevel | Arc::old_level_to_level (unsigned int old_level) |
Convert an old-style log level (int from 0 to 5) to a LogLevel. More... | |
template<typename T > | |
T | Arc::stringto (const std::string &s) |
This method converts a string to any type. More... | |
template<typename T > | |
bool | Arc::stringto (const std::string &s, T &t) |
This method converts a string to any type but lets calling function process errors. More... | |
bool | Arc::strtoint (const std::string &s, signed int &t, int base=10) |
Convert string to integer with specified base. More... | |
bool | Arc::strtoint (const std::string &s, unsigned int &t, int base=10) |
Convert string to unsigned integer with specified base. More... | |
bool | Arc::strtoint (const std::string &s, signed long &t, int base=10) |
Convert string to long integer with specified base. More... | |
bool | Arc::strtoint (const std::string &s, unsigned long &t, int base=10) |
Convert string to unsigned long integer with specified base. More... | |
bool | Arc::strtoint (const std::string &s, signed long long &t, int base=10) |
Convert string to long long integer with specified base. More... | |
bool | Arc::strtoint (const std::string &s, unsigned long long &t, int base=10) |
Convert string to unsigned long long integer with specified base. More... | |
template<typename T > | |
std::string | Arc::tostring (T t, int width=0, int precision=0) |
This method converts any type to a string of the width given. More... | |
std::string | Arc::inttostr (signed long long t, int base=10, int width=0) |
Convert long long integer to textual representation for specified base. More... | |
std::string | Arc::inttostr (unsigned long long t, int base=10, int width=0) |
Convert unsigned long long integer to textual representation for specified base. More... | |
std::string | Arc::inttostr (signed int t, int base=10, int width=0) |
Convert integer to textual representation for specied base. More... | |
std::string | Arc::inttostr (unsigned int t, int base=10, int width=0) |
Convert unsigned integer to textual representation for specied base. More... | |
std::string | Arc::inttostr (signed long t, int base=10, int width=0) |
Convert long integer to textual representation for specied base. More... | |
std::string | Arc::inttostr (unsigned long t, int base=10, int width=0) |
Convert unsigned long integer to textual representation for specied base. More... | |
std::string | Arc::booltostr (bool b) |
Convert bool to textual representation, i.e. "true" or "false". More... | |
bool | Arc::strtobool (const std::string &s) |
Convert string to bool. Simply checks string if equal to "true" or "1". More... | |
bool | Arc::strtobool (const std::string &s, bool &b) |
Convert string to bool. More... | |
std::string | Arc::lower (const std::string &s) |
This method converts the given string to lower case. More... | |
std::string | Arc::upper (const std::string &s) |
This method converts the given string to upper case. More... | |
void | Arc::tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ", const std::string &start_quotes="", const std::string &end_quotes="") |
This method tokenizes string. More... | |
void | Arc::tokenize (const std::string &str, std::list< std::string > &tokens, const std::string &delimiters=" ", const std::string &start_quotes="", const std::string &end_quotes="") |
This method tokenizes string. More... | |
std::string::size_type | Arc::get_token (std::string &token, const std::string &str, std::string::size_type pos, const std::string &delimiters=" ", const std::string &start_quotes="", const std::string &end_quotes="") |
This method extracts first token in string str starting at pos. More... | |
std::string | Arc::trim (const std::string &str, const char *sep=NULL) |
This method removes given separators from the beginning and the end of the string. More... | |
std::string | Arc::strip (const std::string &str) |
This method removes blank lines from the passed text string. Lines with only space on them are considered blank. More... | |
std::string | Arc::join (const std::list< std::string > &strlist, const std::string &delimiter) |
Join all the elements in strlist using delimiter. More... | |
std::string | Arc::uri_encode (const std::string &str, bool encode_slash) |
This method %-encodes characters in URI str. More... | |
std::string | Arc::uri_unencode (const std::string &str) |
This method unencodes the %-encoded URI str. More... | |
std::string | Arc::convert_to_rdn (const std::string &dn) |
Convert dn to rdn: /O=Grid/OU=Knowarc/CN=abc —> CN=abc,OU=Knowarc,O=Grid. More... | |
std::string | Arc::escape_chars (const std::string &str, const std::string &chars, char esc, bool excl, escape_type type=escape_char) |
Escape or encode the given chars in str using the escape character esc. More... | |
std::string | Arc::unescape_chars (const std::string &str, char esc, escape_type type=escape_char) |
Unescape or unencode characters in str escaped with esc. More... | |
bool | Arc::CreateThreadFunction (void(*func)(void *), void *arg, SimpleCounter *count=NULL) |
Helper function to create simple thread. More... | |
std::string | Arc::tostring (const ServiceType st) |
Returns "computing" if st is COMPUTING, "index" if st is "INDEX", otherwise an empty string. More... | |
std::string | Arc::GetEnv (const std::string &var) |
Portable function for getting environment variables. Protected by shared lock. More... | |
std::string | Arc::GetEnv (const std::string &var, bool &found) |
Portable function for getting environment variables. Protected by shared lock. More... | |
bool | Arc::SetEnv (const std::string &var, const std::string &value, bool overwrite=true) |
Portable function for setting environment variables. Protected by exclusive lock. More... | |
void | Arc::UnsetEnv (const std::string &var) |
Portable function for unsetting environment variables. Protected by exclusive lock. More... | |
void | Arc::EnvLockAcquire (void) |
Obtain lock on environment. More... | |
void | Arc::EnvLockRelease (void) |
Release lock on environment. More... | |
void | Arc::EnvLockWrap (bool all=false) |
Start code which is using setenv/getenv. More... | |
void | Arc::EnvLockUnwrap (bool all=false) |
End code which is using setenv/getenv. More... | |
void | Arc::EnvLockUnwrapComplete (void) |
Use after fork() to reset all internal variables and release all locks. More... | |
Arc::EnvLockWrapper::EnvLockWrapper (bool all=false) | |
Create a new environment lock for using setenv/getenv. More... | |
Arc::EnvLockWrapper::~EnvLockWrapper (void) | |
Release environment lock. More... | |
std::string | Arc::StrError (int errnum=errno) |
Portable function for obtaining description of last system error. More... | |
Arc::AutoPointer< T >::AutoPointer (void) | |
NULL pointer constructor. More... | |
Arc::AutoPointer< T >::AutoPointer (T *o) | |
Constructor which wraps pointer. More... | |
Arc::AutoPointer< T >::~AutoPointer (void) | |
Destructor destroys wrapped object using delete() More... | |
void | Arc::AutoPointer< T >::operator= (T *o) |
T & | Arc::AutoPointer< T >::operator* (void) const |
For referring wrapped object. More... | |
T * | Arc::AutoPointer< T >::operator-> (void) const |
For referring wrapped object. More... | |
Arc::AutoPointer< T >::operator bool (void) const | |
Returns false if pointer is NULL and true otherwise. More... | |
bool | Arc::AutoPointer< T >::operator! (void) const |
Returns true if pointer is NULL and false otherwise. More... | |
T * | Arc::AutoPointer< T >::Ptr (void) const |
Cast to original pointer. More... | |
T * | Arc::AutoPointer< T >::Release (void) |
Release referred object so that it can be passed to other container. More... | |
Arc::CountedPointer< T >::Base< P >::Base (P *p) | |
Base< P > * | Arc::CountedPointer< T >::Base< P >::add (void) |
bool | Arc::CountedPointer< T >::Base< P >::rem (void) |
Arc::CountedPointer< T >::CountedPointer (T *p=NULL) | |
Arc::CountedPointer< T >::CountedPointer (const CountedPointer< T > &p) | |
CountedPointer< T > & | Arc::CountedPointer< T >::operator= (T *p) |
CountedPointer< T > & | Arc::CountedPointer< T >::operator= (const CountedPointer< T > &p) |
T & | Arc::CountedPointer< T >::operator* (void) const |
For referring wrapped object. More... | |
T * | Arc::CountedPointer< T >::operator-> (void) const |
For referring wrapped object. More... | |
Arc::CountedPointer< T >::operator bool (void) const | |
Returns false if pointer is NULL and true otherwise. More... | |
bool | Arc::CountedPointer< T >::operator! (void) const |
Returns true if pointer is NULL and false otherwise. More... | |
bool | Arc::CountedPointer< T >::operator== (const CountedPointer &p) const |
Returns true if pointers are equal. More... | |
bool | Arc::CountedPointer< T >::operator!= (const CountedPointer &p) const |
Returns true if pointers are not equal. More... | |
bool | Arc::CountedPointer< T >::operator< (const CountedPointer &p) const |
Comparison operator. More... | |
T * | Arc::CountedPointer< T >::Ptr (void) const |
Cast to original pointer. More... | |
T * | Arc::CountedPointer< T >::Release (void) |
Release referred object so that it can be passed to other container. More... | |
bool | Arc::PersistentLibraryInit (const std::string &name) |
Load library and keep persistent. More... | |
std::ostream & | Arc::operator<< (std::ostream &out, const XMLNode &node) |
Write XMLNode to output stream. More... | |
std::istream & | Arc::operator>> (std::istream &in, XMLNode &node) |
Read into XMLNode from input stream. More... | |
bool | Arc::MatchXMLName (const XMLNode &node1, const XMLNode &node2) |
Returns true if underlying XML elements have same names. More... | |
bool | Arc::MatchXMLName (const XMLNode &node, const char *name) |
Returns true if 'name' matches name of 'node'. If name contains prefix it's checked too. More... | |
bool | Arc::MatchXMLName (const XMLNode &node, const std::string &name) |
Returns true if 'name' matches name of 'node'. If name contains prefix it's checked too. More... | |
bool | Arc::MatchXMLNamespace (const XMLNode &node1, const XMLNode &node2) |
Returns true if underlying XML elements belong to same namespaces. More... | |
bool | Arc::MatchXMLNamespace (const XMLNode &node, const char *uri) |
Returns true if 'namespace' matches 'node's namespace.. More... | |
bool | Arc::MatchXMLNamespace (const XMLNode &node, const std::string &uri) |
Returns true if 'namespace' matches 'node's namespace.. More... | |
Variables | |
Logger | Arc::stringLogger |
int | Arc::CountedPointer< T >::Base< P >::cnt |
P * | Arc::CountedPointer< T >::Base< P >::ptr |
bool | Arc::CountedPointer< T >::Base< P >::released |
#define ARC_VERSION "4.0.0" |
ARC API version
#define ARC_VERSION_MAJOR 4 |
ARC API major version number
#define ARC_VERSION_MINOR 0 |
ARC API minor version number
#define ARC_VERSION_NUM 0x040000 |
ARC API version number
#define ARC_VERSION_PATCH 0 |
ARC API patch number
enum Arc::escape_type |
enum Arc::LogFormat |
Output formats. Defines prefix for each message.
enum Arc::LogLevel |
Logging levels for tagging and filtering log messages.
enum Arc::PeriodBase |
Base to use when constructing a new Period.
enum Arc::ServiceType |
enum Arc::TimeFormat |
|
inline |
NULL pointer constructor.
|
inline |
Constructor which wraps pointer.
|
inline |
Convert bool to textual representation, i.e. "true" or "false".
bool Arc::CanonicalDir | ( | std::string & | name, |
bool | leading_slash = true |
||
) |
Removes /../ from 'name'.
If leading_slash=true '/' will be added at the beginning of 'name' if missing. Otherwise it will be removed. The directory separator used here depends on the platform.
std::string Arc::convert_to_rdn | ( | const std::string & | dn | ) |
Convert dn to rdn: /O=Grid/OU=Knowarc/CN=abc —> CN=abc,OU=Knowarc,O=Grid.
bool Arc::CreateThreadFunction | ( | void(*)(void *) | func, |
void * | arg, | ||
SimpleCounter * | count = NULL |
||
) |
Helper function to create simple thread.
It takes care of all the peculiarities of the Glib::Thread API. It runs function 'func' with argument 'arg' in a separate thread. If count parameter is not NULL then count will be incremented before this function returns and then decremented when thread finishes.
bool Arc::DirCreate | ( | const std::string & | path, |
mode_t | mode, | ||
bool | with_parents = false |
||
) |
Create a new directory.
bool Arc::DirCreate | ( | const std::string & | path, |
uid_t | uid, | ||
gid_t | gid, | ||
mode_t | mode, | ||
bool | with_parents = false |
||
) |
Create a new directory using the specified uid and gid.
Specified uid and gid are used for accessing filesystem.
bool Arc::DirDelete | ( | const std::string & | path, |
bool | recursive = true |
||
) |
Delete a directory, and its content if recursive is true.
If the directory is not empty and recursive is false DirDelete will fail.
bool Arc::DirDelete | ( | const std::string & | path, |
bool | recursive, | ||
uid_t | uid, | ||
gid_t | gid | ||
) |
Delete a directory, and its content if recursive is true.
If the directory is not empty and recursive is false DirDelete will fail. Specified uid and gid are used for accessing filesystem.
void Arc::EnvLockAcquire | ( | void | ) |
Obtain lock on environment.
For use with external libraries using unprotected setenv/getenv in a multi-threaded environment.
void Arc::EnvLockRelease | ( | void | ) |
Release lock on environment.
For use with external libraries using unprotected setenv/getenv in a multi-threaded environment.
void Arc::EnvLockUnwrap | ( | bool | all = false | ) |
End code which is using setenv/getenv.
For use with external libraries using unprotected setenv/getenv in a multi-threaded environment.
all | must be same as in corresponding EnvLockWrap. |
void Arc::EnvLockUnwrapComplete | ( | void | ) |
Use after fork() to reset all internal variables and release all locks.
For use with external libraries using unprotected setenv/getenv in a multi-threaded environment.
void Arc::EnvLockWrap | ( | bool | all = false | ) |
Start code which is using setenv/getenv.
For use with external libraries using unprotected setenv/getenv in a multi-threaded environment. Must always have corresponding EnvLockUnwrap.
all | set to true for setenv and false for getenv. |
|
inline |
Create a new environment lock for using setenv/getenv.
all | set to true for setenv and false for getenv. |
std::string Arc::escape_chars | ( | const std::string & | str, |
const std::string & | chars, | ||
char | esc, | ||
bool | excl, | ||
escape_type | type = escape_char |
||
) |
Escape or encode the given chars in str using the escape character esc.
If excl is true then escape all characters not in chars.
bool Arc::FileCopy | ( | const std::string & | source_path, |
const std::string & | destination_path, | ||
uid_t | uid, | ||
gid_t | gid | ||
) |
Copy file source_path to file destination_path.
Specified uid and gid are used for accessing filesystem.
bool Arc::FileCopy | ( | const std::string & | source_path, |
const std::string & | destination_path | ||
) |
Copy file source_path to file destination_path.
bool Arc::FileCopy | ( | const std::string & | source_path, |
int | destination_handle | ||
) |
Copy file source_path to file handle destination_handle.
bool Arc::FileCopy | ( | int | source_handle, |
const std::string & | destination_path | ||
) |
Copy from file handle source_handle to file destination_path.
bool Arc::FileCopy | ( | int | source_handle, |
int | destination_handle | ||
) |
Copy from file handle source_handle to file handle destination_handle.
bool Arc::FileCreate | ( | const std::string & | filename, |
const std::string & | data, | ||
uid_t | uid = 0 , |
||
gid_t | gid = 0 , |
||
mode_t | mode = 0 |
||
) |
Simple method to create a new file containing given data.
Specified uid and gid are used for accessing filesystem. An existing file is overwritten with the new data. Overwriting is performed atomically so the file is guaranteed to exist throughout the duration of this method. Permissions of the created file are determined by mode, the default is 644 or 600 if uid and gid are non-zero. If protected access is required, FileLock should be used in addition to FileCreate. If uid/gid are zero then no real switch of uid/gid is done.
bool Arc::FileDelete | ( | const std::string & | path | ) |
Deletes file at path.
bool Arc::FileDelete | ( | const std::string & | path, |
uid_t | uid, | ||
gid_t | gid | ||
) |
Deletes file at path using the specified uid and gid.
Specified uid and gid are used for accessing filesystem.
bool Arc::FileLink | ( | const std::string & | oldpath, |
const std::string & | newpath, | ||
bool | symbolic | ||
) |
Make symbolic or hard link of file.
bool Arc::FileLink | ( | const std::string & | oldpath, |
const std::string & | newpath, | ||
uid_t | uid, | ||
gid_t | gid, | ||
bool | symbolic | ||
) |
Make symbolic or hard link of file using the specified uid and gid.
Specified uid and gid are used for accessing filesystem.
bool Arc::FileRead | ( | const std::string & | filename, |
std::list< std::string > & | data, | ||
uid_t | uid = 0 , |
||
gid_t | gid = 0 |
||
) |
Simple method to read file content from filename.
Specified uid and gid are used for accessing filesystem. The content is split into lines with the new line character removed, and the lines are returned in the data list. If protected access is required, FileLock should be used in addition to FileRead.
bool Arc::FileRead | ( | const std::string & | filename, |
std::string & | data, | ||
uid_t | uid = 0 , |
||
gid_t | gid = 0 |
||
) |
Simple method to read whole file content from filename.
Specified uid and gid are used for accessing filesystem.
std::string Arc::FileReadLink | ( | const std::string & | path | ) |
Returns path at which symbolic link is pointing.
std::string Arc::FileReadLink | ( | const std::string & | path, |
uid_t | uid, | ||
gid_t | gid | ||
) |
Returns path at which symbolic link is pointing using the specified uid and gid.
Specified uid and gid are used for accessing filesystem.
bool Arc::FileStat | ( | const std::string & | path, |
struct stat * | st, | ||
bool | follow_symlinks | ||
) |
Stat a file and put info into the st struct.
bool Arc::FileStat | ( | const std::string & | path, |
struct stat * | st, | ||
uid_t | uid, | ||
gid_t | gid, | ||
bool | follow_symlinks | ||
) |
Stat a file using the specified uid and gid and put info into the st struct.
Specified uid and gid are used for accessing filesystem.
const char* Arc::FindNTrans | ( | const char * | s, |
const char * | p, | ||
unsigned long | n | ||
) |
Return the plural form translation of the given string when it refers to multiple n.
const char* Arc::FindTrans | ( | const char * | p | ) |
Return the translation of the given string.
std::string::size_type Arc::get_token | ( | std::string & | token, |
const std::string & | str, | ||
std::string::size_type | pos, | ||
const std::string & | delimiters = " " , |
||
const std::string & | start_quotes = "" , |
||
const std::string & | end_quotes = "" |
||
) |
This method extracts first token in string str starting at pos.
std::string Arc::GetEnv | ( | const std::string & | var | ) |
Portable function for getting environment variables. Protected by shared lock.
std::string Arc::GetEnv | ( | const std::string & | var, |
bool & | found | ||
) |
Portable function for getting environment variables. Protected by shared lock.
void Arc::GUID | ( | std::string & | guid | ) |
Generates a unique identifier using information such as IP address, current time etc.
std::string Arc::inttostr | ( | signed long long | t, |
int | base = 10 , |
||
int | width = 0 |
||
) |
Convert long long integer to textual representation for specified base.
The result is left-padded with zeroes to make the string size width.
std::string Arc::inttostr | ( | unsigned long long | t, |
int | base = 10 , |
||
int | width = 0 |
||
) |
Convert unsigned long long integer to textual representation for specified base.
The result is left-padded with zeroes to make the string size width.
|
inline |
Convert integer to textual representation for specied base.
The result is left-padded with zeroes to make the string size width.
|
inline |
Convert unsigned integer to textual representation for specied base.
The result is left-padded with zeroes to make the string size width.
|
inline |
Convert long integer to textual representation for specied base.
The result is left-padded with zeroes to make the string size width.
|
inline |
Convert unsigned long integer to textual representation for specied base.
The result is left-padded with zeroes to make the string size width.
LogLevel Arc::istring_to_level | ( | const std::string & | llStr | ) |
Convert string case-insensitively to a LogLevel.
bool Arc::istring_to_level | ( | const std::string & | llStr, |
LogLevel & | ll | ||
) |
Case-insensitive parsing of a string to a LogLevel with error response.
The method will try to parse (case-insensitive) the argument string to a corresponding LogLevel. If the method succeeds, true will be returned and the argument ll will be set to the parsed LogLevel. If the parsing fails false
will be returned. The parsing succeeds if llStr match (case-insensitively) one of the names of the LogLevel members.
llStr | a string which should be parsed to a Arc::LogLevel. |
ll | a Arc::LogLevel reference which will be set to the matching Arc::LogLevel upon successful parsing. |
true
in case of successful parsing, otherwise false
. std::string Arc::join | ( | const std::list< std::string > & | strlist, |
const std::string & | delimiter | ||
) |
Join all the elements in strlist using delimiter.
std::string Arc::level_to_string | ( | const LogLevel & | level | ) |
Convert LogLevel to a string.
std::string Arc::lower | ( | const std::string & | s | ) |
This method converts the given string to lower case.
bool Arc::MatchXMLName | ( | const XMLNode & | node1, |
const XMLNode & | node2 | ||
) |
Returns true if underlying XML elements have same names.
bool Arc::MatchXMLName | ( | const XMLNode & | node, |
const char * | name | ||
) |
Returns true if 'name' matches name of 'node'. If name contains prefix it's checked too.
bool Arc::MatchXMLName | ( | const XMLNode & | node, |
const std::string & | name | ||
) |
Returns true if 'name' matches name of 'node'. If name contains prefix it's checked too.
bool Arc::MatchXMLNamespace | ( | const XMLNode & | node1, |
const XMLNode & | node2 | ||
) |
Returns true if underlying XML elements belong to same namespaces.
bool Arc::MatchXMLNamespace | ( | const XMLNode & | node, |
const char * | uri | ||
) |
Returns true if 'namespace' matches 'node's namespace..
bool Arc::MatchXMLNamespace | ( | const XMLNode & | node, |
const std::string & | uri | ||
) |
Returns true if 'namespace' matches 'node's namespace..
LogLevel Arc::old_level_to_level | ( | unsigned int | old_level | ) |
Convert an old-style log level (int from 0 to 5) to a LogLevel.
|
inline |
Returns false if pointer is NULL and true otherwise.
|
inline |
Returns false if pointer is NULL and true otherwise.
|
inline |
Returns true if pointer is NULL and false otherwise.
|
inline |
Returns true if pointer is NULL and false otherwise.
|
inline |
Returns true if pointers are not equal.
|
inline |
For referring wrapped object.
|
inline |
For referring wrapped object.
|
inline |
For referring wrapped object.
|
inline |
For referring wrapped object.
|
inline |
Comparison operator.
std::ostream& Arc::operator<< | ( | std::ostream & | os, |
const LoggerFormat & | format | ||
) |
Allows printing of messages to streams using ARC Logger formatting.
std::ostream& Arc::operator<< | ( | std::ostream & | os, |
LogLevel | level | ||
) |
Printing of LogLevel values to ostreams.
Output operator so that LogLevel values can be printed in a nicer way.
std::ostream& Arc::operator<< | ( | std::ostream & | , |
const Period & | |||
) |
Prints a Period-object to the given ostream – typically cout.
std::ostream& Arc::operator<< | ( | std::ostream & | , |
const Time & | |||
) |
Prints a Time-object to the given ostream – typically cout.
std::ostream& Arc::operator<< | ( | std::ostream & | out, |
const XMLNode & | node | ||
) |
Write XMLNode to output stream.
|
inline |
Returns true if pointers are equal.
std::istream& Arc::operator>> | ( | std::istream & | in, |
XMLNode & | node | ||
) |
Read into XMLNode from input stream.
bool Arc::PersistentLibraryInit | ( | const std::string & | name | ) |
Load library and keep persistent.
|
inline |
Cast to original pointer.
|
inline |
Cast to original pointer.
|
inline |
Release referred object so that it can be passed to other container.
|
inline |
Release referred object so that it can be passed to other container.
bool Arc::SetEnv | ( | const std::string & | var, |
const std::string & | value, | ||
bool | overwrite = true |
||
) |
Portable function for setting environment variables. Protected by exclusive lock.
std::string Arc::StrError | ( | int | errnum = errno | ) |
Portable function for obtaining description of last system error.
LogLevel Arc::string_to_level | ( | const std::string & | str | ) |
Convert string to a LogLevel.
bool Arc::string_to_level | ( | const std::string & | str, |
LogLevel & | ll | ||
) |
Same as istring_to_level except it is case-sensitive.
T Arc::stringto | ( | const std::string & | s | ) |
This method converts a string to any type.
bool Arc::stringto | ( | const std::string & | s, |
T & | t | ||
) |
This method converts a string to any type but lets calling function process errors.
std::string Arc::strip | ( | const std::string & | str | ) |
This method removes blank lines from the passed text string. Lines with only space on them are considered blank.
|
inline |
Convert string to bool. Simply checks string if equal to "true" or "1".
|
inline |
Convert string to bool.
Checks whether string is equal to one of "true", "false", "1" or "0", and if not returns false. If equal, true is returned and the bool reference is set to true, if string equals "true" or "1", otherwise it is set to false.
bool Arc::strtoint | ( | const std::string & | s, |
signed int & | t, | ||
int | base = 10 |
||
) |
Convert string to integer with specified base.
bool Arc::strtoint | ( | const std::string & | s, |
unsigned int & | t, | ||
int | base = 10 |
||
) |
Convert string to unsigned integer with specified base.
bool Arc::strtoint | ( | const std::string & | s, |
signed long & | t, | ||
int | base = 10 |
||
) |
Convert string to long integer with specified base.
bool Arc::strtoint | ( | const std::string & | s, |
unsigned long & | t, | ||
int | base = 10 |
||
) |
Convert string to unsigned long integer with specified base.
bool Arc::strtoint | ( | const std::string & | s, |
signed long long & | t, | ||
int | base = 10 |
||
) |
Convert string to long long integer with specified base.
bool Arc::strtoint | ( | const std::string & | s, |
unsigned long long & | t, | ||
int | base = 10 |
||
) |
Convert string to unsigned long long integer with specified base.
std::string Arc::TimeStamp | ( | const TimeFormat & | = Time::GetFormat() | ) |
Returns a time-stamp of the current time in some format.
std::string Arc::TimeStamp | ( | Time | , |
const TimeFormat & | = Time::GetFormat() |
||
) |
Returns a time-stamp of some specified time in some format.
bool Arc::TmpDirCreate | ( | std::string & | path | ) |
Create a temporary directory under the system defined temp location, and return its path.
Uses mkdtemp if available, and a combination of random parameters if not. This latter method is not as safe as mkdtemp.
bool Arc::TmpFileCreate | ( | std::string & | filename, |
const std::string & | data, | ||
uid_t | uid = 0 , |
||
gid_t | gid = 0 , |
||
mode_t | mode = 0 |
||
) |
Simple method to create a temporary file containing given data.
Specified uid and gid are used for accessing filesystem. Permissions of the created file are determined by mode, with default being read/write only by owner. If uid/gid are zero then no real switch of uid/gid is done. If the parameter filename ends with "XXXXXX" then the file created has the same path as filename with these characters replaced by random values. If filename has any other value or is empty then the file is created in the system defined temp location. On success filename contains the name of the temporary file. The content of the data argument is written into this file. This method returns true if data was successfully written to the temporary file, false otherwise.
void Arc::tokenize | ( | const std::string & | str, |
std::vector< std::string > & | tokens, | ||
const std::string & | delimiters = " " , |
||
const std::string & | start_quotes = "" , |
||
const std::string & | end_quotes = "" |
||
) |
This method tokenizes string.
void Arc::tokenize | ( | const std::string & | str, |
std::list< std::string > & | tokens, | ||
const std::string & | delimiters = " " , |
||
const std::string & | start_quotes = "" , |
||
const std::string & | end_quotes = "" |
||
) |
This method tokenizes string.
std::string Arc::tostring | ( | const ServiceType | st | ) |
Returns "computing" if st is COMPUTING, "index" if st is "INDEX", otherwise an empty string.
std::string Arc::tostring | ( | T | t, |
int | width = 0 , |
||
int | precision = 0 |
||
) |
This method converts any type to a string of the width given.
std::string Arc::trim | ( | const std::string & | str, |
const char * | sep = NULL |
||
) |
This method removes given separators from the beginning and the end of the string.
std::string Arc::unescape_chars | ( | const std::string & | str, |
char | esc, | ||
escape_type | type = escape_char |
||
) |
Unescape or unencode characters in str escaped with esc.
void Arc::UnsetEnv | ( | const std::string & | var | ) |
Portable function for unsetting environment variables. Protected by exclusive lock.
std::string Arc::upper | ( | const std::string & | s | ) |
This method converts the given string to upper case.
std::string Arc::uri_encode | ( | const std::string & | str, |
bool | encode_slash | ||
) |
This method %-encodes characters in URI str.
Characters which are not unreserved according to RFC 3986 are encoded. If encode_slash is true forward slashes will also be encoded. It is useful to set encode_slash to false when encoding full paths.
std::string Arc::uri_unencode | ( | const std::string & | str | ) |
This method unencodes the %-encoded URI str.
std::string Arc::UUID | ( | void | ) |
Generates a unique identifier using the system uuid libraries.
|
inline |
Destructor destroys wrapped object using delete()
|
inline |
Release environment lock.