A Discrete-Event Network Simulator
API
Object

Base classes which provide memory management and object aggregation. More...

+ Collaboration diagram for Object:

Files

file  attribute-construction-list.cc
 ns3::AttributeConstructionList implementation.
 
file  attribute-construction-list.h
 ns3::AttributeConstructionList declaration.
 
file  object-base.cc
 ns3::ObjectBase class implementation.
 
file  object-base.h
 ns3::ObjectBase declaration and NS_OBJECT_ENSURE_REGISTERED() madro definition.
 
file  object-factory.cc
 ns3::ObjectFactory class implementation.
 
file  object-factory.h
 ns3::ObjectFactory class declaration.
 
file  object-test-suite.cc
 Object test suite.
 
file  object.cc
 ns3::Object class implementation.
 
file  object.h
 ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
 
file  type-id.cc
 ns3::TypeId and ns3::IidManager implementations.
 
file  type-id.h
 ns3::TypeId declaration; inline and template implementations.
 
file  type-traits-test-suite.cc
 TypeTraits test suite.
 
file  type-traits.h
 ns3::TypeTraits introspection declaration and template implementation.
 

Classes

class  ns3::AttributeConstructionList
 List of Attribute name, value and checker triples used to construct Objects. More...
 
class  ns3::IidManager
 TypeId information manager. More...
 
class  ns3::Object
 A base class which provides memory management and object aggregation. More...
 
class  ns3::ObjectBase
 Anchor the ns-3 type and attribute system. More...
 
struct  ns3::ObjectDeleter
 Standard Object deleter, used by SimpleRefCount to delete an Object when the reference count drops to zero. More...
 
class  ns3::ObjectFactory
 Instantiate subclasses of ns3::Object. More...
 
class  ns3::TypeId
 a unique identifier for an interface. More...
 
struct  ns3::TypeTraits< T >
 Inspect a type to deduce its features. More...
 

Macros

#define IID   "IidManager"
 
#define IIDL   IID << ": "
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
 Register an Object subclass with the TypeId system. More...
 
#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param)
 Explicitly instantiate a template class and register the resulting instance with the TypeId system. More...
 

Functions

template<typename T >
Ptr< T > ns3::CreateObjectWithAttributes (std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
 Allocate an Object on the heap and initialize with a set of attributes. More...
 
template<typename T >
Ptr< T > ns3::CreateObject (void)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 >
Ptr< T > ns3::CreateObject (T1 a1)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 , typename T3 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2, T3 a3)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
 Create an object by type, with varying number of constructor parameters. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
Ptr< T > ns3::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
 Create an object by type, with varying number of constructor parameters. More...
 

Detailed Description

Base classes which provide memory management and object aggregation.

Macro Definition Documentation

◆ IID

◆ IIDL

◆ NS_OBJECT_ENSURE_REGISTERED

#define NS_OBJECT_ENSURE_REGISTERED (   type)
Value:
static struct Object ## type ## RegistrationClass \
{ \
Object ## type ## RegistrationClass () { \
ns3::TypeId tid = type::GetTypeId (); \
tid.SetSize (sizeof (type)); \
tid.GetParent (); \
} \
} Object ## type ## RegistrationVariable

Register an Object subclass with the TypeId system.

This macro should be invoked once for every class which defines a new GetTypeId method.

If the class is in a namespace, then the macro call should also be in the namespace.

Definition at line 45 of file object-base.h.

◆ NS_OBJECT_TEMPLATE_CLASS_DEFINE

#define NS_OBJECT_TEMPLATE_CLASS_DEFINE (   type,
  param 
)
Value:
template class type<param>; \
template <> std::string DoGetTypeParamName<type<param> > () \
{ \
return #param; \
} \
static struct Object ## type ## param ## RegistrationClass \
{ \
Object ## type ## param ## RegistrationClass () { \
ns3::TypeId tid = type<param>::GetTypeId (); \
tid.SetSize (sizeof (type<param>)); \
tid.GetParent (); \
} \
} Object ## type ## param ## RegistrationVariable

Explicitly instantiate a template class and register the resulting instance with the TypeId system.

This macro should be invoked once for every required instance of a template class which derives from the Object class and defines a new GetTypeId method.

If the template class is in a namespace, then the macro call should also be in the namespace.

Definition at line 67 of file object-base.h.

Function Documentation

◆ CreateObject() [1/8]

template<typename T >
Ptr<T> ns3::CreateObject ( void  )

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
Returns
The derived object.

Definition at line 528 of file object.h.

References ns3::CompleteConstruct().

Referenced by ns3::Ipv6L3Protocol::AddInterface(), ns3::Ipv4L3Protocol::AddInterface(), TestChildQueueDisc::CheckConfig(), Ipv4L3ProtocolTestCase::DoRun(), PointToPointTest::DoRun(), Ipv6L3ProtocolTestCase::DoRun(), ns3::Ipv4L3Protocol::SetupLoopback(), and ns3::Ipv6L3Protocol::SetupLoopback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateObject() [2/8]

