From: Christian Herdtweck Date: Thu, 6 Nov 2014 16:05:59 +0000 (+0100) Subject: make abstract base classes boost::noncopyable to avoid warnings concerning copy-assig... X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=cc8d3a02b2ae7ca6b4cd09ab0eec4776587a11af;p=pingcheck make abstract base classes boost::noncopyable to avoid warnings concerning copy-assignment and -constructors --- diff --git a/src/config/configurationcommandline.cpp b/src/config/configurationcommandline.cpp index 266e630..5f1330c 100644 --- a/src/config/configurationcommandline.cpp +++ b/src/config/configurationcommandline.cpp @@ -40,7 +40,7 @@ using I2n::Logger::GlobalLogger; //----------------------------------------------------------------------------- /** - * @brief Parameterized constructor. + * @brief Parameterized constructor. Never called since is private * * @param _argc The number of arguments in command line. * @param _argv A vector containing the command line elements. @@ -57,7 +57,7 @@ ConfigurationCommandLine::ConfigurationCommandLine( } /** - * @brief Copy constructor. + * @brief Copy constructor. Never called since is private * * @param other A object to be copied. */ diff --git a/src/config/configurationcommandline.h b/src/config/configurationcommandline.h index c2db9f2..1bfda60 100644 --- a/src/config/configurationcommandline.h +++ b/src/config/configurationcommandline.h @@ -36,11 +36,8 @@ class ConfigurationCommandLine : public ConfigurationInterface { public: ConfigurationCommandLine( const int _argc, const char **_argv ); - ConfigurationCommandLine( const ConfigurationCommandLine &other ); virtual ~ConfigurationCommandLine(); - ConfigurationCommandLine& operator=( const ConfigurationCommandLine &other ); - bool process( boost::program_options::variables_map *vm ); bool parse( @@ -52,6 +49,9 @@ private: int argc; const char **argv; + ConfigurationCommandLine( const ConfigurationCommandLine &other ); + ConfigurationCommandLine& operator=( const ConfigurationCommandLine &other ); + }; #endif // CONFIGURATION_COMMAND_LINE_H diff --git a/src/config/configurationinterface.h b/src/config/configurationinterface.h index 56eef94..fd5611e 100644 --- a/src/config/configurationinterface.h +++ b/src/config/configurationinterface.h @@ -22,6 +22,7 @@ #define CONFIGURATION_INTERFACE_H #include +#include #include "config/configuration.h" @@ -32,7 +33,7 @@ /** * @brief Abstract class for configuration interfaces. */ -class ConfigurationInterface +class ConfigurationInterface : boost::noncopyable { public: ConfigurationInterface(); diff --git a/src/config/configurationoptions.h b/src/config/configurationoptions.h index a4ffccb..c5b69ec 100644 --- a/src/config/configurationoptions.h +++ b/src/config/configurationoptions.h @@ -24,6 +24,7 @@ #include #include +#include #include "config/configuration.h" #include "config/option/configurationoption.h" @@ -36,7 +37,7 @@ /** * @brief Options for configuration. */ -class ConfigurationOptions +class ConfigurationOptions : boost::noncopyable { public: ConfigurationOptions(); diff --git a/src/host/pinger.cpp b/src/host/pinger.cpp index b841bf9..df49629 100644 --- a/src/host/pinger.cpp +++ b/src/host/pinger.cpp @@ -32,28 +32,8 @@ Pinger::Pinger() } /** - * @brief Copy constructor. - */ -Pinger::Pinger( const Pinger & ) -{ -} - -/** * @brief Destructor. */ Pinger::~Pinger() { } - -/** - * @brief Copy assignment operator. - */ -Pinger& Pinger::operator=( const Pinger &other ) -{ - // checking for self-assignment (i.e. object1 = object1) - if ( &other == this ) { - return *this; - } - // TODO: Not implemented at all? Then disable it in the class definition - return *this; -} diff --git a/src/host/pinger.h b/src/host/pinger.h index a4d65f2..203e585 100644 --- a/src/host/pinger.h +++ b/src/host/pinger.h @@ -27,6 +27,7 @@ #include #include +#include //----------------------------------------------------------------------------- // Pinger @@ -36,7 +37,7 @@ * @brief Abstract class for pingers. * Scope: one object per host. */ -class Pinger +class Pinger : boost::noncopyable { public: virtual void ping( @@ -48,11 +49,6 @@ public: protected: Pinger(); virtual ~Pinger(); - -private: - Pinger( const Pinger &other ); - Pinger& operator=( const Pinger &other ); - }; //----------------------------------------------------------------------------- diff --git a/src/icmp/icmpmessage.cpp b/src/icmp/icmpmessage.cpp index b73c30a..cffff70 100644 --- a/src/icmp/icmpmessage.cpp +++ b/src/icmp/icmpmessage.cpp @@ -18,13 +18,6 @@ IcmpMessage::IcmpMessage() } /** - * @brief Copy constructor. - */ -IcmpMessage::IcmpMessage( const IcmpMessage & ) -{ -} - -/** * @brief Destructor. */ IcmpMessage::~IcmpMessage() @@ -32,20 +25,6 @@ IcmpMessage::~IcmpMessage() } /** - * @brief Copy assignment operator. - */ -IcmpMessage& IcmpMessage::operator=( const IcmpMessage &other ) -{ - // checking for self-assignment (i.e. object1 = object1) - if ( &other == this ) { - return *this; - } - - // TODO: Not implemented at all. Fix it or disable it - return *this; -} - -/** * This method MUST be called to initialize the data member of ICMP Messages. */ void IcmpMessage::init( const Icmpv4Type type ) diff --git a/src/icmp/icmpmessage.h b/src/icmp/icmpmessage.h index cf9fc46..60ae871 100644 --- a/src/icmp/icmpmessage.h +++ b/src/icmp/icmpmessage.h @@ -11,6 +11,7 @@ #include #include +#include #include "icmp/icmptype.h" @@ -21,7 +22,7 @@ /** * @brief Abstract class to which the ICMP messages are interpreted. */ -class IcmpMessage +class IcmpMessage : boost::noncopyable { public: void init( const Icmpv4Type type ); @@ -52,10 +53,6 @@ protected: IcmpMessage(); virtual ~IcmpMessage(); -private: - IcmpMessage( const IcmpMessage &other ); - IcmpMessage& operator=( const IcmpMessage &other ); - }; #endif // ICMP_MESSAGE_H diff --git a/src/icmp/icmppacket.cpp b/src/icmp/icmppacket.cpp index e081321..43d272a 100644 --- a/src/icmp/icmppacket.cpp +++ b/src/icmp/icmppacket.cpp @@ -32,29 +32,8 @@ IcmpPacket::IcmpPacket() } /** - * @brief Copy constructor. - */ -IcmpPacket::IcmpPacket( const IcmpPacket & ) -{ -} - -/** * @brief Destructor. */ IcmpPacket::~IcmpPacket() { } - -/** - * @brief Copy assignment operator. - */ -IcmpPacket& IcmpPacket::operator=( const IcmpPacket &other ) -{ - // checking for self-assignment (i.e. object1 = object1) - if ( &other == this ) { - return *this; - } - - // TODO: Not implemented at all. Fix it or disable it - return *this; -} diff --git a/src/icmp/icmppacket.h b/src/icmp/icmppacket.h index 6e5a3d5..706eadb 100644 --- a/src/icmp/icmppacket.h +++ b/src/icmp/icmppacket.h @@ -14,6 +14,7 @@ #include #include #include +#include //----------------------------------------------------------------------------- // IcmpPacket @@ -22,7 +23,7 @@ /** * @brief Abstract class for ICMP Packets. */ -class IcmpPacket +class IcmpPacket : boost::noncopyable { public: virtual bool match_echo_reply( @@ -49,10 +50,6 @@ protected: IcmpPacket(); virtual ~IcmpPacket(); -private: - IcmpPacket( const IcmpPacket &other ); - IcmpPacket& operator=( const IcmpPacket &other ); - }; //----------------------------------------------------------------------------- diff --git a/src/tcp/tcpsegment.cpp b/src/tcp/tcpsegment.cpp index 35234e5..90b1978 100644 --- a/src/tcp/tcpsegment.cpp +++ b/src/tcp/tcpsegment.cpp @@ -32,29 +32,8 @@ TcpSegment::TcpSegment() } /** - * @brief Copy constructor. - */ -TcpSegment::TcpSegment( const TcpSegment & ) -{ -} - -/** * @brief Destructor. */ TcpSegment::~TcpSegment() { } - -/** - * @brief Copy assignment operator. - */ -TcpSegment& TcpSegment::operator=( const TcpSegment &other ) -{ - // checking for self-assignment (i.e. object1 = object1) - if ( &other == this ) { - return *this; - } - - // TODO: Not implemented at all. Fix it or disable it. - return *this; -} diff --git a/src/tcp/tcpsegment.h b/src/tcp/tcpsegment.h index 7df5b6c..9478af4 100644 --- a/src/tcp/tcpsegment.h +++ b/src/tcp/tcpsegment.h @@ -25,6 +25,7 @@ #include #include +#include //----------------------------------------------------------------------------- // TcpSegment @@ -33,7 +34,7 @@ /** * @brief Abstract class for TCP Segments. */ -class TcpSegment +class TcpSegment : boost::noncopyable { public: virtual bool match_rst_reply( @@ -59,9 +60,6 @@ protected: TcpSegment(); virtual ~TcpSegment(); -private: - TcpSegment( const TcpSegment &other ); - TcpSegment& operator=( const TcpSegment &other ); }; //-----------------------------------------------------------------------------