rename MakeNewObject to Create
This commit is contained in:
@@ -103,10 +103,10 @@ int main (int argc, char *argv[])
|
||||
|
||||
// Here, we will explicitly create four nodes. In more sophisticated
|
||||
// topologies, we could configure a node factory.
|
||||
Ptr<Node> n0 = MakeNewObject<InternetNode> ();
|
||||
Ptr<Node> n1 = MakeNewObject<InternetNode> ();
|
||||
Ptr<Node> n2 = MakeNewObject<InternetNode> ();
|
||||
Ptr<Node> n3 = MakeNewObject<InternetNode> ();
|
||||
Ptr<Node> n0 = Create<InternetNode> ();
|
||||
Ptr<Node> n1 = Create<InternetNode> ();
|
||||
Ptr<Node> n2 = Create<InternetNode> ();
|
||||
Ptr<Node> n3 = Create<InternetNode> ();
|
||||
|
||||
// We create the channels first without any IP addressing information
|
||||
Ptr<PointToPointChannel> channel0 =
|
||||
@@ -145,7 +145,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
// Create the OnOff application to send UDP datagrams of size
|
||||
// 210 bytes at a rate of 448 Kb/s
|
||||
Ptr<OnOffApplication> ooff = MakeNewObject<OnOffApplication> (
|
||||
Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
|
||||
n0,
|
||||
Ipv4Address("10.1.3.2"),
|
||||
80,
|
||||
@@ -157,7 +157,7 @@ int main (int argc, char *argv[])
|
||||
ooff->Stop (Seconds(10.0));
|
||||
|
||||
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
|
||||
ooff = MakeNewObject<OnOffApplication> (
|
||||
ooff = Create<OnOffApplication> (
|
||||
n3,
|
||||
Ipv4Address("10.1.2.1"),
|
||||
80,
|
||||
|
||||
@@ -68,7 +68,7 @@ YetAnotherObject::YetAnotherObject (int a)
|
||||
// enable our interface
|
||||
SetInterfaceId (YetAnotherObject::iid);
|
||||
// aggregated directly to another object.
|
||||
AddInterface (MakeNewObject<AnObject> ());
|
||||
AddInterface (Create<AnObject> ());
|
||||
}
|
||||
void
|
||||
YetAnotherObject::DoDispose (void)
|
||||
@@ -87,7 +87,7 @@ int main (int argc, char *argv[])
|
||||
Ptr<AnotherObject> anotherObject;
|
||||
Ptr<YetAnotherObject> yetAnotherObject;
|
||||
|
||||
p = MakeNewObject<AnObject> ();
|
||||
p = Create<AnObject> ();
|
||||
// p gives you access to AnObject's interface
|
||||
anObject = p->QueryInterface<AnObject> (AnObject::iid);
|
||||
NS_ASSERT (anObject != 0);
|
||||
@@ -95,7 +95,7 @@ int main (int argc, char *argv[])
|
||||
anotherObject = p->QueryInterface<AnotherObject> (AnotherObject::iid);
|
||||
NS_ASSERT (anotherObject == 0);
|
||||
|
||||
anotherObject = MakeNewObject<AnotherObject> (1);
|
||||
anotherObject = Create<AnotherObject> (1);
|
||||
// AnotherObject does not give you access to AnObject's interface
|
||||
anObject = anotherObject->QueryInterface<AnObject> (AnObject::iid);
|
||||
NS_ASSERT (anObject == 0);
|
||||
@@ -110,7 +110,7 @@ int main (int argc, char *argv[])
|
||||
NS_ASSERT (anotherObject != 0);
|
||||
|
||||
|
||||
yetAnotherObject = MakeNewObject<YetAnotherObject> (2);
|
||||
yetAnotherObject = Create<YetAnotherObject> (2);
|
||||
// gives you acess to AnObject interface too.
|
||||
anObject = yetAnotherObject->QueryInterface<AnObject> (AnObject::iid);
|
||||
NS_ASSERT (anObject != 0);
|
||||
|
||||
@@ -49,7 +49,7 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
// Create a new object of type A, store it in global
|
||||
// variable g_a
|
||||
Ptr<A> a = MakeNewObject<A> ();
|
||||
Ptr<A> a = Create<A> ();
|
||||
a->Method ();
|
||||
Ptr<A> prev = StoreA (a);
|
||||
NS_ASSERT (prev == 0);
|
||||
@@ -58,7 +58,7 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
// Create a new object of type A, store it in global
|
||||
// variable g_a, get a hold on the previous A object.
|
||||
Ptr<A> a = MakeNewObject<A> ();
|
||||
Ptr<A> a = Create<A> ();
|
||||
Ptr<A> prev = StoreA (a);
|
||||
// call method on object
|
||||
prev->Method ();
|
||||
|
||||
@@ -38,7 +38,7 @@ PrintTraffic (Ptr<Socket> socket)
|
||||
void
|
||||
RunSimulation (void)
|
||||
{
|
||||
Ptr<Node> a = MakeNewObject<InternetNode> ();
|
||||
Ptr<Node> a = Create<InternetNode> ();
|
||||
|
||||
InterfaceId iid = InterfaceId::LookupByName ("IUdp");
|
||||
Ptr<ISocketFactory> socketFactory = a->QueryInterface<ISocketFactory> (iid);
|
||||
|
||||
@@ -266,12 +266,12 @@ public:
|
||||
// always properly disambiguited by the c++ compiler
|
||||
template <typename FUNCTOR>
|
||||
Callback (FUNCTOR const &functor, bool, bool)
|
||||
: m_impl (MakeNewObject<FunctorCallbackImpl<FUNCTOR,R,T1,T2,T3,T4,T5> > (functor))
|
||||
: m_impl (Create<FunctorCallbackImpl<FUNCTOR,R,T1,T2,T3,T4,T5> > (functor))
|
||||
{}
|
||||
|
||||
template <typename OBJ_PTR, typename MEM_PTR>
|
||||
Callback (OBJ_PTR const &objPtr, MEM_PTR mem_ptr)
|
||||
: m_impl (MakeNewObject<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5> > (objPtr, mem_ptr))
|
||||
: m_impl (Create<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5> > (objPtr, mem_ptr))
|
||||
{}
|
||||
|
||||
Callback (Ptr<CallbackImpl<R,T1,T2,T3,T4,T5> > const &impl)
|
||||
@@ -627,33 +627,33 @@ private:
|
||||
template <typename R, typename TX>
|
||||
Callback<R> MakeBoundCallback (R (*fnPtr) (TX), TX a) {
|
||||
Ptr<CallbackImpl<R,empty,empty,empty,empty,empty> > impl =
|
||||
MakeNewObject<BoundFunctorCallbackImpl<R (*) (TX),R,TX,empty,empty,empty,empty,empty> >(fnPtr, a);
|
||||
Create<BoundFunctorCallbackImpl<R (*) (TX),R,TX,empty,empty,empty,empty,empty> >(fnPtr, a);
|
||||
return Callback<R> (impl);
|
||||
}
|
||||
|
||||
template <typename R, typename TX, typename T1>
|
||||
Callback<R,T1> MakeBoundCallback (R (*fnPtr) (TX,T1), TX a) {
|
||||
Ptr<CallbackImpl<R,T1,empty,empty,empty,empty> > impl =
|
||||
MakeNewObject<BoundFunctorCallbackImpl<R (*) (TX,T1),R,TX,T1,empty,empty,empty,empty> > (fnPtr, a);
|
||||
Create<BoundFunctorCallbackImpl<R (*) (TX,T1),R,TX,T1,empty,empty,empty,empty> > (fnPtr, a);
|
||||
return Callback<R,T1> (impl);
|
||||
}
|
||||
template <typename R, typename TX, typename T1, typename T2>
|
||||
Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr) (TX,T1,T2), TX a) {
|
||||
Ptr<CallbackImpl<R,T1,T2,empty,empty,empty> > impl =
|
||||
MakeNewObject<BoundFunctorCallbackImpl<R (*) (TX,T1,T2),R,TX,T1,T2,empty,empty,empty> > (fnPtr, a);
|
||||
Create<BoundFunctorCallbackImpl<R (*) (TX,T1,T2),R,TX,T1,T2,empty,empty,empty> > (fnPtr, a);
|
||||
return Callback<R,T1,T2> (impl);
|
||||
}
|
||||
template <typename R, typename TX, typename T1, typename T2,typename T3,typename T4>
|
||||
Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), TX a) {
|
||||
Ptr<CallbackImpl<R,T1,T2,T3,T4,empty> > impl =
|
||||
MakeNewObject<BoundFunctorCallbackImpl<R (*) (TX,T1,T2,T3,T4),R,TX,T1,T2,T3,T4,empty> > (fnPtr, a);
|
||||
Create<BoundFunctorCallbackImpl<R (*) (TX,T1,T2,T3,T4),R,TX,T1,T2,T3,T4,empty> > (fnPtr, a);
|
||||
return Callback<R,T1,T2,T3,T4> (impl);
|
||||
}
|
||||
|
||||
template <typename R, typename TX, typename T1, typename T2,typename T3,typename T4,typename T5>
|
||||
Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), TX a) {
|
||||
Ptr<CallbackImpl<R,T1,T2,T3,T4,T5> > impl =
|
||||
MakeNewObject<BoundFunctorCallbackImpl<R (*) (TX,T1,T2,T3,T4,T5),R,TX,T1,T2,T3,T4,T5> > (fnPtr, a);
|
||||
Create<BoundFunctorCallbackImpl<R (*) (TX,T1,T2,T3,T4,T5),R,TX,T1,T2,T3,T4,T5> > (fnPtr, a);
|
||||
return Callback<R,T1,T2,T3,T4,T5> (impl);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ A::A ()
|
||||
m_oneUi32Invoked (false)
|
||||
{
|
||||
SetInterfaceId (A::iid);
|
||||
ns3::Ptr<B> b = ns3::MakeNewObject<B> ();
|
||||
ns3::Ptr<B> b = ns3::Create<B> ();
|
||||
AddInterface (b);
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ A::A (bool bo)
|
||||
m_bool (bo)
|
||||
{
|
||||
SetInterfaceId (A::iid);
|
||||
ns3::Ptr<B> b = ns3::MakeNewObject<B> ();
|
||||
ns3::Ptr<B> b = ns3::Create<B> ();
|
||||
AddInterface (b);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ A::A (uint32_t i)
|
||||
m_ui32 (i)
|
||||
{
|
||||
SetInterfaceId (A::iid);
|
||||
ns3::Ptr<B> b = ns3::MakeNewObject<B> ();
|
||||
ns3::Ptr<B> b = ns3::Create<B> ();
|
||||
AddInterface (b);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ template <typename T>
|
||||
struct ObjectMaker<T,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (void) {
|
||||
return ns3::MakeNewObject<T> ();
|
||||
return ns3::Create<T> ();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -437,7 +437,7 @@ template <typename T, typename T1>
|
||||
struct ObjectMaker<T,T1,ns3::empty,ns3::empty,ns3::empty,ns3::empty> {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (T1 a1) {
|
||||
return ns3::MakeNewObject<T> (a1);
|
||||
return ns3::Create<T> (a1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -445,7 +445,7 @@ template <typename T, typename T1, typename T2>
|
||||
struct ObjectMaker<T,T1,T2,ns3::empty,ns3::empty,ns3::empty> {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (T1 a1, T2 a2) {
|
||||
return ns3::MakeNewObject<T> (a1, a2);
|
||||
return ns3::Create<T> (a1, a2);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -453,7 +453,7 @@ template <typename T, typename T1, typename T2, typename T3>
|
||||
struct ObjectMaker<T,T1,T2,T3,ns3::empty,ns3::empty> {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (T1 a1, T2 a2, T3 a3) {
|
||||
return ns3::MakeNewObject<T> (a1, a2, a3);
|
||||
return ns3::Create<T> (a1, a2, a3);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -462,7 +462,7 @@ template <typename T, typename T1, typename T2, typename T3,
|
||||
struct ObjectMaker<T,T1,T2,T3,T4,ns3::empty> {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (T1 a1, T2 a2, T3 a3, T4 a4) {
|
||||
return ns3::MakeNewObject<T> (a1, a2, a3, a4);
|
||||
return ns3::Create<T> (a1, a2, a3, a4);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -471,7 +471,7 @@ template <typename T, typename T1, typename T2, typename T3,
|
||||
struct ObjectMaker {
|
||||
static ns3::Ptr<ns3::Object>
|
||||
MakeObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
|
||||
return ns3::MakeNewObject<T> (a1, a2, a3, a4, a5);
|
||||
return ns3::Create<T> (a1, a2, a3, a4, a5);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ ObjectTest::RunTests (void)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
Ptr<BaseA> baseA = MakeNewObject<BaseA> ();
|
||||
Ptr<BaseA> baseA = Create<BaseA> ();
|
||||
if (baseA->QueryInterface<BaseA> (BaseA::iid) != baseA)
|
||||
{
|
||||
ok = false;
|
||||
@@ -308,7 +308,7 @@ ObjectTest::RunTests (void)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
baseA = MakeNewObject<DerivedA> (10);
|
||||
baseA = Create<DerivedA> (10);
|
||||
if (baseA->QueryInterface<BaseA> (BaseA::iid) != baseA)
|
||||
{
|
||||
ok = false;
|
||||
@@ -322,8 +322,8 @@ ObjectTest::RunTests (void)
|
||||
ok = false;
|
||||
}
|
||||
|
||||
baseA = MakeNewObject<BaseA> ();
|
||||
Ptr<BaseB> baseB = MakeNewObject<BaseB> ();
|
||||
baseA = Create<BaseA> ();
|
||||
Ptr<BaseB> baseB = Create<BaseB> ();
|
||||
Ptr<BaseB> baseBCopy = baseB;
|
||||
baseA->AddInterface (baseB);
|
||||
if (baseA->QueryInterface<BaseA> (BaseA::iid) == 0)
|
||||
@@ -363,8 +363,8 @@ ObjectTest::RunTests (void)
|
||||
ok = false;
|
||||
}
|
||||
|
||||
baseA = MakeNewObject<DerivedA> (1);
|
||||
baseB = MakeNewObject<DerivedB> (1);
|
||||
baseA = Create<DerivedA> (1);
|
||||
baseB = Create<DerivedB> (1);
|
||||
baseBCopy = baseB;
|
||||
baseA->AddInterface (baseB);
|
||||
if (baseA->QueryInterface<DerivedB> (DerivedB::iid) == 0)
|
||||
@@ -400,8 +400,8 @@ ObjectTest::RunTests (void)
|
||||
ok = false;
|
||||
}
|
||||
|
||||
baseA = MakeNewObject<BaseA> ();
|
||||
baseB = MakeNewObject<BaseB> ();
|
||||
baseA = Create<BaseA> ();
|
||||
baseB = Create<BaseB> ();
|
||||
baseA->AddInterface (baseB);
|
||||
baseA = 0;
|
||||
baseA = baseB->QueryInterface<BaseA> (BaseA::iid);
|
||||
|
||||
@@ -93,7 +93,7 @@ PtrTest::RunTests (void)
|
||||
Callback<void> cb = MakeCallback (&PtrTest::DestroyNotify, this);
|
||||
m_nDestroyed = false;
|
||||
{
|
||||
Ptr<NoCount> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p = Create<NoCount> (cb);
|
||||
}
|
||||
if (m_nDestroyed != 1)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p;
|
||||
p = MakeNewObject<NoCount> (cb);
|
||||
p = Create<NoCount> (cb);
|
||||
p = p;
|
||||
}
|
||||
if (m_nDestroyed != 1)
|
||||
@@ -114,7 +114,7 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p1;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
Ptr<NoCount> p2 = p1;
|
||||
}
|
||||
if (m_nDestroyed != 1)
|
||||
@@ -125,7 +125,7 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p1;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
Ptr<NoCount> p2;
|
||||
p2 = p1;
|
||||
}
|
||||
@@ -137,8 +137,8 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p1;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p2 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
Ptr<NoCount> p2 = Create<NoCount> (cb);
|
||||
p2 = p1;
|
||||
}
|
||||
if (m_nDestroyed != 2)
|
||||
@@ -149,9 +149,9 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p1;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
Ptr<NoCount> p2;
|
||||
p2 = MakeNewObject<NoCount> (cb);
|
||||
p2 = Create<NoCount> (cb);
|
||||
p2 = p1;
|
||||
}
|
||||
if (m_nDestroyed != 2)
|
||||
@@ -162,8 +162,8 @@ PtrTest::RunTests (void)
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p1;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
}
|
||||
if (m_nDestroyed != 2)
|
||||
{
|
||||
@@ -175,8 +175,8 @@ PtrTest::RunTests (void)
|
||||
Ptr<NoCount> p1;
|
||||
{
|
||||
Ptr<NoCount> p2;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p2 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
p2 = Create<NoCount> (cb);
|
||||
p2 = p1;
|
||||
}
|
||||
if (m_nDestroyed != 1)
|
||||
@@ -194,8 +194,8 @@ PtrTest::RunTests (void)
|
||||
Ptr<NoCount> p1;
|
||||
{
|
||||
Ptr<NoCount> p2;
|
||||
p1 = MakeNewObject<NoCount> (cb);
|
||||
p2 = MakeNewObject<NoCount> (cb);
|
||||
p1 = Create<NoCount> (cb);
|
||||
p2 = Create<NoCount> (cb);
|
||||
p2 = CallTest (p1);
|
||||
}
|
||||
if (m_nDestroyed != 1)
|
||||
@@ -237,7 +237,7 @@ PtrTest::RunTests (void)
|
||||
{
|
||||
NoCount *raw;
|
||||
{
|
||||
Ptr<NoCount> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p = Create<NoCount> (cb);
|
||||
{
|
||||
Ptr<NoCount const> p1 = p;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ PtrTest::RunTests (void)
|
||||
|
||||
m_nDestroyed = 0;
|
||||
{
|
||||
Ptr<NoCount> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p = Create<NoCount> (cb);
|
||||
const NoCount *v1 = PeekPointer (p);
|
||||
NoCount *v2 = PeekPointer (p);
|
||||
v1->Nothing ();
|
||||
@@ -266,8 +266,8 @@ PtrTest::RunTests (void)
|
||||
}
|
||||
|
||||
{
|
||||
Ptr<Object> p0 = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p1 = MakeNewObject<NoCount> (cb);
|
||||
Ptr<Object> p0 = Create<NoCount> (cb);
|
||||
Ptr<NoCount> p1 = Create<NoCount> (cb);
|
||||
if (p0 == p1)
|
||||
{
|
||||
ok = false;
|
||||
@@ -282,12 +282,12 @@ PtrTest::RunTests (void)
|
||||
}
|
||||
|
||||
{
|
||||
Ptr<NoCount> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<NoCount> p = Create<NoCount> (cb);
|
||||
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
|
||||
callback ();
|
||||
}
|
||||
{
|
||||
Ptr<const NoCount> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<const NoCount> p = Create<NoCount> (cb);
|
||||
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
|
||||
callback ();
|
||||
}
|
||||
@@ -295,7 +295,7 @@ PtrTest::RunTests (void)
|
||||
#if 0
|
||||
// as expected, fails compilation.
|
||||
{
|
||||
Ptr<const Object> p = MakeNewObject<NoCount> (cb);
|
||||
Ptr<const Object> p = Create<NoCount> (cb);
|
||||
Callback<void> callback = MakeCallback (&NoCount::Nothing, p);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ns3 {
|
||||
* smart pointer with the GetPointer and PeekPointer methods.
|
||||
*
|
||||
* If you want to store a newed object into a smart pointer,
|
||||
* we recommend you to use the MakeNewObject template functions
|
||||
* we recommend you to use the Create template functions
|
||||
* to create the object and store it in a smart pointer to avoid
|
||||
* memory leaks. These functions are really small conveniance
|
||||
* functions and their goal is just is save you a small
|
||||
@@ -98,28 +98,28 @@ public:
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Ptr<T> MakeNewObject (void);
|
||||
Ptr<T> Create (void);
|
||||
|
||||
template <typename T, typename T1>
|
||||
Ptr<T> MakeNewObject (T1 a1);
|
||||
Ptr<T> Create (T1 a1);
|
||||
|
||||
template <typename T, typename T1, typename T2>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2);
|
||||
Ptr<T> Create (T1 a1, T2 a2);
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3);
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3);
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4);
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4);
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
|
||||
|
||||
/**
|
||||
* \relates Ptr
|
||||
@@ -206,7 +206,7 @@ namespace ns3 {
|
||||
************************************************/
|
||||
|
||||
template <typename T>
|
||||
Ptr<T> MakeNewObject (void)
|
||||
Ptr<T> Create (void)
|
||||
{
|
||||
T *obj = new T ();
|
||||
Ptr<T> p = obj;
|
||||
@@ -215,7 +215,7 @@ Ptr<T> MakeNewObject (void)
|
||||
}
|
||||
|
||||
template <typename T, typename T1>
|
||||
Ptr<T> MakeNewObject (T1 a1)
|
||||
Ptr<T> Create (T1 a1)
|
||||
{
|
||||
T *obj = new T (a1);
|
||||
Ptr<T> p = obj;
|
||||
@@ -224,7 +224,7 @@ Ptr<T> MakeNewObject (T1 a1)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2)
|
||||
Ptr<T> Create (T1 a1, T2 a2)
|
||||
{
|
||||
T *obj = new T (a1, a2);
|
||||
Ptr<T> p = obj;
|
||||
@@ -233,7 +233,7 @@ Ptr<T> MakeNewObject (T1 a1, T2 a2)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3)
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3)
|
||||
{
|
||||
T *obj = new T (a1, a2, a3);
|
||||
Ptr<T> p = obj;
|
||||
@@ -242,7 +242,7 @@ Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
{
|
||||
T *obj = new T (a1, a2, a3, a4);
|
||||
Ptr<T> p = obj;
|
||||
@@ -251,7 +251,7 @@ Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
{
|
||||
T *obj = new T (a1, a2, a3, a4, a5);
|
||||
Ptr<T> p = obj;
|
||||
@@ -260,7 +260,7 @@ Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
|
||||
{
|
||||
T *obj = new T (a1, a2, a3, a4, a5, a6);
|
||||
Ptr<T> p = obj;
|
||||
@@ -269,7 +269,7 @@ Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
|
||||
}
|
||||
|
||||
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
Ptr<T> MakeNewObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
|
||||
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
|
||||
{
|
||||
T *obj = new T (a1, a2, a3, a4, a5, a6, a7);
|
||||
Ptr<T> p = obj;
|
||||
|
||||
@@ -45,15 +45,15 @@ PointToPointTopology::AddPointToPointLink(
|
||||
const DataRate& bps,
|
||||
const Time& delay)
|
||||
{
|
||||
Ptr<PointToPointChannel> channel = MakeNewObject<PointToPointChannel> (bps, delay);
|
||||
Ptr<PointToPointChannel> channel = Create<PointToPointChannel> (bps, delay);
|
||||
|
||||
Ptr<PointToPointNetDevice> net1 = MakeNewObject<PointToPointNetDevice> (n1);
|
||||
Ptr<PointToPointNetDevice> net1 = Create<PointToPointNetDevice> (n1);
|
||||
|
||||
Ptr<Queue> q = Queue::CreateDefault ();
|
||||
net1->AddQueue(q);
|
||||
net1->Attach (channel);
|
||||
|
||||
Ptr<PointToPointNetDevice> net2 = MakeNewObject<PointToPointNetDevice> (n2);
|
||||
Ptr<PointToPointNetDevice> net2 = Create<PointToPointNetDevice> (n2);
|
||||
|
||||
q = Queue::CreateDefault ();
|
||||
net2->AddQueue(q);
|
||||
|
||||
@@ -54,21 +54,21 @@ InternetNode::~InternetNode ()
|
||||
void
|
||||
InternetNode::Construct (void)
|
||||
{
|
||||
Ptr<Ipv4> ipv4 = MakeNewObject<Ipv4> (this);
|
||||
Ptr<Arp> arp = MakeNewObject<Arp> (this);
|
||||
Ptr<Udp> udp = MakeNewObject<Udp> (this);
|
||||
Ptr<Ipv4> ipv4 = Create<Ipv4> (this);
|
||||
Ptr<Arp> arp = Create<Arp> (this);
|
||||
Ptr<Udp> udp = Create<Udp> (this);
|
||||
|
||||
Ptr<L3Demux> l3Demux = MakeNewObject<L3Demux> (this);
|
||||
Ptr<Ipv4L4Demux> ipv4L4Demux = MakeNewObject<Ipv4L4Demux> (this);
|
||||
Ptr<L3Demux> l3Demux = Create<L3Demux> (this);
|
||||
Ptr<Ipv4L4Demux> ipv4L4Demux = Create<Ipv4L4Demux> (this);
|
||||
|
||||
l3Demux->Insert (ipv4);
|
||||
l3Demux->Insert (arp);
|
||||
ipv4L4Demux->Insert (udp);
|
||||
|
||||
Ptr<IUdpImpl> udpImpl = MakeNewObject<IUdpImpl> (udp);
|
||||
Ptr<IArpPrivate> arpPrivate = MakeNewObject<IArpPrivate> (arp);
|
||||
Ptr<IIpv4Impl> ipv4Impl = MakeNewObject<IIpv4Impl> (ipv4);
|
||||
Ptr<IIpv4Private> ipv4Private = MakeNewObject<IIpv4Private> (ipv4);
|
||||
Ptr<IUdpImpl> udpImpl = Create<IUdpImpl> (udp);
|
||||
Ptr<IArpPrivate> arpPrivate = Create<IArpPrivate> (arp);
|
||||
Ptr<IIpv4Impl> ipv4Impl = Create<IIpv4Impl> (ipv4);
|
||||
Ptr<IIpv4Private> ipv4Private = Create<IIpv4Private> (ipv4);
|
||||
|
||||
Object::AddInterface (ipv4Private);
|
||||
Object::AddInterface (ipv4Impl);
|
||||
|
||||
@@ -68,7 +68,7 @@ Udp::DoDispose (void)
|
||||
Ptr<Socket>
|
||||
Udp::CreateSocket (void)
|
||||
{
|
||||
Ptr<Socket> socket = MakeNewObject<UdpSocket> (m_node, this);
|
||||
Ptr<Socket> socket = Create<UdpSocket> (m_node, this);
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ int main (int argc, char *argv[])
|
||||
std::vector< Ptr<BaseA> > objlist;
|
||||
|
||||
for (int i = 0; i < nobjects; ++i)
|
||||
objlist.push_back (MakeNewObject<BaseA> ());
|
||||
objlist.push_back (Create<BaseA> ());
|
||||
|
||||
for (int swapCounter = nswaps; swapCounter; --swapCounter)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user