make abstract base classes boost::noncopyable to avoid warnings concerning copy-assig...
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 6 Nov 2014 16:05:59 +0000 (17:05 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 12 Nov 2014 10:11:05 +0000 (11:11 +0100)
12 files changed:
src/config/configurationcommandline.cpp
src/config/configurationcommandline.h
src/config/configurationinterface.h
src/config/configurationoptions.h
src/host/pinger.cpp
src/host/pinger.h
src/icmp/icmpmessage.cpp
src/icmp/icmpmessage.h
src/icmp/icmppacket.cpp
src/icmp/icmppacket.h
src/tcp/tcpsegment.cpp
src/tcp/tcpsegment.h

index 266e630..5f1330c 100644 (file)
@@ -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.
  */
index c2db9f2..1bfda60 100644 (file)
@@ -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
index 56eef94..fd5611e 100644 (file)
@@ -22,6 +22,7 @@
 #define CONFIGURATION_INTERFACE_H
 
 #include <boost/program_options.hpp>
+#include <boost/utility.hpp>
 
 #include "config/configuration.h"
 
@@ -32,7 +33,7 @@
 /**
  * @brief Abstract class for configuration interfaces.
  */
-class ConfigurationInterface
+class ConfigurationInterface : boost::noncopyable
 {
 public:
     ConfigurationInterface();
index a4ffccb..c5b69ec 100644 (file)
@@ -24,6 +24,7 @@
 #include <string>
 
 #include <boost/program_options.hpp>
+#include <boost/utility.hpp>
 
 #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();
index b841bf9..df49629 100644 (file)
@@ -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;
-}
index a4d65f2..203e585 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
 
 //-----------------------------------------------------------------------------
 // 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 );
-
 };
 
 //-----------------------------------------------------------------------------
index b73c30a..cffff70 100644 (file)
@@ -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 )
index cf9fc46..60ae871 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <istream>
 #include <ostream>
+#include <boost/utility.hpp>
 
 #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
index e081321..43d272a 100644 (file)
@@ -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;
-}
index 6e5a3d5..706eadb 100644 (file)
@@ -14,6 +14,7 @@
 #include <boost/asio.hpp>
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
 
 //-----------------------------------------------------------------------------
 // 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 );
-
 };
 
 //-----------------------------------------------------------------------------
index 35234e5..90b1978 100644 (file)
@@ -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;
-}
index 7df5b6c..9478af4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <boost/asio.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
 
 //-----------------------------------------------------------------------------
 // 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 );
 };
 
 //-----------------------------------------------------------------------------