Elements  6.2
A C++ base framework for the Euclid Software.
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables

Namespaces

 Examples
 
 Kernel
 
 Auxiliary
 
 Configuration
 
 Path
 
 Units
 
 Services
 
 DataSync
 
 System
 

Classes

class  Environment
 Python dictionary-like Environment interface. More...
 
class  Exception
 Elements base exception class. More...
 
class  FloatingPoint
 
class  Logging
 Logging API of the Elements framework. More...
 
struct  Module
 
class  OptionException
 
class  Program
 Abstract class for all Elements programs. More...
 
class  ProgramManager
 Class for managing all Elements programs. More...
 
struct  Project
 
class  SimpleProgram
 
class  TempDir
 
class  TempFile
 
class  TempPath
 
class  TypeWithSize
 
class  TypeWithSize< 4 >
 
class  TypeWithSize< 8 >
 

Typedefs

using ExitCodeType = std::underlying_type< ExitCode >::type
 Underlying type of the ExitCode class. More...
 
using TempEnv = Environment
 
using OptionsDescription = Program::OptionsDescription
 
using PositionalOptionsDescription = Program::PositionalOptionsDescription
 
using VariablesMap = Program::VariablesMap
 

Enumerations

enum  ExitCode : int {
  ExitCode::OK = 0, ExitCode::NOT_OK = 1, ExitCode::USAGE = 64, ExitCode::DATAERR = 65,
  ExitCode::NOINPUT = 66, ExitCode::NOUSER = 67, ExitCode::NOHOST = 68, ExitCode::UNAVAILABLE = 69,
  ExitCode::SOFTWARE = 70, ExitCode::OSERR = 71, ExitCode::OSFILE = 72, ExitCode::CANTCREAT = 73,
  ExitCode::IOERR = 74, ExitCode::TEMPFAIL = 75, ExitCode::PROTOCOL = 76, ExitCode::NOPERM = 77,
  ExitCode::CONFIG = 78
}
 Strongly typed exit numbers. More...
 
enum  SearchType { SearchType::Local, SearchType::Recursive }
 

Functions

ELEMENTS_API std::string getAuxiliaryVariableName ()
 retrieve the variable name used for the auxiliary file lookup More...
 
template<typename T >
ELEMENTS_API Path::Item getAuxiliaryPath (const T &file_name, bool raise_exception=true)
 
template ELEMENTS_API Path::Item getAuxiliaryPath (const Path::Item &file_name, bool raise_exception)
 
template ELEMENTS_API Path::Item getAuxiliaryPath (const std::string &file_name, bool raise_exception)
 
ELEMENTS_API std::vector< Path::Item > getAuxiliaryLocations (bool exist_only=false)
 
ELEMENTS_API std::string getConfigurationVariableName ()
 retrieve the variable name used for the configuration file lookup More...
 
template<typename T >
ELEMENTS_API Path::Item getConfigurationPath (const T &file_name, bool raise_exception=true)
 
template ELEMENTS_API Path::Item getConfigurationPath (const Path::Item &file_name, bool raise_exception)
 
template ELEMENTS_API Path::Item getConfigurationPath (const std::string &file_name, bool raise_exception)
 
ELEMENTS_API std::vector< Path::Item > getConfigurationLocations (bool exist_only=false)
 
ELEMENTS_API std::ostreamoperator<< (std::ostream &, const Environment::Variable &)
 
ELEMENTS_API Environment::Variable operator+ (const std::string &, const Environment::Variable &)
 
template<typename Ex , typename T , typename = typename std::enable_if< std::is_base_of<Exception, typename std::remove_reference<Ex>::type>::value>::type>
auto operator<< (Ex &&ex, const T &message) -> decltype(std::forward< Ex >(ex))
 
template<typename T , typename... Args>
ELEMENTS_API std::unique_ptr< T > make_unique (Args &&... args)
 Constructs an object of type T and wraps it in a std::unique_ptr using args as the parameter list for the constructor of T. More...
 
std::ostreamoperator<< (std::ostream &stream, const Module &m)
 
