On Mon, Feb 23, 2009 at 7:01 PM, <timbla...@gmail.com> wrote:
> In my application, I have a need to track characteristics of message
> fields on a field-by-field basis, e.g. has this field changed. This is
> very much like what is already done in libprotobuf code for tracking
> whether a field has been set yet. Looking under the hood, I found the
> _has_bits_, a simple bitfield tracking mechanism, and thought I could
> reuse this for tracking other characteristics my app is interested in.
> So far, though, it looks like the bit numbers are hard-coded in the
> _set_bit/_clear_bit/has_bit method calls. Is there any plan to modify
> the compiler to define these field bits as constants or at least
> #defines in the generated c++ header file?
_has_bits_ is an internal (private) implementation detail. We don't plan to
make it publicly-accessible.
Aside from this general question, is there another simple way you can
> think of to track what fields have changed? I couldn't find anything
> in the API that allowed diff'ing two instances of the same message
> class. (I also couldn't find any equality operators, so had to define
> that myself; please advise if this was unnecessary.)
It's not included in the base library, but you could write code to do this
based on reflection.
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at