diff --git a/essentials/include/essentials/base.hpp b/essentials/include/essentials/base.hpp deleted file mode 100644 index e360481..0000000 --- a/essentials/include/essentials/base.hpp +++ /dev/null @@ -1,36 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A -#define BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A - - -//!\def SX_ASSERT( _condition, _message ) -//!\brief Assert a given condition. Adds the message to the assert for better diagnostics when the assert is triggered. -#define SX_ASSERT( _condition, _message ) \ - do \ - { \ - assert( ( _condition ) && _message ); \ - } \ - while( 0 ) - -//!\def SX_ASSERTED( _x ) -//!\brief Suppress warnings for variables that are only used within asserts. -#define SX_ASSERTED( _x ) static_cast< void >( _x ); - -//!\def SX_UNUSED_PARAMETER( _x ) -//!\brief Suppress warnings for unreferenced parameters. -#define SX_UNUSED_PARAMETER( _x ) static_cast( _x ) - - -#include - - -#endif diff --git a/essentials/include/essentials/build_number.hpp b/essentials/include/essentials/build_number.hpp deleted file mode 100644 index 0e18bab..0000000 --- a/essentials/include/essentials/build_number.hpp +++ /dev/null @@ -1,35 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 -#define BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - -namespace version -{ - - - const sxe::uint16_t BUILD_NUMBER( 60 ); - - -} - - -} - - -#endif diff --git a/essentials/include/essentials/compatibility/chrono.hpp b/essentials/include/essentials/compatibility/chrono.hpp deleted file mode 100644 index b53e1fd..0000000 --- a/essentials/include/essentials/compatibility/chrono.hpp +++ /dev/null @@ -1,59 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 -#define CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 - - -#ifdef SX_CPP03_BOOST - -#include - -#else - -#include - -#endif - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - using boost::chrono::time_point; - using boost::chrono::system_clock; - using boost::chrono::steady_clock; - using boost::chrono::seconds; - using boost::chrono::milliseconds; - using boost::chrono::duration_cast; - using boost::chrono::time_point; - - -#else // C++11 compatibility - - - using std::chrono::time_point; - using std::chrono::system_clock; - using std::chrono::steady_clock; - using std::chrono::milliseconds; - using std::chrono::seconds; - using std::chrono::duration_cast; - using std::chrono::time_point; - - -#endif - - -} - - -#endif diff --git a/essentials/include/essentials/compatibility/compatibility.hpp b/essentials/include/essentials/compatibility/compatibility.hpp deleted file mode 100644 index 90ddb19..0000000 --- a/essentials/include/essentials/compatibility/compatibility.hpp +++ /dev/null @@ -1,181 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 -#define COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 - - -#ifdef SX_CPP03_BOOST -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4456 ) -#pragma warning( disable : 4996 ) -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -#else -#include -#include -#include -#include -#include -#endif - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - #define SX_OVERRIDE - #define SX_FINAL - #define SX_DELETE - #define SX_NULLPTR NULL - - #define SX_FOR(_variable, _container) BOOST_FOREACH( _variable, _container ) - - #define SX_CONSTEXPR const - - #define SX_NOEXCEPT throw() - - - using boost::shared_ptr; - #define SX_UNIQUE_PTR shared_ptr - - #define SX_MAKE_SHARED boost::make_shared - #define SX_MAKE_UNIQUE boost::make_shared - - template - _type& move(_type& _t) - { - return( _t ); - } - - using boost::int8_t; - using boost::int16_t; - using boost::int32_t; - using boost::int64_t; - using boost::uint8_t; - using boost::uint16_t; - using boost::uint32_t; - using boost::uint64_t; - - using boost::bind; - using boost::ref; - using boost::cref; - using boost::placeholders::_1; - using boost::placeholders::_2; - - using boost::function; - - using boost::remove_reference; - using boost::remove_const; - - using boost::random_device; - - -#else // C++11 compatibility - - #ifdef SX_NO_STD_MAKE_UNIQUE - - template< typename t, typename ... args > - std::unique_ptr< t > make_unique(args&& ... _args) - { - return( std::unique_ptr< t >(new t(std::forward< args >(_args)...)) ); - } - - #else - - using std::make_unique; - - #endif - - #define SX_OVERRIDE override - #define SX_FINAL final - #define SX_DELETE = delete - #define SX_NULLPTR nullptr - - #define SX_FOR(_variable, _container) for( _variable : _container ) - - #ifdef _MSC_VER - #if _MSC_VER <= 1800 - #define SX_CONSTEXPR const - #endif - #endif - - #ifndef SX_CONSTEXPR - #define SX_CONSTEXPR constexpr - #endif - -#ifdef _MSC_VER - #if _MSC_VER <= 1800 - #define SX_NOEXCEPT throw() - #else - #define SX_NOEXCEPT noexcept - #endif -#else - #define SX_NOEXCEPT noexcept -#endif - - using std::shared_ptr; - template - using SX_UNIQUE_PTR = std::unique_ptr<_pointee>; - - #define SX_MAKE_SHARED std::make_shared - #define SX_MAKE_UNIQUE sxe::make_unique - - using std::move; - - - using std::int8_t; - using std::int16_t; - using std::int32_t; - using std::int64_t; - using std::uint8_t; - using std::uint16_t; - using std::uint32_t; - using std::uint64_t; - - using std::bind; - using std::ref; - using std::cref; - using std::placeholders::_1; - using std::placeholders::_2; - - using std::function; - - using std::remove_reference; - using std::remove_const; - - using std::random_device; - - -#endif - - -} - - -#endif diff --git a/essentials/include/essentials/compatibility/thread.hpp b/essentials/include/essentials/compatibility/thread.hpp deleted file mode 100644 index 3cdb3c3..0000000 --- a/essentials/include/essentials/compatibility/thread.hpp +++ /dev/null @@ -1,63 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF -#define THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF - - -#ifdef SX_CPP03_BOOST - -#include -#include - -#else - -#include -#include -#include -#include - -#endif - - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - using boost::thread; - using boost::unique_lock; - using boost::mutex; - using boost::lock_guard; - using boost::condition_variable; - using boost::this_thread::sleep_for; - using boost::atomic; - - -#else // C++11 compatibility - - - using std::thread; - using std::unique_lock; - using std::mutex; - using std::lock_guard; - using std::condition_variable; - using std::this_thread::sleep_for; - using std::atomic; - - -#endif - - -} - - -#endif diff --git a/essentials/include/essentials/conversion.hpp b/essentials/include/essentials/conversion.hpp deleted file mode 100644 index 8d73274..0000000 --- a/essentials/include/essentials/conversion.hpp +++ /dev/null @@ -1,53 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 -#define CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - - //!\brief Converts a number from string to int. - //!\param _int_as_string Number in string format. - //!\param _result Variable where the result will be stored. - //!\return True on success, false otherwise. - bool string_to_int( const char* const _int_as_string, int& _result ); - - //!\brief Converts a number from unsigned int 32 to string. - //!\param _value Number to be converted. - //!\return Number as string. - std::string to_string( const sxe::uint32_t _value ); - - //!\brief Converts a number from int to string. - //!\param _value Number to be converted. - //!\return Number as string. - std::string to_string( const int _value ); - - //!\brief Converts a string to uppercase. - //!\param _value String to be converted. - //!\return String in uppercase format. - //!\sa to_lower - std::string to_upper( const std::string& _value ); - - //!\brief Converts a string to lowercase. - //!\param _value String to be converted. - //!\return String in lowercase format. - //!\sa to_upper - std::string to_lower( const std::string& _value ); - -} - - -#endif diff --git a/essentials/include/essentials/essentials_version.hpp b/essentials/include/essentials/essentials_version.hpp deleted file mode 100644 index b652986..0000000 --- a/essentials/include/essentials/essentials_version.hpp +++ /dev/null @@ -1,41 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E -#define VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - -namespace version -{ - - -void log_version(); - - -sxe::uint16_t get_major_version(); -sxe::uint16_t get_minor_version(); -sxe::uint16_t get_patch_version(); -sxe::uint16_t get_build_number(); - - -} - - -} - - -#endif diff --git a/essentials/include/essentials/exception.hpp b/essentials/include/essentials/exception.hpp deleted file mode 100644 index 2e357f8..0000000 --- a/essentials/include/essentials/exception.hpp +++ /dev/null @@ -1,30 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 -#define EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 - - -#include "exception_template.hpp" - - -namespace sxe -{ - - -//!\def SX_EXCEPTION( exception ) -//!\brief The Seadex essentials exception class. -SX_EXCEPTION( exception ) - - -} - - -#endif diff --git a/essentials/include/essentials/exception_template.hpp b/essentials/include/essentials/exception_template.hpp deleted file mode 100644 index 749894f..0000000 --- a/essentials/include/essentials/exception_template.hpp +++ /dev/null @@ -1,160 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D -#define EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/sxprintf.hpp" - - -#ifndef SX_CPP03_BOOST - - -//!\def SX_EXCEPTION( _name ) -//!\brief Create an exception class inheriting std::exception with the given name. It also supports -//! creating messages with placeholders by calling sxprintf. -//!\sa sxprintf -#define SX_EXCEPTION( _name ) \ -class _name: public std::exception \ -{ \ -public: \ - template< typename ... args > \ - _name(const std::string & _what, args ... _args ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _args ... ) ) \ - { \ - } \ -\ -\ - virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ -\ -\ - virtual const char* what() const throw () SX_OVERRIDE \ - { \ - return ( what_.c_str() ); \ - } \ -\ -\ -private: \ - std::string what_; \ -\ -\ -}; - - -#else - - -#define SX_EXCEPTION( _name ) \ -class _name: public std::exception \ -{ \ -public: \ - explicit _name(const std::string & _what ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str() ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6 ) ) \ - { \ - } \ -\ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ) \ - { \ - } \ -\ -\ - virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ -\ -\ - virtual const char* what() const throw () SX_OVERRIDE \ - { \ - return ( what_.c_str() ); \ - } \ -\ -\ -private: \ - std::string what_; \ -\ -\ -}; - - -#endif - - -#endif diff --git a/essentials/include/essentials/format_settings.hpp b/essentials/include/essentials/format_settings.hpp deleted file mode 100644 index 798c83e..0000000 --- a/essentials/include/essentials/format_settings.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB -#define FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB - - -#include - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - -//!\struct format_settings -//!\brief Structure containing information for formatting the output of sxprintf. -struct format_settings SX_FINAL -{ - //!\brief Constructor. - format_settings(); - - - std::string format_string_; - bool missing_closing_bracket_; - bool correct_; - bool hex_; - bool pad_zeros_; - bool places_set_; - int places_; - bool decimal_places_set_; - int decimal_places_; -}; - -} - - -#endif diff --git a/essentials/include/essentials/macro_helpers.hpp b/essentials/include/essentials/macro_helpers.hpp deleted file mode 100644 index 46609e4..0000000 --- a/essentials/include/essentials/macro_helpers.hpp +++ /dev/null @@ -1,46 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 -#define MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 - - -#ifndef SX_NO_VARIADIC_MACRO - - -//!\def EXPAND( x ) -//!\brief Helper to work around some Visual C++ compiler quirk dealing with variadic macros. -#define EXPAND( x ) x - -//!\def CAT( A, B ) -//!\brief Concatenate two tokens. -#define CAT( A, B ) A ## B - -//!\def SELECT( NAME, NUM ) -//!\brief Creating a name from a base name and a number with underscore between them. -#define SELECT( NAME, NUM ) CAT( NAME ## _, NUM ) - -//!\def GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) -//!\brief Helper for counting the number of parameters of a macro. -#define GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) COUNT - -//!\def VA_SIZE( ... ) -//!\brief Count the number of parameters of a macro. -#define VA_SIZE( ... ) EXPAND( GET_COUNT( __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1 ) ) - -//!\def VA_SELECT( NAME, ... ) -//!\brief Selects the correct overloaded macro based on the number of parameters. -#define VA_SELECT( NAME, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__) ) - - -#endif - - -#endif diff --git a/essentials/include/essentials/non_copyable.hpp b/essentials/include/essentials/non_copyable.hpp deleted file mode 100644 index d9f85b4..0000000 --- a/essentials/include/essentials/non_copyable.hpp +++ /dev/null @@ -1,68 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 -#define NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST - - -//!\def SX_NO_COPY(_class_name) -//!\brief Delete the copy constructor and assignment operator of the given class. -#define SX_NO_COPY(_class_name)\ -private:\ - _class_name(const _class_name&) SX_DELETE;\ - _class_name& operator=(const _class_name&) SX_DELETE;\ -public:\ -\ - - -//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) -//!\brief Delete the assignment operator of the given class. -#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ -private:\ - _class_name& operator=( const _class_name& ) SX_DELETE;\ -public:\ -\ - - -#else - - -//!\def SX_NO_COPY(_class_name) -//!\brief Delete the copy constructor and assignment operator of the given class. -#define SX_NO_COPY(_class_name)\ - _class_name(const _class_name&) SX_DELETE;\ - _class_name& operator=(const _class_name&) SX_DELETE;\ -\ - - -//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) -//!\brief Delete the assignment operator of the given class. -#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ - _class_name& operator=( const _class_name& ) SX_DELETE;\ -\ - - -#endif - - -} - - -#endif diff --git a/essentials/include/essentials/sxprintf.hpp b/essentials/include/essentials/sxprintf.hpp deleted file mode 100644 index f6c4d72..0000000 --- a/essentials/include/essentials/sxprintf.hpp +++ /dev/null @@ -1,242 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 -#define PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 - - -#include -#include - - -#ifdef SX_CPP03_BOOST - #include - #include -#endif - -#include "compatibility/compatibility.hpp" -#include "format_settings.hpp" - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST - typedef boost::variant< bool, int, unsigned int, sxe::int8_t, sxe::uint8_t, sxe::uint16_t, sxe::uint32_t, - std::string, std::size_t, const char*, int_least64_t, double > value_type; - typedef std::vector< value_type > value_types; -#endif - - -extern const char PLACE_HOLDER; -extern const char* const SUPERFLUOUS_PARAMETER_START; -extern const char SUPERFLUOUS_PARAMETER_END; -extern const char OPENING_SQUARE_BRACKET; -extern const char CLOSING_SQUARE_BRACKET; - - -template< typename value > -struct stream_writer -{ - static void print( std::ostream& _os, const value& _value ) - { - _os << _value; - } -}; - - -template< > -struct stream_writer< sxe::uint8_t > -{ - static void print(std::ostream& _os, const sxe::uint8_t& _value) - { - _os << static_cast( _value ); - } -}; - - -// cppcheck-suppress unusedFunction -std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ); -sxe::format_settings parse_format_string( const char** const _format ); - - -#ifdef SX_CPP03_BOOST - -void print_value_type_value( std::ostream& _os, const value_type& _value ); - - -#endif - - -template< typename value > -void print_superfluous_parameters( std::ostream& _os, const value& _value ) -{ - _os << SUPERFLUOUS_PARAMETER_START; -#ifndef SX_CPP03_BOOST - stream_writer< value >::print( _os, _value ); -#else - print_value_type_value( _os, _value ); -#endif - _os << SUPERFLUOUS_PARAMETER_END; -} - - -#ifndef SX_CPP03_BOOST - - -template< typename value, typename ... args > -void print_superfluous_parameters( std::ostream& _os, - const value& _value, args ... _args ) -{ - _os << SUPERFLUOUS_PARAMETER_START; - stream_writer< value >::print( _os, _value ); - _os << SUPERFLUOUS_PARAMETER_END; - print_superfluous_parameters( _os, _args ... ); -} - - -#else - - -#endif - - -void sxprintf( std::ostream& _os, const char* _format ); - -#ifndef SX_CPP03_BOOST -template< typename value, typename ... args > -void sxprintf( std::ostream& _os, const char* _format, const value& _value, args ... _args ) -{ - while( *_format ) - { - if( PLACE_HOLDER == *_format ) - { - if( PLACE_HOLDER == *( _format + 1 ) ) - { - ++_format; // skip first place holder - _os << *_format++; // output of the second place holder - } - else - { - if( OPENING_SQUARE_BRACKET == *( _format + 1 ) ) - { - ++_format; - const sxe::format_settings format_settings = sxe::parse_format_string( &_format ); - const std::ios_base::fmtflags stream_flags = _os.flags(); - const char streafill_ = _os.fill(); - if( format_settings.correct_ ) - { - _os << format_settings; - stream_writer< value >::print( _os, _value ); - } - else - { - while( CLOSING_SQUARE_BRACKET != *( _format ) ) - { - ++_format; - } - stream_writer< value >::print( _os, _value ); - _os << format_settings; - } - _os.flags( stream_flags ); - _os.fill( streafill_ ); - } - else - { - stream_writer< value >::print( _os, _value ); - } - - sxprintf( _os, _format + 1, _args ... ); - return; - } - } - else - { - _os << *_format++; - } - } - - print_superfluous_parameters( _os, _value, _args ... ); -} - - -//!\brief Creates a formatted message. The format string can contain placeholders ('%'s) that will be replaced with -//!the parameters by this function. To emit a '%' use two percent signs ("%%"). -//!\param _format The format string in which will the placeholders will be replaced (if there are any). -//!\param _args The arguments that will replace the placeholders in the format string. The number of parameters in -//!_args has to be equal to the number of placeholders in the format string. If you pass too few or too many -//!arguments, the resulting string will contain diagnostics in the resulting string -//!([Missing parameter!] or [Superfluous parameter: x]). -//!\return String containing the complete formatted message. -template< typename ... args > -std::string sxprintf(const char* const _format, args ... _args) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _args ...); - return( target_string_stream.str() ); -} - -#else - -std::string sxprintf(const char* const _format); -std::string sxprintf(const char* const _format, const value_type& _value1); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9, const value_type& _value10); - - -void sxprintf(std::ostream& _os, const char* const _format); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10); - - void sxprintf(std::ostream& _os, const char* const _format, const value_types& _values); - -#endif - - -} - -#endif diff --git a/essentials/include/essentials/uri.hpp b/essentials/include/essentials/uri.hpp deleted file mode 100644 index 5a0a0bb..0000000 --- a/essentials/include/essentials/uri.hpp +++ /dev/null @@ -1,55 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D -#define URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D - - -#include - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sxe -{ - - -const char URI_DELIMITER = '/'; - - -class uri SX_FINAL -{ -public: - explicit uri( const std::string& _uri = "" ); - ~uri() SX_NOEXCEPT; - bool is_empty() const; - const std::string to_string() const; - const std::string& get_front() const; - const std::string& get_back(); - void push_front( const std::string& _segment ); - void push_back( const std::string& _segment ); - void pop_front(); - void pop_back(); - size_t size() const; - - -private: - const std::string build_uri() const; - void split_string_to_uri_segments( const std::string& _uri ); - - - std::deque< std::string > uri_; -}; - - -} - - -#endif diff --git a/essentials/license/essentials_Anhang_Appendix_20170406.pdf b/essentials/license/essentials_Anhang_Appendix_20170406.pdf deleted file mode 100644 index e6c6650..0000000 Binary files a/essentials/license/essentials_Anhang_Appendix_20170406.pdf and /dev/null differ diff --git a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf b/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf deleted file mode 100644 index 1cdf2ed..0000000 Binary files a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf and /dev/null differ diff --git a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf b/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf deleted file mode 100644 index 037bf28..0000000 Binary files a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf and /dev/null differ diff --git a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf b/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf deleted file mode 100644 index 0ba7c9e..0000000 Binary files a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf and /dev/null differ diff --git a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf b/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf deleted file mode 100644 index 90989c4..0000000 Binary files a/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf and /dev/null differ diff --git a/essentials/source/conversion.cpp b/essentials/source/conversion.cpp deleted file mode 100644 index 21ee550..0000000 --- a/essentials/source/conversion.cpp +++ /dev/null @@ -1,102 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/conversion.hpp" - -#include -#include - -#ifndef SX_CPP03_BOOST - #include -#else - #include -#endif - - -namespace sxe -{ - - -bool string_to_int( const char* const _int_as_string, int& _result ) -{ - bool success = false; - try - { -#ifndef SX_CPP03_BOOST - _result = std::stoi( std::string( _int_as_string ) ); - success = true; -#else - std::istringstream is( _int_as_string ); - if (is >> _result) - { - success = true; - } - else - { - success = false; - } -#endif - - } - catch ( const std::invalid_argument& ) - { - success = false; - } - catch ( const std::out_of_range& ) - { - success = false; - } - return( success ); -} - - -std::string to_string( const sxe::uint32_t _value ) -{ -#ifndef SX_CPP03_BOOST - return( std::to_string( _value ) ); -#else - std::ostringstream ostr; - ostr << _value; - return( ostr.str() ); -#endif -} - - -std::string to_string( const int _value ) -{ -#ifndef SX_CPP03_BOOST - return( std::to_string( _value ) ); -#else - std::ostringstream ostr; - ostr << _value; - return( ostr.str() ); -#endif -} - - -// cppcheck-suppress unusedFunction -std::string to_upper( const std::string& _value ) -{ - std::string value_caps = _value; - std::transform( value_caps.begin(), value_caps.end(), value_caps.begin(), ::toupper ); - return( value_caps ); -} - - -// cppcheck-suppress unusedFunction -std::string to_lower( const std::string& _value ) -{ - std::string value_to_lower = _value; - std::transform( value_to_lower.begin(), value_to_lower.end(), value_to_lower.begin(), ::tolower ); - return( value_to_lower ); -} - - -} diff --git a/essentials/source/essentials_version.cpp b/essentials/source/essentials_version.cpp deleted file mode 100644 index 1d851f7..0000000 --- a/essentials/source/essentials_version.cpp +++ /dev/null @@ -1,74 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "essentials/essentials_version.hpp" - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/build_number.hpp" -#include "essentials/sxprintf.hpp" - - -namespace sxe -{ - - -namespace version -{ - - -namespace -{ - - -const sxe::uint16_t VERSION_MAJOR( 1 ); -const sxe::uint16_t VERSION_MINOR( 2 ); -const sxe::uint16_t VERSION_PATCH( 0 ); - - -} - - -// cppcheck-suppress unusedFunction -void log_version() -{ - std::cout << sxe::sxprintf( "essentials library version %.%.%.%.", get_major_version(), - get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; -} - - -sxe::uint16_t get_major_version() -{ - return( VERSION_MAJOR ); -} - - -sxe::uint16_t get_minor_version() -{ - return( VERSION_MINOR ); -} - - -sxe::uint16_t get_patch_version() -{ - return( VERSION_PATCH ); -} - - -sxe::uint16_t get_build_number() -{ - return( BUILD_NUMBER ); -} - - -} - - -} diff --git a/essentials/source/format_settings.cpp b/essentials/source/format_settings.cpp deleted file mode 100644 index 768379a..0000000 --- a/essentials/source/format_settings.cpp +++ /dev/null @@ -1,32 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "essentials/format_settings.hpp" - - -namespace sxe -{ - - -format_settings::format_settings(): - format_string_(), - missing_closing_bracket_( false ), - correct_( false ), - hex_( false ), - pad_zeros_( false ), - places_set_( false ), - places_( 0 ), - decimal_places_set_( false ), - decimal_places_( 0 ) -{ - // Nothing to do... -} - - -} diff --git a/essentials/source/sxprintf.cpp b/essentials/source/sxprintf.cpp deleted file mode 100644 index e5fc6b5..0000000 --- a/essentials/source/sxprintf.cpp +++ /dev/null @@ -1,628 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/sxprintf.hpp" - -#include - -#include "essentials/base.hpp" -#include "essentials/conversion.hpp" - - -namespace sxe -{ - - -namespace -{ - - - const char MISSING_PARAMETERS_MESSAGE[] = "[Missing parameter!]"; - const char MISSING_TERMINATOR[] = "[Missing output modifier terminator!]"; - const char ILLEGAL_MODIFIER[] = "[Illegal output modifier!]"; - const char POINT = '.'; - const char ZERO = '0'; - const char X = 'x'; - const char CAPS_X = 'X'; - - -} - - -const char PLACE_HOLDER = '%'; -const char* const SUPERFLUOUS_PARAMETER_START = "[Superfluous parameter: "; -const char SUPERFLUOUS_PARAMETER_END = ']'; -const char OPENING_SQUARE_BRACKET = '['; -const char CLOSING_SQUARE_BRACKET = ']'; - - -// cppcheck-suppress unusedFunction -std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ) -{ - if( !_format.correct_ ) - { - _os << ILLEGAL_MODIFIER; - } - else if( _format.missing_closing_bracket_ ) - { - _os << MISSING_TERMINATOR; - } - else - { - if( _format.hex_ ) - { - _os << std::hex; - _os << std::showbase; - _os.fill( '0' ); - } - else - { - if( _format.pad_zeros_ ) - { - _os.fill( '0' ); - } - - if( _format.places_set_ ) - { - _os.width( _format.places_ ); - } - - if( _format.decimal_places_set_ ) - { - _os.precision( _format.decimal_places_ ); - } - } - } - - return( _os ); -} - - -bool is_allowed_char( const char _char ) -{ - const bool success = ( std::isdigit( _char ) || ( X == _char ) || ( CAPS_X == _char ) ); - return( success ); -} - - -sxe::format_settings parse_format_string( const char** const _format ) -{ - sxe::format_settings format_settings; - format_settings.correct_ = true; - SX_ASSERT( ( OPENING_SQUARE_BRACKET == **_format ), "Format string to parse doesn't start with [." ); - ++*_format; - format_settings.missing_closing_bracket_ = true; - bool point_found = false; - const char* text_before_point = *_format; - std::size_t text_before_point_size = 0; - const char* text_after_point = SX_NULLPTR; - std::size_t text_after_point_size = 0; - while( **_format ) - { - if( CLOSING_SQUARE_BRACKET == **_format ) - { - format_settings.missing_closing_bracket_ = false; - break; - } - else - if( POINT == **_format ) - { - if( point_found ) - { - format_settings.correct_ = false; - break; - } - else - { - point_found = true; - text_after_point = ( *_format ) + 1; - text_after_point_size = 0; - } - } - else - { - const char _text_char = **_format; - if( is_allowed_char( _text_char ) ) - { - if( point_found ) - { - ++text_after_point_size; - } - else - { - ++text_before_point_size; - } - } - else - { - format_settings.correct_ = false; - break; - } - } - - ++( *_format ); - } - - SX_ASSERT( text_before_point, "Logic error parsing format string!" ); - if( ( 0 == text_before_point_size ) && ( 0 == text_after_point_size ) ) - { - format_settings.correct_ = false; - } - - if( ( !format_settings.missing_closing_bracket_ ) && format_settings.correct_ ) - { - if( ( 0 < text_before_point_size ) && ( ( X == text_before_point[ 0 ] ) || ( CAPS_X == text_before_point[ 0 ] ) ) ) - { - format_settings.hex_ = true; - ++text_before_point; - --text_before_point_size; - } - - if( ( 0 < text_before_point_size ) && ( ZERO == text_before_point[ 0 ] ) ) - { - format_settings.pad_zeros_ = true; - ++text_before_point; - --text_before_point_size; - } - - if( 0 < text_before_point_size ) - { - format_settings.places_set_ = true; - if( !string_to_int( text_before_point, format_settings.places_ ) ) - { - format_settings.correct_ = false; - } - } - - if( 0 < text_after_point_size ) - { - SX_ASSERT( text_after_point, "Logic error parsing format string!" ); - format_settings.decimal_places_set_ = true; - if( !string_to_int( text_after_point, format_settings.decimal_places_ ) ) - { - format_settings.correct_ = false; - } - } - } - - return( format_settings ); -} - - -#ifdef SX_CPP03_BOOST - - -void print_superfluous_parameters( std::ostream& _os, const value_types& _values, value_types::const_iterator& _position ) -{ - while( _position != _values.end() ) - { - print_superfluous_parameters( _os, *_position ); - ++_position; - } -} - - -#endif - - -void sxprintf( std::ostream& _os, const char* _format ) -{ - while( *_format ) - { - if( PLACE_HOLDER == *_format ) - { - if( PLACE_HOLDER == *( _format + 1 ) ) - { - ++_format; - } - else - { - _os << MISSING_PARAMETERS_MESSAGE; - } - } - _os << *_format++; - } -} - - -#ifdef SX_CPP03_BOOST - - -std::string sxprintf(const char* const _format) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9, const value_type& _value10) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10); - return( target_string_stream.str() ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1 ) -{ - value_types values; - values.push_back( _value1 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - values.push_back( _value9 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - values.push_back( _value9 ); - values.push_back( _value10 ); - sxprintf( _os, _format, values ); -} - - -const char* sxprintf_impl( std::ostream& _os, const char* _format, value_types::const_iterator& _position, - const value_types::const_iterator _end, bool& printed ) -{ - while (*_format) - { - if (PLACE_HOLDER == *_format) - { - if (PLACE_HOLDER == *( _format + 1 )) - { - ++_format; // skip first place holder - _os << *_format++; // output of the second place holder - } - else - { - if (OPENING_SQUARE_BRACKET == *( _format + 1 )) - { - ++_format; - const sxe::format_settings format_settings = sxe::parse_format_string(&_format); - const std::ios_base::fmtflags stream_flags = _os.flags(); - const char streafill_ = _os.fill(); - _os << format_settings; - print_value_type_value( _os, *_position ); - _os.flags(stream_flags); - _os.fill(streafill_); - printed = true; - if( !format_settings.missing_closing_bracket_ ) - { - if( CLOSING_SQUARE_BRACKET == *( _format ) ) - { - ++_format; - } - } - else - { - if( !format_settings.correct_ ) - { - ++_format; - } - } - } - else - { - print_value_type_value( _os, *_position ); - printed = true; - ++_format; - break; - } - - if( _position + 1 != _end ) - { - if( *_format != '\0' ) - { - ++_position; - _format = sxprintf_impl( _os, _format, _position, _end, printed ); - } - } - return( _format ); - } - } - else - { - _os << *_format++; - } - } - return ( _format ); -} - - -void sxprintf( std::ostream& _os, const char * const _format, const value_types& _values ) -{ - SX_ASSERT( _format, "No format string to parse was passed!" ); - const char* current_position = _format; - - value_types::const_iterator _end = _values.end(); - value_types::const_iterator _position = _values.begin(); - while( _position != _end ) - { - bool printed = false; - current_position = sxprintf_impl( _os, current_position, _position, _end, printed ); - if( printed ) - { - ++_position; - } - if( current_position[0] == '\0' ) - { - break; - } - } - - sxprintf( _os, current_position ); - - if( _position != _end ) - { - print_superfluous_parameters( _os, _values, _position ); - } -} - - -void print_value_type_value( std::ostream& _os, const value_type& _value ) -{ - const std::type_info& type_info = _value.type(); - - if( type_info == typeid ( bool ) ) - { - stream_writer< bool >::print( _os, boost::get< bool >( _value ) ); - } - else if( type_info == typeid ( int ) ) - { - stream_writer< int >::print( _os, boost::get< int >( _value ) ); - } - else if( type_info == typeid ( unsigned int ) ) - { - stream_writer< unsigned int >::print( _os, boost::get< unsigned int >( _value ) ); - } - else if( type_info == typeid ( sxe::int8_t ) ) - { - stream_writer< sxe::int8_t >::print( _os, boost::get< sxe::int8_t >( _value ) ); - } - else if (type_info == typeid ( sxe::uint8_t )) - { - stream_writer< sxe::uint8_t >::print(_os, boost::get< sxe::uint8_t >(_value)); - } - else if( type_info == typeid ( sxe::uint16_t ) ) - { - stream_writer< sxe::uint16_t >::print( _os, boost::get< sxe::uint16_t >( _value ) ); - } - else if( type_info == typeid ( sxe::uint32_t ) ) - { - stream_writer< sxe::uint32_t >::print( _os, boost::get< sxe::uint32_t >( _value ) ); - } - else if( type_info == typeid ( std::string ) ) - { - stream_writer< std::string >::print( _os, boost::get< std::string >( _value ) ); - } - else if( type_info == typeid ( std::size_t ) ) - { - stream_writer< std::size_t >::print( _os, boost::get< std::size_t >( _value ) ); - } - else if( type_info == typeid ( const char* ) ) - { - stream_writer< const char* >::print( _os, boost::get< const char* >( _value ) ); - } - else if( type_info == typeid ( int_least64_t ) ) - { - stream_writer< int_least64_t >::print( _os, boost::get< int_least64_t >( _value ) ); - } - else if( type_info == typeid ( double ) ) - { - stream_writer< double >::print( _os, boost::get< double >( _value ) ); - } -} - - -#endif - - -} diff --git a/essentials/source/uri.cpp b/essentials/source/uri.cpp deleted file mode 100644 index 9926a9a..0000000 --- a/essentials/source/uri.cpp +++ /dev/null @@ -1,136 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/uri.hpp" - -#include -#include - -#include "essentials/base.hpp" - - -namespace sxe -{ - - -uri::uri( const std::string& _uri ) - : uri_() -{ - split_string_to_uri_segments( _uri ); -} - - -uri::~uri() SX_NOEXCEPT -{ - // Nothing to do... -} - - -bool uri::is_empty() const -{ - return( uri_.empty() ); -} - - -const std::string uri::to_string() const -{ - return( build_uri() ); -} - - -const std::string& uri::get_front() const -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - return( uri_.front() ); -} - - -const std::string& uri::get_back() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - return( uri_.back() ); -} - - -void uri::push_front( const std::string& _segment ) -{ - uri_.push_front( _segment ); -} - - -void uri::push_back( const std::string& _segment ) -{ - uri_.push_back( _segment ); -} - - -void uri::pop_front() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - uri_.pop_front(); -} - - -void uri::pop_back() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - uri_.pop_back(); -} - - -size_t uri::size() const -{ - return( uri_.size() ); -} - - -const std::string uri::build_uri() const -{ - std::stringstream uri; - - SX_FOR( const std::string& uri_element, uri_ ) - { - uri << URI_DELIMITER << uri_element; - } - - return( uri.str() ); -} - - -void uri::split_string_to_uri_segments( const std::string& _uri ) -{ - std::string uri = _uri; - if( !_uri.empty() ) - { - if( URI_DELIMITER == _uri[ 0 ] ) - { - uri = _uri.substr( 1 ); - } - - std::string::size_type start = 0; - std::string::size_type end = uri.find( URI_DELIMITER ); - while( end != std::string::npos ) - { - const std::string& segment = uri.substr( start, end - start ); - uri_.push_back( segment ); - start = ++end; - end = uri.find( URI_DELIMITER, end ); - } - - const std::string& last_segment = uri.substr( start ); - if( last_segment[ 0 ] != URI_DELIMITER ) - { - uri_.push_back( last_segment ); - } - } -} - - -} diff --git a/examples/classic_farmroad/CMakeLists.txt b/examples/classic_farmroad/CMakeLists.txt index 66f34d9..23a40e0 100644 --- a/examples/classic_farmroad/CMakeLists.txt +++ b/examples/classic_farmroad/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,23 +131,24 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() - -endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(classic_farmroad ${classic_farmroad_SRC}) @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/event_collector_example/CMakeLists.txt b/examples/event_collector_example/CMakeLists.txt index c731a40..5d7e70e 100644 --- a/examples/event_collector_example/CMakeLists.txt +++ b/examples/event_collector_example/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,23 +131,24 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() - -endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(event_collector_example ${event_collector_example_SRC}) @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/events_with_parameters/CMakeLists.txt b/examples/events_with_parameters/CMakeLists.txt index 7540ce4..4fac669 100644 --- a/examples/events_with_parameters/CMakeLists.txt +++ b/examples/events_with_parameters/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,23 +131,24 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() - -endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(events_with_parameters ${events_with_parameters_SRC}) @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/forty_two/CMakeLists.txt b/examples/forty_two/CMakeLists.txt index 85ec659..9ceac97 100644 --- a/examples/forty_two/CMakeLists.txt +++ b/examples/forty_two/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,23 +131,24 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() - -endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(forty_two ${forty_two_SRC}) @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/generator_example/CMakeLists.txt b/examples/generator_example/CMakeLists.txt index 8878dea..1674e86 100644 --- a/examples/generator_example/CMakeLists.txt +++ b/examples/generator_example/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -127,22 +127,23 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") -endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") @@ -170,7 +171,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/hello_yasmine/CMakeLists.txt b/examples/hello_yasmine/CMakeLists.txt index d40d0ef..fb470bb 100644 --- a/examples/hello_yasmine/CMakeLists.txt +++ b/examples/hello_yasmine/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,22 +131,23 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") -endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/examples/substatemachines_and_variables/CMakeLists.txt b/examples/substatemachines_and_variables/CMakeLists.txt index 5d25010..842e54d 100644 --- a/examples/substatemachines_and_variables/CMakeLists.txt +++ b/examples/substatemachines_and_variables/CMakeLists.txt @@ -16,7 +16,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32" ) set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -131,23 +131,24 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if( "${Y_PROFILER}" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") endif() - -endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(substatemachines_and_variables ${substatemachines_and_variables_SRC}) @@ -174,7 +175,7 @@ endif() if("${CPP_VERSION}" STREQUAL "03") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${Y_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${Y_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) diff --git a/hermes/include/hermes/build_number.hpp b/hermes/include/hermes/build_number.hpp deleted file mode 100644 index 61892f9..0000000 --- a/hermes/include/hermes/build_number.hpp +++ /dev/null @@ -1,35 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 -#define BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -namespace version -{ - - - const sxe::uint16_t BUILD_NUMBER( 66 ); - - -} - - -} - - -#endif diff --git a/hermes/include/hermes/color.hpp b/hermes/include/hermes/color.hpp deleted file mode 100644 index 54a7248..0000000 --- a/hermes/include/hermes/color.hpp +++ /dev/null @@ -1,94 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 -#define COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 - - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - - //!\enum color - //!\brief Enumeration for predefined colors. - enum class color - { - C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, - C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 - }; - - -#else - - - //!\struct color - //!\brief Structure representing a predefined color (enum wrapper for C++11 enum class like behavior). - struct color - { - //!\enum color - //!\brief Enumeration for predefined colors. - enum inner - { - C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, - C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 - }; - - - //!\brief Constructor. Default value is white. - color() : value_( C_WHITE ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _value Given color value that is represented by the structure. - color( const inner _value ) : value_( _value ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _color Given color structure containing the color that is represented by the structure. - color( const color& _color ) : value_( _color.value_ ) - { - // Nothing to do... - } - - - //!\brief Get the color value represented by the structure. - operator inner() const - { - return ( value_ ); - } - - - //!\brief Color represented by the structure. - inner value_; - - }; - - -#endif - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/color_mapping.hpp b/hermes/include/hermes/color_mapping.hpp deleted file mode 100644 index 229e883..0000000 --- a/hermes/include/hermes/color_mapping.hpp +++ /dev/null @@ -1,59 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 -#define COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 - - -#include - -#include "essentials/non_copyable.hpp" -#include "color.hpp" -#include "log_level.hpp" - - -namespace hermes -{ - - -//!\class color_mapping -//!\brief Class for mapping colors to log levels. -class color_mapping SX_FINAL -{ -public: - //!\typedef color_map - //!\brief Alias for the map of log levels to colors. - typedef std::map< log_level, color > color_map; - - //!\brief Constructor. - color_mapping(); - ~color_mapping() SX_NOEXCEPT; - SX_NO_COPY(color_mapping) - - //!\brief Method for getting the color associated with the given log level. - //!\param _log_level The log level for which the color is requested. - //!\return Color value associated with the given log level. - color get_color( const log_level _log_level ) const; - - -private: - color_map color_map_; -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/cout_logger.hpp b/hermes/include/hermes/cout_logger.hpp deleted file mode 100644 index 9dc5508..0000000 --- a/hermes/include/hermes/cout_logger.hpp +++ /dev/null @@ -1,60 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F -#define COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F - - -#include "logger.hpp" -#include "color_mapping.hpp" - - -namespace hermes -{ - - -//!\class cout_logger -//!\brief Class for printing messages in the console via cout. -class cout_logger: - public logger -{ -public: - //!\brief Constructor - cout_logger(); - virtual ~cout_logger() SX_NOEXCEPT SX_OVERRIDE - { - // Nothing to do... - } - - - SX_NO_COPY(cout_logger) - - //!\brief Prints the message. - //!\param _log_message Log message that will be printed. - //!\return void - virtual void log( const log_message& _log_message ) SX_OVERRIDE; - - -private: - void log_level_as_message( const hermes::log_level _log_level ) const; - - color_mapping color_mapping_; -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/file_logger.hpp b/hermes/include/hermes/file_logger.hpp deleted file mode 100644 index d0df092..0000000 --- a/hermes/include/hermes/file_logger.hpp +++ /dev/null @@ -1,80 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 -#define FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 - - -#include "logger.hpp" -#include "essentials/exception_template.hpp" - - -namespace hermes -{ - - -//!\class file_logger -//!\brief Class for writing messages to a log file. It rotates the log file if a certain size limit is met. Naming and -//!location of the log files can be customized. Also the number of log files in rotation can be set. -class file_logger: - public logger -{ -public: - //!\brief Exception class of the file_logger. - SX_EXCEPTION( exception ) - - //!\brief Constructor - //!\param _max_file_size_in_bytes Maximum size of a log file in bytes. - //!\param _log_files_directory Folder where the log files are stored. - //!\param _name_suffix The suffix for the log files. - //!\param _name_extension The extension of the log files. - //!\param _max_file_number The maximum number of log files. - //!\param _throw_on_error Flag for throwing an exception on error. Default is true. - explicit file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, - const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, - const bool _throw_on_error = true ); - virtual ~file_logger() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY(file_logger) - - //!\brief Writes the message. - //!\param _log_message Log message that will be written. - //!\return void - virtual void log( const log_message& _log_message ) SX_OVERRIDE; - - -private: - std::string get_log_file_name_with_index( const unsigned _index ) const; - std::string get_working_log_file_name() const; - void log_into_file( const std::string& _message ) const; - void rotate_if_necessary() const; - void rename_files() const; - void rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const; - void delete_file( const std::string& _file_name ) const; - - - const size_t max_file_size_in_bytes_; - const std::string log_files_directory_; - const std::string name_sufix_; - const std::string name_extension_; - const unsigned max_file_number_; - const bool throw_on_error_; - std::string working_file_; -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/file_system.hpp b/hermes/include/hermes/file_system.hpp deleted file mode 100644 index 2ec9753..0000000 --- a/hermes/include/hermes/file_system.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 -#define FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 - - -#include -#include - - -namespace hermes -{ - - -//!\fn get_file_size -//!\brief Get the size of the file with the given name. -//!\param _file_name Name of file for which the size is requested. -//!\return Size of the given file. -size_t get_file_size( const std::string& _file_name ); - -//!\fn does_file_exist -//!\brief Checks if the file with the given name exists. -//!\param _file_name Name of the file to be checked. -//!\return True if the given file exists, false otherwise. -bool does_file_exist( const std::string& _file_name ); - -//!\fn add_trailing_slash_to_directory_path -//!\brief Add trailing slash to the given path. -//!\param _path Path to which the trailing slash is added. -//!\return Path with trailing slash at the end. -std::string add_trailing_slash_to_directory_path( const std::string& _path ); - - -} - - -#endif diff --git a/hermes/include/hermes/globals.hpp b/hermes/include/hermes/globals.hpp deleted file mode 100644 index 74ac1d4..0000000 --- a/hermes/include/hermes/globals.hpp +++ /dev/null @@ -1,26 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 -#define GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 - - -namespace hermes -{ - - -//!\brief Constant for width of the log level block. The log level block has a fixed width for better readability. -extern const int LOG_LEVEL_BLOCK_WIDTH; - - -} - - -#endif diff --git a/hermes/include/hermes/hermes_version.hpp b/hermes/include/hermes/hermes_version.hpp deleted file mode 100644 index fb0ec05..0000000 --- a/hermes/include/hermes/hermes_version.hpp +++ /dev/null @@ -1,41 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 -#define VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -namespace version -{ - - -void log_version(); - - -sxe::uint16_t get_major_version(); -sxe::uint16_t get_minor_version(); -sxe::uint16_t get_patch_version(); -sxe::uint16_t get_build_number(); - - -} - - -} - - -#endif diff --git a/hermes/include/hermes/log.hpp b/hermes/include/hermes/log.hpp deleted file mode 100644 index 5de53e2..0000000 --- a/hermes/include/hermes/log.hpp +++ /dev/null @@ -1,150 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 -#define LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 - - -#ifdef SX_NO_LOGGING - - -inline void parameter_muncher() -{ - // Nothing to do... -} - - -template< typename T, typename ... args > -void parameter_muncher( T, args ... _args ) -{ - parameter_muncher( _args... ); -} - - -//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters -//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. -//!\sa sxprintf -#define SX_LOG( _dummy, ... ) \ - do \ - { \ - parameter_muncher( __VA_ARGS__ ); \ - } \ - while( false ) - - -//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters -//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. -//!\sa sxprintf -#define SX_LOG_HEX( _dummy, ... ) \ - do \ - { \ - parameter_muncher( __VA_ARGS__ ); \ - } \ - while( false ) - - -#else - - -#ifndef SX_CPP03_BOOST - -//!\brief Create a log message. -//!\param _level The log level of the message. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG( _level, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -//!\brief Create a hex log message. -//!\param _level The log level of the message. -//!\param _heading The heading of the message. -//!\param _data The message of the log. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG_HEX( _level, _heading, _data, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - const std::string l_heading(_heading);\ - const std::string l_data(_data);\ - const std::string l_message = l_heading + "\n" + l_data;\ - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, l_message, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -//!\brief Create a log message and wait for the message to be written by the logger. -//!\param _level The log level of the message. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG_AND_WAIT( _level, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - l_log_manager.log_and_wait( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -#else - - -#define SX_LOG hermes::log_helper( __FILE__, __LINE__).log -#define SX_LOG_AND_WAIT hermes::log_helper( __FILE__, __LINE__).log_and_wait - - -#endif - - -#endif - - -#ifndef SX_NO_LOGGING - - -#include "log_manager_template.hpp" -#include "std_timestamp_policy.hpp" - - -namespace hermes -{ - - -//!\brief An alias-declaration for the log manager template. -typedef hermes::log_manager_template< hermes::std_timestamp_policy > log_manager; - - -} - - -#ifdef SX_CPP03_BOOST -#include "log_helper.hpp" -#endif - - -#endif - - -#endif diff --git a/hermes/include/hermes/log_and_throw.hpp b/hermes/include/hermes/log_and_throw.hpp deleted file mode 100644 index 049507b..0000000 --- a/hermes/include/hermes/log_and_throw.hpp +++ /dev/null @@ -1,124 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 -#define LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 - - -#include "log.hpp" -#include "essentials/exception.hpp" - - -#ifdef SX_CPP03_BOOST - #ifdef SX_NO_VARIADIC_MACRO - #include "log_and_throw_helper.hpp" - #else - #include "essentials/macro_helpers.hpp" - #endif -#endif - - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - -//!\def LOG_AND_THROW( _log_level, ... ) -//!\brief Log a message and then throw an exception with the same message. -#define LOG_AND_THROW( _log_level, ... ) \ - SX_LOG( _log_level, __VA_ARGS__ ); \ - throw sxe::exception( __VA_ARGS__ ); - - -#else - - -#ifndef SX_NO_VARIADIC_MACRO - -#define HERMES_VA_SELECT( NAME, _level, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )( _level, __VA_ARGS__) ) - -//!\def LOG_AND_THROW( _level, ... ) -//!\brief Log a message and then throw an exception with the same message. -#define LOG_AND_THROW( _level, ... ) HEMRES_EXPAND( HERMES_VA_SELECT( LOG_AND_THROW_PARAM, _level, __VA_ARGS__ ) ) - - -#define LOG_AND_THROW_PARAM_1( _log_level, _what ) \ - SX_LOG( _log_level, _what ); \ - throw sxe::exception( _what ); - - -#define LOG_AND_THROW_PARAM_2( _log_level, _what, _value ) \ - SX_LOG( _log_level, _what, _value ); \ - throw sxe::exception( _what, _value ); - - -#define LOG_AND_THROW_PARAM_3( _log_level, _what, _value1, _value2 ) \ - SX_LOG( _log_level, _what, _value1, _value2 ); \ - throw sxe::exception( _what, _value1, _value2 ); - - -#define LOG_AND_THROW_PARAM_4( _log_level, _what, _value1, _value2, _value3 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3 ); \ - throw sxe::exception( _what, _value1, _value2, _value3 ); - - -#define LOG_AND_THROW_PARAM_5( _log_level, _what, _value1, _value2, _value3, _value4 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4 ); - - -#define LOG_AND_THROW_PARAM_6( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5 ); - - -#define LOG_AND_THROW_PARAM_7( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6 ); - - -#define LOG_AND_THROW_PARAM_8( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - - -#define LOG_AND_THROW_PARAM_9( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - - -#define LOG_AND_THROW_PARAM_10( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - - -#define LOG_AND_THROW_PARAM_11( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - - -#else - - -#define LOG_AND_THROW hermes::log_and_throw_helper( __FILE__, __LINE__ ).log - - -#endif - - -#endif - - -} - - -#endif diff --git a/hermes/include/hermes/log_and_throw_helper.hpp b/hermes/include/hermes/log_and_throw_helper.hpp deleted file mode 100644 index 898ab1e..0000000 --- a/hermes/include/hermes/log_and_throw_helper.hpp +++ /dev/null @@ -1,210 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC -#define LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC - - -#ifdef SX_CPP03_BOOST - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" -#include "essentials/exception.hpp" -#include "log.hpp" - - -namespace hermes -{ - - - struct log_level; - - - class log_and_throw_helper SX_FINAL - { - public: - log_and_throw_helper( const std::string& _file_name, const int _line ); - ~log_and_throw_helper() SX_NOEXCEPT; - SX_NO_COPY( log_and_throw_helper ) - - void log( const log_level& _level, const std::string& _message ) const; - - template< typename _parameter_type1 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1 ); - } - throw sxe::exception( _message, _value1 ); - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2 ); - } - throw sxe::exception( _message, _value1, _value2 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3 ); - } - throw sxe::exception( _message, _value1, _value2, _value3 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8, typename _parameter_type9 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8, typename _parameter_type9, typename _parameter_type10 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, - _value10 ); - } - - private: - const std::string& file_name_; - const int line_; - - - }; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/log_callback.hpp b/hermes/include/hermes/log_callback.hpp deleted file mode 100644 index 4fd9f04..0000000 --- a/hermes/include/hermes/log_callback.hpp +++ /dev/null @@ -1,57 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 -#define LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 - - -#include "essentials/compatibility/compatibility.hpp" - -namespace hermes -{ - - -//!\interface log_callback -//!\brief Interface that adds wait functionality to the class that implements it. -class log_callback -{ -public: - log_callback() - { - // Nothing to do... - } - - - virtual ~log_callback() SX_NOEXCEPT - { - // Nothing to do... - } - - - //!\brief Wait for a condition. - virtual void wait() = 0; - - //!\brief The thing we are waiting for is done. - virtual void done() = 0; - - //!\brief Checks the theing we are waiting for is done. - virtual bool is_done() = 0; -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/log_helper.hpp b/hermes/include/hermes/log_helper.hpp deleted file mode 100644 index 92623d1..0000000 --- a/hermes/include/hermes/log_helper.hpp +++ /dev/null @@ -1,342 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 -#define LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 - - -#ifdef SX_CPP03_BOOST - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" -#include "log.hpp" - - -namespace hermes -{ - - -struct log_level; - - -class log_helper SX_FINAL -{ -public: - log_helper( const std::string& _file_name, const int _line ); - ~log_helper() SX_NOEXCEPT; - SX_NO_COPY( log_helper ) - - void log( const log_level& _level, const std::string& _message ) const; - - - template< typename _parameter_type1 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9, typename _parameter_type10 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - } - - - template< typename _parameter_type1 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9, typename _parameter_type10 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - } - - -private: - const std::string& file_name_; - const int line_; - - -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/log_level.hpp b/hermes/include/hermes/log_level.hpp deleted file mode 100644 index c6da58b..0000000 --- a/hermes/include/hermes/log_level.hpp +++ /dev/null @@ -1,117 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef SX_NO_LOGGING - - -#ifndef LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 -#define LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 - - -#include - - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - -//!\enum log_level -//!\brief The log levels. -enum class log_level -{ - LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 -}; - - -#else - - -//!\struct log_level -//!\brief Structure representing a log level (enum wrapper for C++11 enum class like behavior). -struct log_level -{ - //!\enum log_level - //!\brief The log levels. - enum inner - { - LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 - }; - - - //!\brief Constructor - //!\param _value Given log level value that is represented by the structure. - log_level( inner _value ) : value_( _value ) - { - // Nothing to do... - } - - - //!\brief Constructor. Default value is LL_OFF. - log_level() : value_( LL_OFF ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _color Given log level structure containing the log level value that is represented by the structure. - log_level(const log_level& _log_level) : value_(_log_level.value_) - { - // Nothing to do... - } - - - //!\brief Function returning the log level value represented by the structure. - operator inner() const - { - return ( value_ ); - } - - - //!\brief Log level value represented by the structure. - inner value_; - -}; - - -#endif - - - -//!\brief Convert the given log level to a string. -//!\param _log_level The log level. -//!\return The log level as string. -std::string log_level_to_string( const log_level _log_level ); - - - -#ifdef SX_CPP03_BOOST - - -bool operator==( const hermes::log_level& _lhs, const hermes::log_level::inner _rhs ); -bool operator==( const hermes::log_level::inner _lhs, const hermes::log_level& _rhs ); -bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs); -bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ); - - - -#endif - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/log_manager_template.hpp b/hermes/include/hermes/log_manager_template.hpp deleted file mode 100644 index 65dd14c..0000000 --- a/hermes/include/hermes/log_manager_template.hpp +++ /dev/null @@ -1,591 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B -#define LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B - - -#include - -#include "essentials/base.hpp" -#include "logger.hpp" -#include "log_message.hpp" -#include "essentials/sxprintf.hpp" -#include "waiter.hpp" - - -namespace hermes -{ - - -namespace -{ - - -bool LOG_MANAGER_EXISTS = false; - - -} - -//!\class t_log_manager_template -//!\brief The log manager (a singleton) controls the different loggers, manages the current log level, and takes care -//!of dispatching log messages. -template< typename time_stamp_policy > -class log_manager_template SX_FINAL -{ -public: - //!\brief Get a reference to the single instance of the log manager template. - static log_manager_template& get_instance( void ) - { - static log_manager_template instance; - return( instance ); - } - - - SX_NO_COPY(log_manager_template) - - //!\brief Get the currently set log level. - //!\return Current log level. - log_level get_log_level() const - { - return( log_level_ ); - } - - - //!\brief Set a new log level. - //!\param _log_level Log level to be set. - //!\return void - void set_log_level( const log_level _log_level ) - { - log_level_ = _log_level; - } - - -#ifndef SX_CPP03_BOOST - - - //!\brief Add a message to the queue of messages that will be processed. - //!\param _log_level Log level of the message. - //!\param _time_stamp Date and time when the log message was created. - //!\param _file The file from where the log was called. - //!\param _line The line from where the log was called. - //!\param _message The message text for the log. - //!\param _args Parameters that are inserted in the message. - //!\return void - //!\sa log_and_wait, SX_LOG(), sxprintf - template< typename ... args > - void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, args ... _args ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - } - - - //!\brief Add a message to the queue of messages and waits the message to be processed. - //!\param _log_level Log level of the message. - //!\param _time_stamp Date and time when the log message was created. - //!\param _file The file from where the log was called. - //!\param _line The line from where the log was called. - //!\param _message The message text for the log. - //!\param _args Parameters that are inserted in the message. - //!\return void - //!\sa log, SX_LOG(), sxprintf - template< typename ... args > - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, args ... _args ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - -#else - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const hermes::log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, - _value2) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5 ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - -//**************************************************log_and_wait**************************************************// - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - -#endif - - - //!\brief Adds a logger to which the log will be written. - //!\param _logger - The logger to be added. - //!\return void - void add_logger( logger_uptr _logger ) - { - SX_ASSERT( stop_, "Logger cannot be added while running!" ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - loggers_.push_back( sxe::move( _logger ) ); - } - - - //!\brief Starts the logging. On starting, a new thread is created which processes the enqueued log message by - //!sending them to each logger. The thread has to be stopped and joined before the log manager is destroyed! - //!\return void - //!\sa halt, join - void run() - { - stop_ = false; - thread_ = sxe::thread( sxe::bind( &log_manager_template::work, this ) ); - } - - - //!\brief Stops the logging. The thread that processes the log messages is notified that it should stop. It still has - //!to be joined later. - //!\return void - //!\sa run, join, halt_and_join - void halt() - { - { - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - stop_ = true; - } - condition_.notify_one(); - } - - - //!\brief Joins the thread that processed the log messages. Join has to be called after the halt function. - //!\return void - //!\sa halt, run, halt_and_join - void join() - { - thread_.join(); - } - - - //!\brief Stops the logging and joins the thread that processed the log messages. - //!\return void - //!\sa halt, run, join - void halt_and_join() - { - halt(); - join(); - } - - - //!\brief Get the current date and time as a string. - //!\return String containing the date and time. - static std::string get_timestamp() - { - return( time_stamp_policy::get_timestamp() ); - } - - -private: - log_manager_template() - : thread_(), - mutex_(), - condition_(), - stop_( true ), - loggers_(), - messages_(), - log_level_( log_level::LL_OFF ) - { - SX_ASSERT( !LOG_MANAGER_EXISTS, "Log manager already exists!" ); - LOG_MANAGER_EXISTS = true; - } - - - ~log_manager_template() - { - SX_ASSERT( stop_, "Thread is still running! It was not stopped." ); - } - - - bool should_be_running() const - { - return( stop_ || !messages_.empty() ); - } - - - bool finished() const - { - return( stop_ && messages_.empty() ); - } - - - void work() - { - while( true ) - { - log_message message; - { - sxe::unique_lock< sxe::mutex > lock( mutex_ ); - condition_.wait( lock, sxe::bind( &log_manager_template::should_be_running, this ) ); - - if( finished() ) - { - break; - } - - message = messages_.front(); - messages_.pop(); - } - - SX_FOR(const logger_uptr& logger, loggers_) - { - logger->log( message ); - message.done(); - } - } - } - - - sxe::thread thread_; - sxe::mutex mutex_; - sxe::condition_variable condition_; - bool stop_; - loggers loggers_; - std::queue< log_message > messages_; - log_level log_level_; -}; - - -} - - -#endif - -#endif diff --git a/hermes/include/hermes/log_message.hpp b/hermes/include/hermes/log_message.hpp deleted file mode 100644 index 34159c2..0000000 --- a/hermes/include/hermes/log_message.hpp +++ /dev/null @@ -1,63 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 -#define LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 - - -#include "log_level.hpp" -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -class log_callback; - - -//!\struct log_message -//!\brief Structure of the message to be logged, containing all necessary elements: log callback (if it is used), -//!\log level, time stamp of the log, file and line where the log is generated and the message of the log. -struct log_message SX_FINAL -{ - //!\brief Constructor - log_message(); - - //!\brief Constructor - //!\param _log_callback Pointer to log callback. - //!\param _log_level Log level for this log message. - //!\param _time_stamp Time stamp of the log message. - //!\param _file File where the log message was generated. - //!\param _line Line of the file where the log message is generated. - //!\param _message The message of the log. - log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, - const std::string& _file, const int _line, const std::string& _message ); - - //!\brief Function that notifies the log callback that we are done. - void done(); - - log_level log_level_; - std::string time_stamp_; - std::string file_; - int line_; - std::string message_; - log_callback* log_callback_; -}; - - -} - - -#endif - -#endif diff --git a/hermes/include/hermes/logger.hpp b/hermes/include/hermes/logger.hpp deleted file mode 100644 index b8e2267..0000000 --- a/hermes/include/hermes/logger.hpp +++ /dev/null @@ -1,61 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 -#define LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 - - -#include "logger_fwd.hpp" -#include "essentials/non_copyable.hpp" - - -namespace hermes -{ - - -struct log_message; - - -//!\interface logger -//!\brief Interface of the general logger. The specialized loggers derive from this interface. -class logger -{ -public: - //!\brief logger constructor. - logger() - { - // Nothing to do... - } - - - virtual ~logger() SX_NOEXCEPT - { - // Nothing to do... - } - - - SX_NO_COPY(logger) - - //!\brief Log the message to the target medium. - //!\param _log_message Message to be logged. - //!\return void - virtual void log( const log_message& _log_message ) = 0; -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/logger_fwd.hpp b/hermes/include/hermes/logger_fwd.hpp deleted file mode 100644 index 3d86d91..0000000 --- a/hermes/include/hermes/logger_fwd.hpp +++ /dev/null @@ -1,41 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 -#define LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 - - -#include - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -class logger; - -//!\typedef Alias for logger smart pointer. -typedef sxe::SX_UNIQUE_PTR< logger > logger_uptr; - -//!\typedef Alias for vector of logger smart pointers. -typedef std::vector< logger_uptr > loggers; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/std_timestamp_policy.hpp b/hermes/include/hermes/std_timestamp_policy.hpp deleted file mode 100644 index 9ebc2e4..0000000 --- a/hermes/include/hermes/std_timestamp_policy.hpp +++ /dev/null @@ -1,44 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#ifndef STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB -#define STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB - - -#include - -#include "essentials/non_copyable.hpp" - - -namespace hermes -{ - -//!\class std_timestamp_policy -//!\brief Provides time stamps for the logger. -class std_timestamp_policy SX_FINAL -{ -public: - SX_NO_COPY(std_timestamp_policy) - - //!\ Provides time stamp as string. - //!\return Time stamp as string. - static std::string get_timestamp(); -}; - - -} - - -#endif - - -#endif diff --git a/hermes/include/hermes/waiter.hpp b/hermes/include/hermes/waiter.hpp deleted file mode 100644 index 04992ab..0000000 --- a/hermes/include/hermes/waiter.hpp +++ /dev/null @@ -1,58 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef SX_NO_LOGGING - - -#ifndef WAITER_5E57D733_02DD_413D_A906_5047979A5DFD -#define WAITER_5E57D733_02DD_413D_A906_5047979A5DFD - - -#include "log_callback.hpp" -#include "essentials/compatibility/thread.hpp" - - -namespace hermes -{ - - //!\class waiter - //!\brief Class that implements the log callback and gives the logger the ability to wait for a message to be printed. This useful when - //!when we have to be sure writing a log message has definitely finished (e.g. before triggering an assert). - class waiter : public log_callback - { - public: - //!\brief Constructor - waiter(); - virtual ~waiter() SX_NOEXCEPT SX_OVERRIDE; - - //!\brief Wait for the process to finish. - virtual void wait() SX_OVERRIDE; - - //!\brief The thing we are waiting for is done. - virtual void done() SX_OVERRIDE; - - //!\brief Check if the thing we are waiting for is done. - //!\return True if it's done, false otherwise. - virtual bool is_done() SX_OVERRIDE; - - - private: - sxe::mutex done_mutex_; - sxe::condition_variable done_condition_variable_; - bool done_; - }; - -} - - -#endif - - -#endif diff --git a/hermes/license/hermes_Anhang_Appendix_20170406.pdf b/hermes/license/hermes_Anhang_Appendix_20170406.pdf deleted file mode 100644 index 30535fb..0000000 Binary files a/hermes/license/hermes_Anhang_Appendix_20170406.pdf and /dev/null differ diff --git a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf b/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf deleted file mode 100644 index 3ee52e9..0000000 Binary files a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf and /dev/null differ diff --git a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf b/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf deleted file mode 100644 index 352fa73..0000000 Binary files a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf and /dev/null differ diff --git a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf b/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf deleted file mode 100644 index 06d0d59..0000000 Binary files a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf and /dev/null differ diff --git a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf b/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf deleted file mode 100644 index 9edc89c..0000000 Binary files a/hermes/license/hermes_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf and /dev/null differ diff --git a/hermes/source/color_mapping.cpp b/hermes/source/color_mapping.cpp deleted file mode 100644 index 9e7a468..0000000 --- a/hermes/source/color_mapping.cpp +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/color_mapping.hpp" - -#include -#include - - -namespace hermes -{ - -#ifndef SX_CPP03_BOOST - - -color_mapping::color_mapping() - : color_map_( - { - { log_level::LL_FATAL, color::C_RED }, { log_level::LL_ERROR, color::C_DARK_RED }, - { log_level::LL_ASSERT, color::C_DARK_RED }, { log_level::LL_WARN, color::C_YELLOW }, - { log_level::LL_INFO, color::C_DARK_YELLOW }, { log_level::LL_DEBUG, color::C_DARK_GREEN }, - { log_level::LL_TRACE,color::C_DARK_GREEN }, { log_level::LL_SPAM, color::C_GREEN } - } ) -{ - // Nothing to do... -} - - -#else - - - color_mapping::color_mapping() - { - color_map_[ log_level::LL_FATAL ] = color::C_RED; - color_map_[ log_level::LL_ERROR ] = color::C_DARK_RED; - color_map_[ log_level::LL_ASSERT ] = color::C_DARK_RED; - color_map_[ log_level::LL_WARN ] = color::C_YELLOW; - color_map_[ log_level::LL_INFO ] = color::C_DARK_YELLOW; - color_map_[ log_level::LL_DEBUG ] = color::C_DARK_GREEN; - color_map_[ log_level::LL_TRACE ] = color::C_DARK_GREEN; - color_map_[ log_level::LL_SPAM ] = color::C_GREEN; - } - - -#endif - - -color_mapping::~color_mapping() SX_NOEXCEPT -{ - // Nothing to do... -} - - -color color_mapping::get_color( const hermes::log_level _log_level ) const -{ - color color_to_use( color::C_WHITE ); - color_map::const_iterator search = color_map_.find( _log_level ); - if (search != color_map_.end()) - { - color_to_use = search->second; - } - return( color_to_use ); -} - - -} - - -#endif diff --git a/hermes/source/cout_logger.cpp b/hermes/source/cout_logger.cpp deleted file mode 100644 index 23c6c03..0000000 --- a/hermes/source/cout_logger.cpp +++ /dev/null @@ -1,96 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/cout_logger.hpp" - -#include -#include -#include - -#include "essentials/conversion.hpp" - -#include "hermes/log_message.hpp" - - -#ifdef WIN32 - - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#ifndef SX_NO_WINDOWS_H - #include -#endif - - -#endif - -#include "hermes/globals.hpp" - - -namespace hermes -{ - - -cout_logger::cout_logger() - : logger(), - color_mapping_() -{ - // Nothing to do... -} - - -void cout_logger::log( const log_message& _log_message ) -{ - std::stringstream log_stream; - log_level_as_message( _log_message.log_level_ ); - log_stream << " " << _log_message.time_stamp_; - log_stream << " [" << _log_message.file_; - log_stream << "@" << sxe::to_string( _log_message.line_ ); - log_stream << "]: " << _log_message.message_; - std::cout << log_stream.str() << std::endl; -} - - -void cout_logger::log_level_as_message( const hermes::log_level _log_level ) const -{ - const std::string& log_level = log_level_to_string( _log_level ); - -#ifdef WIN32 - - CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info; - HANDLE handle = GetStdHandle( STD_OUTPUT_HANDLE ); - GetConsoleScreenBufferInfo( handle, &console_screen_buffer_info ); - const color color_of_log_level = color_mapping_.get_color( _log_level ); -#ifndef SX_CPP03_BOOST - SetConsoleTextAttribute( handle, static_cast< WORD >( color_of_log_level ) ); -#else - SetConsoleTextAttribute(handle, static_cast< WORD >( color_of_log_level.value_ )); -#endif - std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; - SetConsoleTextAttribute( handle, console_screen_buffer_info.wAttributes ); - -#else - - std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; - -#endif - - -} - - -} - - -#endif diff --git a/hermes/source/file_logger.cpp b/hermes/source/file_logger.cpp deleted file mode 100644 index 205bac0..0000000 --- a/hermes/source/file_logger.cpp +++ /dev/null @@ -1,186 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/file_logger.hpp" - -#include -#include -#include - -#include "essentials/conversion.hpp" - -#include "hermes/file_system.hpp" -#include "hermes/globals.hpp" -#include "hermes/log_message.hpp" - - -namespace hermes -{ - - -file_logger::file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, - const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, - const bool _throw_on_error ) : - max_file_size_in_bytes_( _max_file_size_in_bytes ), - log_files_directory_( add_trailing_slash_to_directory_path( _log_files_directory ) ), - name_sufix_( _name_suffix ), - name_extension_( _name_extension ), - max_file_number_( _max_file_number ), - throw_on_error_( _throw_on_error ), - working_file_() -{ - // Set member here to avoid future trouble with initialization order. - working_file_ = get_working_log_file_name(); - rotate_if_necessary(); -} - - -file_logger::~file_logger() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void file_logger::log( const log_message& _log_message ) -{ - const std::string log_level = log_level_to_string( _log_message.log_level_ ); - std::stringstream log_message_stream; - log_message_stream << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level << - " " << _log_message.time_stamp_ << " [" << _log_message.file_ << "@" << _log_message.line_ << - "]: " << _log_message.message_; - log_into_file( log_message_stream.str() ); - rotate_if_necessary(); -} - - -void file_logger::log_into_file( const std::string& _message ) const -{ - const bool append = does_file_exist( working_file_ ); - std::ios_base::openmode open_mode_flag; - if( append ) - { - open_mode_flag = std::ios::app; - } - else - { - open_mode_flag = std::ios::trunc; - } - -#ifndef SX_CPP03_BOOST - std::ofstream file( working_file_, open_mode_flag ); -#else - std::ofstream file( working_file_.c_str(), open_mode_flag ); -#endif - if( !file ) - { - const std::string error_message = sxe::sxprintf( "Failed to open file '%'.", working_file_ ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } - - file << _message << std::endl; - file.close(); -} - - -std::string file_logger::get_log_file_name_with_index( const unsigned _index ) const -{ - std::stringstream file_name_stream; - file_name_stream << log_files_directory_ << name_sufix_ << sxe::to_string( _index ) << "." << name_extension_; - return( file_name_stream.str() ); -} - - -std::string file_logger::get_working_log_file_name() const -{ - return( log_files_directory_ + name_sufix_ + "." + name_extension_ ); -} - - -void file_logger::rotate_if_necessary() const -{ - const size_t file_size = get_file_size( working_file_ ); - if( file_size > max_file_size_in_bytes_ ) - { - rename_files(); - } -} - - -void file_logger::rename_files() const -{ - for( unsigned i = max_file_number_ - 1; i > 0; --i ) - { - const std::string old_name = get_log_file_name_with_index( i - 1 ); - const std::string new_name = get_log_file_name_with_index( i ); - rename_file_if_exists( old_name, new_name ); - } - - // rename from foo.log to foo0.log - rename_file_if_exists( working_file_, get_log_file_name_with_index( 0 ) ); -} - - -void file_logger::rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const -{ - if( does_file_exist( _old_name ) ) - { - if( does_file_exist( _new_name ) ) - { - delete_file( _new_name ); - } - - const int renamed = std::rename( _old_name.c_str(), _new_name.c_str() ); - if( renamed ) - { - const std::string error_message = sxe::sxprintf( "File '%' could not be renamed!", _old_name ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } - } -} - - -void file_logger::delete_file( const std::string& _file_name ) const -{ - const int removed = std::remove( _file_name.c_str() ); - if( removed > 0 ) - { - const std::string error_message = sxe::sxprintf( "File '%' could not be deleted!\n", _file_name ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } -} - - -} - - -#endif diff --git a/hermes/source/file_system.cpp b/hermes/source/file_system.cpp deleted file mode 100644 index 2e0022e..0000000 --- a/hermes/source/file_system.cpp +++ /dev/null @@ -1,70 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "hermes/file_system.hpp" - - -namespace hermes -{ - - -size_t get_file_size( const std::string& _file_name ) -{ -#ifndef SX_CPP03_BOOST - std::ifstream in( _file_name, std::ios::binary | std::ios::ate ); -#else - std::ifstream in( _file_name.c_str(), std::ios::binary | std::ios::ate ); -#endif - return( static_cast< size_t >( in.tellg() ) ); -} - - -bool does_file_exist( const std::string& _file_name ) -{ - bool file_exists = false; -#ifndef SX_CPP03_BOOST - std::ifstream in( _file_name ); -#else - std::ifstream in( _file_name.c_str() ); -#endif - if( in ) - { - file_exists = true; - in.close(); - } - - return( file_exists ); -} - - -std::string add_trailing_slash_to_directory_path( const std::string& _path ) -{ - std::string log_file_directory_with_trailing_slash = _path; - if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '/' ) && - ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) - { - log_file_directory_with_trailing_slash += '/'; - } - - if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) - { - *log_file_directory_with_trailing_slash.rbegin() = '/'; - } - - if( log_file_directory_with_trailing_slash.empty() ) - { - log_file_directory_with_trailing_slash = "./"; - } - - return( log_file_directory_with_trailing_slash ); -} - - -} diff --git a/hermes/source/globals.cpp b/hermes/source/globals.cpp deleted file mode 100644 index fe75321..0000000 --- a/hermes/source/globals.cpp +++ /dev/null @@ -1,21 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "hermes/globals.hpp" - - -namespace hermes -{ - - -const int LOG_LEVEL_BLOCK_WIDTH = 7; - - -} diff --git a/hermes/source/hermes_version.cpp b/hermes/source/hermes_version.cpp deleted file mode 100644 index d97db8b..0000000 --- a/hermes/source/hermes_version.cpp +++ /dev/null @@ -1,76 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/sxprintf.hpp" - -#include "hermes/hermes_version.hpp" -#include "hermes/build_number.hpp" - - -namespace hermes -{ - - -namespace version -{ - - -namespace -{ - - -const sxe::uint16_t VERSION_MAJOR( 1 ); -const sxe::uint16_t VERSION_MINOR( 0 ); -const sxe::uint16_t VERSION_PATCH( 2 ); - - -} - - -// cppcheck-suppress unusedFunction -void log_version() -{ - std::cout << sxe::sxprintf( "hermes library version %.%.%.%.", hermes::version::get_major_version(), - hermes::version::get_minor_version(), hermes::version::get_patch_version(), hermes::version::get_build_number() ) - << std::endl; -} - - -sxe::uint16_t get_major_version() -{ - return( VERSION_MAJOR ); -} - - -sxe::uint16_t get_minor_version() -{ - return( VERSION_MINOR ); -} - - -sxe::uint16_t get_patch_version() -{ - return( VERSION_PATCH ); -} - - -sxe::uint16_t get_build_number() -{ - return( hermes::version::BUILD_NUMBER ); -} - - -} - - -} diff --git a/hermes/source/log_and_throw_helper.cpp b/hermes/source/log_and_throw_helper.cpp deleted file mode 100644 index 5ead8a2..0000000 --- a/hermes/source/log_and_throw_helper.cpp +++ /dev/null @@ -1,50 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifdef SX_CPP03_BOOST - - -#include "hermes/log_and_throw_helper.hpp" - -#include "essentials/sxprintf.hpp" - - -namespace hermes -{ - - - log_and_throw_helper::log_and_throw_helper( const std::string& _file_name, const int _line ) - : file_name_( _file_name ), - line_( _line ) - { - // Nothing to do... - } - - - log_and_throw_helper::~log_and_throw_helper() SX_NOEXCEPT - { - // Nothing to do... - } - - - void log_and_throw_helper::log( const log_level& _level, const std::string& _message ) const - { - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); - } - throw sxe::exception( _message ); - } - -} - - -#endif diff --git a/hermes/source/log_helper.cpp b/hermes/source/log_helper.cpp deleted file mode 100644 index 79c86e3..0000000 --- a/hermes/source/log_helper.cpp +++ /dev/null @@ -1,47 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef SX_CPP03_BOOST - -#include "hermes/log_helper.hpp" - -#include "essentials/sxprintf.hpp" - - -namespace hermes -{ - - - log_helper::log_helper( const std::string& _file_name, const int _line ) - : file_name_(_file_name), - line_(_line) - { - // Nothing to do... - } - - - log_helper::~log_helper() SX_NOEXCEPT - { - // Nothing to do... - } - - - void log_helper::log( const log_level& _level, const std::string& _message ) const - { - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); - } - } - -} - - -#endif diff --git a/hermes/source/log_level.cpp b/hermes/source/log_level.cpp deleted file mode 100644 index 854b7db..0000000 --- a/hermes/source/log_level.cpp +++ /dev/null @@ -1,126 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/log_level.hpp" - -#include "essentials/base.hpp" - - -namespace hermes -{ - - -std::string log_level_to_string( const log_level _log_level ) -{ - std::string log_level_string = "???"; - -#ifndef SX_CPP03_BOOST - switch( _log_level ) -#else - switch (_log_level.value_) -#endif - { - case ( log_level::LL_FATAL ): - { - log_level_string = "FATAL"; - } - break; - - case ( log_level::LL_ERROR ): - { - log_level_string = "ERROR"; - } - break; - - case ( log_level::LL_ASSERT ): - { - log_level_string = "ASSERT"; - } - break; - - case ( log_level::LL_WARN ): - { - log_level_string = "WARN"; - } - break; - - case ( log_level::LL_INFO ): - { - log_level_string = "INFO"; - } - break; - - case ( log_level::LL_DEBUG ): - { - log_level_string = "DEBUG"; - } - break; - - case ( log_level::LL_TRACE ): - { - log_level_string = "TRACE"; - } - break; - - case ( log_level::LL_SPAM ): - { - log_level_string = "SPAM"; - } - break; - - default: - SX_ASSERT( false, "Unknown log level!" ); - break; - } - - - return( log_level_string ); -} - - -#ifdef SX_CPP03_BOOST - - -// cppcheck-suppress unusedFunction -bool operator==(const hermes::log_level& _lhs, const hermes::log_level::inner _rhs) -{ - return( _lhs.value_ == _rhs ); -} - - -bool operator==(const hermes::log_level::inner _lhs, const hermes::log_level& _rhs) -{ - return( _lhs == _rhs.value_ ); -} - - -// cppcheck-suppress unusedFunction -bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs) -{ - return ( _lhs.value_ < _rhs.value_ ); -} - - -// cppcheck-suppress unusedFunction -bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ) -{ - return ( _lhs.value_ <= _rhs.value_ ); -} - - -#endif - - -} - - -#endif diff --git a/hermes/source/log_message.cpp b/hermes/source/log_message.cpp deleted file mode 100644 index 725e83b..0000000 --- a/hermes/source/log_message.cpp +++ /dev/null @@ -1,58 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/log_message.hpp" -#include "hermes/log_callback.hpp" - - -namespace hermes -{ - - -log_message::log_message() - : log_level_(), - time_stamp_(), - file_(), - line_(), - message_(), - log_callback_() -{ - // Nothing to do... -} - - -log_message::log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, - const std::string& _file, const int _line, const std::string& _message ) - : log_level_( _log_level ), - time_stamp_( _time_stamp ), - file_( _file ), - line_( _line ), - message_( _message ), - log_callback_( _log_callback ) -{ - // Nothing to do... -} - - -void log_message::done() -{ - if( log_callback_ ) - { - log_callback_->done(); - } -} - - -} - - -#endif diff --git a/hermes/source/std_timestamp_policy.cpp b/hermes/source/std_timestamp_policy.cpp deleted file mode 100644 index 77c02f3..0000000 --- a/hermes/source/std_timestamp_policy.cpp +++ /dev/null @@ -1,60 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/std_timestamp_policy.hpp" - -#include -#include - -#include - - -namespace hermes -{ - - -namespace -{ - - -const unsigned int WIDTH_YEAR( 4 ); -const unsigned int WIDTH_CLOCK( 2 ); -const char FILL_VALUE( '0' ); -const unsigned int YEAR_1900( 1900 ); -const char DATE_DELIMITER( '/' ); -const char TIME_DELIMITER( ':' ); -const char SPACE_SEPARATOR( ' ' ); - - -} - - -std::string std_timestamp_policy::get_timestamp() -{ - std::stringstream date_time_stream; - time_t rawtime; - time( &rawtime ); - tm timeinfo = *localtime( &rawtime ); - date_time_stream << std::setfill( FILL_VALUE ) << std::setw( WIDTH_YEAR ) << ( YEAR_1900 + timeinfo.tm_year ) << - DATE_DELIMITER << std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << ++timeinfo.tm_mon << DATE_DELIMITER << - std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << timeinfo.tm_mday << SPACE_SEPARATOR << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_hour << TIME_DELIMITER << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_min << TIME_DELIMITER << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_sec; - return( date_time_stream.str() ); -} - - -} - - -#endif diff --git a/hermes/source/waiter.cpp b/hermes/source/waiter.cpp deleted file mode 100644 index dd30cc9..0000000 --- a/hermes/source/waiter.cpp +++ /dev/null @@ -1,59 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/waiter.hpp" - - -namespace hermes -{ - - -waiter::waiter() - : done_mutex_(), - done_condition_variable_(), - done_() -{ - // Nothing to do... -} - - -waiter::~waiter() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void waiter::wait() -{ - sxe::unique_lock lock( done_mutex_ ); - done_condition_variable_.wait( lock, sxe::bind( &waiter::is_done, this ) ); -} - - -void waiter::done() -{ - sxe::lock_guard lock( done_mutex_ ); - done_ = true; -} - - -bool waiter::is_done() -{ - // no locking necessary, only used within wait of condition variable - return( done_ ); -} - - -} - - -#endif diff --git a/libyasmine/CMakeLists.txt b/libyasmine/CMakeLists.txt index ba94302..99fabe2 100644 --- a/libyasmine/CMakeLists.txt +++ b/libyasmine/CMakeLists.txt @@ -14,7 +14,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -152,27 +152,26 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"Y_PROFILER\"") message(STATUS "Y_PROFILER is defined.") endif() + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() endif() include_directories("./include" "./include_impl" "../externals/essentials/include" "../externals/hermes/include") -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") -endif() - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") @@ -182,7 +181,19 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_library(libyasmine STATIC ${yasmine_SRC}) endif() +SET_TARGET_PROPERTIES ( libyasmine PROPERTIES + VERSION 1.1.2 + SOVERSION 1.1 ) install(TARGETS libyasmine DESTINATION lib) -install(FILES *.hpp DESTINATION include) +file(GLOB yasmine_hpp "include/*.hpp") +file(GLOB yasmine_hpp_impl "include_impl/*.hpp") +file(GLOB essentials_hpp "../externals/essentials/include/essentials/*.hpp" "../externals/essentials/include/essentials/compatibility/*.hpp") +file(GLOB essentials_compatibility_hpp "../externals/essentials/include/essentials/compatibility/*.hpp") +file(GLOB hermes_hpp "../externals/hermes/include/hermes/*.hpp") +install(FILES ${yasmine_hpp} DESTINATION include/yasmine/include) +install(FILES ${yasmine_hpp_impl} DESTINATION include/yasmine/include_impl) +install(FILES ${essentials_hpp} DESTINATION include/yasmine/essentials/include/essentials) +install(FILES ${essentials_compatibility_hpp} DESTINATION include/yasmine/essentials/include/essentials/compatibility) +install(FILES ${hermes_hpp} DESTINATION include/yasmine/hermes/include) set_target_properties(libyasmine PROPERTIES PREFIX "") \ No newline at end of file diff --git a/libyasmine/changelog.txt b/libyasmine/changelog.txt index 87cea83..3201cf8 100644 --- a/libyasmine/changelog.txt +++ b/libyasmine/changelog.txt @@ -1,6 +1,7 @@ # Change log All notable changes to this project are documented in this file. + ##[1.1.2] - 2017-04-25 ### Changed diff --git a/libyasmine/include_impl/build_number.hpp b/libyasmine/include_impl/build_number.hpp index ca91b13..e2eaebc 100644 --- a/libyasmine/include_impl/build_number.hpp +++ b/libyasmine/include_impl/build_number.hpp @@ -24,7 +24,7 @@ namespace version { -const sxe::uint16_t BUILD_NUMBER( 656 ); +const sxe::uint16_t BUILD_NUMBER( 661 ); } diff --git a/libygen/CMakeLists.txt b/libygen/CMakeLists.txt index 40a7cc3..43ee6ed 100644 --- a/libygen/CMakeLists.txt +++ b/libygen/CMakeLists.txt @@ -14,7 +14,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -28,23 +28,23 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ endif() - -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") include_directories("./include") @@ -61,14 +61,15 @@ endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${CPP_VERSION}" STREQUAL "03") - target_link_libraries (libygen LINK_PUBLIC libyasmine genesis yasmine_model pthread boost_system boost_thread boost_chrono) + target_link_libraries (libygen LINK_PUBLIC libyasmine libgenesis libyasmine_model pthread boost_system boost_thread boost_chrono) else() - target_link_libraries (libygen LINK_PUBLIC libyasmine genesis yasmine_model pthread) + target_link_libraries (libygen LINK_PUBLIC libyasmine libgenesis libyasmine_model pthread) endif() elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - target_link_libraries (hello_yasmine LINK_PUBLIC libyasmine genesis yasmine_model) + target_link_libraries (libygen LINK_PUBLIC libyasmine genesis yasmine_model) endif() install(TARGETS libygen DESTINATION lib) -install(FILES *.hpp DESTINATION include) +file(GLOB libygen_hpp "include/*.hpp") +install(FILES ${libygen_hpp} DESTINATION include/libygen/include) set_target_properties(libygen PROPERTIES PREFIX "") \ No newline at end of file diff --git a/libygen/include/libygen_build_number.hpp b/libygen/include/libygen_build_number.hpp index 6f79db1..e2b8c7e 100644 --- a/libygen/include/libygen_build_number.hpp +++ b/libygen/include/libygen_build_number.hpp @@ -24,7 +24,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 656 ); + const sxe::uint16_t BUILD_NUMBER( 661 ); } diff --git a/version.txt b/version.txt index 1febba0..94e4cbc 100644 --- a/version.txt +++ b/version.txt @@ -1,5 +1,15 @@ Versions +• yasmine 1.2.1 released 2017-04-28 + • libyasmine 1.1.2 + • essentials 1.2.0 + • hermes 1.0.1 + • genesis 0.2.0 + • yasmine_model 0.1.0 + • libygen 0.1.0 + • ygen 0.1.1 + + • yasmine 1.2.0 released 2017-04-25 • libyasmine 1.1.2 • essentials 1.2.0 diff --git a/yasmine_model/CMakeLists.txt b/yasmine_model/CMakeLists.txt index cfb575a..510ac8b 100644 --- a/yasmine_model/CMakeLists.txt +++ b/yasmine_model/CMakeLists.txt @@ -14,7 +14,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -29,19 +29,21 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" ) + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() endif() @@ -52,21 +54,22 @@ include_directories("./../yasmine_model/include") include_directories("./../externals/essentials/include") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_library(yasmine_model SHARED ${yasmine_model_SRC}) + add_library(libyasmine_model SHARED ${yasmine_model_SRC}) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_library(yasmine_model STATIC ${yasmine_model_SRC}) endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${CPP_VERSION}" STREQUAL "03") - target_link_libraries (yasmine_model LINK_PUBLIC pthread boost_system boost_thread boost_chrono) + target_link_libraries (libyasmine_model LINK_PUBLIC pthread boost_system boost_thread boost_chrono) else() - target_link_libraries (yasmine_model LINK_PUBLIC pthread) + target_link_libraries (libyasmine_model LINK_PUBLIC pthread) endif() elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - target_link_libraries (hello_yasmine LINK_PUBLIC) + target_link_libraries (yasmine_model LINK_PUBLIC) endif() -install(TARGETS yasmine_model DESTINATION lib) -install(FILES *.hpp DESTINATION include) -set_target_properties(yasmine_model PROPERTIES PREFIX "") \ No newline at end of file +install(TARGETS libyasmine_model DESTINATION lib) +file(GLOB yasmine_model_hpp "include/*.hpp") +install(FILES ${yasmine_model_hpp} DESTINATION include/yasmine_model/include) +set_target_properties(libyasmine_model PROPERTIES PREFIX "") \ No newline at end of file diff --git a/yasmine_model/include/build_number.hpp b/yasmine_model/include/build_number.hpp index 116e66d..07f6c19 100644 --- a/yasmine_model/include/build_number.hpp +++ b/yasmine_model/include/build_number.hpp @@ -24,7 +24,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 656 ); + const sxe::uint16_t BUILD_NUMBER( 661 ); } diff --git a/ygen/CMakeLists.txt b/ygen/CMakeLists.txt index 1a2e244..b2875fb 100644 --- a/ygen/CMakeLists.txt +++ b/ygen/CMakeLists.txt @@ -15,7 +15,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) set(extra_flags "${extra_flags} -m64") message(STATUS "setting platform x64") - else() + elseif( "${CMAKE_CXX_FLAGS}" STREQUAL "-m32") set(extra_flags "${extra_flags} -m32") message(STATUS "setting platform x86") endif() @@ -75,20 +75,20 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. set(extra_flags "${extra_flags} /NXCOMPAT") -endif() + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() -# for release -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - #Creates fast code. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") - - #Controls LINK optimizations. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") - -# for debug -elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - #Creates a program database (PDB) file. - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") @@ -109,13 +109,13 @@ endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(Boost_USE_STATIC_LIBS ON) + #SET(Boost_USE_STATIC_LIBS ON) SET(BOOST_ROOT "${SX_BOOST_LIB_INCLUDE}") SET(Boost_INCLUDE_DIRS "${SX_BOOST_LIB_INCLUDE}") include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(ygen LINK_PUBLIC ${Boost_LIBRARIES}) - target_link_libraries(ygen LINK_PUBLIC "boost_program_options.a") - target_link_libraries(ygen LINK_PUBLIC "boost_filesystem.a") + target_link_libraries(ygen LINK_PUBLIC "boost_program_options") + target_link_libraries(ygen LINK_PUBLIC "boost_filesystem") target_link_libraries (ygen LINK_PUBLIC libygen) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") target_link_libraries (ygen LINK_PUBLIC libygen) diff --git a/ygen/changelog.txt b/ygen/changelog.txt index 1555932..491d4ef 100644 --- a/ygen/changelog.txt +++ b/ygen/changelog.txt @@ -1,6 +1,13 @@ # Change log All notable changes to this project are documented in this file. + +##[0.1.1] - 2017-04-28 + +### Fixed +• corrected spell for ygen command from 'behavior_classe' to 'behavior_class' + + ##[0.1.0] - 2017-04-25 • The very first released version of ygen \ No newline at end of file diff --git a/ygen/include/ygen_build_number.hpp b/ygen/include/ygen_build_number.hpp index 8ddd08a..5201a22 100644 --- a/ygen/include/ygen_build_number.hpp +++ b/ygen/include/ygen_build_number.hpp @@ -20,7 +20,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 656 ); + const sxe::uint16_t BUILD_NUMBER( 661 ); } diff --git a/ygen/source/main.cpp b/ygen/source/main.cpp index 11a6b5f..4bbedc8 100644 --- a/ygen/source/main.cpp +++ b/ygen/source/main.cpp @@ -30,7 +30,7 @@ bool parse_program_options( int argc, char** argv, boost::program_options::varia ( "header_template,e", value( &_config.header_template_file )->default_value( HEADER_TEMPLATE_FILE_DEFAULT ), HEADER_TEMPLATE_FILE_TEXT ) ( "out_file,o", value( &_config.source_output_file ), SOURCE_OUT_FILE_TEXT ) ( "namespace,n", value< std::vector >( &_config.namespaces ), NAMESPACES_TEXT ) - ( "behavior_classe,b", value< std::vector >( &_config.behavior_classes ), BEHAVIOR_CLASSES_TEXT ) + ( "behavior_class,b", value< std::vector >( &_config.behavior_classes ), BEHAVIOR_CLASSES_TEXT ) ( "model,m", value( &_config.model_file ), MODEL_FILE_TEXT ) ( "state_machine_name,i", value( &_config.state_machine_name ), STATE_MACHINE_NAME_TEXT ) ( "state_machine_type,y", value( &_config.sm_type )->default_value(sxy::state_machine_type::SMT_SYNC, STATE_MACHINE_TYPE_SYNC ), STATE_MACHINE_TYPE_TEXT)