src/node/packetbb.h
changeset 5505 c0ac392289c3
parent 5263 a0283279fddd
child 5943 afda15a818fa
     1.1 --- a/src/node/packetbb.h	Thu Sep 24 18:05:36 2009 -0400
     1.2 +++ b/src/node/packetbb.h	Thu Nov 12 13:01:01 2009 +0100
     1.3 @@ -31,6 +31,7 @@
     1.4  #include "ns3/address.h"
     1.5  #include "ns3/header.h"
     1.6  #include "ns3/buffer.h"
     1.7 +#include "ns3/simple-ref-count.h"
     1.8  
     1.9  namespace ns3 {
    1.10  
    1.11 @@ -360,7 +361,7 @@
    1.12   *
    1.13   * See: http://tools.ietf.org/html/rfc5444 for details.
    1.14   */
    1.15 -class PbbPacket : public Header
    1.16 +class PbbPacket : public SimpleRefCount<PbbPacket,Header>
    1.17  {
    1.18  public:
    1.19    typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
    1.20 @@ -595,10 +596,6 @@
    1.21     */
    1.22    void MessageClear (void);
    1.23  
    1.24 -  /* Smart pointer methods */
    1.25 -  void Ref (void) const;
    1.26 -  void Unref (void) const;
    1.27 -
    1.28    /* Methods implemented by all headers */
    1.29    static TypeId GetTypeId (void);
    1.30    virtual TypeId GetInstanceTypeId (void) const;
    1.31 @@ -644,8 +641,6 @@
    1.32  
    1.33    bool m_hasseqnum;
    1.34    uint16_t m_seqnum;
    1.35 -
    1.36 -  mutable uint32_t m_refCount;
    1.37  };
    1.38  
    1.39  /**
    1.40 @@ -655,7 +650,7 @@
    1.41   * virtual base class, when creating a message, you should instantiate either
    1.42   * PbbMessageIpv4 or PbbMessageIpv6.
    1.43   */
    1.44 -class PbbMessage
    1.45 +class PbbMessage : public SimpleRefCount<PbbMessage>
    1.46  {
    1.47  public:
    1.48    typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
    1.49 @@ -959,10 +954,6 @@
    1.50     */
    1.51    void AddressBlockClear (void);
    1.52  
    1.53 -  /* Smart pointer methods */
    1.54 -  void Ref (void) const;
    1.55 -  void Unref (void) const;
    1.56 -
    1.57    /**
    1.58     * \brief Deserializes a message, returning the correct object depending on
    1.59     *        whether it is an IPv4 message or an IPv6 message.
    1.60 @@ -1048,8 +1039,6 @@
    1.61  
    1.62    bool m_hasSequenceNumber;
    1.63    uint16_t m_sequenceNumber;
    1.64 -
    1.65 -  mutable uint32_t m_refCount;
    1.66  };
    1.67  
    1.68  /**
    1.69 @@ -1098,7 +1087,7 @@
    1.70   * This is a pure virtual base class, when creating address blocks, you should
    1.71   * instantiate either PbbAddressBlockIpv4 or PbbAddressBlockIpv6.
    1.72   */
    1.73 -class PbbAddressBlock
    1.74 +class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock>
    1.75  {
    1.76  public:
    1.77    typedef std::list< Address >::iterator AddressIterator;
    1.78 @@ -1412,10 +1401,6 @@
    1.79     */
    1.80    void TlvClear (void);
    1.81  
    1.82 -  /* Smart pointer methods */
    1.83 -  void Ref (void) const;
    1.84 -  void Unref (void) const;
    1.85 -
    1.86    /**
    1.87     * \return The size (in bytes) needed to serialize this address block.
    1.88     */
    1.89 @@ -1475,8 +1460,6 @@
    1.90    std::list<Address> m_addressList;
    1.91    std::list<uint8_t> m_prefixList;
    1.92    PbbAddressTlvBlock m_addressTlvList;
    1.93 -
    1.94 -  mutable uint32_t m_refCount;
    1.95  };
    1.96  
    1.97  /**
    1.98 @@ -1520,11 +1503,11 @@
    1.99  /**
   1.100   * \brief A packet or message TLV
   1.101   */
   1.102 -class PbbTlv
   1.103 +class PbbTlv : public SimpleRefCount<PbbTlv>
   1.104  {
   1.105  public:
   1.106    PbbTlv (void);
   1.107 -  ~PbbTlv (void);
   1.108 +  virtual ~PbbTlv (void);
   1.109  
   1.110    /**
   1.111     * \brief Sets the type of this TLV.
   1.112 @@ -1599,10 +1582,6 @@
   1.113     */
   1.114    bool HasValue (void) const;
   1.115  
   1.116 -  /* Smart pointer methods */
   1.117 -  void Ref (void) const;
   1.118 -  void Unref (void) const;
   1.119 -
   1.120    /**
   1.121     * \return The size (in bytes) needed to serialize this TLV.
   1.122     */
   1.123 @@ -1672,8 +1651,6 @@
   1.124    bool m_isMultivalue;
   1.125    bool m_hasValue;
   1.126    Buffer m_value;
   1.127 -
   1.128 -  mutable uint32_t m_refCount;
   1.129  };
   1.130  
   1.131  /**