[Ns-developers] [ns3] topology API

Tom Henderson tomh at tomh.org
Thu Jan 17 22:32:06 PST 2008


Craig,
I like this model for possibly building some topology or scenario code. 
  However, I am not sure that we want the whole bowels of the ns-3 
system inverted for such access.  In the example you posted, we are 
talking about asking users to write:

   Ptr<NetDevice>
MyWirelessClusterFramework::CreateNetDevice (Ptr<Node> n, Ptr<Channel> ch)
{
   Ptr<WifiNetDevice> nd = CreateObject<WifiNetDevice> (n);

   Ptr<CraigsWierdRateControl> rate =
     CreateObject<CraigsWierdRateControl> (param1, param2, param3);

   nd->SetRateControl (rate);

   return nd;
}

where presently they could write something like:

DefaultValue::Bind ("WifiNetDevice::RateControl", "CraigsRateControl");

if the constructors matched.

My main concern about delegating object creation to the user in every 
case is that we seem to be losing the capability for such simple APIs as 
above for modifying the construction of composite objects like 
InternetNode and NetDevice.

But it seems in your most recent post that you are suggesting some kind 
of middle ground where both a component manager and inversion of control 
could be applied where needed:

 > - Leave the ability to substitute "components" in simple cases (i.e.,
 > "TcpRaj" vs. "TcpReno" in cases where their constructors are default or
 > identical);
 > - Use the frameworks approach to bring methods "out from the bowels" 
in more
 > difficult situations for greatest flexibility.
 >

which appeals to me as well.

Tom


More information about the Ns-developers mailing list