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
 
crai...@ee.washington.edu  
View profile  
 More options Sep 11 2009, 7:11 pm
From: <crai...@ee.washington.edu>
Date: Fri, 11 Sep 2009 16:11:15 -0700
Local: Fri, Sep 11 2009 7:11 pm
Subject: RE: On callbacks
[ ... ]

>   I guess TracedCallback is somewhat of a generic version for passing
> multiple parameters, and TracedValue for singular ones that you can do
> slight arithmetic with?

There is a more rigorous definition.  The documentation of TracedValue talks
about value semantics and so implies that a TracedValue is a trace source
that captures changes to an object with value semantics.

In general, value semantics just means that you can pass the object around,
not an address.  In order to use value semantics at all you have to have an
object with an associated copy constructor and assignment operator
available.  We extend the requirements to talk about the set of operators
that are pre-defined for plain-old-data (POD) types.  Operator=, operator++,
operator--, operator+, operator==, etc., etc.  You can see the list in
src/core/traced-value.h if you want.

I don't think there any instance in our codebase of a TracedValue tracing
anything but POD (uin32_t, int8_t, etc.), so I tend to think about
TracedValue in terms of tracing POD -- ints, chars, longs, shorts, etc.  You
can extend this to user defined types, but like I said I don't think anyone
has done that yet.  The signature of the trace sink is fixed since the
semantics are fixed (you get the old *value* and the new *value* of the
object with *value* semantics).

A TracedCallback is a completely different animal.  There is no object with
value semantics in sight.  What you are doing with a traced callback is just
executing a callback.  TracedCallback is essentially just a
point-to-multipoint connection between the trace source and sinks.  You can
define a callback any way you want, so the parameter list can be whatever
you want.  The compiler just makes sure that things match.

TracedValue -> objects with value semantics
TracedCallback -> generic callback

-- Craig


 
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.