template<typename TargetType , typename SourceType >
ELEMENTS_API TargetType numberCast (const SourceType &s)
 this function is a number cast. It behaves exactly as a static_cast except when casting from a floating point number to an integral one. This one is doing the correct rounding. More...
 
template<typename T >
ELEMENTS_API std::vector< T > pathSearch (const std::string &searched_name, T directory, SearchType search_type)
 Searches for a file or a directory in a directory. The search can be recursive (SearchType.Recursive) and in that case more than one results can be return. More...
 
template ELEMENTS_API std::vector< Path::Item > pathSearch (const std::string &searched_name, Path::Item directory, SearchType search_type)
 
template ELEMENTS_API std::vector< std::stringpathSearch (const std::string &searched_name, std::string directory, SearchType search_type)
 
ELEMENTS_API std::vector< Path::Item > pathSearchInEnvVariable (const std::string &file_name, const std::string &path_like_env_variable, SearchType search_type=SearchType::Recursive)
 Searches for a file or a directory in a path pointed by an environment variable. It can contains collection of colon separated locations. The search can be recursive (SearchType.Recursive) and in that case more than one results can be return. More...
 
std::ostreamoperator<< (std::ostream &stream, const Project &p)
 
template<typename RawType >
constexpr std::size_t defaultMaxUlps ()
 
template<>
constexpr std::size_t defaultMaxUlps< float > ()
 
template<>
constexpr std::size_t defaultMaxUlps< double > ()
 
template<typename FloatType >
bool almostEqual2sComplement (ELEMENTS_UNUSED const FloatType &a, ELEMENTS_UNUSED const FloatType &b, ELEMENTS_UNUSED const std::size_t &max_ulps=0)
 
