ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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
 
 Helper ()=delete
 
 Helper (const Helper &)=delete
 
Helperoperator= (const Helper &)=delete
 
 Helper ()=delete
 
 Helper (const Helper &)=delete
 
Helperoperator= (const Helper &)=delete
 

Static Public Member Functions

static std::string GetHostname (const bool withDomain=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 addrPort, std::string &addr, int &port)
 
template<typename EVENT >
static const std::string GetRequestId (rad::AnyEvent const &event)
 
static std::string GetHostname (const bool withDomain=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 addrPort, std::string &addr, int &port)
 
template<typename EVENT >
static const std::string GetRequestId (rad::AnyEvent const &event)
 
static std::string GetHostname (const bool withDomain=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 addrPort, std::string &addr, int &port)
 
template<typename EVENT >
static const std::string GetRequestId (rad::AnyEvent const &event)
 

Static Public Attributes

static constexpr const char * INTROOT = "INTROOT"
 

Detailed Description

Class containing static helper methods.

Constructor & Destructor Documentation

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

Member Function Documentation

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

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

Returns
A randomly generated UUID.
static std::string rad::Helper::CreateIdentity ( )
static
static std::string rad::Helper::CreateIdentity ( )
static
static bool rad::Helper::FileExists ( const std::string &  fileName)
static
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.
static bool rad::Helper::FileExists ( const std::string &  fileName)
static
static std::string rad::Helper::FindFile ( const std::string &  fileName)
static
static std::string rad::Helper::FindFile ( const std::string &  fileName)
static
std::string rad::Helper::FindFile ( const std::string &  fileName)
static

This function tries to find the location of a file.

Parameters
[in]fileNameName of the file or path to a file to be located.
Returns
The path to a given file or an empty string if the file cannot be located.
static std::string rad::Helper::GetEnvVar ( const std::string &  key)
static
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.
static std::string rad::Helper::GetEnvVar ( const std::string &  key)
static
static std::string rad::Helper::GetHostname ( const bool  withDomain = false)
static
static std::string rad::Helper::GetHostname ( const bool  withDomain = false)
static
std::string rad::Helper::GetHostname ( const bool  withDomain = false)
static
Returns
the host name.
template<typename EVENT >
static const std::string rad::Helper::GetRequestId ( rad::AnyEvent const event)
static
template<typename EVENT >
static const std::string rad::Helper::GetRequestId ( rad::AnyEvent const event)
static
template<typename EVENT >
const std::string rad::Helper::GetRequestId ( rad::AnyEvent const event)
static

This method can be used to retrieve the identity of the originator of the request associated to the given event.

Parameters
[in]eventEvent used to retrieve its payload the originator of the request associated to the event.
Returns
The identity of the originator of the request associated to the event (basically the request ID).
Helper& rad::Helper::operator= ( const Helper )
delete
Helper& rad::Helper::operator= ( const Helper )
delete
Helper& rad::Helper::operator= ( const Helper )
delete
static void rad::Helper::SplitAddrPort ( const std::string  addrPort,
std::string &  addr,
int &  port 
)
static
static void rad::Helper::SplitAddrPort ( const std::string  addrPort,
std::string &  addr,
int &  port 
)
static
void rad::Helper::SplitAddrPort ( const std::string  addrPort,
std::string &  addr,
int &  port 
)
static

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

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

Member Data Documentation

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

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