diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index b2da90dd6..16920044b 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -22,6 +22,7 @@ #include "ns3/packet-metadata.h" #include #include +#include using namespace ns3; @@ -39,6 +40,7 @@ public: virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); private: + static std::string GetTypeName (void); bool m_ok; }; @@ -54,13 +56,20 @@ BenchHeader::IsOk (void) const return m_ok; } +template +std::string +BenchHeader::GetTypeName (void) +{ + std::ostringstream oss; + oss << "ns3::BenchHeader<" << N << ">"; + return oss.str (); +} + template TypeId BenchHeader::GetTypeId (void) { - std::ostringstream oss; - oss << "ns3::BenchHeader<"<"; - static TypeId tid = TypeId (oss.str ().c_str ()) + static TypeId tid = TypeId (GetTypeName ().c_str ()) .SetParent
() ; return tid;