Replaced boost::shared_ptr<Pinger> by PingerItem.
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 25 Feb 2012 16:01:41 +0000 (14:01 -0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 25 Feb 2012 16:01:41 +0000 (14:01 -0200)
src/host/pingerfactory.cpp
src/host/pingerfactory.h

index 943338f..1d1a0e2 100644 (file)
@@ -64,7 +64,7 @@ PingerFactory::~PingerFactory()
  * packet will be sent.
  * @return a Pinger object to able to ping using the given protocol.
  */
-shared_ptr<Pinger> PingerFactory::createPinger(
+PingerItem PingerFactory::createPinger(
         const PingProtocol protocol,
         io_service &io_serv,
         const string &network_interface
@@ -81,24 +81,24 @@ shared_ptr<Pinger> PingerFactory::createPinger(
         switch ( protocol )
         {
         case PingProtocol_ICMP:
-            return shared_ptr<Pinger>(
+            return PingerItem(
                     new IcmpPinger( io_serv, icmp::v4(), network_interface, ping_reply_timeout_in_sec )
             );
         case PingProtocol_ICMPv6:
-            return shared_ptr<Pinger>(
+            return PingerItem(
                     new IcmpPinger( io_serv, icmp::v6(), network_interface, ping_reply_timeout_in_sec )
             );
         case PingProtocol_TCP:
-            return shared_ptr<Pinger>(
+            return PingerItem(
                     new TcpPinger( io_serv, tcp_raw_protocol::v4(), network_interface, ping_reply_timeout_in_sec )
             );
         case PingProtocol_TCP_IPv6:
-            return shared_ptr<Pinger>(
+            return PingerItem(
                     new TcpPinger( io_serv, tcp_raw_protocol::v6(), network_interface, ping_reply_timeout_in_sec )
             );
         default:
             BOOST_ASSERT( !"Try to create a pinger from an invalid protocol" );                                                 //lint !e506
-            return shared_ptr<Pinger>();                                                                                                             //lint !e527
+            return PingerItem();                                                                                                             //lint !e527
         }
     }
     catch ( const system_error &ex )
@@ -109,5 +109,5 @@ shared_ptr<Pinger> PingerFactory::createPinger(
         exit( EXIT_FAILURE );
     }
 
-    return shared_ptr<Pinger>();                                                                                                                        //lint !e527
+    return PingerItem();                                                                                                                        //lint !e527
 }
index 08f4cd4..4e21b88 100644 (file)
@@ -36,7 +36,7 @@
 class PingerFactory
 {
 public:
-    static boost::shared_ptr<Pinger> createPinger(
+    static PingerItem createPinger(
             const PingProtocol protocol,
             boost::asio::io_service &io_serv,
             const std::string &network_interface