Elements  5.8
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Namespaces | Classes | Macros | Functions
ElementsKernel: The Kernel Module of the Elements Framework

Core CMake, C++ and Python utilities. More...

Namespaces

 Elements
 

Classes

class  BoostTestAdapter
 
class  GoogleMockSetupFixture
 

Macros

#define __attribute__(x)
 
#define ELEMENTS_DEPRECATED   __attribute__ ((__deprecated__))
 
#define ELEMENTS_DEPRECATED_MSG(msg)   __attribute__ ((__deprecated__(msg)))
 
#define ELEMENTS_API
 Dummy definitions for the backward compatibility mode. More...
 
#define ELEMENTS_IMPORT
 
#define ELEMENTS_EXPORT
 
#define ELEMENTS_LOCAL
 
#define LIKELY(x)   x
 
#define UNLIKELY(x)   x
 
#define ELEMENTS_DEFAULT_LOGLEVEL   DEBUG
 
#define CREATE_MANAGER_WITH_ARGS(MANAGER, ELEMENTS_PROGRAM,...)
 
#define CREATE_MANAGER(ELEMENTS_PROGRAM_NAME, MANAGER)   CREATE_MANAGER_WITH_ARGS(MANAGER, ELEMENTS_PROGRAM_NAME, )
 
#define MAIN_FOR_WITH_ARGS(ELEMENTS_PROGRAM,...)
 
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)   MAIN_FOR_WITH_ARGS(ELEMENTS_PROGRAM_NAME, )
 
#define _xstr(s)   str(s)
 
#define _str(s)   #s
 
#define ELEMENTS_UNUSED   __attribute__ ((unused))
 

Functions

constexpr std::uint_least64_t CALC_PROJECT_VERSION (const std::uint_least64_t maj, const std::uint_least64_t min, const std::uint_least64_t pat)
 Mange major, minor and patch version number into a single integer. More...
 
ELEMENTS_API std::string Elements::getVersionFromSvnKeywords (const std::string &svnUrl, const std::string &svnId)
 Function returning a version string extracted from SVN keywords. More...
 
ELEMENTS_API std::string Elements::getVersionString (const unsigned short major, const unsigned short minor, const unsigned short patch=0)
 Function converting the version numbers into a string. More...
 

Detailed Description

Core CMake, C++ and Python utilities.

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

Macro Definition Documentation

#define __attribute__ (   x)

define the attribute macro to nothing if the gcc compiler is earlier than GCC 3.4.

Definition at line 38 of file Attribute.h.

#define _str (   s)    #s

Definition at line 40 of file Stringify.h.

#define _xstr (   s)    str(s)

helper macro

Macro to convert a preprocessor constant into a string.

#define CREATE_MANAGER (   ELEMENTS_PROGRAM_NAME,
  MANAGER 
)    CREATE_MANAGER_WITH_ARGS(MANAGER, ELEMENTS_PROGRAM_NAME, )

Macro that declares a program manager with all the needed arguments. It is typically called from the MAIN_FOR(ELEMENTS_PROGRAM_NAME, MANAGER) macro.

Parameters
ELEMENTS_PROGRAM_NAMEname of the main program class, derived from the class Elements::Program class.
MANAGERname of the manager variable to be created.

Definition at line 67 of file Main.h.

