Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion On callbacks
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
C Facchini  
View profile  
 More options Sep 16 2009, 6:48 pm
From: C Facchini <c.facch...@gmail.com>
Date: Wed, 16 Sep 2009 15:48:10 -0700 (PDT)
Local: Wed, Sep 16 2009 6:48 pm
Subject: Re: On callbacks
Thank you so much!
It works, plus now I got where I was stuck.

> We usually frown on passing pointers around in ns-3, but prefer to use
> Objects and our reference counting system.  The example above works, but you
> have got to be very, very careful about the lifetime of that ofstream.

> If you look at the CsmaHelper, you will see that the MakeBoundCallback takes
> a Ptr<PcapWriter> as the bound parameter.  This points to an Object that, in
> turn, holds the ofstream object; and so you can pass the Ptr<PcapWriter>
> around by value just fine.  As long as someone has a reference to the
> underlying writer it stays around taking care of the lifetime issue
> automagically.

> So I would take that approach and make my own kind of writer.

I've noticed that every EnableAscii() resorts to AsciiWriter, but I
thought it was overly complicated for my programming skills (that's
why I decided to use just an ostream, which turns out to be more harm
than good as the programmer in question doesn't know how to tame wild
pointers :).

I tried writing my own AsciiWriter and have some scope issues. But
since this problem is not Callback-related, I'd better start another
topic.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.