[Opengc-devel] status report
Status: Pre-Alpha
Brought to you by:
madmartigan
From: Damion S. <da...@op...> - 2003-12-30 18:16:39
|
Hi folks, A quick update as to what I've been working on in the past month. I _finally_ solved the problem of how to maintain an authoritative list of objects within the OpenGC world for the purposes of passing messages around (for instance, between the zoom in/out buttons on the nav display and the nav map). My first thought was to try to adapt the Object class from the Insight Toolkit project, but after several days of experimentation this proved to be much harder than I had hoped and required a great deal of code which would have no real function in OpenGC. The solution I ended up implementing is to write a simple ogcObject class that handles all of the message passing tasks, and then derive the RenderObject (and therefore all gauges) from this. Eventually, data sources and render windows will also be ogcObjects. The new ogcObject contains a static linked list of pointers to ogcObjects. The constructor of an ogcObject adds the "this" pointer to this list and the destructor searches the list and removes it. The net result is that there is a statically accessible list of all ogcObjects; message passing occurs by iterating through this list and posting the message to each object. In retrospect this is a fairly obvious solution, and it seems to work as expected. The code that was "broken" in the new OpenGC repository (the map zoom, keypad demo, etc.) is now working again. I've updated the opengcnew CVS repository if you want to give this a try. The other model for message passing that I plan on adding is a transmitter/receiver model. Right now, messages are dispatched to _all_ OpenGC objects even if they're only appropriate for one. Ambiguity could result if there were two nav displays, for example, because the zoom controls for one should not affect the other (but would, at the moment). This should be easy to avoid by providing a means to set certain objects as receivers of the messages of a particular "transmitter", and providing a second dispatch function that iterates only over a given object's receivers rather than every OpenGC object. Issues with my current design MAY include: 1) Thread safety 2) The inconvenience of having to initialize a static member (the object list) from outside the class I have not done much programming with static members, so if anyone can comment on the initialization process I'd appreciate it. Cheers, -Damion- |