[Opengc-devel] ogcDataSource.h comments requested
Status: Pre-Alpha
Brought to you by:
madmartigan
From: Damion S. <dam...@ho...> - 2002-09-14 21:17:06
|
Hi everyone, I've begun preliminary modifications on the ogcDataSource base class to provide the generic ability to get and set values of variables. To clarify the distinction: Old model: all variables are public, access to them is not controlled, writing to flight model is impossible New model: all variables are protected, access to them occurs with Get/Set functions. Writing to flight model occurs with appropriate Set call. To this end I've started putting together compiler macros (defined at the beginning of ogcDataSource.h) which automatically generate the approprate Get/Set functions and member variables from a one-line declaration. This saves you time in coding and makes the header easier to read. I also changed the documentation style, so that the declaration of a single variable now looks like: /** The number of cows being transported */ ogcDataReadMacro(Num_Cows_In_Baggage, int); Note that ogcDataReadMacro does not generate a Set() function; it's intended for variables which are "read-only" as far as the flight model is concerned. Most variables stored in the data source fall into this category. The other macro is ogcDataReadWriteMacro, which generates a Set function that in its default implementation does nothing and should be overridden in a derived class to add specific functionality. Variables which can be written include commanded control surface deflections (for autopilots), nav radio settings, etc. As of right now, these updates do not affect existing code in any way. Although the eventual intent is to have all data members be protected members of the class, they are currently still public to maintain compatibility with existing code. At some point, once the initial conversion is finished, I'll notify the list that we should start converting over gauges, components, and any other code that accesses data sources to the Get/Set model. In most cases the change will be from: localCopy = m_pDataSource->Variable_Name to localCopy = m_pDataSource->GetVariable_Name(); so I don't anticipate that this will be a major problem. If you want to start doing this early, great. If not, that's fine too. Not all of the members of the data source class support Get() operations yet, only those defined using macros. I will have to add additional macros to handle strings and arrays of values (for the engines) and haven't done this yet. To summarize, what you should do now: 1) Look over the header file. Tell me what you like/dislike. Now's the time to complain if it doesn't meet your needs. 2) Begin converting your code to the Get() model, if possible (not yet possible for engines or autopilot code). 3) Feedback! The data source class is central to OpenGC and it's important that it's up to the job. Cheers, -Damion- _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |