[Ns-bugs] [Bug 277] star topologies are painful to create

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Fri Aug 8 15:16:13 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=277





------- Comment #4 from gjcarneiro at gmail.com  2008-08-08 18:16 -------
(In reply to comment #3)
> (In reply to comment #2)
> 
> > > std::pair<NetDeviceContainer,NetDeviceContainer> 
> > > PointToPointHelper::InstallStar (Ptr<Node> center, const NodeContainer
> > > &terminals);
> > > 
> > > The biggest issue with this proposal is what should be the return value of
> > > InstallStar. As an alternative to the above proposal, we could create a
> > > NetDeviceContainerPair class to mirror our use of std:: containers in the
> > > helper API.
> > 
> > Personally, I would rather have two separate return values.  And of course the
> > way to have two output parameters in C++ is to have output reference
> > parameters...  So:
> > 
> >   void CsmaHelper::InstallStar (Ptr<Node> center, const NodeContainer
> > &terminals, NetDeviceContainer &outCenterDevices, NetDeviceContainer
> > &outTerminalDevices);
> > 
> > In Python, with 'direction' parameter annotations this can become:
> > 
> >   csma = ns3.CmsmaHelper()
> >   centerDevices, outerDevices = csma.InstallStar(center, terminals)
> 
> 
> naively, I would have thought that this could be obtained in python with the
> std::pair<> version. At worst, you could write a simple C++ wrapper which
> converts the std::pair return value to a pair of arguments and is wrapped
> itself to InstallStar in python. I understand that this is annoying for the
> automatic wrapper generation but using input arguments in the c++ version would
> force users to unconditionally create variables to hold the result while they
> can conceivably ignore the return value of InstallStar when they don't need it.
> 

On the other hand, in case they _do_ need it (which I think is the more common
scenario), they will be forced to decode the meaning of the std::pair.  What
does 'first' hold, what does 'second' hold?  At least with output parameters,
the parameter names make it clearer.


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list