src/common/packet-metadata-test.cc
changeset 2646 c1fef7686472
parent 2643 2a3324f4dabe
child 2657 489c7086867a
equal deleted inserted replaced
2645:139b2dec56c0 2646:c1fef7686472
    32 
    32 
    33 template <int N>
    33 template <int N>
    34 class HistoryHeader : public Header
    34 class HistoryHeader : public Header
    35 {
    35 {
    36 public:
    36 public:
       
    37   HistoryHeader ();
       
    38   bool IsOk (void) const;
    37   static TypeId GetTypeId (void);
    39   static TypeId GetTypeId (void);
    38   virtual TypeId GetInstanceTypeId (void) const;
    40   virtual TypeId GetInstanceTypeId (void) const;
    39   static uint32_t GetUid (void);
    41   virtual void Print (std::ostream &os) const;
    40   HistoryHeader ();
       
    41   bool IsOk (void) const;
       
    42   std::string GetName (void) const;
       
    43   void Print (std::ostream &os) const;
       
    44   virtual uint32_t GetSerializedSize (void) const;
    42   virtual uint32_t GetSerializedSize (void) const;
    45   virtual void Serialize (Buffer::Iterator start) const;
    43   virtual void Serialize (Buffer::Iterator start) const;
    46   virtual uint32_t Deserialize (Buffer::Iterator start);
    44   virtual uint32_t Deserialize (Buffer::Iterator start);
    47 private:
    45 private:
    48   bool m_ok;
    46   bool m_ok;
    49 };
    47 };
    50 
    48 
    51 template <int N>
    49 template <int N>
       
    50 HistoryHeader<N>::HistoryHeader ()
       
    51   : m_ok (false)
       
    52 {}
       
    53 
       
    54 template <int N>
       
    55 bool 
       
    56 HistoryHeader<N>::IsOk (void) const
       
    57 {
       
    58   return m_ok;
       
    59 }
       
    60 
       
    61 template <int N>
    52 TypeId
    62 TypeId
    53 HistoryHeader<N>::GetTypeId (void)
    63 HistoryHeader<N>::GetTypeId (void)
    54 {
    64 {
    55   std::ostringstream oss;
    65   std::ostringstream oss;
    56   oss << "ns3::HistoryHeader<"<<N<<">";
    66   oss << "ns3::HistoryHeader<"<<N<<">";
    64 TypeId 
    74 TypeId 
    65 HistoryHeader<N>::GetInstanceTypeId (void) const
    75 HistoryHeader<N>::GetInstanceTypeId (void) const
    66 {
    76 {
    67   return GetTypeId ();
    77   return GetTypeId ();
    68 }
    78 }
    69 
       
    70 template <int N>
       
    71 uint32_t
       
    72 HistoryHeader<N>::GetUid (void)
       
    73 {
       
    74   std::ostringstream oss;
       
    75   oss << N << "HistoryHeader.ns3";
       
    76   static uint32_t uid = AllocateUid<HistoryHeader<N> > (oss.str());
       
    77   return uid;
       
    78 }
       
    79 
       
    80 template <int N>
       
    81 HistoryHeader<N>::HistoryHeader ()
       
    82   : m_ok (false)
       
    83 {}
       
    84 
       
    85 template <int N>
       
    86 bool 
       
    87 HistoryHeader<N>::IsOk (void) const
       
    88 {
       
    89   return m_ok;
       
    90 }
       
    91 
       
    92 template <int N>
       
    93 std::string 
       
    94 HistoryHeader<N>::GetName (void) const
       
    95 {
       
    96   std::ostringstream oss;
       
    97   oss << N;
       
    98   return oss.str ();
       
    99 }
       
   100 
       
   101 template <int N>
    79 template <int N>
   102 void 
    80 void 
   103 HistoryHeader<N>::Print (std::ostream &os) const
    81 HistoryHeader<N>::Print (std::ostream &os) const
   104 {
    82 {
   105   NS_ASSERT (false);
    83   NS_ASSERT (false);
   133 
   111 
   134 template <int N>
   112 template <int N>
   135 class HistoryTrailer : public Trailer
   113 class HistoryTrailer : public Trailer
   136 {
   114 {
   137 public:
   115 public:
       
   116   HistoryTrailer ();
       
   117   bool IsOk (void) const;
       
   118 
   138   static TypeId GetTypeId (void);
   119   static TypeId GetTypeId (void);
   139   virtual TypeId GetInstanceTypeId (void) const;
   120   virtual TypeId GetInstanceTypeId (void) const;
   140   static uint32_t GetUid (void);
   121   virtual void Print (std::ostream &os) const;
   141   HistoryTrailer ();
       
   142   bool IsOk (void) const;
       
   143   std::string GetName (void) const;
       
   144   void Print (std::ostream &os) const;
       
   145   virtual uint32_t GetSerializedSize (void) const;
   122   virtual uint32_t GetSerializedSize (void) const;
   146   virtual void Serialize (Buffer::Iterator start) const;
   123   virtual void Serialize (Buffer::Iterator start) const;
   147   virtual uint32_t Deserialize (Buffer::Iterator start);
   124   virtual uint32_t Deserialize (Buffer::Iterator start);
   148 private:
   125 private:
   149   bool m_ok;
   126   bool m_ok;
   150 };
   127 };
   151 
   128 
       
   129 template <int N>
       
   130 HistoryTrailer<N>::HistoryTrailer ()
       
   131   : m_ok (false)
       
   132 {}
       
   133 
       
   134 template <int N>
       
   135 bool
       
   136 HistoryTrailer<N>::IsOk (void) const
       
   137 {
       
   138   return m_ok;
       
   139 }
   152 
   140 
   153 template <int N>
   141 template <int N>
   154 TypeId
   142 TypeId
   155 HistoryTrailer<N>::GetTypeId (void)
   143 HistoryTrailer<N>::GetTypeId (void)
   156 {
   144 {
   165 template <int N>
   153 template <int N>
   166 TypeId 
   154 TypeId 
   167 HistoryTrailer<N>::GetInstanceTypeId (void) const
   155 HistoryTrailer<N>::GetInstanceTypeId (void) const
   168 {
   156 {
   169   return GetTypeId ();
   157   return GetTypeId ();
   170 }
       
   171 
       
   172 template <int N>
       
   173 uint32_t
       
   174 HistoryTrailer<N>::GetUid (void)
       
   175 {
       
   176   std::ostringstream oss;
       
   177   oss << N << "HistoryTrailer.ns3";
       
   178   static uint32_t uid = AllocateUid<HistoryTrailer<N> > (oss.str ());
       
   179   return uid;
       
   180 }
       
   181 
       
   182 
       
   183 template <int N>
       
   184 HistoryTrailer<N>::HistoryTrailer ()
       
   185   : m_ok (false)
       
   186 {}
       
   187 
       
   188 template <int N>
       
   189 bool
       
   190 HistoryTrailer<N>::IsOk (void) const
       
   191 {
       
   192   return m_ok;
       
   193 }
       
   194 
       
   195 template <int N>
       
   196 std::string 
       
   197 HistoryTrailer<N>::GetName (void) const
       
   198 {
       
   199   std::ostringstream oss;
       
   200   oss << N;
       
   201   return oss.str ();
       
   202 }
   158 }
   203 template <int N>
   159 template <int N>
   204 void 
   160 void 
   205 HistoryTrailer<N>::Print (std::ostream &os) const
   161 HistoryTrailer<N>::Print (std::ostream &os) const
   206 {
   162 {