[ndnSIM] Print() in ndn-pit-impl.h

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Aug 7 14:59:45 PDT 2013


Hi Kang,

Print method is defined to return nothing:

  virtual void
  Print (std::ostream &os) const;

So, you cannot really use it they way you tried.  But simple change should fix your problem:

  std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"
            << node->GetId () << "\t"
            << Names::FindName (node) << "\t"
            << pit->GetSize () << "\n";

  pit->Print(std::cout);
  std::cout << "\n";

---
Alex

PS
Not sure what happened, but somehow either your email client or the smtp provider completely destroyed format of your message (I had to dig in into the message source to get readable text back).  You may try to use the HTML format next time.

On Aug 7, 2013, at 2:28 PM, 강승석 <msukang at swu.ac.kr> wrote:

> Dear Manager,
> 
> I have a very simple question.
> 
> I'd like to use a Print() method defined in nun-pit-impl.h.
> 
> My slightly modified code in ndn-simple-with-pit-count-stats.cc is as follo=
> ws.
> 
> void
> PeriodicStatsPrinter (Ptr<Node> node, Time next)
> {
>   Ptr<ndn::Pit> pit =3D node->GetObject<ndn::Pit> ();
> 
>   std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"
>             << node->GetId () << "\t"
>             << Names::FindName (node) << "\t"
>             << pit->GetSize () << "\n"
>             << pit->Print(std::cout) << "\n";    //  <<<=3D=3D=3D Here!!
> }
> 
> When I added the pit->Print() statement, it produces a long error.
> 
> What will be the proper argument in the Print() method?
> 
> Thanks in advance
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130807/5742b399/attachment.html>


More information about the ndnSIM mailing list