diff --git a/alib2common/makefile b/alib2common/makefile index 38bca86b66f086f610da9ff2985a30493671b4ef..bf9f76e92604e1768a0c1f7bea9ac9cc0f568d5f 100644 --- a/alib2common/makefile +++ b/alib2common/makefile @@ -10,6 +10,8 @@ endef export NEW_LINE +CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls + space := $(eval) $(eval) LDFLAGS_DEBUG:=-rdynamic -shared @@ -54,7 +56,7 @@ FORCE: $${NEW_LINE}\ export NEW_LINE$${NEW_LINE}\ $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c -Wall -pedantic -Wextra -Werror -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ + CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ $${NEW_LINE}\ SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ diff --git a/alib2common/src/base/WrapperBase.hpp b/alib2common/src/base/WrapperBase.hpp index 4551f4ff5ec7341439d00293d22e892105ad08f2..af3d469d68e75e97f7c0140262e78a403254c854 100644 --- a/alib2common/src/base/WrapperBase.hpp +++ b/alib2common/src/base/WrapperBase.hpp @@ -19,49 +19,49 @@ class WrapperBaseBase { template < typename T > class WrapperBase : public WrapperBaseBase { protected: - std::cow_shared_ptr < T > data; + std::cow_shared_ptr < T > m_data; private: void unify ( WrapperBase & other ) { - if ( this->data.getUseCount ( ) > other.data.getUseCount ( ) ) - other.data = this->data; + if ( this->m_data.getUseCount ( ) > other.m_data.getUseCount ( ) ) + other.m_data = this->m_data; else - this->data = other.data; + this->m_data = other.m_data; } public: WrapperBase ( int ) = delete; - explicit WrapperBase ( T * data ) : data ( data ) { + explicit WrapperBase ( T * data ) : m_data ( data ) { } - explicit WrapperBase ( const T & data ) : data ( data.clone ( ) ) { + explicit WrapperBase ( const T & data ) : m_data ( data.clone ( ) ) { } - explicit WrapperBase ( T && data ) : data ( std::move ( data ).plunder ( ) ) { + explicit WrapperBase ( T && data ) : m_data ( std::move ( data ).plunder ( ) ) { } virtual ~WrapperBase ( ) noexcept { } const T & getData ( ) const { - return * data; + return * m_data; } T & getData ( ) { - return * data; + return * m_data; } void setData ( T * data ) { - this->data = std::cow_shared_ptr < T > ( data ); + this->m_data = std::cow_shared_ptr < T > ( data ); } void setData ( const T & data ) { - this->data = std::cow_shared_ptr < T > ( data.clone ( ) ); + this->m_data = std::cow_shared_ptr < T > ( data.clone ( ) ); } void setData ( T && data ) { - this->data = std::cow_shared_ptr < T > ( std::move ( data ).plunder ( ) ); + this->m_data = std::cow_shared_ptr < T > ( std::move ( data ).plunder ( ) ); } bool operator >=( const WrapperBase & other ) const { @@ -89,9 +89,9 @@ public: } int compare ( const WrapperBase & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return 0; + if ( this->m_data.get ( ) == other.m_data.get ( ) ) return 0; - int res = ( * this->data ).compare ( * other.data ); + int res = ( * this->m_data ).compare ( * other.m_data ); if ( res == 0 ) const_cast < WrapperBase * > ( this )->unify ( const_cast < WrapperBase & > ( other ) ); @@ -99,12 +99,12 @@ public: } friend std::ostream & operator <<( std::ostream & os, const WrapperBase & instance ) { - os << * ( instance.data ); + os << * ( instance.m_data ); return os; } explicit operator std::string ( ) const { - return ( std::string ) * data; + return ( std::string ) * m_data; } }; diff --git a/alib2common/src/container/ObjectsDeque.h b/alib2common/src/container/ObjectsDeque.h index 7315b5595399a4152efb75cac9c575656868bc63..cc06e7b33e57d1408f8c07870d7cfe14df05338b 100644 --- a/alib2common/src/container/ObjectsDeque.h +++ b/alib2common/src/container/ObjectsDeque.h @@ -59,7 +59,7 @@ public: }; template < class ElementType > -ObjectsDeque < ElementType >::ObjectsDeque ( std::deque < ElementType > deque ) : std::deque < ElementType > ( std::move ( deque ) ) { +ObjectsDeque < ElementType >::ObjectsDeque ( std::deque < ElementType > data ) : std::deque < ElementType > ( std::move ( data ) ) { } template < class ElementType > diff --git a/alib2common/src/container/ObjectsList.h b/alib2common/src/container/ObjectsList.h index c6f555ee13aa02b21272bcb1f9c33c7dd14fdd68..0b30f5879e059d4a00e3cad28884a3b3d6885ff6 100644 --- a/alib2common/src/container/ObjectsList.h +++ b/alib2common/src/container/ObjectsList.h @@ -59,7 +59,7 @@ public: }; template < class ElementType > -ObjectsList < ElementType >::ObjectsList ( std::list < ElementType > list ) : std::list < ElementType > ( std::move ( list ) ) { +ObjectsList < ElementType >::ObjectsList ( std::list < ElementType > data ) : std::list < ElementType > ( std::move ( data ) ) { } template < class ElementType > diff --git a/alib2common/src/container/ObjectsMap.h b/alib2common/src/container/ObjectsMap.h index 5141ade605f5b5d9cea5682a7765744e0d48168c..56815432405188eb21896d100a3578fa5e004c55 100644 --- a/alib2common/src/container/ObjectsMap.h +++ b/alib2common/src/container/ObjectsMap.h @@ -61,7 +61,7 @@ public: }; template < class KeyType, class ValueType > -ObjectsMap<KeyType, ValueType>::ObjectsMap(std::map<KeyType, ValueType> map) : std::map<KeyType, ValueType>(std::move(map)) { +ObjectsMap<KeyType, ValueType>::ObjectsMap ( std::map < KeyType, ValueType > data ) : std::map < KeyType, ValueType > ( std::move ( data ) ) { } diff --git a/alib2common/src/container/ObjectsPair.h b/alib2common/src/container/ObjectsPair.h index 74e355fac827ad71ee6b4afebc17b22fdcd81b00..13abfc482a8c4859aa431eb7ce078a11e640bd34 100644 --- a/alib2common/src/container/ObjectsPair.h +++ b/alib2common/src/container/ObjectsPair.h @@ -59,7 +59,7 @@ public: }; template < class KeyType, class ValueType > -ObjectsPair < KeyType, ValueType >::ObjectsPair(std::pair<KeyType, ValueType> pair) : std::pair<KeyType, ValueType>(std::move(pair)) { +ObjectsPair < KeyType, ValueType >::ObjectsPair(std::pair<KeyType, ValueType> data) : std::pair<KeyType, ValueType>(std::move(data)) { } diff --git a/alib2common/src/container/ObjectsSet.h b/alib2common/src/container/ObjectsSet.h index 83d65b11d2154ea2df78a1ed2d4ec0ccf54e43b2..1de6c6df6148e8d05c15cb42fbdb3ce84bcd0c40 100644 --- a/alib2common/src/container/ObjectsSet.h +++ b/alib2common/src/container/ObjectsSet.h @@ -59,7 +59,7 @@ public: }; template < class ElementType > -ObjectsSet < ElementType >::ObjectsSet(std::set<ElementType> set) : std::set<ElementType>(std::move(set)) { +ObjectsSet < ElementType >::ObjectsSet(std::set<ElementType> data) : std::set<ElementType>(std::move(data)) { } diff --git a/alib2common/src/container/ObjectsTree.h b/alib2common/src/container/ObjectsTree.h index 421f7462c1966edac377886e77ce537dc00311fc..4dc894a0e257880675a4bb989ac41dcdcf37441d 100644 --- a/alib2common/src/container/ObjectsTree.h +++ b/alib2common/src/container/ObjectsTree.h @@ -58,7 +58,7 @@ public: }; template < class ElementType > -ObjectsTree < ElementType >::ObjectsTree ( std::tree < ElementType > tree ) : std::tree < ElementType > ( std::move ( tree ) ) { +ObjectsTree < ElementType >::ObjectsTree ( std::tree < ElementType > data ) : std::tree < ElementType > ( std::move ( data ) ) { } template < class ElementType > diff --git a/alib2common/src/container/ObjectsVector.h b/alib2common/src/container/ObjectsVector.h index 29f7b5faafb52b95aa64874ab563756e9c681ee3..c1f00206be4331d1341ee49eabcc19ea72abf656 100644 --- a/alib2common/src/container/ObjectsVector.h +++ b/alib2common/src/container/ObjectsVector.h @@ -59,7 +59,7 @@ public: }; template < class ElementType > -ObjectsVector < ElementType >::ObjectsVector ( std::vector < ElementType > vector ) : std::vector < ElementType > ( std::move ( vector ) ) { +ObjectsVector < ElementType >::ObjectsVector ( std::vector < ElementType > data ) : std::vector < ElementType > ( std::move ( data ) ) { } template < class ElementType > diff --git a/alib2common/src/core/components.hpp b/alib2common/src/core/components.hpp index bf1e7657378b575e1e5375427fb036f0da6fe31d..160c08587b97b77e0f299e3912973dcf48869bc3 100644 --- a/alib2common/src/core/components.hpp +++ b/alib2common/src/core/components.hpp @@ -63,7 +63,7 @@ class Component { /** * The set. */ - std::set < DataType > data; + std::set < DataType > m_data; /** * Checks whether symbol can be added to the set. Calls valid and available functions. @@ -89,7 +89,7 @@ protected: /** Checks the state of the set. */ void checkState ( ) { - for ( const DataType & symbol : data ) + for ( const DataType & symbol : m_data ) checkAdd ( symbol ); } @@ -98,7 +98,7 @@ public: * Constructs a set containing given elements. * @throw CommonException if elements are not available in context of datatype where the set is used */ - Component ( std::set < DataType > symbols ) : data ( std::move ( symbols ) ) { + Component ( std::set < DataType > symbols ) : m_data ( std::move ( symbols ) ) { } /** @@ -110,7 +110,7 @@ public: */ bool add ( DataType symbol ) { checkAdd ( symbol ); - return data.insert ( std::move ( symbol ) ).second; + return m_data.insert ( std::move ( symbol ) ).second; } /** @@ -131,7 +131,7 @@ public: */ void set ( std::set < DataType > symbols ) { std::set < DataType > removed; - std::set_difference ( data.begin ( ), data.end ( ), symbols.begin ( ), symbols.end ( ), std::inserter ( removed, removed.end ( ) ) ); + std::set_difference ( m_data.begin ( ), m_data.end ( ), symbols.begin ( ), symbols.end ( ), std::inserter ( removed, removed.end ( ) ) ); for ( const DataType & symbol : removed ) checkRemove ( symbol ); @@ -139,21 +139,21 @@ public: for ( const DataType & symbol : symbols ) checkAdd ( symbol ); - data = std::move ( symbols ); + m_data = std::move ( symbols ); } /** * @return the set. */ std::set < DataType > & get ( ) { - return data; + return m_data; } /** * @return the set. */ const std::set < DataType > & get ( ) const { - return data; + return m_data; } /** @@ -164,7 +164,7 @@ public: */ bool remove ( const DataType & symbol ) { checkRemove ( symbol ); - return data.erase ( symbol ); + return m_data.erase ( symbol ); } /** @@ -181,7 +181,7 @@ public: * @return true if set is an empty */ bool empty ( ) const { - return data.empty ( ); + return m_data.empty ( ); } }; @@ -222,7 +222,7 @@ class Element { /** * The element. */ - DataType data; + DataType m_data; /** * Checks whether element can be set. Calls valid and available functions. @@ -239,7 +239,7 @@ protected: /** Checks the state of the element. */ void checkState ( ) { - checkSet ( data ); + checkSet ( m_data ); } public: @@ -247,7 +247,7 @@ public: * Constructs a notable element. * @throw CommonException if element is not available in context of datatype where the class is used */ - Element ( DataType symbol ) : data ( std::move ( symbol ) ) { + Element ( DataType symbol ) : m_data ( std::move ( symbol ) ) { } /** @@ -260,9 +260,9 @@ public: bool set ( DataType symbol ) { checkSet ( symbol ); - if ( data == symbol ) return false; + if ( m_data == symbol ) return false; - data = std::move ( symbol ); + m_data = std::move ( symbol ); return true; } @@ -271,7 +271,7 @@ public: * @return the notable element */ DataType & get ( ) { - return data; + return m_data; } /** @@ -279,7 +279,7 @@ public: * @return the notable element */ const DataType & get ( ) const { - return data; + return m_data; } }; diff --git a/alib2common/src/core/multipleDispatch.hpp b/alib2common/src/core/multipleDispatch.hpp index fff9754d94ad28716e79f345daa6654ae9eadd4e..5403f47896370a60249fdc4cba4b7883370aa144 100644 --- a/alib2common/src/core/multipleDispatch.hpp +++ b/alib2common/src/core/multipleDispatch.hpp @@ -43,14 +43,14 @@ private: public: template < class RealReturnType, class ... RealParameterTypeBases > class RegistratorWrapper : public RegistratorWrapperBase { - std::function < RealReturnType ( FrontStaticParamTypes ..., typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && ..., BackStaticParamTypes ... ) > callback; + std::function < RealReturnType ( FrontStaticParamTypes ..., typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && ..., BackStaticParamTypes ... ) > m_callback; public: ReturnType eval ( FrontStaticParamTypes ... front, DispatchedParameterTypes && ... dispatched, BackStaticParamTypes ... back ) { - return ReturnType ( callback ( front ..., std::forward < typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type > ( static_cast < typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && > ( dispatched ) ) ..., back ... ) ); + return ReturnType ( m_callback ( front ..., std::forward < typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type > ( static_cast < typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && > ( dispatched ) ) ..., back ... ) ); } - RegistratorWrapper ( RealReturnType ( * callback ) ( FrontStaticParamTypes ..., typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && ..., BackStaticParamTypes ... ) ) : callback ( callback ) { + RegistratorWrapper ( RealReturnType ( * callback ) ( FrontStaticParamTypes ..., typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type && ..., BackStaticParamTypes ... ) ) : m_callback ( callback ) { if ( !getInstance ( ).registeredFunctions.insert ( std::make_pair ( std::make_tuple ( std::type_index ( typeid ( typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type ) ) ... ), this ) ).second ) { std::stringstream ss; ( void ) initializer_list < int > { ( ss << cstringToString ( std::type_name < typename std::match_cv_ref < DispatchedParameterTypes, RealParameterTypeBases >::type > ( ) ), 0 ) ... }; @@ -119,19 +119,19 @@ public: class RegistratorWrapper : public RegistratorWrapperBase { typedef typename std::match_cv_ref < ParametersType, RealParametersTypeBase >::type RealParametersType; - std::function < RealReturnType ( RealParametersType &&, RealParametersType && ) > callback; + std::function < RealReturnType ( RealParametersType &&, RealParametersType && ) > m_callback; public: ReturnType eval ( bool firstAttempt, ParametersType && first, ParametersType && second ) { if ( std::type_index ( typeid ( first ) ) == std::type_index ( typeid ( second ) ) ) - return ReturnType ( callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( first ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( second ) ) ) ); + return ReturnType ( m_callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( first ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( second ) ) ) ); if ( firstAttempt ) { alib::Object casted = alib::castApi::getCastPool ( std::type_index ( typeid ( first ) ) ).cast ( std::forward < ParametersType > ( second ) ); - return ReturnType ( callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( first ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( casted.getData ( ) ) ) ) ); + return ReturnType ( m_callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( first ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( casted.getData ( ) ) ) ) ); } else { alib::Object casted = alib::castApi::getCastPool ( std::type_index ( typeid ( second ) ) ).cast ( std::forward < ParametersType > ( first ) ); - return ReturnType ( callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( casted.getData ( ) ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( second ) ) ) ); + return ReturnType ( m_callback ( std::forward < RealParametersType > ( static_cast < RealParametersType && > ( casted.getData ( ) ) ), std::forward < RealParametersType > ( static_cast < RealParametersType && > ( second ) ) ) ); } } @@ -144,7 +144,7 @@ public: return alib::castApi::castAvailable ( second, first ); } - RegistratorWrapper ( RealReturnType ( * callback ) ( RealParametersType &&, RealParametersType && ) ) : callback ( callback ) { + RegistratorWrapper ( RealReturnType ( * callback ) ( RealParametersType &&, RealParametersType && ) ) : m_callback ( callback ) { if ( !getInstance ( ).registeredFunctions.insert ( std::make_pair ( std::type_index ( typeid ( RealParametersType ) ), this ) ).second ) { std::string paramsType = std::cstringToString ( std::type_name < RealParametersType > ( ) ); diff --git a/alib2common/src/core/visitor.hpp b/alib2common/src/core/visitor.hpp index ad34ad33bea07f882ad6f0b4ce5843cc58b0bc59..d355642499ba2a63e20639304ec7d22f4406b360 100644 --- a/alib2common/src/core/visitor.hpp +++ b/alib2common/src/core/visitor.hpp @@ -39,20 +39,20 @@ template < class ReturnType, class Visitor, class ... Params > class VisitorContextAux { typename std::aligned_storage < SizeOf < ReturnType >::size, AlignOf < ReturnType >::align >::type result; - std::tuple < Params ... > params; + std::tuple < Params ... > m_params; public: - VisitorContextAux ( Params && ... params ) : params ( std::forward < Params > ( params ) ... ) { + VisitorContextAux ( Params && ... params ) : m_params ( std::forward < Params > ( params ) ... ) { } template < class Inherit, size_t ... Indexes, class ReturnType2 = ReturnType > void call ( const Inherit & inherit, std::index_sequence < Indexes ... >, typename std::enable_if < !std::is_void < ReturnType2 >::value && std::is_same < ReturnType, ReturnType2 >::value >::type * = 0 ) { - new ( & result )ReturnType ( Visitor::visit ( inherit, std::forward < Params > ( std::get < Indexes > ( params ) ) ... ) ); + new ( & result )ReturnType ( Visitor::visit ( inherit, std::forward < Params > ( std::get < Indexes > ( m_params ) ) ... ) ); } template < class Inherit, size_t ... Indexes, class ReturnType2 = ReturnType > void call ( const Inherit & inherit, std::index_sequence < Indexes ... >, typename std::enable_if < std::is_void < ReturnType2 >::value && std::is_same < ReturnType, ReturnType2 >::value >::type * = 0 ) { - ReturnType ( Visitor::visit ( inherit, std::forward < Params > ( std::get < Indexes > ( params ) ) ... ) ); + ReturnType ( Visitor::visit ( inherit, std::forward < Params > ( std::get < Indexes > ( m_params ) ) ... ) ); } template < class ReturnType2 = ReturnType > diff --git a/alib2common/src/core/xmlApi.hpp b/alib2common/src/core/xmlApi.hpp index 28a866c00410f19387d7e61a3848daf39f866e3e..5813976d35b5eb8ddd9bb2b291339efbcb1c3482 100644 --- a/alib2common/src/core/xmlApi.hpp +++ b/alib2common/src/core/xmlApi.hpp @@ -164,11 +164,11 @@ public: static void compose ( std::deque < sax::Token > & output, const Group & data ) { xmlApiOutputContext & context = ( xmlApiOutputContext & ) output; - typename std::map < void *, int >::iterator elem = context.instanceToId ( Group::getXmlTagRefName() ).find ( ( void * ) & data.getData ( ) ); + typename std::map < void *, int >::iterator elem = context.instanceToId ( Group::getXmlTagRefName() ).find ( const_cast< void * >(static_cast< const void * > ( & data.getData ( ) ) ) ); if ( elem == context.instanceToId ( Group::getXmlTagRefName() ).end ( ) ) { data.getData ( ).compose ( output ); - context.instanceToId ( Group::getXmlTagRefName() ).insert ( std::make_pair ( ( void * ) & data.getData ( ), context.instanceToIdMax ( Group::getXmlTagRefName() )++ ) ); + context.instanceToId ( Group::getXmlTagRefName() ).insert ( std::make_pair ( const_cast< void * > ( static_cast< const void * > ( & data.getData ( ) ) ), context.instanceToIdMax ( Group::getXmlTagRefName() )++ ) ); } else { output.emplace_back ( Group::getXmlTagRefName(), sax::Token::TokenType::START_ELEMENT ); output.emplace_back ( "id", sax::Token::TokenType::START_ATTRIBUTE ); diff --git a/alib2common/src/debug/simpleStacktrace.cpp b/alib2common/src/debug/simpleStacktrace.cpp index ed65b4869357ce9118f6ea06dc0d551242adbf04..1603387f09c4def8df045b64c10262ab68d13540 100644 --- a/alib2common/src/debug/simpleStacktrace.cpp +++ b/alib2common/src/debug/simpleStacktrace.cpp @@ -111,9 +111,9 @@ string simpleStacktrace(unsigned int max_frames) { // __cxa_demangle(): int status; - char* ret = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status); + char* demangled = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status); if (status == 0) { - funcname = ret; // use possibly realloc()-ed string + funcname = demangled; // use possibly realloc()-ed string ss << " " << symbollist[i] << " : " << funcname << "+" << begin_offset << " " << begin_name << " [0x" << addr_offset_by_dl.c_str() << "; @ " << addr_offset << "]" << endl; } else { // demangling failed. Output function name as a C function with diff --git a/alib2common/src/exception/CommonException.cpp b/alib2common/src/exception/CommonException.cpp index e8c8ca8f530cef5468fdb70f457745a1a14f60be..b4053278c6f21b4823595c7f50b4b2be29677fd2 100644 --- a/alib2common/src/exception/CommonException.cpp +++ b/alib2common/src/exception/CommonException.cpp @@ -18,24 +18,24 @@ namespace exception { -CommonException::CommonException ( std::string cause ) : cause(std::move(cause)) { +CommonException::CommonException ( std::string cause ) : m_cause(std::move(cause)) { #ifdef DEBUG - this->backtrace = std::simpleStacktrace(); + this->m_backtrace = std::simpleStacktrace(); #else - this->backtrace = ""; + this->m_backtrace = ""; #endif for(int i = 0; i < common::GlobalData::argc; i++) { - if(i != 0) this->command += " "; - this->command += common::GlobalData::argv[i]; + if(i != 0) this->m_command += " "; + this->m_command += common::GlobalData::argv[i]; } - this->whatMessage += this->backtrace; - this->whatMessage += this->cause; + this->m_whatMessage += this->m_backtrace; + this->m_whatMessage += this->m_cause; } -CommonException::CommonException ( std::string cause, std::string backtrace, std::string command ) : cause(std::move(cause)), backtrace(std::move(backtrace)), command(std::move(command)) { - this->whatMessage += this->backtrace; - this->whatMessage += this->cause; +CommonException::CommonException ( std::string cause, std::string backtrace, std::string command ) : m_cause(std::move(cause)), m_backtrace(std::move(backtrace)), m_command(std::move(command)) { + this->m_whatMessage += this->m_backtrace; + this->m_whatMessage += this->m_cause; } alib::ObjectBase* CommonException::clone() const { @@ -47,31 +47,31 @@ alib::ObjectBase* CommonException::plunder() && { } int CommonException::compare(const CommonException& other) const { - return this->whatMessage.compare(other.whatMessage); + return this->m_whatMessage.compare(other.m_whatMessage); } const char * CommonException::what ( ) const noexcept { - return whatMessage.c_str ( ); + return m_whatMessage.c_str ( ); } const std::string & CommonException::getCause ( ) const { - return cause; + return m_cause; } const std::string & CommonException::getBacktrace ( ) const { - return backtrace; + return m_backtrace; } const std::string & CommonException::getCommand ( ) const { - return command; + return m_command; } void CommonException::operator>>(std::ostream& os) const { - os << this->whatMessage; + os << this->m_whatMessage; } CommonException::operator std::string() const { - return this->whatMessage; + return this->m_whatMessage; } CommonException CommonException::parse(std::deque<sax::Token>::iterator& input) { @@ -104,13 +104,13 @@ CommonException CommonException::parse(std::deque<sax::Token>::iterator& input) void CommonException::compose(std::deque<sax::Token>& out) const { out.emplace_back(CommonException::getXmlTagName(), sax::Token::TokenType::START_ELEMENT); out.emplace_back("cause", sax::Token::TokenType::START_ELEMENT); - out.emplace_back(cause, sax::Token::TokenType::CHARACTER); + out.emplace_back(m_cause, sax::Token::TokenType::CHARACTER); out.emplace_back("cause", sax::Token::TokenType::END_ELEMENT); out.emplace_back("backtrace", sax::Token::TokenType::START_ELEMENT); - out.emplace_back(backtrace, sax::Token::TokenType::CHARACTER); + out.emplace_back(m_backtrace, sax::Token::TokenType::CHARACTER); out.emplace_back("backtrace", sax::Token::TokenType::END_ELEMENT); out.emplace_back("command", sax::Token::TokenType::START_ELEMENT); - out.emplace_back(command, sax::Token::TokenType::CHARACTER); + out.emplace_back(m_command, sax::Token::TokenType::CHARACTER); out.emplace_back("command", sax::Token::TokenType::END_ELEMENT); out.emplace_back(CommonException::getXmlTagName(), sax::Token::TokenType::END_ELEMENT); } diff --git a/alib2common/src/exception/CommonException.h b/alib2common/src/exception/CommonException.h index 0ce196f9973d75f620a2ee66c67ebd45ddcc160b..3018c762b4af8d7935a1648ed39ccf766bcc83ca 100644 --- a/alib2common/src/exception/CommonException.h +++ b/alib2common/src/exception/CommonException.h @@ -24,10 +24,10 @@ namespace exception { */ class CommonException : public std::exception, public alib::ObjectBase { protected: - std::string cause; - std::string backtrace; - std::string whatMessage; - std::string command; + std::string m_cause; + std::string m_backtrace; + std::string m_whatMessage; + std::string m_command; public: explicit CommonException ( std::string cause ); diff --git a/alib2common/src/measurements/MeasurementEngine.cpp b/alib2common/src/measurements/MeasurementEngine.cpp index e88b9351349479b8fd6853785feca203419726bc..c927b801b7a7048c0455c8bce61d25e2c9e0f205 100644 --- a/alib2common/src/measurements/MeasurementEngine.cpp +++ b/alib2common/src/measurements/MeasurementEngine.cpp @@ -66,10 +66,10 @@ MeasurementResults MeasurementEngine::getResults ( ) const { } template < typename Hint > -void MeasurementEngine::hint ( Hint hint ) { +void MeasurementEngine::hint ( Hint arg ) { if ( ( frameIdxStack.size ( ) == 0 ) ) return; - Hint::frame_type::hint ( frameIdxStack.back ( ), frames, std::move ( hint ) ); + Hint::frame_type::hint ( frameIdxStack.back ( ), frames, std::move ( arg ) ); } template void MeasurementEngine::hint < MemoryHint > ( MemoryHint ); diff --git a/alib2common/src/measurements/MeasurementFrame.cpp b/alib2common/src/measurements/MeasurementFrame.cpp index 0d2cc03e55ab0f9cfaf6ac60658b806da3932c7e..153d5ae30056f4f11a59b8cfb325c0c40d953ec8 100644 --- a/alib2common/src/measurements/MeasurementFrame.cpp +++ b/alib2common/src/measurements/MeasurementFrame.cpp @@ -7,7 +7,7 @@ namespace measurements { -MeasurementFrame::MeasurementFrame ( measurements::stealth_string name, measurements::Type type, unsigned parentIdx ) : name ( std::move ( name ) ), type ( type ), parentIdx ( parentIdx ), time ( ), memory ( ) { +MeasurementFrame::MeasurementFrame ( measurements::stealth_string frameName, measurements::Type frameType, unsigned frameParentIdx ) : name ( std::move ( frameName ) ), type ( frameType ), parentIdx ( frameParentIdx ), time ( ), memory ( ) { } std::ostream & operator <<( std::ostream & os, const MeasurementFrame & frame ) { diff --git a/alib2common/src/measurements/MeasurementFrame.hpp b/alib2common/src/measurements/MeasurementFrame.hpp index adb1189f3525f47ca10cf7e2eaa93c35c8258d81..c411fbbd2c49e6196f6b685b659e6111f2f0ad74 100644 --- a/alib2common/src/measurements/MeasurementFrame.hpp +++ b/alib2common/src/measurements/MeasurementFrame.hpp @@ -18,8 +18,8 @@ namespace measurements { struct MeasurementFrame { measurements::stealth_string name; - measurements::Type type; - unsigned parentIdx; + measurements::Type type; + unsigned parentIdx; measurements::stealth_vector < unsigned > subIdxs; diff --git a/alib2common/src/measurements/MeasurementResults.cpp b/alib2common/src/measurements/MeasurementResults.cpp index 6456339dd4df6f6c8b2ac9c5066f1f36ae3dd936..c55c0c17d1a6f9a233bcbd364b85e1af9c7f58e7 100644 --- a/alib2common/src/measurements/MeasurementResults.cpp +++ b/alib2common/src/measurements/MeasurementResults.cpp @@ -9,7 +9,7 @@ namespace measurements { MeasurementResults::MeasurementResults ( ) { } -MeasurementResults::MeasurementResults ( const measurements::stealth_vector < MeasurementFrame > & frames ) : frames ( frames ) { +MeasurementResults::MeasurementResults ( const measurements::stealth_vector < MeasurementFrame > & resultFrames ) : frames ( resultFrames ) { } void MeasurementResults::printAsList ( std::ostream & os ) const { diff --git a/alib2common/src/primitive/Bool.cpp b/alib2common/src/primitive/Bool.cpp index 936cb7e4449bd72ba83bcd03dd084e8fee1e6b38..7075c1b5b94907a6b80cf55b5b3a5f6ded0a2871 100644 --- a/alib2common/src/primitive/Bool.cpp +++ b/alib2common/src/primitive/Bool.cpp @@ -13,7 +13,7 @@ namespace primitive { -Bool::Bool(bool data) : data(data) { +Bool::Bool(bool data) : m_data(data) { } @@ -26,23 +26,23 @@ PrimitiveBase* Bool::plunder() && { } bool Bool::getData() const { - return data; + return m_data; } void Bool::setData(bool data) { - this->data = data; + this->m_data = data; } int Bool::compare(const Bool& other) const { - return data - other.data; + return m_data - other.m_data; } void Bool::operator>>(std::ostream& out) const { - out << "(Bool " << (data ? "true" : "false") << ")"; + out << "(Bool " << (m_data ? "true" : "false") << ")"; } Bool::operator std::string() const { - return data ? "true" : "false"; + return m_data ? "true" : "false"; } Bool Bool::parse(std::deque<sax::Token>::iterator& input) { @@ -77,11 +77,11 @@ void Bool::compose(std::deque<sax::Token>& out, bool primitive) { } Bool Bool::next() const { - return Bool(!data); + return Bool(!m_data); } void Bool::inc() { - data = !data; + m_data = !m_data; } } /* namespace primitive */ diff --git a/alib2common/src/primitive/Bool.h b/alib2common/src/primitive/Bool.h index a5cb0602131a5f19c529413237975dc315b09aef..eae50fff10ee7a9fac714ff2397634d5f541794e 100644 --- a/alib2common/src/primitive/Bool.h +++ b/alib2common/src/primitive/Bool.h @@ -18,7 +18,7 @@ namespace primitive { */ class Bool : public PrimitiveBase { protected: - bool data; + bool m_data; public: /** diff --git a/alib2common/src/primitive/Character.cpp b/alib2common/src/primitive/Character.cpp index 22116f0449932a1334d0e05813cbc8c33d74e77b..dd6cc85cb9044a3e3db865c93acb59f1cf3da74b 100644 --- a/alib2common/src/primitive/Character.cpp +++ b/alib2common/src/primitive/Character.cpp @@ -12,7 +12,7 @@ namespace primitive { -Character::Character(char data) : data(data) { +Character::Character(char data) : m_data(data) { } @@ -25,23 +25,23 @@ PrimitiveBase* Character::plunder() && { } char Character::getData() const { - return data; + return m_data; } void Character::setData(char data) { - this->data = data; + this->m_data = data; } int Character::compare(const Character& other) const { - return data - other.data; + return m_data - other.m_data; } void Character::operator>>(std::ostream& out) const { - out << "(Character " << data << ")"; + out << "(Character " << m_data << ")"; } Character::operator std::string() const { - return std::string(1, data); + return std::string(1, m_data); } Character Character::parse(std::deque<sax::Token>::iterator& input) { @@ -66,11 +66,11 @@ void Character::compose(std::deque<sax::Token>& out, char primitive) { } Character Character::next() const { - return Character(data + 1); + return Character(m_data + 1); } void Character::inc() { - data++; + m_data++; } } /* namespace primitive */ diff --git a/alib2common/src/primitive/Character.h b/alib2common/src/primitive/Character.h index 3caadd1bd6a31597498df445af671398ef0a9da4..c80ed46cb215904b6b4e506d7c562141a86d091c 100644 --- a/alib2common/src/primitive/Character.h +++ b/alib2common/src/primitive/Character.h @@ -18,7 +18,7 @@ namespace primitive { */ class Character : public PrimitiveBase { protected: - char data; + char m_data; public: /** diff --git a/alib2common/src/primitive/Integer.cpp b/alib2common/src/primitive/Integer.cpp index 6a8975c07f3a2a2de5f3ac79f1401ce78953c831..ae9b0013e82839b20d39aa51e05c7d74daf7a501 100644 --- a/alib2common/src/primitive/Integer.cpp +++ b/alib2common/src/primitive/Integer.cpp @@ -12,7 +12,7 @@ namespace primitive { -Integer::Integer(int data) : data(data) { +Integer::Integer(int data) : m_data(data) { } @@ -25,23 +25,23 @@ PrimitiveBase* Integer::plunder() && { } int Integer::getData() const { - return data; + return m_data; } void Integer::setData(int data) { - this->data = data; + this->m_data = data; } int Integer::compare(const Integer& other) const { - return data - other.data; + return m_data - other.m_data; } void Integer::operator>>(std::ostream& out) const { - out << "(Integer " << data << ")"; + out << "(Integer " << m_data << ")"; } Integer::operator std::string() const { - return std::to_string(data); + return std::to_string(m_data); } Integer Integer::parse(std::deque<sax::Token>::iterator& input) { @@ -66,11 +66,11 @@ void Integer::compose(std::deque<sax::Token>& out, int primitive) { } Integer Integer::next() const { - return Integer(data + 1); + return Integer(m_data + 1); } void Integer::inc() { - data++; + m_data++; } } /* namespace primitive */ diff --git a/alib2common/src/primitive/Integer.h b/alib2common/src/primitive/Integer.h index bf0cf60f99e7bd9f422bdb68ab355254b1de3860..6ad4fec405a3e897d46062e46045ed633a6fe669 100644 --- a/alib2common/src/primitive/Integer.h +++ b/alib2common/src/primitive/Integer.h @@ -18,7 +18,7 @@ namespace primitive { */ class Integer : public PrimitiveBase { protected: - int data; + int m_data; public: /** diff --git a/alib2common/src/primitive/String.cpp b/alib2common/src/primitive/String.cpp index bc18ae77f5441657045fd8b20b3deb927c7f0fc2..c70588f88b4c0849cbae46d64a91fa8a9577fe49 100644 --- a/alib2common/src/primitive/String.cpp +++ b/alib2common/src/primitive/String.cpp @@ -12,7 +12,7 @@ namespace primitive { -String::String(std::string data) : data(std::move(data)) { +String::String(std::string data) : m_data(std::move(data)) { } @@ -29,23 +29,23 @@ PrimitiveBase* String::plunder() && { } const std::string& String::getData() const { - return data; + return m_data; } std::string& String::getData() { - return data; + return m_data; } int String::compare(const String& other) const { - return data.compare(other.data); + return m_data.compare(other.m_data); } void String::operator>>(std::ostream& out) const { - out << "(String " << data << ")"; + out << "(String " << m_data << ")"; } String::operator std::string() const { - return data; + return m_data; } String String::parse(std::deque<sax::Token>::iterator& input) { @@ -73,11 +73,11 @@ void String::compose(std::deque<sax::Token>& out, std::string primitive) { } String String::next() const { - return String(data + '\''); + return String(m_data + '\''); } void String::inc() { - data.push_back('\''); + m_data.push_back('\''); } } /* namespace primitive */ diff --git a/alib2common/src/primitive/String.h b/alib2common/src/primitive/String.h index cd49a5457237e31aa09fae8a7eddf93c7e3ec208..371fc901e3ddebe7a2ef4875a2f5fb45f4042f5e 100644 --- a/alib2common/src/primitive/String.h +++ b/alib2common/src/primitive/String.h @@ -19,7 +19,7 @@ namespace primitive { */ class String : public PrimitiveBase { protected: - std::string data; + std::string m_data; public: /** diff --git a/alib2common/src/primitive/Unsigned.cpp b/alib2common/src/primitive/Unsigned.cpp index 1b1b8eb2097072c08a4d3cb09f789be8188c93ff..d4b899c5b06be4572971261ba7469ebdfe01a2c7 100644 --- a/alib2common/src/primitive/Unsigned.cpp +++ b/alib2common/src/primitive/Unsigned.cpp @@ -12,7 +12,7 @@ namespace primitive { -Unsigned::Unsigned(unsigned data) : data(data) { +Unsigned::Unsigned(unsigned data) : m_data(data) { } @@ -25,23 +25,23 @@ PrimitiveBase* Unsigned::plunder() && { } unsigned Unsigned::getData() const { - return data; + return m_data; } void Unsigned::setData(unsigned data) { - this->data = data; + this->m_data = data; } int Unsigned::compare(const Unsigned& other) const { - return data - other.data; + return m_data - other.m_data; } void Unsigned::operator>>(std::ostream& out) const { - out << "(Unsigned " << data << ")"; + out << "(Unsigned " << m_data << ")"; } Unsigned::operator std::string() const { - return std::to_string(data); + return std::to_string(m_data); } Unsigned Unsigned::parse(std::deque<sax::Token>::iterator& input) { @@ -66,11 +66,11 @@ void Unsigned::compose(std::deque<sax::Token>& out, unsigned primitive) { } Unsigned Unsigned::next() const { - return Unsigned(data + 1); + return Unsigned(m_data + 1); } void Unsigned::inc() { - data++; + m_data++; } } /* namespace primitive */ diff --git a/alib2common/src/primitive/Unsigned.h b/alib2common/src/primitive/Unsigned.h index 201c4c016038dd3076a02ee12fe1cb9db9326b10..627e54cd1762285b8de29fc3a0abeb5419bd8ed1 100644 --- a/alib2common/src/primitive/Unsigned.h +++ b/alib2common/src/primitive/Unsigned.h @@ -18,7 +18,7 @@ namespace primitive { */ class Unsigned : public PrimitiveBase { protected: - unsigned data; + unsigned m_data; public: /** diff --git a/alib2common/src/sax/ComposerException.cpp b/alib2common/src/sax/ComposerException.cpp index 382023204420871406a119e99d7867541c82e6a5..007bb46e6d0a5eeec769488c3cc658c2b50971e5 100644 --- a/alib2common/src/sax/ComposerException.cpp +++ b/alib2common/src/sax/ComposerException.cpp @@ -9,7 +9,7 @@ namespace sax { -ComposerException::ComposerException(const Token& expected, const Token& read) : CommonException("Composer Exception: Expected: " + expected.getData() + " Read: " + read.getData()), expected(expected), read(read) { +ComposerException::ComposerException(const Token& expected, const Token& read) : CommonException("Composer Exception: Expected: " + expected.getData() + " Read: " + read.getData()), m_expected(expected), m_read(read) { } } /* namespace sax */ diff --git a/alib2common/src/sax/ComposerException.h b/alib2common/src/sax/ComposerException.h index 99d0953e7e283319eb0e87d8f1648de894f413a9..7d0577b787f5cdbadcd9cbef439830d79095df30 100644 --- a/alib2common/src/sax/ComposerException.h +++ b/alib2common/src/sax/ComposerException.h @@ -18,8 +18,8 @@ namespace sax { */ class ComposerException: public exception::CommonException { protected: - Token expected; - Token read; + Token m_expected; + Token m_read; public: ComposerException(const Token& expected, const Token& read); }; diff --git a/alib2common/src/sax/ParserException.cpp b/alib2common/src/sax/ParserException.cpp index 3e462848550d56c73ce164fb65d58887c2721168..1dad0a079708e1a53064d81a25c60ff583cd4ea7 100644 --- a/alib2common/src/sax/ParserException.cpp +++ b/alib2common/src/sax/ParserException.cpp @@ -9,7 +9,7 @@ namespace sax { -ParserException::ParserException(const Token& expected, const Token& read) : CommonException("Parser Exception: Expected: " + expected.getData() + " Read: " + read.getData()), expected(expected), read(read) { +ParserException::ParserException(const Token& expected, const Token& read) : CommonException("Parser Exception: Expected: " + expected.getData() + " Read: " + read.getData()), m_expected(expected), m_read(read) { } } /* namespace sax */ diff --git a/alib2common/src/sax/ParserException.h b/alib2common/src/sax/ParserException.h index f8161aba5196031f6b410c95870fd7b15449caa2..ed228b776f708c0ac773ac7b242930f9b1c93f07 100644 --- a/alib2common/src/sax/ParserException.h +++ b/alib2common/src/sax/ParserException.h @@ -18,8 +18,8 @@ namespace sax { */ class ParserException: public exception::CommonException { protected: - Token expected; - Token read; + Token m_expected; + Token m_read; public: ParserException(const Token& expected, const Token& read); }; diff --git a/alib2common/src/sax/Token.cpp b/alib2common/src/sax/Token.cpp index 7ab6eeac2425dfb4a968fe61c155a82dba620d55..631c25c2008b160633d832ea786a6342118fb6ac 100644 --- a/alib2common/src/sax/Token.cpp +++ b/alib2common/src/sax/Token.cpp @@ -11,13 +11,13 @@ namespace sax { -Token::Token(const std::string& data, const Token::TokenType type) : - data(data), type(type) { +Token::Token(const std::string& tokenData, const Token::TokenType tokenType) : + data(tokenData), type(tokenType) { } -Token::Token(std::string&& data, const Token::TokenType type) : - data(std::move(data)), type(type) { +Token::Token(std::string&& tokenData, const Token::TokenType tokenType) : + data(std::move(tokenData)), type(tokenType) { } diff --git a/alib2common/test-src/container/ContainerTest.cpp b/alib2common/test-src/container/ContainerTest.cpp index 9021dbdfec554e5a893f8c39510b8eabb8718b9b..af8fbd1dd4788024a31d1b9ad0dd33b8411d42d0 100644 --- a/alib2common/test-src/container/ContainerTest.cpp +++ b/alib2common/test-src/container/ContainerTest.cpp @@ -36,15 +36,15 @@ void ContainerTest::testXMLParser ( ) { alib::Object object ( set ); { - std::string tmp = alib::XmlDataFactory::toString ( object ); - alib::Object object2 = alib::XmlDataFactory::fromString < alib::Object > ( tmp ); + std::string tmp2 = alib::XmlDataFactory::toString ( object ); + alib::Object object2 = alib::XmlDataFactory::fromString < alib::Object > ( tmp2 ); CPPUNIT_ASSERT ( object == object2 ); - std::set < primitive::String > concrete = alib::XmlDataFactory::fromString < std::set < primitive::String > > ( tmp ); - std::string tmp2 = alib::XmlDataFactory::toString ( concrete ); + std::set < primitive::String > concrete = alib::XmlDataFactory::fromString < std::set < primitive::String > > ( tmp2 ); + std::string tmp3 = alib::XmlDataFactory::toString ( concrete ); - CPPUNIT_ASSERT ( tmp == tmp2 ); + CPPUNIT_ASSERT ( tmp2 == tmp3 ); } } diff --git a/alib2common/test-src/core/ComponentsTest.cpp b/alib2common/test-src/core/ComponentsTest.cpp index a3ee2b581686ccc9af60edbcd0139fbbcbedc791..5c496a7e02b051f7e08a1fc1524837d23708e7da 100644 --- a/alib2common/test-src/core/ComponentsTest.cpp +++ b/alib2common/test-src/core/ComponentsTest.cpp @@ -24,8 +24,8 @@ namespace std { template < > class ComponentConstraint< A, std::string, GeneralAlphabet > { public: - static bool used ( const A & a, const std::string & string ) { - return a.accessComponent < NonlinearAlphabet > ( ).get ( ).count ( string ) || a.accessElement < SubtreeWildcard > ( ).get ( ) == string; + static bool used ( const A & a, const std::string & str ) { + return a.accessComponent < NonlinearAlphabet > ( ).get ( ).count ( str ) || a.accessElement < SubtreeWildcard > ( ).get ( ) == str; } static bool available ( const A &, const std::string & ) { @@ -43,26 +43,26 @@ public: return false; } - static bool available ( const A & a, const std::string & string ) { - return a.accessComponent < GeneralAlphabet > ( ).get ( ).count ( string ); + static bool available ( const A & a, const std::string & str ) { + return a.accessComponent < GeneralAlphabet > ( ).get ( ).count ( str ); } - static void valid ( const A & a, const std::string & string ) { - if ( a.accessElement < SubtreeWildcard > ( ).get ( ) == string ) - throw::exception::CommonException ( "Symbol " + ( std::string ) string + "cannot be set as nonlinear variable since it is already a subtree wildcard" ); + static void valid ( const A & a, const std::string & str ) { + if ( a.accessElement < SubtreeWildcard > ( ).get ( ) == str ) + throw::exception::CommonException ( "Symbol " + ( std::string ) str + "cannot be set as nonlinear variable since it is already a subtree wildcard" ); } }; template < > class ElementConstraint< A, std::string, SubtreeWildcard > { public: - static bool available ( const A & a, const std::string & string ) { - return a.accessComponent < GeneralAlphabet > ( ).get ( ).count ( string ); + static bool available ( const A & a, const std::string & str ) { + return a.accessComponent < GeneralAlphabet > ( ).get ( ).count ( str ); } - static void valid ( const A & a, const std::string & string) { - if ( a.accessComponent < NonlinearAlphabet > ( ).get ( ).count ( string ) ) - throw::exception::CommonException ( "Symbol " + ( std::string ) string + "cannot be set as subtree wildcard since it is already a nonlinear variable" ); + static void valid ( const A & a, const std::string & str ) { + if ( a.accessComponent < NonlinearAlphabet > ( ).get ( ).count ( str ) ) + throw::exception::CommonException ( "Symbol " + ( std::string ) str + "cannot be set as subtree wildcard since it is already a nonlinear variable" ); } }; diff --git a/alib2common/test-src/core/DispatchTest.cpp b/alib2common/test-src/core/DispatchTest.cpp index 9db314aec73b1e7baae70daf3099125786593a8f..04469720a621764501ef3ab9edf5b97b14420174 100644 --- a/alib2common/test-src/core/DispatchTest.cpp +++ b/alib2common/test-src/core/DispatchTest.cpp @@ -21,19 +21,19 @@ class TmpBase : public alib::CommonBase < TmpBase > { }; class Tmp1 : public TmpBase { - int data; + int m_data; public: - int moves; - int copies; + int m_moves; + int m_copies; - Tmp1 ( int data ) : data ( data ), moves ( 0 ), copies ( 0 ) { + Tmp1 ( int data ) : m_data ( data ), m_moves ( 0 ), m_copies ( 0 ) { } - Tmp1 ( const Tmp1 & other ) : data ( other.data ), moves ( other.moves ), copies ( other.copies + 1 ) { + Tmp1 ( const Tmp1 & other ) : m_data ( other.m_data ), m_moves ( other.m_moves ), m_copies ( other.m_copies + 1 ) { } - Tmp1 ( Tmp1 && other ) noexcept : data ( other.data ), moves ( other.moves + 1 ), copies ( other.copies ) { + Tmp1 ( Tmp1 && other ) noexcept : m_data ( other.m_data ), m_moves ( other.m_moves + 1 ), m_copies ( other.m_copies ) { } ~Tmp1 ( ) noexcept { @@ -52,40 +52,40 @@ public: } virtual int compare ( const Tmp1 & other ) const { - return this->data - other.data; + return this->m_data - other.m_data; } virtual void operator >>( std::ostream & os ) const { - os << "Tmp1(" << data << ")"; + os << "Tmp1(" << m_data << ")"; } virtual operator std::string ( ) const { - return "Tmp1(" + std::to_string ( data ) + ")"; + return "Tmp1(" + std::to_string ( m_data ) + ")"; } int getData ( ) const { - return data; + return m_data; } }; class Tmp2 : public TmpBase { - double data; + double m_data; public: - int moves; - int copies; + int m_moves; + int m_copies; - Tmp2 ( double data ) : data ( data ), moves ( 0 ), copies ( 0 ) { + Tmp2 ( double data ) : m_data ( data ), m_moves ( 0 ), m_copies ( 0 ) { } - Tmp2 ( const Tmp1 & other ) : data ( other.getData ( ) ) { + Tmp2 ( const Tmp1 & other ) : m_data ( other.getData ( ) ) { } - Tmp2 ( const Tmp2 & other ) : data ( other.data ), moves ( other.moves ), copies ( other.copies + 1 ) { + Tmp2 ( const Tmp2 & other ) : m_data ( other.m_data ), m_moves ( other.m_moves ), m_copies ( other.m_copies + 1 ) { } - Tmp2 ( Tmp2 && other ) noexcept : data ( other.data ), moves ( other.moves + 1 ), copies ( other.copies ) { + Tmp2 ( Tmp2 && other ) noexcept : m_data ( other.m_data ), m_moves ( other.m_moves + 1 ), m_copies ( other.m_copies ) { } ~Tmp2 ( ) noexcept { @@ -104,43 +104,43 @@ public: } virtual int compare ( const Tmp2 & other ) const { - return this->data - other.data; + return this->m_data - other.m_data; } virtual void operator >>( std::ostream & os ) const { - os << "Tmp2(" << data << ")"; + os << "Tmp2(" << m_data << ")"; } virtual operator std::string ( ) const { - return "Tmp2(" + std::to_string ( data ) + ")"; + return "Tmp2(" + std::to_string ( m_data ) + ")"; } double getData ( ) const { - return data; + return m_data; } }; class Tmp3 : public TmpBase { - std::string data; + std::string m_data; public: - int moves; - int copies; + int m_moves; + int m_copies; - Tmp3 ( const std::string & data ) : data ( data ), moves ( 0 ), copies ( 0 ) { + Tmp3 ( const std::string & data ) : m_data ( data ), m_moves ( 0 ), m_copies ( 0 ) { } - Tmp3 ( const Tmp1 & other ) : data ( std::to_string ( other.getData ( ) ) ), moves ( 0 ), copies ( 0 ) { + Tmp3 ( const Tmp1 & other ) : m_data ( std::to_string ( other.getData ( ) ) ), m_moves ( 0 ), m_copies ( 0 ) { } - Tmp3 ( const Tmp2 & other ) : data ( std::to_string ( other.getData ( ) ) ), moves ( 0 ), copies ( 0 ) { + Tmp3 ( const Tmp2 & other ) : m_data ( std::to_string ( other.getData ( ) ) ), m_moves ( 0 ), m_copies ( 0 ) { } - Tmp3 ( const Tmp3 & other ) : data ( other.data ), moves ( other.moves ), copies ( other.copies + 1 ) { + Tmp3 ( const Tmp3 & other ) : m_data ( other.m_data ), m_moves ( other.m_moves ), m_copies ( other.m_copies + 1 ) { } - Tmp3 ( Tmp3 && other ) noexcept : data ( other.data ), moves ( other.moves + 1 ), copies ( other.copies ) { + Tmp3 ( Tmp3 && other ) noexcept : m_data ( other.m_data ), m_moves ( other.m_moves + 1 ), m_copies ( other.m_copies ) { } ~Tmp3 ( ) noexcept { @@ -159,19 +159,19 @@ public: } virtual int compare ( const Tmp3 & other ) const { - return this->data.compare ( other.data ); + return this->m_data.compare ( other.m_data ); } virtual void operator >>( std::ostream & os ) const { - os << "Tmp3(" << data << ")"; + os << "Tmp3(" << m_data << ")"; } virtual operator std::string ( ) const { - return "Tmp3(" + data + ")"; + return "Tmp3(" + m_data + ")"; } const std::string & getData ( ) const { - return data; + return m_data; } }; @@ -183,8 +183,8 @@ public: static int eval ( const Tmp2 & first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); return 2; } @@ -192,8 +192,8 @@ public: static int eval ( const Tmp3 & first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); return 3; } @@ -244,8 +244,8 @@ public: static void eval ( int & res, const Tmp2 & first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); res = 2; } @@ -253,8 +253,8 @@ public: static void eval ( int & res, const Tmp3 & first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); res = 3; } @@ -268,8 +268,8 @@ public: void TmpVisitor2ExtensionTmp1 ( int & res, const Tmp1 & first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); res = 1; } @@ -309,8 +309,8 @@ public: static int eval ( Tmp2 && first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); return 2; } @@ -318,8 +318,8 @@ public: static int eval ( Tmp3 && first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); return 3; } @@ -333,8 +333,8 @@ public: int TmpVisitor3ExtensionTmp1 ( Tmp1 && first ) { std::cout << first << std::endl; - CPPUNIT_ASSERT ( first.moves == 0); - CPPUNIT_ASSERT ( first.copies == 0); + CPPUNIT_ASSERT ( first.m_moves == 0); + CPPUNIT_ASSERT ( first.m_copies == 0); return 1; }