[Opengc-devel] a few ideas...
Status: Pre-Alpha
Brought to you by:
madmartigan
From: Damion S. <dam...@ho...> - 2002-09-05 20:27:59
|
Hi, I've been kicking a few ideas around in my head and would like to solicit comments on the following ideas: 1) An OpenGC namespace. Instead making the distinction between OpenGC and "the rest of the world" based on naming convention (i.e. ogcDataSource) the distinction would be enforced with the namespace command. Within the namespace you would use DataSource, and outside of the namespace ogc::DataSource. 2) A substantial overhaul of the data source base class. There are several problems with my original design for the data source: a) All of the member variables are public, so read/write control is not enforced. An object in OpenGC can modify the data source without any other gauges knowing this occurred; they assume the value they see is from the sim. b) There is no way to know whether or not a particular data source is capable of reading/writing a particular piece of data. c) For that matter, there is no way at all to write data back to the flight model since the data source updates itself completely in a destructive fashion once per rendering cycle. It is essence read-only as far as interacting with the sim goes. So, how do we get around this? What I've come up with so far is a scheme that would resemble the following. The base class provides two accessor functions, GetValue() and SetValue(). Within a gauge, you refer to a particular piece of data using an enum. For example, to access the altitude in meters, you'd call GetValue(Altitude_Meters). Setting of values would be handled in a somewhat different fashion. The data source would collect all of the SetValue() calls that occur within a single rendering cycle without modifying the local values modified by the set call. At the end of the rendering cycle, the specific implementation of the data source (FSUIPCDataSource, for example) would be responsible for writing as much of this data as possible back to the sim. The other option, aside from an enum-based approach with the Get/SetValue() commands would be to code Get and Set functions for each variable defined in the data source. The default Get function would return a copy of the value stored in the data source and default Set function would do nothing, leaving specific implementation of the Set function up to the derived class. Though this would (probably) be more work than the enum approach, it might be more flexible. Each approach has it's ups and downs. Thoughts/comments? Cheers, -Damion- _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |