I don't think that's something we want to do in general, because storing the callbacks would make the message objects much bigger, and checking for their presence would add branches in all the setter methods, both of which would harm performance. That said, you could write a custom protoc which generates wrapper objects that wrap the standard C++ objects and adds your functionality. Or you could just modify the C++ code generator for your own use.
On Mon, Mar 2, 2009 at 9:32 AM, Tim <timbla...@gmail.com> wrote: > > I would be using pb message structs not only as a messages between > objects, but also for data storage within active objects in an > embedded c++ app. This makes the most sense, in terms of minimizing > copies. I would like to be able to extend whatever framework we choose > to be able to automate actions when certain fields of an object's > message member are changed. > > The objects in our application have several interfaces which may read > and write object data. The nice thing about using PB for us is that it > allows us to generalize these interfaces so that they all ultimately > call the same generic "setAttrs" kind of method. I'd like for these > objects to be able to register callbacks within the framework so that, > for example, NotifyNewLevel() gets called when the "level" field > changes, regardless of what interface did the setting. The detection > of a changing message field would be managed by the framework so you > don't have to do extra "did the field change" and "if so, what should > I do about it now?" checks at a higher level. Is this sort of > consideration on anyone's radar? > > Tim > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---