Elements 6.3.3
A C++ base framework for the Euclid Software.
|
Namespaces | |
namespace | Auxiliary |
namespace | Configuration |
namespace | DataSync |
namespace | Kernel |
namespace | Path |
namespace | Services |
namespace | System |
namespace | Units |
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. | |
using | TempEnv = Environment |
using | OptionsDescription = Program::OptionsDescription |
using | PositionalOptionsDescription = Program::PositionalOptionsDescription |
using | VariablesMap = Program::VariablesMap |
Enumerations | |
enum class | 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 class | SearchType { Local , Recursive } |
Functions | |
ELEMENTS_API std::string | getAuxiliaryVariableName () |
retrieve the variable name used for the auxiliary file lookup | |
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 | |
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::ostream & | operator<< (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> | |
ELEMENTS_API 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. | |
std::ostream & | operator<< (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. | |
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. | |
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::string > | pathSearch (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. | |
std::ostream & | operator<< (std::ostream &stream, const Project &) |
template<typename RawType> | |
ELEMENTS_API constexpr std::size_t | defaultMaxUlps () |
template<> | |
ELEMENTS_API constexpr std::size_t | defaultMaxUlps< float > () |
template<> | |
ELEMENTS_API constexpr std::size_t | defaultMaxUlps< double > () |
template<typename FloatType> | |
ELEMENTS_API bool | almostEqual2sComplement (ELEMENTS_UNUSED const FloatType &a, ELEMENTS_UNUSED const FloatType &b, ELEMENTS_UNUSED const std::size_t &max_ulps=0) |
template<typename RawType> | |
ELEMENTS_API bool | isNan (const RawType &x) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isEqual (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isEqual (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isEqual (const double &left, const double &right) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isNotEqual (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isNotEqual (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isNotEqual (const double &left, const double &right) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isLess (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isLess (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isLess (const double &left, const double &right) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isGreater (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isGreater (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isGreater (const double &left, const double &right) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isLessOrEqual (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isLessOrEqual (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isLessOrEqual (const double &left, const double &right) |
template<typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()> | |
ELEMENTS_API bool | isGreaterOrEqual (const RawType &left, const RawType &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API bool | isGreaterOrEqual (const float &left, const float &right) |
template<std::size_t max_ulps> | |
ELEMENTS_API 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. | |
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. | |
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. | |
ELEMENTS_API void | normalSleep (int sec) |
Simple sleep function. | |
ELEMENTS_API void | nanoSleep (std::int64_t nsec) |
Small variation on the sleep function for nanoseconds sleep. | |
ELEMENTS_API std::string | getVersionFromSvnKeywords (const std::string &svnUrl, const std::string &svnId) |
Function returning a version string extracted from SVN keywords. | |
ELEMENTS_API std::string | getVersionString (unsigned short major, unsigned short minor, unsigned short patch=0) |
Function converting the version numbers into a string. | |
unique_ptr< Layout > | getLogLayout () |
template vector< string > | pathSearch< 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< string > | pathSearch< 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) |
ELEMENTS_API std::string | getEnv (const std::string &var) |
get a particular environment variable | |
ELEMENTS_API bool | isEnvSet (const std::string &var) |
Check if an environment variable is set or not. | |
ELEMENTS_API int | setEnv (const string &name, const string &value, bool overwrite) |
set an environment variables. | |
ELEMENTS_API int | unSetEnv (const std::string &name) |
Simple wrap around unsetenv for strings. | |
ELEMENTS_API Path::Item | getExecutablePath () |
Get the full executable path. |
Variables | |
constexpr std::size_t | FLT_DEFAULT_MAX_ULPS {4} |
Single precision float default maximum unit in the last place. | |
constexpr std::size_t | DBL_DEFAULT_MAX_ULPS {10} |
Double precision float default maximum unit in the last place. | |
ELEMENTS_API const double | FLT_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<float>::digits10) |
Single precision float default test tolerance. | |
ELEMENTS_API const double | DBL_DEFAULT_TEST_TOLERANCE = pow(10.0, -numeric_limits<double>::digits10) |
Double precision float default test tolerance. | |
const std::string | DEFAULT_TMP_KEEP_VAR {"KEEPTEMPDIR"} |
The default environment variable name to keep the temporary object. | |
const std::string | DEFAULT_TMP_MOTIF {"%%%%-%%%%-%%%%-%%%%"} |
The default random creation motif. | |
static const std::map< string, const int > | LOG_LEVEL |
Copyright (C) 2012-2020 Euclid Science Ground Segment
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using Elements::ExitCodeType = std::underlying_type<ExitCode>::type |
Definition at line 28 of file Program.cpp.
Definition at line 29 of file Program.cpp.
using Elements::TempEnv = Environment |
Definition at line 67 of file Temporary.h.
Definition at line 68 of file ProgramManager.cpp.
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.
left | first double number |
right | second double number |
max_ulps | The 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. |
Definition at line 65 of file Real.cpp.
References std::memcpy().
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.
left | first float number |
right | second float number |
max_ulps | The 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. |
Definition at line 39 of file Real.cpp.
References std::memcpy().
ELEMENTS_API bool Elements::almostEqual2sComplement | ( | ELEMENTS_UNUSED const FloatType & | a, |
ELEMENTS_UNUSED const FloatType & | b, | ||
ELEMENTS_UNUSED const std::size_t & | max_ulps = 0 ) |
References ELEMENTS_API, and ELEMENTS_UNUSED.
|
constexpr |
References ELEMENTS_API.
|
constexpr |
References ELEMENTS_API.
|
constexpr |
References ELEMENTS_API.
string Elements::System::getEnv | ( | const std::string & | var | ) |
get a particular environment variable
Definition at line 317 of file System.cpp.
Referenced by Elements::Environment::get(), Elements::Environment::set(), and Elements::Environment::unSet().
Path::Item Elements::System::getExecutablePath | ( | ) |
Get the full executable path.
Definition at line 240 of file ModuleInfo.cpp.
Referenced by Elements::ProgramManager::setProgramName(), and Elements::ProgramManager::setProgramPath().
unique_ptr< Layout > Elements::getLogLayout | ( | ) |
Definition at line 67 of file Logging.cpp.
References NON_REDUNDANT_MOVE.
Referenced by Elements::Logging::getLogger(), and Elements::Logging::setLogFile().
bool Elements::System::isEnvSet | ( | const std::string & | var | ) |
Check if an environment variable is set or not.
Definition at line 340 of file System.cpp.
Referenced by Elements::Environment::hasKey().
ELEMENTS_API bool Elements::isEqual | ( | const double & | left, |
const double & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isEqual | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isEqual | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isGreater | ( | const double & | left, |
const double & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isGreater | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isGreater | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isGreaterOrEqual | ( | const double & | left, |
const double & | right ) |
References DBL_DEFAULT_MAX_ULPS, ELEMENTS_API, and FLT_DEFAULT_MAX_ULPS.
ELEMENTS_API bool Elements::isGreaterOrEqual | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isGreaterOrEqual | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLess | ( | const double & | left, |
const double & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLess | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLess | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLessOrEqual | ( | const double & | left, |
const double & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLessOrEqual | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isLessOrEqual | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isNan | ( | const RawType & | x | ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isNotEqual | ( | const double & | left, |
const double & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isNotEqual | ( | const float & | left, |
const float & | right ) |
References ELEMENTS_API.
ELEMENTS_API bool Elements::isNotEqual | ( | const RawType & | left, |
const RawType & | right ) |
References ELEMENTS_API.
void Elements::nanoSleep | ( | std::int64_t | nsec | ) |
Small variation on the sleep function for nanoseconds sleep.
Definition at line 39 of file Sleep.cpp.
References sleep_for().
void Elements::normalSleep | ( | int | sec | ) |
Simple sleep function.
Small variation on the sleep function for seconds sleep.
Definition at line 32 of file Sleep.cpp.
References sleep_for().
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().
ELEMENTS_API auto Elements::operator<< | ( | Ex && | ex, |
const T & | message ) -> decltype(std::forward< Ex >(ex)) |
References ELEMENTS_API.
ostream & Elements::operator<< | ( | std::ostream & | stream, |
const Environment::Variable & | v ) |
Definition at line 295 of file Environment.cpp.
References Elements::Environment::Variable::value().
std::ostream & Elements::operator<< | ( | std::ostream & | stream, |
const Module & | m ) |
std::ostream & Elements::operator<< | ( | std::ostream & | stream, |
const Project & | ) |
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.
left | right hand number to compare |
right | left hand number to compare |
RawType | raw type: ie float or double |
References ELEMENTS_API.
template bool Elements::realBitWiseEqual< double > | ( | const double & | left, |
const double & | right ) |
template bool Elements::realBitWiseEqual< float > | ( | const float & | left, |
const float & | right ) |
int Elements::System::setEnv | ( | const std::string & | name, |
const std::string & | value, | ||
bool | overwrite = true ) |
set an environment variables.
Set an environment variables. If value is empty, the variable is removed from the environment. When overwrite is 0, the variable is not set if already present. Returns 0 on success, -1 on failure. See man 3 setenv.
Definition at line 362 of file System.cpp.
Referenced by Elements::Environment::restore(), and Elements::Environment::set().
int Elements::System::unSetEnv | ( | const std::string & | name | ) |
Simple wrap around unsetenv for strings.
Definition at line 372 of file System.cpp.
Referenced by Elements::Environment::restore(), and Elements::Environment::unSet().
|
constexpr |
Double precision float default maximum unit in the last place.
Definition at line 86 of file Real.h.
Referenced by isGreaterOrEqual().
|
extern |
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.
const std::string Elements::DEFAULT_TMP_MOTIF {"%%%%-%%%%-%%%%-%%%%"} |
The default random creation motif.
Definition at line 40 of file Temporary.h.
|
constexpr |
Single precision float default maximum unit in the last place.
Definition at line 84 of file Real.h.
Referenced by isGreaterOrEqual().
|
extern |
Definition at line 57 of file Logging.cpp.
Referenced by Elements::Logging::setLevel().