[Ns-bugs] [Bug 138] Point-to-point netdevice queues aren't configurable from higher layers

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Fri Mar 7 03:01:50 PST 2008


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





------- Comment #5 from gjcarneiro at gmail.com  2008-03-07 06:01 -------
(In reply to comment #4)
> I prefer using GetObject.
> 

But keep in mind that:
 1- GetObject does some completely redundant work that dynamic_cast doesn't
have to do.  In particular now that types have parent types and all, I have
seen GetObject and TypeId::GetParent starting to appear in performance
profiling.

 2- Having a GetQueue () explicit method makes the code easier to use than
GetObject <something> ().  GetObject makes some things rather hidden from the
programmer; you can't tell there is a certain object aggregated by looking at
the header file alone.

 3- The main point of GetObject is to gain modularity and decoupling of
orthogonal aspects.  If netdevices always need to have queues, then we are not
getting anything.

So we potentially lose performance (1), readability (2), and do not gain
anything in return (3).  There's only one argument in favor of GetObject, here,
which is that it is easier to use.  But if we want easy to use, we might as
well redesign the GetQueue method like this:

template<typename QUEUE>
Ptr<QUEUE> GetQueue (void) const
{
  return dynamic_cast<QUEUE*> (PeekPointer (DoGetQueue ()));
}

Problem solved.  Or add my DynamicCast function.


-- 
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