macros to ensure proper initialization
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Aug 2007 16:49:06 +0200
changeset 1152 1d06449f0a98
parent 1151 527d7b7e25af
child 1153 c33427a6bef0
macros to ensure proper initialization
src/common/header.h
src/common/trailer.h
src/internet-node/arp-header.cc
src/internet-node/ipv4-header.cc
src/internet-node/udp-header.cc
src/node/ethernet-header.cc
src/node/ethernet-trailer.cc
src/node/llc-snap-header.cc
--- a/src/common/header.h	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/common/header.h	Sat Aug 04 16:49:06 2007 +0200
@@ -24,6 +24,16 @@
 
 #include "chunk.h"
 
+#define NS_HEADER_ENSURE_REGISTERED(x)          \
+namespace {                                     \
+static class thisisaveryverylongclassname       \
+{                                               \
+public:                                         \
+  thisisaveryverylongclassname ()               \
+  { uint32_t uid; uid = x::GetUid ();}          \
+} g_thisisanotherveryveryverylongname;          \
+}
+
 namespace ns3 {
 
 /**
--- a/src/common/trailer.h	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/common/trailer.h	Sat Aug 04 16:49:06 2007 +0200
@@ -24,6 +24,16 @@
 
 #include "chunk.h"
 
+#define NS_TRAILER_ENSURE_REGISTERED(x)         \
+namespace {                                     \
+static class thisisaveryverylongclassname       \
+{                                               \
+public:                                         \
+  thisisaveryverylongclassname ()               \
+  { uint32_t uid; uid = x::GetUid ();}          \
+} g_thisisanotherveryveryverylongname;          \
+}
+
 namespace ns3 {
 
 /**
--- a/src/internet-node/arp-header.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/internet-node/arp-header.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -23,6 +23,8 @@
 #include "ns3/address-utils.h"
 #include "arp-header.h"
 
+NS_HEADER_ENSURE_REGISTERED (ns3::ArpHeader);
+
 namespace ns3 {
 
 uint32_t
--- a/src/internet-node/ipv4-header.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/internet-node/ipv4-header.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -26,6 +26,8 @@
 
 NS_DEBUG_COMPONENT_DEFINE ("Ipv4Header");
 
+NS_HEADER_ENSURE_REGISTERED (ns3::Ipv4Header);
+
 namespace ns3 {
 
 bool Ipv4Header::m_calcChecksum = false;
--- a/src/internet-node/udp-header.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/internet-node/udp-header.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -22,6 +22,8 @@
 #include "udp-header.h"
 #include "ipv4-checksum.h"
 
+NS_HEADER_ENSURE_REGISTERED (ns3::UdpHeader);
+
 namespace ns3 {
 
 bool UdpHeader::m_calcChecksum = false;
--- a/src/node/ethernet-header.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/node/ethernet-header.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -27,6 +27,8 @@
 
 NS_DEBUG_COMPONENT_DEFINE ("EthernetHeader");
 
+NS_HEADER_ENSURE_REGISTERED (ns3::EthernetHeader);
+
 namespace ns3 {
 
 uint32_t
--- a/src/node/ethernet-trailer.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/node/ethernet-trailer.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -26,6 +26,8 @@
 
 NS_DEBUG_COMPONENT_DEFINE ("EthernetTrailer");
 
+NS_TRAILER_ENSURE_REGISTERED (ns3::EthernetTrailer);
+
 namespace ns3 {
 
 bool EthernetTrailer::m_calcFcs = false;
--- a/src/node/llc-snap-header.cc	Sat Aug 04 16:37:16 2007 +0200
+++ b/src/node/llc-snap-header.cc	Sat Aug 04 16:49:06 2007 +0200
@@ -23,6 +23,8 @@
 #include "ns3/assert.h"
 #include <string>
 
+NS_HEADER_ENSURE_REGISTERED (ns3::LlcSnapHeader);
+
 
 namespace ns3 {