[Ns-bugs] [Bug 518] New: Constructing objects from a TypeId seems complex

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Mon Mar 9 07:33:07 PDT 2009


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

           Summary: Constructing objects from a TypeId seems complex
           Product: ns-3
           Version: ns-3-dev
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: simulation core
        AssignedTo: ns-bugs at isi.edu
        ReportedBy: gjcarneiro at gmail.com
   Estimated Hours: 0.0


>From the code I am writing:

void AddWimetronetStack (Ptr<Node> node, NodeId nodeId, TypeId
terminalMobility)
{
[...]
      terminalMobilityStrategy = Ptr<wmrp::TerminalMobilityStrategy>
(dynamic_cast<wmrp::TerminalMobilityStrategy*> (terminalMobility.GetConstructor
()()), false);
[...]

So, given a TypeId, creating an object of that typeid seems rather more complex
than the average NS-3 programmer will be able to discern.  Good thing I am not
an average programmer, but I feel sorry for the poor souls that will need to do
this too :-)

A good candidate for a better API could be (for example):

Ptr<T> TypeId::CreateObject () const;


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


More information about the Ns-bugs mailing list