AddInterface -> AggregateObject

This commit is contained in:
Mathieu Lacage
2008-01-31 22:23:46 +01:00
parent 5ade799440
commit cecd35e20b
18 changed files with 31 additions and 31 deletions

View File

@@ -50,7 +50,7 @@ CreateAdhocNode (Ptr<WifiChannel> channel,
device->Attach (channel);
Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
node->AggregateObject (mobility);
return node;
}

View File

@@ -78,7 +78,7 @@ CreateApNode (Ptr<WifiChannel> channel,
device->Attach (channel);
Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
node->AggregateObject (mobility);
return node;
}
@@ -95,7 +95,7 @@ CreateStaNode (Ptr<WifiChannel> channel,
device->Attach (channel);
Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> ();
mobility->SetPosition (position);
node->AddInterface (mobility);
node->AggregateObject (mobility);
return node;
}

View File

@@ -46,7 +46,7 @@ int main (int argc, char *argv[])
for (uint32_t i = 0; i < 100; i++)
{
Ptr<Node> node = CreateObject<Node> ();
node->AddInterface (CreateObject<MobilityModelNotifier> ());
node->AggregateObject (CreateObject<MobilityModelNotifier> ());
}
topology.Layout (NodeList::Begin (), NodeList::End ());

View File

@@ -410,7 +410,7 @@ Object::Dispose (void)
}
void
Object::AddInterface (Ptr<Object> o)
Object::AggregateObject (Ptr<Object> o)
{
NS_ASSERT (!m_disposed);
NS_ASSERT (!o->m_disposed);
@@ -762,7 +762,7 @@ ObjectTest::RunTests (void)
baseA = CreateObject<BaseA> ();
Ptr<BaseB> baseB = CreateObject<BaseB> ();
Ptr<BaseB> baseBCopy = baseB;
baseA->AddInterface (baseB);
baseA->AggregateObject (baseB);
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseA> (), 0);
NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedA> (), 0);
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0);
@@ -776,7 +776,7 @@ ObjectTest::RunTests (void)
baseA = CreateObject<DerivedA> (1);
baseB = CreateObject<DerivedB> (1);
baseBCopy = baseB;
baseA->AddInterface (baseB);
baseA->AggregateObject (baseB);
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<DerivedB> (), 0);
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0);
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<DerivedA> (), 0);
@@ -788,7 +788,7 @@ ObjectTest::RunTests (void)
baseA = CreateObject<BaseA> ();
baseB = CreateObject<BaseB> ();
baseA->AddInterface (baseB);
baseA->AggregateObject (baseB);
baseA = 0;
baseA = baseB->GetObject<BaseA> ();
@@ -806,7 +806,7 @@ ObjectTest::RunTests (void)
NS_TEST_ASSERT (m_baseBTrace);
baseB->TraceDisconnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this));
baseA->AddInterface (baseB);
baseA->AggregateObject (baseB);
baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
m_baseATrace = false;
@@ -838,7 +838,7 @@ ObjectTest::RunTests (void)
Ptr<DerivedA> derivedA;
derivedA = CreateObject<DerivedA> (1);
baseB = CreateObject<BaseB> ();
derivedA->AddInterface (baseB);
derivedA->AggregateObject (baseB);
baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this));
baseB->TraceConnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this));
m_derivedATrace = false;

View File

@@ -180,7 +180,7 @@ public:
* method returns, it becomes possible to call GetObject
* on one to get the other, and vice-versa.
*/
void AddInterface (Ptr<Object> other);
void AggregateObject (Ptr<Object> other);
/**
* \param path the path to match for the callback

View File

@@ -540,7 +540,7 @@ void CsmaNetDevice::AddReceiveErrorModel (Ptr<ErrorModel> em)
NS_LOG_PARAM ("(" << em << ")");
m_receiveErrorModel = em;
AddInterface (em);
AggregateObject (em);
}
void

View File

@@ -302,7 +302,7 @@ void PointToPointNetDevice::AddReceiveErrorModel (Ptr<ErrorModel> em)
NS_LOG_PARAMS ("(" << em << ")");
m_receiveErrorModel = em;
AddInterface (em);
AggregateObject (em);
}
void PointToPointNetDevice::Receive (Ptr<Packet> packet)

View File

@@ -34,7 +34,7 @@ class Node;
*
* If you need to use ARP on top of a specific NetDevice, you
* can use this Ipv4Interface subclass to wrap it for the Ipv4 class
* when calling Ipv4::AddInterface.
* when calling Ipv4::AggregateObject.
*/
class ArpIpv4Interface : public Ipv4Interface
{

View File

@@ -73,12 +73,12 @@ InternetNode::Construct (void)
Ptr<TcpImpl> tcpImpl = CreateObject<TcpImpl> (tcp);
Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> (ipv4);
Object::AddInterface (ipv4);
Object::AddInterface (arp);
Object::AddInterface (ipv4Impl);
Object::AddInterface (udpImpl);
Object::AddInterface (tcpImpl);
Object::AddInterface (ipv4L4Demux);
Object::AggregateObject (ipv4);
Object::AggregateObject (arp);
Object::AggregateObject (ipv4Impl);
Object::AggregateObject (udpImpl);
Object::AggregateObject (tcpImpl);
Object::AggregateObject (ipv4L4Demux);
}
Ptr<TraceResolver>