template<typename RawType >
bool isNan (const RawType &x)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isEqual (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isEqual (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isEqual (const double &left, const double &right)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isNotEqual (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isNotEqual (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isNotEqual (const double &left, const double &right)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isLess (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isLess (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isLess (const double &left, const double &right)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isGreater (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isGreater (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isGreater (const double &left, const double &right)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isLessOrEqual (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isLessOrEqual (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isLessOrEqual (const double &left, const double &right)
 
template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool isGreaterOrEqual (const RawType &left, const RawType &right)
 
template<std::size_t max_ulps>
bool isGreaterOrEqual (const float &left, const float &right)
 
template<std::size_t max_ulps>
bool isGreaterOrEqual (const double &left, const double &right)
 
ELEMENTS_API bool almostEqual2sComplement (const float &left, const float &right, const int &max_ulps=FLT_DEFAULT_MAX_ULPS)
 This function compare 2 floats with a relative tolerance. More...
 
ELEMENTS_API bool almostEqual2sComplement (const double &left, const double &right, const int &max_ulps=DBL_DEFAULT_MAX_ULPS)
 This function compare 2 doubles with a relative tolerance. More...
 
template<typename RawType >
ELEMENTS_API bool realBitWiseEqual (const RawType &left, const RawType &right)
 This function compares 2 floating point numbers bitwise. These are the strict equivalent of the "==". They are only here for the example. More...
 
ELEMENTS_API void normalSleep (int sec)
 Simple sleep function. More...
 
ELEMENTS_API void nanoSleep (std::int64_t nsec)
 Small variation on the sleep function for nanoseconds sleep. More...
 
ELEMENTS_API std::string getVersionFromSvnKeywords (const std::string &svnUrl, const std::string &svnId)
 Function returning a version string extracted from SVN keywords. More...
 
ELEMENTS_API std::string getVersionString (const unsigned short major, const unsigned short minor, const unsigned short patch=0)
 Function converting the version numbers into a string. More...
 
unique_ptr< Layout > getLogLayout ()
 
template vector< stringpathSearch< string, directory_iterator > (const string &searched_name, string directory)
 
template vector< Path::Item > pathSearch< Path::Item, directory_iterator > (const string &searched_name, Path::Item directory)
 
template vector< stringpathSearch< string, recursive_directory_iterator > (const string &searched_name, string directory)
 
template vector< Path::Item > pathSearch< Path::Item, recursive_directory_iterator > (const string &searched_name, Path::Item directory)
 
template bool realBitWiseEqual< float > (const float &left, const float &right)
 
template bool realBitWiseEqual< double > (const double &left, const double &right)
 

Variables

constexpr std::size_t FLT_DEFAULT_MAX_ULPS {4}
 Single precision float default maximum unit in the last place. More...
 
constexpr std::size_t DBL_DEFAULT_MAX_ULPS {10}
 Double precision float default maximum unit in the last place. More...
 
const ELEMENTS_API double FLT_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<float>::digits10)
 Single precision float default test tolerance. More...
 
const ELEMENTS_API double DBL_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<double>::digits10)
 Double precision float default test tolerance. More...
 
const std::string DEFAULT_TMP_KEEP_VAR {"KEEPTEMPDIR"}
 The default environment variable name to keep the temporary object. More...
 
const std::string DEFAULT_TMP_MOTIF {"%%%%-%%%%-%%%%-%%%%"}
 The default random creation motif. More...
 
static const std::map< string, const int > LOG_LEVEL
 

Typedef Documentation

◆ ExitCodeType

Underlying type of the ExitCode class.

Definition at line 122 of file Exit.h.

◆ OptionsDescription

Definition at line 28 of file Program.cpp.

◆ PositionalOptionsDescription

Definition at line 29 of file Program.cpp.

◆ TempEnv

using Elements::TempEnv = typedef Environment
Examples
ElementsKernel/tests/src/Configuration_test.cpp.

Definition at line 67 of file Temporary.h.

◆ VariablesMap

Definition at line 66 of file ProgramManager.cpp.

Function Documentation

◆ almostEqual2sComplement() [1/3]

bool Elements::almostEqual2sComplement ( const double &  left,
const double &  right,
const int &  max_ulps = DBL_DEFAULT_MAX_ULPS 
)

This function compare 2 doubles with a relative tolerance.

The comparison is performed by casting the floating point numbers into integers and then compare their representation with a tolerance for their last bits.

Parameters
leftfirst double number
rightsecond double number
max_ulpsThe relative tolerance is expressed as ULPS (units in the last place). They are unit in the last place of the mantissa. And the recommended default value is 10 for double precision numbers.
Returns
true if the numbers are equal (or cannot be distinguished) and false otherwise.

Definition at line 65 of file Real.cpp.

References std::memcpy().

Here is the call graph for this function:

◆ almostEqual2sComplement() [2/3]

bool Elements::almostEqual2sComplement ( const float &  left,
const float &  right,
const int &  max_ulps = FLT_DEFAULT_MAX_ULPS 
)

This function compare 2 floats with a relative tolerance.

The comparison is performed by casting the floating point numbers into integers and then compare their representation with a tolerance for their last bits.

Parameters
leftfirst float number
rightsecond float number
max_ulpsThe relative tolerance is expressed as ULPS (units in the last place). They are unit in the last place of the mantissa. And the recommended default value is 4 for single precision numbers.
Returns
true if the numbers are equal (or cannot be distinguished) and false otherwise.

Definition at line 39 of file Real.cpp.

References std::memcpy().

Here is the call graph for this function:

◆ almostEqual2sComplement() [3/3]

template<typename FloatType >
bool Elements::almostEqual2sComplement ( ELEMENTS_UNUSED const FloatType &  a,
ELEMENTS_UNUSED const FloatType &  b,
ELEMENTS_UNUSED const std::size_t max_ulps = 0 
)

Definition at line 328 of file Real.h.

◆ defaultMaxUlps()

template<typename RawType >
constexpr std::size_t Elements::defaultMaxUlps ( )
constexpr

Definition at line 128 of file Real.h.

References FLT_DEFAULT_MAX_ULPS.

◆ defaultMaxUlps< double >()

template<>
constexpr std::size_t Elements::defaultMaxUlps< double > ( )
constexpr

Definition at line 138 of file Real.h.

References DBL_DEFAULT_MAX_ULPS.

◆ defaultMaxUlps< float >()

template<>
constexpr std::size_t Elements::defaultMaxUlps< float > ( )
constexpr

Definition at line 133 of file Real.h.

References FLT_DEFAULT_MAX_ULPS.

◆ getLogLayout()

unique_ptr<Layout> Elements::getLogLayout ( )

Definition at line 55 of file Logging.cpp.

Referenced by Elements::Logging::getLogger(), and Elements::Logging::setLogFile().

◆ isEqual() [1/3]

template<std::size_t max_ulps>
bool Elements::isEqual ( const double &  left,
const double &  right 
)
inline

Definition at line 369 of file Real.h.

◆ isEqual() [2/3]

template<std::size_t max_ulps>
bool Elements::isEqual ( const float &  left,
const float &  right 
)
inline

Definition at line 364 of file Real.h.

◆ isEqual() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isEqual ( const RawType &  left,
const RawType &  right 
)

◆ isGreater() [1/3]

template<std::size_t max_ulps>
bool Elements::isGreater ( const double &  left,
const double &  right 
)
inline

Definition at line 426 of file Real.h.

◆ isGreater() [2/3]

template<std::size_t max_ulps>
bool Elements::isGreater ( const float &  left,
const float &  right 
)
inline

Definition at line 421 of file Real.h.

◆ isGreater() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isGreater ( const RawType &  left,
const RawType &  right 
)

Definition at line 410 of file Real.h.

◆ isGreaterOrEqual() [1/3]

template<std::size_t max_ulps>
bool Elements::isGreaterOrEqual ( const double &  left,
const double &  right 
)
inline

Definition at line 468 of file Real.h.

◆ isGreaterOrEqual() [2/3]

template<std::size_t max_ulps>
bool Elements::isGreaterOrEqual ( const float &  left,
const float &  right 
)
inline

Definition at line 463 of file Real.h.

◆ isGreaterOrEqual() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isGreaterOrEqual ( const RawType &  left,
const RawType &  right 
)

Definition at line 452 of file Real.h.

◆ isLess() [1/3]

template<std::size_t max_ulps>
bool Elements::isLess ( const double &  left,
const double &  right 
)
inline

Definition at line 405 of file Real.h.

◆ isLess() [2/3]

template<std::size_t max_ulps>
bool Elements::isLess ( const float &  left,
const float &  right 
)
inline

Definition at line 400 of file Real.h.

◆ isLess() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isLess ( const RawType &  left,
const RawType &  right 
)

Definition at line 389 of file Real.h.

◆ isLessOrEqual() [1/3]

template<std::size_t max_ulps>
bool Elements::isLessOrEqual ( const double &  left,
const double &  right 
)
inline

Definition at line 447 of file Real.h.

◆ isLessOrEqual() [2/3]

template<std::size_t max_ulps>
bool Elements::isLessOrEqual ( const float &  left,
const float &  right 
)
inline

Definition at line 442 of file Real.h.

◆ isLessOrEqual() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isLessOrEqual ( const RawType &  left,
const RawType &  right 
)

Definition at line 431 of file Real.h.

◆ isNan()

template<typename RawType >
bool Elements::isNan ( const RawType &  x)

Definition at line 334 of file Real.h.

References std::memcpy().

Referenced by Elements::FloatingPoint< RawType >::AlmostEquals().

Here is the call graph for this function:

◆ isNotEqual() [1/3]

template<std::size_t max_ulps>
bool Elements::isNotEqual ( const double &  left,
const double &  right 
)
inline

Definition at line 384 of file Real.h.

◆ isNotEqual() [2/3]

template<std::size_t max_ulps>
bool Elements::isNotEqual ( const float &  left,
const float &  right 
)
inline

Definition at line 379 of file Real.h.

◆ isNotEqual() [3/3]

template<typename RawType , std::size_t max_ulps = defaultMaxUlps<RawType>()>
bool Elements::isNotEqual ( const RawType &  left,
const RawType &  right 
)
inline

Definition at line 374 of file Real.h.

◆ nanoSleep()

void Elements::nanoSleep ( std::int64_t  nsec)

Small variation on the sleep function for nanoseconds sleep.

Author
Hubert Degaudenzi
Examples
ElementsExamples/src/program/SimpleProgram.cpp.

Definition at line 39 of file Sleep.cpp.

Referenced by Elements::Examples::SimpleProgram::mainMethod().

◆ normalSleep()

void Elements::normalSleep ( int  sec)

Simple sleep function.

Small variation on the sleep function for seconds sleep.

Author
Hubert Degaudenzi

Definition at line 32 of file Sleep.cpp.

◆ operator+()

Environment::Variable Elements::operator+ ( const std::string value,
const Environment::Variable other 
)

Definition at line 302 of file Environment.cpp.

References Elements::Environment::Variable::env(), Elements::Environment::Variable::index(), and Elements::Environment::Variable::prepend().

Here is the call graph for this function:

◆ operator<<() [1/4]

template<typename Ex , typename T , typename = typename std::enable_if< std::is_base_of<Exception, typename std::remove_reference<Ex>::type>::value>::type>
auto Elements::operator<< ( Ex &&  ex,
const T &  message 
) -> decltype(std::forward<Ex>(ex))

Definition at line 166 of file Exception.h.

◆ operator<<() [2/4]

ostream & Elements::operator<< ( std::ostream stream,
const Environment::Variable v 
)

Definition at line 295 of file Environment.cpp.

References Elements::Environment::Variable::value().

Here is the call graph for this function:

◆ operator<<() [3/4]

std::ostream& Elements::operator<< ( std::ostream stream,
const Module m 
)
inline

Definition at line 62 of file Module.h.

References std::endl(), and Elements::Kernel::Units::m.

Here is the call graph for this function:

◆ operator<<() [4/4]

std::ostream& Elements::operator<< ( std::ostream stream,
const Project p 
)
inline

◆ realBitWiseEqual()

template<typename RawType >
ELEMENTS_API bool Elements::realBitWiseEqual ( const RawType &  left,
const RawType &  right 
)

This function compares 2 floating point numbers bitwise. These are the strict equivalent of the "==". They are only here for the example.

Parameters
leftright hand number to compare
rightleft hand number to compare
Template Parameters
RawTyperaw type: ie float or double
Returns
true if the 2 numbers are bitwise equal

Definition at line 523 of file Real.h.

◆ realBitWiseEqual< double >()

template bool Elements::realBitWiseEqual< double > ( const double &  left,
const double &  right 
)

◆ realBitWiseEqual< float >()

template bool Elements::realBitWiseEqual< float > ( const float &  left,
const float &  right 
)

Variable Documentation

◆ DBL_DEFAULT_MAX_ULPS

constexpr std::size_t Elements::DBL_DEFAULT_MAX_ULPS {10}
constexpr

Double precision float default maximum unit in the last place.

Definition at line 90 of file Real.h.

Referenced by defaultMaxUlps< double >().

◆ DBL_DEFAULT_TEST_TOLERANCE

const double Elements::DBL_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<double>::digits10)

Double precision float default test tolerance.

Definition at line 36 of file Real.cpp.

◆ DEFAULT_TMP_KEEP_VAR

const std::string Elements::DEFAULT_TMP_KEEP_VAR {"KEEPTEMPDIR"}

The default environment variable name to keep the temporary object.

Definition at line 38 of file Temporary.h.

◆ DEFAULT_TMP_MOTIF

const std::string Elements::DEFAULT_TMP_MOTIF {"%%%%-%%%%-%%%%-%%%%"}

The default random creation motif.

Definition at line 40 of file Temporary.h.

Referenced by Elements::TempPath::TempPath().

◆ FLT_DEFAULT_MAX_ULPS

constexpr std::size_t Elements::FLT_DEFAULT_MAX_ULPS {4}
constexpr

Single precision float default maximum unit in the last place.

Definition at line 88 of file Real.h.

Referenced by defaultMaxUlps(), and defaultMaxUlps< float >().

◆ FLT_DEFAULT_TEST_TOLERANCE

const double Elements::FLT_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<float>::digits10)

Single precision float default test tolerance.

Definition at line 35 of file Real.cpp.

◆ LOG_LEVEL

const std::map<string, const int> Elements::LOG_LEVEL
static
Initial value:
{{"FATAL", Priority::FATAL},
{"ERROR", Priority::ERROR},
{"WARN", Priority::WARN},
{"INFO", Priority::INFO},
{"DEBUG", Priority::DEBUG}}

Definition at line 49 of file Logging.cpp.

Referenced by Elements::Logging::setLevel().