[Ns-bugs] [Bug 50] New: The example code on the page Low-level tracing page does not compile

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Fri Jul 13 12:11:33 PDT 2007


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

           Summary: The example code on the page Low-level tracing page does
                    not compile
           Product: ns-3
           Version: pre-release
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P3
         Component: documentation
        AssignedTo: ns-bugs at isi.edu
        ReportedBy: emmanuelle.laprise at bluekazoo.ca


I am trying to create a trace sink to do some tracing. I tried to follow the
example on the Low-level tracing page in the Doxygen documentation.

There are two problems:
1) The code:
 void MyTraceSink (TraceContext const &context, Packet &packet)
 {
   NodeList::Index index;
   context.Get (index);
   std::cout << "node id=" << NodeList::GetNode (index)->GetId () << std::endl;
 }

Should be changed to:


 void MyTraceSink (TraceContext const &context, Packet &packet)
 {
   NodeList::NodeIndex index;
   context.Get (index);
   std::cout << "node id=" << NodeList::GetNode (index)->GetId () << std::endl;
 }

2) The command:
   TraceRoot::Connect ("/nodes/ * / Ipv4 / *", MakeCallback
(&TraceSink::MyTraceSink));
Which I assume can be put in the main file gives the following compile error:
examples/simple-multipoint.cc:154: error: no matching function for call to
'MakeCallback(void (ns3::TraceSink::*)(const ns3::TraceContext&,
ns3::Packet&))'

Now, if I have that command in another class, I can use:
TraceRoot::Connect ("/nodes/ * / Ipv4 / *", MakeCallback
(&TraceSink::MyTraceSink, this));

What does the "this" do?

Thanks,

Emmanuelle


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