View File

@@ -44,7 +44,7 @@ GridTopology::LayoutOneRowFirst (Ptr<Object> object, uint32_t i)
x = m_xMin + m_deltaX * (i % m_n);
y = m_yMin + m_deltaY * (i / m_n);
Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
object->AggregateObject (mobility);
mobility->SetPosition (Vector (x, y, 0.0));
}
@@ -55,7 +55,7 @@ GridTopology::LayoutOneColumnFirst (Ptr<Object> object, uint32_t i)
x = m_xMin + m_deltaX * (i / m_n);
y = m_yMin + m_deltaY * (i % m_n);
Ptr<MobilityModel> mobility = m_positionTypeId.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
object->AggregateObject (mobility);
mobility->SetPosition (Vector (x, y, 0.0));
}

View File

@@ -43,12 +43,12 @@ HierarchicalMobilityModel::HierarchicalMobilityModel (Ptr<MobilityModel> child,
if (childNotifier == 0)
{
childNotifier = CreateObject<MobilityModelNotifier> ();
child->AddInterface (childNotifier);
child->AggregateObject (childNotifier);
}
if (parentNotifier == 0)
{
parentNotifier = CreateObject<MobilityModelNotifier> ();
parent->AddInterface (parentNotifier);
parent->AggregateObject (parentNotifier);
}
childNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this));
parentNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ParentChanged, this));

View File

@@ -53,7 +53,7 @@ Ns2MobilityFileTopology::GetMobilityModel (std::string idString, const ObjectSto
if (model == 0)
{
model = CreateObject<StaticSpeedMobilityModel> ();
object->AddInterface (model);
object->AggregateObject (model);
}
return model;
}

View File

@@ -68,7 +68,7 @@ void
RandomTopology::LayoutOne (Ptr<Object> object)
{
Ptr<MobilityModel> mobility = m_mobilityModel.CreateObject ()->GetObject<MobilityModel> ();
object->AddInterface (mobility);
object->AggregateObject (mobility);
Vector position = m_positionModel->Get ();
mobility->SetPosition (position);
}

View File

@@ -116,7 +116,7 @@ Node::Construct (void)
{
m_id = NodeList::Add (this);
Ptr<PacketSocketFactory> socketFactory = CreateObject<PacketSocketFactory> ();
AddInterface (socketFactory);
AggregateObject (socketFactory);
}
Node::~Node ()

View File

@@ -367,7 +367,7 @@ GlobalRouteManagerImpl::SelectRouterNodes ()
node->GetId ());
Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> ();
node->AddInterface (globalRouter);
node->AggregateObject (globalRouter);
}
}

View File

@@ -173,7 +173,7 @@ AgentImpl::AgentImpl (Ptr<Node> node)
m_queuedMessagesTimer.SetFunction (&AgentImpl::SendQueuedMessages, this);
// Aggregate with the Node, so that OLSR dies when the node is destroyed.
node->AddInterface (this);
node->AggregateObject (this);
m_packetSequenceNumber = OLSR_MAX_SEQ_NUM;
m_messageSequenceNumber = OLSR_MAX_SEQ_NUM;

View File

@@ -94,7 +94,7 @@ int model_init (int argc, char *argv[], double *x1, double *y1, double *x2, doub
for (uint32_t i = 0; i < g_numNodes; i++)
{
Ptr<Node> node = CreateObject<Node> ();
node->AddInterface (CreateObject<MobilityModelNotifier> ());
node->AggregateObject (CreateObject<MobilityModelNotifier> ());
}
topology.Layout (NodeList::Begin (), NodeList::End ());

View File

@@ -117,7 +117,7 @@ PrintDefaultValuesDoxygen (std::ostream &os)
int main (int argc, char *argv[])
{
Ptr<Node> node = CreateObject<InternetNode> ();
node->AddInterface (CreateObject<MobilityModelNotifier> ());
node->AggregateObject (CreateObject<MobilityModelNotifier> ());
Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> (node);
p2p->AddQueue (Queue::CreateDefault ());