#define CREATE_MANAGER_WITH_ARGS (   MANAGER,
  ELEMENTS_PROGRAM,
  ... 
)
Value:
Elements::ProgramManager MANAGER {std::unique_ptr<Elements::Program>{new ELEMENTS_PROGRAM{__VA_ARGS__}}, \
THIS_PROJECT_VERSION_STRING, THIS_PROJECT_NAME_STRING, \
THIS_PROJECT_VCS_VERSION, \
THIS_MODULE_VERSION_STRING, THIS_MODULE_NAME_STRING, \
THIS_PROJECT_SEARCH_DIRS, \
Class for managing all Elements programs.
#define ELEMENTS_DEFAULT_LOGLEVEL
Definition: Main.h:42

Macro that declares a program manager with custom constructor arguments. It is typically called from the MAIN_FOR(ELEMENTS_PROGRAM_NAME, MANAGER) macro.

Parameters
ELEMENTS_PROGRAMcall of the main program constructor, derived from the class Elements::Program class.
MANAGERname of the manager variable to be created.

Definition at line 52 of file Main.h.

#define ELEMENTS_API

Dummy definitions for the backward compatibility mode.

Definition at line 74 of file Export.h.

#define ELEMENTS_DEFAULT_LOGLEVEL   DEBUG

Definition at line 42 of file Main.h.

#define ELEMENTS_DEPRECATED   __attribute__ ((__deprecated__))

This macro create a warning message for a deprecated function or class

Definition at line 35 of file Deprecated.h.

#define ELEMENTS_DEPRECATED_MSG (   msg)    __attribute__ ((__deprecated__(msg)))

This macro create a warning message for a deprecated function or class This version takes a msg as argument. This message will be displayed together with the deprecation warning.

Definition at line 44 of file Deprecated.h.

#define ELEMENTS_EXPORT

Definition at line 76 of file Export.h.

#define ELEMENTS_IMPORT

Definition at line 75 of file Export.h.

#define ELEMENTS_LOCAL

Definition at line 77 of file Export.h.

#define ELEMENTS_UNUSED   __attribute__ ((unused))

This macro is there to

  • allows to pass the argument name, even if it is not used. it will silence the compiler warning about this
  • It's a bit better that the ugly gcc form. Until the nice [[]] will be the mainstream syntax.
  • we can also hide compiler specific attribute here

Definition at line 39 of file Unused.h.

#define LIKELY (   x)    x

Macro for compiler branch optimisation. To be used when is x condition is more likely to happen that the other one

Definition at line 41 of file Likely.h.

#define MAIN_FOR (   ELEMENTS_PROGRAM_NAME)    MAIN_FOR_WITH_ARGS(ELEMENTS_PROGRAM_NAME, )

Macro which must be used to create a main in classes that derived from Elements::Program, i.e., these derived classes must end with the following line:

* MAIN_FOR(ELEMENTS_PROGRAM_NAME)
*

.

Definition at line 113 of file Main.h.

#define MAIN_FOR_WITH_ARGS (   ELEMENTS_PROGRAM,
  ... 
)
Value:
ELEMENTS_API int main(int argc, char* argv[]) \
{ \
CREATE_MANAGER_WITH_ARGS(manager, ELEMENTS_PROGRAM, __VA_ARGS__); \
Elements::ExitCode exit_code = manager.run(argc, argv); \
return static_cast<Elements::ExitCodeType>(exit_code); \
}
T set_terminate(T...args)
static void onTerminate() noexcept
This is the set_terminate handler that is used in the MAIN_FOR macro.
std::underlying_type< ExitCode >::type ExitCodeType
Underlying type of the ExitCode class.
Definition: Exit.h:122
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
ExitCode
Strongly typed exit numbers.
Definition: Exit.h:97
#define ELEMENTS_UNUSED
Definition: Unused.h:39
#define CREATE_MANAGER_WITH_ARGS(MANAGER, ELEMENTS_PROGRAM,...)
Definition: Main.h:52

Macro which must be used to create a main in classes that derived from Elements::Program, i.e., these derived classes must end with the following line:

* MAIN_FOR_WITH_ARGS(ELEMENTS_PROGRAM, ...)
*

.

Definition at line 87 of file Main.h.

#define UNLIKELY (   x)    x

Macro for compiler branch optimisation. To be used when is x condition is less likely to happen that the other one

Definition at line 42 of file Likely.h.

Function Documentation

constexpr std::uint_least64_t CALC_PROJECT_VERSION ( const std::uint_least64_t  maj,
const std::uint_least64_t  min,
const std::uint_least64_t  pat 
)

Mange major, minor and patch version number into a single integer.

Definition at line 35 of file Version.h.

string Elements::getVersionFromSvnKeywords ( const std::string svnUrl,
const std::string svnId 
)

Function returning a version string extracted from SVN keywords.

ElementsExample/ElementsProgramExample.cpp shows how to use this method to implement a getVersion in a prgram

Parameters
svnUrlThis is a string that can be filled with the HeadURL svn keywords. Writing #define SVN_URL "SVN $HeadURL$ in a file.
svnIdThis is a string that can be filled with the Id svn keywords. Writing #define SVN_ID "SVN $Id$ in a file.

the svn keywords will be expanded upon the next commit if the svn client is instructed to do this with svn propset svn:keywords 'Id Revision HeadURL' ElementsProgramExample.cpp

Returns
Todo:
remove the any reference to SVN for the next major release

Definition at line 35 of file Version.cpp.

string Elements::getVersionString ( const unsigned short  major,
const unsigned short  minor,
const unsigned short  patch = 0 
)

Function converting the version numbers into a string.

This function return either 2 numbers separated with a "." if the patch number is zero. Or 3 numbers separated with a "." if the patch is not zero.

Parameters
majorMajor version number
minorMinor version number
patchPatch version number
Returns
The formatted string with the version numbers
Todo:
use the unsigned uint16_t instead of short for the next major release

Definition at line 68 of file Version.cpp.

References std::to_string().

Here is the call graph for this function: