From d1b35578c86b47596fd77cdc397689503c00345e Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 6 Feb 2011 15:44:09 +0100 Subject: [PATCH] Move tiedpropertylist from flightgear to simgear --- src/Environment/environment.hxx | 4 +- src/Environment/environment_ctrl.cxx | 2 +- src/Environment/environment_mgr.hxx | 4 +- src/Environment/metarairportfilter.hxx | 1 - src/Environment/metarproperties.hxx | 4 +- src/Environment/realwx_ctrl.cxx | 4 +- src/Environment/terrainsampler.cxx | 6 +- src/Environment/tiedpropertylist.hxx | 80 -------------------------- 8 files changed, 12 insertions(+), 93 deletions(-) delete mode 100644 src/Environment/tiedpropertylist.hxx diff --git a/src/Environment/environment.hxx b/src/Environment/environment.hxx index 048b17992..c1da68037 100644 --- a/src/Environment/environment.hxx +++ b/src/Environment/environment.hxx @@ -25,7 +25,7 @@ #include #include -#include "tiedpropertylist.hxx" +#include /** * Model the natural environment. @@ -146,7 +146,7 @@ private: double wind_from_down_fps; bool live_update; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; }; diff --git a/src/Environment/environment_ctrl.cxx b/src/Environment/environment_ctrl.cxx index d4ebbf595..c182f0625 100644 --- a/src/Environment/environment_ctrl.cxx +++ b/src/Environment/environment_ctrl.cxx @@ -123,7 +123,7 @@ private: LayerTable _aloft_table; FGEnvironment _environment; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/src/Environment/environment_mgr.hxx b/src/Environment/environment_mgr.hxx index d9c770319..e6041f813 100644 --- a/src/Environment/environment_mgr.hxx +++ b/src/Environment/environment_mgr.hxx @@ -25,7 +25,7 @@ #include #include #include -#include "tiedpropertylist.hxx" +#include #ifdef SG_HAVE_STD_INCLUDES # include @@ -96,7 +96,7 @@ private: FGClouds *fgClouds; SGPropertyNode_ptr _altitudeNode; bool _cloudLayersDirty; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; }; #endif // _ENVIRONMENT_MGR_HXX diff --git a/src/Environment/metarairportfilter.hxx b/src/Environment/metarairportfilter.hxx index 568a28b95..f31eb64f5 100644 --- a/src/Environment/metarairportfilter.hxx +++ b/src/Environment/metarairportfilter.hxx @@ -24,7 +24,6 @@ #include #include -#include "tiedpropertylist.hxx" namespace Environment { diff --git a/src/Environment/metarproperties.hxx b/src/Environment/metarproperties.hxx index 0e157169e..7d108100d 100644 --- a/src/Environment/metarproperties.hxx +++ b/src/Environment/metarproperties.hxx @@ -25,7 +25,7 @@ #include #include -#include "tiedpropertylist.hxx" +#include namespace Environment { @@ -89,7 +89,7 @@ private: bool _snow_cover; std::string _decoded; protected: - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; MagneticVariation * _magneticVariation; }; diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index 98fe6ed3b..197f4cf52 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -25,7 +25,6 @@ #endif #include "realwx_ctrl.hxx" -#include "tiedpropertylist.hxx" #include "metarproperties.hxx" #include "metarairportfilter.hxx" #include "fgmetar.hxx" @@ -34,6 +33,7 @@ #include #include +#include #include #if defined(ENABLE_THREADS) #include @@ -105,7 +105,7 @@ protected: bool _enabled; bool __enabled; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; ; typedef std::vector MetarPropertiesList; MetarPropertiesList _metarProperties; }; diff --git a/src/Environment/terrainsampler.cxx b/src/Environment/terrainsampler.cxx index 276c8ffb1..0d08af84e 100644 --- a/src/Environment/terrainsampler.cxx +++ b/src/Environment/terrainsampler.cxx @@ -32,7 +32,7 @@ #include "terrainsampler.hxx" using simgear::PropertyList; -#include "tiedpropertylist.hxx" +#include namespace Environment { /** @@ -93,7 +93,7 @@ private: SGPropertyNode_ptr _positionLongitudeNode; deque _elevations; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; }; AreaSampler::AreaSampler( SGPropertyNode_ptr rootNode ) : @@ -329,7 +329,7 @@ private: SGPropertyNode_ptr _rootNode; bool _enabled; - TiedPropertyList _tiedProperties; + simgear::TiedPropertyList _tiedProperties; }; TerrainSamplerImplementation::TerrainSamplerImplementation( SGPropertyNode_ptr rootNode ) : diff --git a/src/Environment/tiedpropertylist.hxx b/src/Environment/tiedpropertylist.hxx deleted file mode 100644 index cfdd57c97..000000000 --- a/src/Environment/tiedpropertylist.hxx +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __TIEDPROPERTYLIST_HXX -#define __TIEDPROPERTYLIST_HXX -#include -using simgear::PropertyList; - -// Maybe this goes into SimGear's props.hxx later? -class TiedPropertyList : PropertyList { -public: - TiedPropertyList() {} - TiedPropertyList( SGPropertyNode_ptr root ) : _root(root) {} - - void setRoot( SGPropertyNode_ptr root ) { _root = root; } - SGPropertyNode_ptr getRoot() const { return _root; } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, const SGRawValue &rawValue, bool useDefault = true ) { - bool success = node->tie( rawValue, useDefault ); - if( success ) { - SG_LOG( SG_ALL, SG_INFO, "Tied " << node->getPath() ); - push_back( node ); - } else { -#if PROPS_STANDALONE - cerr << "Failed to tie property " << node->getPath() << endl; -#else - SG_LOG(SG_GENERAL, SG_WARN, "Failed to tie property " << node->getPath() ); -#endif - } - return node; - } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, V * value, bool useDefault = true ) { - return Tie( node, SGRawValuePointer(value), useDefault ); - } - - template SGPropertyNode_ptr Tie( const char * relative_path, V * value, bool useDefault = true ) { - return Tie( _root->getNode(relative_path,true), SGRawValuePointer(value), useDefault ); - } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true ) { - return Tie(node, SGRawValueFunctions(getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( const char * relative_path, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true ) { - return Tie(_root->getNode(relative_path, true), SGRawValueFunctions(getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, int index, V (*getter)(int), void (*setter)(int, V) = 0, bool useDefault = true) { - return Tie( node, SGRawValueFunctionsIndexed(index, getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( const char * relative_path, int index, V (*getter)(int), void (*setter)(int, V) = 0, bool useDefault = true) { - return Tie( _root->getNode( relative_path, true ), SGRawValueFunctionsIndexed(index, getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, T * obj, V (T::*getter)() const, void (T::*setter)(V) = 0, bool useDefault = true) { - return Tie( node, SGRawValueMethods(*obj, getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( const char * relative_path, T * obj, V (T::*getter)() const, void (T::*setter)(V) = 0, bool useDefault = true) { - return Tie( _root->getNode( relative_path, true), SGRawValueMethods(*obj, getter, setter), useDefault ); - } - - template SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, T * obj, int index, V (T::*getter)(int) const, void (T::*setter)(int, V) = 0, bool useDefault = true) { - return Tie( node, SGRawValueMethodsIndexed(*obj, index, getter, setter), useDefault); - } - - template SGPropertyNode_ptr Tie( const char * relative_path, T * obj, int index, V (T::*getter)(int) const, void (T::*setter)(int, V) = 0, bool useDefault = true) { - return Tie( _root->getNode( relative_path, true ), SGRawValueMethodsIndexed(*obj, index, getter, setter), useDefault); - } - - void Untie() { - while( size() > 0 ) { - SG_LOG( SG_ALL, SG_INFO, "untie of " << back()->getPath() ); - back()->untie(); - pop_back(); - } - } -private: - SGPropertyNode_ptr _root; -}; -#endif -- 2.39.5