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 11 2009, 10:18 am
From: C Facchini <c.facch...@gmail.com>
Date: Fri, 11 Sep 2009 07:18:56 -0700 (PDT)
Local: Fri, Sep 11 2009 10:18 am
Subject: Re: On callbacks
Dear Craig,

first of all, thank you very much for the thorough and insightful
answer!
I so appreciated it.

> [snip]
>   TcpSocketImpl::m_cWnd

> Now, go and look in tcp-socket-impl.h for the declaration of this variable.

I was able to get there. Anyway, before reading your explanation I
couldn't get from there on.

> [...] in ./core/traced-value.h [...]
> You will find that the way these things work is to overload the operators
> that cause the value to be changed.  So you look for the = operator. If you
> look there [...] you will find a call to Set()

It didn't occur to me that changes happen only when the variable *is
actually changed*.
And the variable is changed by means of =, ++, +=, and so on.
In fact, all those operators contain a call to the Set method.

To be honest, I still don't get the motivations behind the macro
(TRACED_VALUE_DEBUG), but that's a minor issue anyway.

> One thing to point out is that the trace hook will only be called if the new
> value is different than the old value.  This sometimes surprises people.

Is it because tracking a variable on a regular time basis is more
difficult in discrete event simulators (and doesn't add anything)?

> So, in the case of TracedValue<uint32_t>, the T becomes int32_t and you have

thanks to the conversion operator:
  operator T () const { return m_v; }

>   int32_t v
>   int32_t m_v

> So m_cb is calling (via an overloaded operator () ) a method that takes two
> uint32_t, the first parameter is the existing (old) value and the second is
> the new value.
> Non trivial, but now you know how all TracedValue work since it is
> templated.

Definitely non trivial, at least for my programming skills.
Again thanks for taking the time to write such a clear explanation.

Regards,
Christian


 
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.