From a292b595744ab42525ab06d445640f6faf4edf1c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 30 Mar 2016 20:40:09 +0200 Subject: [PATCH] enable and fix additional warnings for alib2common --- alib2common/makefile | 4 +- alib2common/src/base/WrapperBase.hpp | 32 +++--- alib2common/src/container/ObjectsDeque.h | 2 +- alib2common/src/container/ObjectsList.h | 2 +- alib2common/src/container/ObjectsMap.h | 2 +- alib2common/src/container/ObjectsPair.h | 2 +- alib2common/src/container/ObjectsSet.h | 2 +- alib2common/src/container/ObjectsTree.h | 2 +- alib2common/src/container/ObjectsVector.h | 2 +- alib2common/src/core/components.hpp | 34 +++---- alib2common/src/core/multipleDispatch.hpp | 16 +-- alib2common/src/core/visitor.hpp | 8 +- alib2common/src/core/xmlApi.hpp | 4 +- alib2common/src/debug/simpleStacktrace.cpp | 4 +- alib2common/src/exception/CommonException.cpp | 40 ++++---- alib2common/src/exception/CommonException.h | 8 +- .../src/measurements/MeasurementEngine.cpp | 4 +- .../src/measurements/MeasurementFrame.cpp | 2 +- .../src/measurements/MeasurementFrame.hpp | 4 +- .../src/measurements/MeasurementResults.cpp | 2 +- alib2common/src/primitive/Bool.cpp | 16 +-- alib2common/src/primitive/Bool.h | 2 +- alib2common/src/primitive/Character.cpp | 16 +-- alib2common/src/primitive/Character.h | 2 +- alib2common/src/primitive/Integer.cpp | 16 +-- alib2common/src/primitive/Integer.h | 2 +- alib2common/src/primitive/String.cpp | 16 +-- alib2common/src/primitive/String.h | 2 +- alib2common/src/primitive/Unsigned.cpp | 16 +-- alib2common/src/primitive/Unsigned.h | 2 +- alib2common/src/sax/ComposerException.cpp | 2 +- alib2common/src/sax/ComposerException.h | 4 +- alib2common/src/sax/ParserException.cpp | 2 +- alib2common/src/sax/ParserException.h | 4 +- alib2common/src/sax/Token.cpp | 8 +- .../test-src/container/ContainerTest.cpp | 10 +- alib2common/test-src/core/ComponentsTest.cpp | 24 ++--- alib2common/test-src/core/DispatchTest.cpp | 98 +++++++++---------- 38 files changed, 210 insertions(+), 208 deletions(-) diff --git a/alib2common/makefile b/alib2common/makefile index 38bca86b66..bf9f76e926 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 4551f4ff5e..af3d469d68 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 7315b55953..cc06e7b33e 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 c6f555ee13..0b30f5879e 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 5141ade605..5681543240 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 74e355fac8..13abfc482a 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 83d65b11d2..1de6c6df61 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 421f7462c1..4dc894a0e2 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 29f7b5faaf..c1f00206be 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 bf1e765737..160c08587b 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 fff9754d94..5403f47896 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 ad34ad33be..d355642499 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 28a866c004..5813976d35 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 ed65b48693..1603387f09 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 e8c8ca8f53..b4053278c6 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 0ce196f997..3018c762b4 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 e88b935134..c927b801b7 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 0d2cc03e55..153d5ae300 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 adb1189f35..c411fbbd2c 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 6456339dd4..c55c0c17d1 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 936cb7e444..7075c1b5b9 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 a5cb060213..eae50fff10 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 22116f0449..dd6cc85cb9 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 3caadd1bd6..c80ed46cb2 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 6a8975c07f..ae9b0013e8 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 bf0cf60f99..6ad4fec405 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 bc18ae77f5..c70588f88b 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 cd49a54572..371fc901e3 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 1b1b8eb209..d4b899c5b0 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 201c4c0160..627e54cd17 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 3820232044..007bb46e6d 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 99d0953e7e..7d0577b787 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 3e46284855..1dad0a0797 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 f8161aba51..ed228b776f 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 7ab6eeac24..631c25c200 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 9021dbdfec..af8fbd1dd4 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 a3ee2b5816..5c496a7e02 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 9db314aec7..04469720a6 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; } -- GitLab