35#define NS_OBJECT_ENSURE_REGISTERED(type) \
36 static struct Object##type##RegistrationClass \
38 Object##type##RegistrationClass() \
40 NS_WARNING_PUSH_DEPRECATED; \
41 ns3::TypeId tid = type::GetTypeId(); \
42 tid.SetSize(sizeof(type)); \
46 } Object##type##RegistrationVariable
67#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param) \
68 template class type<param>; \
70 std::string DoGetTemplateClassName<type<param>>() \
72 return std::string("ns3::") + std::string(#type) + std::string("<") + \
73 std::string(#param) + std::string(">"); \
75 static struct Object##type##param##RegistrationClass \
77 Object##type##param##RegistrationClass() \
79 ns3::TypeId tid = type<param>::GetTypeId(); \
80 tid.SetSize(sizeof(type<param>)); \
83 } Object##type##param##RegistrationVariable
117#define NS_OBJECT_TEMPLATE_CLASS_WITH_NS_DEFINE(nst, type, nsp, param) \
118 template class nst::type<nsp::param>; \
120 std::string DoGetTemplateClassName<nst::type<nsp::param>>() \
122 constexpr std::string_view prefix = "ns3::"; \
123 std::string cName = std::string(#nst) + "::" + #type; \
124 if (cName.starts_with(prefix)) \
125 cName.erase(0, prefix.size()); \
126 std::string pName = std::string(#nsp) + "::" + #param; \
127 if (pName.starts_with(prefix)) \
128 pName.erase(0, prefix.size()); \
129 return std::string("ns3::") + cName + std::string("<") + pName + std::string(">"); \
133 static struct Object##type##nsp##param##RegistrationClass \
135 Object##type##nsp##param##RegistrationClass() \
137 ns3::TypeId tid = type<nsp::param>::GetTypeId(); \
138 tid.SetSize(sizeof(type<nsp::param>)); \
141 } Object##type##nsp##param##RegistrationVariable; \
164#define NS_OBJECT_TEMPLATE_CLASS_TWO_DEFINE(type, param1, param2) \
165 template class type<param1, param2>; \
167 std::string DoGetTemplateClassName<type<param1, param2>>() \
169 return std::string("ns3::") + std::string(#type) + std::string("<") + \
170 std::string(#param1) + std::string(",") + std::string(#param2) + std::string(">"); \
172 static struct Object##type##param1##param2##RegistrationClass \
174 Object##type##param1##param2##RegistrationClass() \
176 ns3::TypeId tid = type<param1, param2>::GetTypeId(); \
177 tid.SetSize(sizeof(type<param1, param2>)); \
180 } Object##type##param1##param2##RegistrationVariable
208class AttributeConstructionList;
Declaration of the various callback functions.
List of Attribute name, value and checker triples used to construct Objects.
Hold a value for an Attribute.
Base class for Callback class.
CallbackImpl class with varying numbers of argument types.
Anchor the ns-3 type and attribute system.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
bool TraceDisconnect(std::string name, std::string context, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected with a context.
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
virtual TypeId GetInstanceTypeId() const =0
Get the most derived TypeId for this Object.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
virtual ~ObjectBase()
Virtual destructor.
bool GetAttributeFailSafe(std::string name, AttributeValue &value) const
Get the value of an attribute without raising errors.
virtual void NotifyConstructionCompleted()
Notifier called once the ObjectBase is fully constructed.
static TypeId GetTypeId()
Get the type ID.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
void GetAttribute(std::string name, AttributeValue &value, bool permissive=false) const
Get the value of an attribute, raising fatal errors if unsuccessful.
bool DoSet(Ptr< const AttributeAccessor > spec, Ptr< const AttributeChecker > checker, const AttributeValue &value)
Attempt to set the value referenced by the accessor spec to a valid value according to the checker,...
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
template Callback< ObjectBase * > MakeCallback< ObjectBase * >(ObjectBase *(*)())
Explicit instantiation for ObjectBase.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string DoGetTemplateClassName()
Helper function to get the name (as a string) of the type of a template class.
std::string GetTemplateClassName()
Helper function to get the name (as a string) of the type of a template class.
ns3::TypeId declaration; inline and template implementations.