rad  5.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rad::Helper Class Reference

#include <helper.hpp>

Public Member Functions

 Helper ()=delete
 
 Helper (const Helper &)=delete
 
Helperoperator= (const Helper &)=delete
 

Static Public Member Functions

static std::string GetHostname (const bool with_domain=false)
 
static std::string FindFile (const std::string &filename)
 
static bool FileExists (const std::string &filename)
 
static std::string GetEnvVar (const std::string &key)
 
static std::string CreateIdentity ()
 
static void SplitAddrPort (const std::string &addr_port, std::string &addr, int &port)
 
static std::string GetVersion ()
 

Static Public Attributes

static constexpr const char * INTROOT = "INTROOT"
 
static constexpr const char * CFGPATH = "CFGPATH"
 

Detailed Description

Class containing static helper methods.

Constructor & Destructor Documentation

◆ Helper() [1/2]

rad::Helper::Helper ( )
delete

◆ Helper() [2/2]

rad::Helper::Helper ( const Helper )
delete

Member Function Documentation

◆ CreateIdentity()

std::string rad::Helper::CreateIdentity ( )
static

This function creates Universally Unique Identifier (UUID) using boost/uuid/random_generator library.

Returns
A randomly generated UUID.

◆ FileExists()

bool rad::Helper::FileExists ( const std::string &  filename)
static

This function checks whether a file exists.

Parameters
[in]filenameName of the file or path to a file.
Returns
true if the file exists, false otherwise.

◆ FindFile()

std::string rad::Helper::FindFile ( const std::string &  filename)
static

This function tries to find the location of a file.

It looks first in the current directory and in case it cannot find it it tries all the directories listed in the CFGPATH env. variable.

TODO remove lookup in $INTROOT/config/ and $INTROOT/resource/config/ directories which are declared obsolete.

Parameters
[in]filenameName of the file or path to a file to be located.
Returns
The absolute path to a given file or an empty string if the file cannot be located or the given filename is empty.

◆ GetEnvVar()

std::string rad::Helper::GetEnvVar ( const std::string &  key)
static

This function checks whether an environment variable exists.

Parameters
[in]keyName of the environment variable.
Returns
The value of the environment variable otherwise an empty string.

◆ GetHostname()

std::string rad::Helper::GetHostname ( const bool  with_domain = false)
static
Returns
the host name.

◆ GetVersion()

std::string rad::Helper::GetVersion ( )
static

The version is configured in the project's wscript file and passed to the C++ preprocessor via the -DVERSION macro definition.

◆ operator=()

Helper& rad::Helper::operator= ( const Helper )
delete

◆ SplitAddrPort()

void rad::Helper::SplitAddrPort ( const std::string &  addr_port,
std::string &  addr,
int &  port 
)
static

Split a string composed by an IP address and a port.

Parameters
[in]addr_portIP address and port separated by ':'.
[out]addrIP address.
[out]portPort.

Member Data Documentation

◆ CFGPATH

constexpr const char* rad::Helper::CFGPATH = "CFGPATH"
staticconstexpr

◆ INTROOT

constexpr const char* rad::Helper::INTROOT = "INTROOT"
staticconstexpr

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