template<typename T , typename T1 >
Ptr<T> ns3::CreateObject ( T1  a1)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the constructor argument.
Parameters
[in]a1The constructor argument
Returns
The derived object.

Definition at line 540 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [3/8]

template<typename T , typename T1 , typename T2 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
Returns
The derived object.

Definition at line 555 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [4/8]

template<typename T , typename T1 , typename T2 , typename T3 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2,
T3  a3 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
T3[deduced] The type of the third constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
[in]a3The constructor third argument
Returns
The derived object.

Definition at line 572 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [5/8]

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2,
T3  a3,
T4  a4 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
T3[deduced] The type of the third constructor argument.
T4[deduced] The type of the fourth constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
[in]a3The constructor third argument
[in]a4The constructor fourth argument
Returns
The derived object.

Definition at line 591 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [6/8]

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2,
T3  a3,
T4  a4,
T5  a5 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
T3[deduced] The type of the third constructor argument.
T4[deduced] The type of the fourth constructor argument.
T5[deduced] The type of the fifth constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
[in]a3The constructor third argument
[in]a4The constructor fourth argument
[in]a5The constructor fifth argument
Returns
The derived object.

Definition at line 612 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [7/8]

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2,
T3  a3,
T4  a4,
T5  a5,
T6  a6 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
T3[deduced] The type of the third constructor argument.
T4[deduced] The type of the fourth constructor argument.
T5[deduced] The type of the fifth constructor argument.
T6[deduced] The type of the sixth constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
[in]a3The constructor third argument
[in]a4The constructor fourth argument
[in]a5The constructor fifth argument
[in]a6The constructor sixth argument
Returns
The derived object.

Definition at line 635 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObject() [8/8]

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
Ptr<T> ns3::CreateObject ( T1  a1,
T2  a2,
T3  a3,
T4  a4,
T5  a5,
T6  a6,
T7  a7 
)

Create an object by type, with varying number of constructor parameters.

Template Parameters
T[explicit] The type of the derived object to construct.
T1[deduced] The type of the first constructor argument.
T2[deduced] The type of the second constructor argument.
T3[deduced] The type of the third constructor argument.
T4[deduced] The type of the fourth constructor argument.
T5[deduced] The type of the fifth constructor argument.
T6[deduced] The type of the sixth constructor argument.
T7[deduced] The type of the seventh constructor argument.
Parameters
[in]a1The constructor first argument
[in]a2The constructor second argument
[in]a3The constructor third argument
[in]a4The constructor fourth argument
[in]a5The constructor fifth argument
[in]a6The constructor sixth argument
[in]a7The constructor seventh argument
Returns
The derived object.

Definition at line 660 of file object.h.

References ns3::CompleteConstruct().

+ Here is the call graph for this function:

◆ CreateObjectWithAttributes()

template<typename T >
Ptr< T > ns3::CreateObjectWithAttributes ( std::string  n1 = "",
const AttributeValue v1 = EmptyAttributeValue (),
std::string  n2 = "",
const AttributeValue v2 = EmptyAttributeValue (),
std::string  n3 = "",
const AttributeValue v3 = EmptyAttributeValue (),
std::string  n4 = "",
const AttributeValue v4 = EmptyAttributeValue (),
std::string  n5 = "",
const AttributeValue v5 = EmptyAttributeValue (),
std::string  n6 = "",
const AttributeValue v6 = EmptyAttributeValue (),
std::string  n7 = "",
const AttributeValue v7 = EmptyAttributeValue (),
std::string  n8 = "",
const AttributeValue v8 = EmptyAttributeValue (),
std::string  n9 = "",
const AttributeValue v9 = EmptyAttributeValue () 
)

Allocate an Object on the heap and initialize with a set of attributes.

Template Parameters
T[explicit] The requested Object type.
Parameters
[in]n1Name of attribute
[in]v1Value of attribute
[in]n2Name of attribute
[in]v2Value of attribute
[in]n3Name of attribute
[in]v3Value of attribute
[in]n4Name of attribute
[in]v4Value of attribute
[in]n5Name of attribute
[in]v5Value of attribute
[in]n6Name of attribute
[in]v6Value of attribute
[in]n7Name of attribute
[in]v7Value of attribute
[in]n8Name of attribute
[in]v8Value of attribute
[in]n9Name of attribute
[in]v9Value of attribute
Returns
A pointer to a newly allocated object.

Definition at line 213 of file object-factory.h.

References ns3::ObjectFactory::Create(), ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().

Referenced by ns3::FifoQueueDisc::CheckConfig(), ns3::PieQueueDisc::CheckConfig(), ns3::CoDelQueueDisc::CheckConfig(), ns3::CobaltQueueDisc::CheckConfig(), and ns3::RedQueueDisc::CheckConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: