1
0
Fork 0

Move tiedpropertylist from flightgear to simgear

This commit is contained in:
Torsten Dreyer 2011-02-06 15:44:09 +01:00
parent 0d233c0dfc
commit d1b35578c8
8 changed files with 12 additions and 93 deletions

View file

@ -25,7 +25,7 @@
#include <simgear/compiler.h>
#include <cmath>
#include "tiedpropertylist.hxx"
#include <simgear/props/tiedpropertylist.hxx>
/**
* Model the natural environment.
@ -146,7 +146,7 @@ private:
double wind_from_down_fps;
bool live_update;
TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
};

View file

@ -123,7 +123,7 @@ private:
LayerTable _aloft_table;
FGEnvironment _environment;
TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
};
//////////////////////////////////////////////////////////////////////////////

View file

@ -25,7 +25,7 @@
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/math/SGMath.hxx>
#include "tiedpropertylist.hxx"
#include <simgear/props/tiedpropertylist.hxx>
#ifdef SG_HAVE_STD_INCLUDES
# include <cmath>
@ -96,7 +96,7 @@ private:
FGClouds *fgClouds;
SGPropertyNode_ptr _altitudeNode;
bool _cloudLayersDirty;
TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
};
#endif // _ENVIRONMENT_MGR_HXX

View file

@ -24,7 +24,6 @@
#include <Airports/simple.hxx>
#include <simgear/props/props.hxx>
#include "tiedpropertylist.hxx"
namespace Environment {

View file

@ -25,7 +25,7 @@
#include <Airports/simple.hxx>
#include <simgear/props/props.hxx>
#include "tiedpropertylist.hxx"
#include <simgear/props/tiedpropertylist.hxx>
namespace Environment {
@ -89,7 +89,7 @@ private:
bool _snow_cover;
std::string _decoded;
protected:
TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
MagneticVariation * _magneticVariation;
};

View file

@ -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 <simgear/structure/exception.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/props/tiedpropertylist.hxx>
#include <algorithm>
#if defined(ENABLE_THREADS)
#include <OpenThreads/Thread>
@ -105,7 +105,7 @@ protected:
bool _enabled;
bool __enabled;
TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
; typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
MetarPropertiesList _metarProperties;
};

View file

@ -32,7 +32,7 @@
#include "terrainsampler.hxx"
using simgear::PropertyList;
#include "tiedpropertylist.hxx"
#include <simgear/props/tiedpropertylist.hxx>
namespace Environment {
/**
@ -93,7 +93,7 @@ private:
SGPropertyNode_ptr _positionLongitudeNode;
deque<double> _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 ) :

View file

@ -1,80 +0,0 @@
#ifndef __TIEDPROPERTYLIST_HXX
#define __TIEDPROPERTYLIST_HXX
#include <simgear/props/props.hxx>
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<typename T> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, const SGRawValue<T> &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 <class V> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, V * value, bool useDefault = true ) {
return Tie( node, SGRawValuePointer<V>(value), useDefault );
}
template <class V> SGPropertyNode_ptr Tie( const char * relative_path, V * value, bool useDefault = true ) {
return Tie( _root->getNode(relative_path,true), SGRawValuePointer<V>(value), useDefault );
}
template <class V> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true ) {
return Tie(node, SGRawValueFunctions<V>(getter, setter), useDefault );
}
template <class V> SGPropertyNode_ptr Tie( const char * relative_path, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true ) {
return Tie(_root->getNode(relative_path, true), SGRawValueFunctions<V>(getter, setter), useDefault );
}
template <class V> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, int index, V (*getter)(int), void (*setter)(int, V) = 0, bool useDefault = true) {
return Tie( node, SGRawValueFunctionsIndexed<V>(index, getter, setter), useDefault );
}
template <class V> 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<V>(index, getter, setter), useDefault );
}
template <class T, class V> SGPropertyNode_ptr Tie( SGPropertyNode_ptr node, T * obj, V (T::*getter)() const, void (T::*setter)(V) = 0, bool useDefault = true) {
return Tie( node, SGRawValueMethods<T,V>(*obj, getter, setter), useDefault );
}
template <class T, class V> 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<T,V>(*obj, getter, setter), useDefault );
}
template <class T, class V> 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<T,V>(*obj, index, getter, setter), useDefault);
}
template <class T, class V> 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<T,V>(*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