14#ifndef PROPS_STANDALONE
15#define PROPS_STANDALONE 1
24#include "simgear/compiler.h"
25#include "JSBSim_API.h"
32# define SG_LOG(type, level, message) (type) ? (std::cerr <<message << endl) : (std::cout <<message << endl)
36#if !defined(BOOST_UTILITY_ENABLE_IF_HPP) && !defined(BOOST_CORE_ENABLE_IF_HPP)
39 template <
bool B,
class T =
void>
47 template <
class Cond,
class T =
void>
50 template <
bool B,
class T =
void>
58 template <
class Cond,
class T =
void>
63# include <boost/utility.hpp>
64# include <boost/type_traits/is_enum.hpp>
66# include <simgear/debug/logstream.hxx>
67# include <simgear/math/SGMathFwd.hxx>
68# include <simgear/math/sg_types.hxx>
70#include <simgear/structure/SGReferenced.hxx>
71#include <simgear/structure/SGSharedPtr.hxx>
79 class PropertyInterpolationMgr;
82std::istream& readFrom(std::istream& stream, T& result)
99 std::istringstream stream(str);
101 readFrom(stream, result);
110#pragma warn A sloppy coder has defined NONE as a macro!
115#pragma warn A sloppy coder has defined ALIAS as a macro!
120#pragma warn A sloppy coder has defined UNSPECIFIED as a macro!
125#pragma warn A sloppy coder has defined BOOL as a macro!
130#pragma warn A sloppy coder has defined INT as a macro!
135#pragma warn A sloppy coder has defined LONG as a macro!
140#pragma warn A sloppy coder has defined FLOAT as a macro!
145#pragma warn A sloppy coder has defined DOUBLE as a macro!
150#pragma warn A sloppy coder has defined STRING as a macro!
182#define DEFINTERNALPROP(TYPE, PROP) \
184struct PropertyTraits<TYPE> \
186 static const Type type_tag = PROP; \
187 enum { Internal = 1 }; \
190DEFINTERNALPROP(
bool, BOOL);
191DEFINTERNALPROP(
int, INT);
192DEFINTERNALPROP(
long, LONG);
193DEFINTERNALPROP(
float, FLOAT);
194DEFINTERNALPROP(
double, DOUBLE);
195DEFINTERNALPROP(
const char *, STRING);
196DEFINTERNALPROP(
const char[], STRING);
197#undef DEFINTERNALPROP
258 virtual std::ostream&
printOn(std::ostream& stream)
const = 0;
262 virtual std::istream&
readFrom(std::istream& stream) = 0;
269template<typename T, int internal = simgear::props::PropertyTraits<T>::Internal>
281 virtual std::ostream& printOn(std::ostream& stream)
const;
282 virtual std::istream& readFrom(std::istream& stream);
446 virtual bool setValue (T value) { *_ptr = value;
return true; }
494 : _getter(getter), _setter(setter) {}
509 if (_getter)
return (*_getter)();
521 if (_setter) { (*_setter)(value);
return true; }
552 typedef T (*getter_t)(int);
553 typedef void (*setter_t)(int,T);
555 : _index(index), _getter(getter), _setter(setter) {}
558 if (_getter)
return (*_getter)(_index);
562 if (_setter) { (*_setter)(_index, value);
return true; }
565 virtual SGRaw* clone ()
const {
581template <
class C,
class T>
585 typedef T (C::*getter_t)()
const;
586 typedef void (C::*setter_t)(T);
588 : _obj(obj), _getter(getter), _setter(setter) {}
591 if (_getter) {
return (_obj.*_getter)(); }
595 if (_setter) { (_obj.*_setter)(value);
return true; }
598 virtual SGRaw* clone ()
const {
614template <
class C,
class T>
618 typedef T (C::*getter_t)(
int)
const;
619 typedef void (C::*setter_t)(
int, T);
621 getter_t getter = 0, setter_t setter = 0)
622 : _obj(obj), _index(index), _getter(getter), _setter(setter) {}
625 if (_getter) {
return (_obj.*_getter)(_index); }
629 if (_setter) { (_obj.*_setter)(_index, value);
return true; }
632 virtual SGRaw* clone ()
const {
673 virtual bool setValue (T value) { _obj = value;
return true; }
696 return stream << static_cast<SGRawValue<T>*>(
this)->getValue();
703 simgear::readFrom(stream, value);
712typedef SGSharedPtr<SGPropertyNode> SGPropertyNode_ptr;
713typedef SGSharedPtr<const SGPropertyNode> SGConstPropertyNode_ptr;
717typedef std::vector<SGPropertyNode_ptr> PropertyList;
746 std::vector<SGPropertyNode *> _properties;
761 MAX_STRING_LEN = 1024
856 int nChildren ()
const {
return (
int)_children.size(); }
874 bool hasChild (
const char * name,
int index = 0)
const
876 return (getChild(name, index) != 0);
882 bool hasChild (
const std::string& name,
int index = 0)
const
884 return (getChild(name, index) != 0);
896 bool append =
true );
900 {
return addChild(name.c_str(), min_index, append); }
913 bool append =
true );
919 bool create =
false);
920 SGPropertyNode * getChild (
const std::string& name,
int index = 0,
921 bool create =
false);
931 {
return getChild(name.c_str(), index); }
943 {
return getChildren(name.c_str()); }
967 SGPropertyNode_ptr
removeChild(
const std::string& name,
int index = 0)
968 {
return removeChild(name.c_str(), index); }
979 {
return removeChildren(name.c_str()); }
1006 {
return alias(path.c_str()); }
1041 std::string
getPath (
bool simplify =
false)
const;
1065 {
return getNode(relative_path.c_str(), create); }
1078 bool create =
false);
1091 bool create =
false)
1092 {
return getNode(relative_path.c_str(), index, create); }
1103 {
return getNode(relative_path.c_str()); }
1123 {
return getNode(relative_path.c_str(), index); }
1139 (state ? _attr |= attr : _attr &= ~attr);
1205 template<
typename T>
1207 ::type* dummy = 0)
const;
1209 template<
typename T>
1211 ::type* dummy = 0)
const;
1216 template<
typename T,
typename T_get >
1217 std::vector<T> getChildValues(
const std::string& name)
const;
1222 template<
typename T>
1223 std::vector<T> getChildValues(
const std::string& name)
const;
1264 {
return setStringValue(value.c_str()); }
1272 template<
typename T>
1273 bool setValue(
const T& val,
1277 template<
typename T>
1278 bool setValue(
const T& val,
1283 bool setValue(
const char (&val)[N])
1285 return setValue(&val[0]);
1296 template<
typename T>
1300 bool ret = node->setValue(value);
1305#if !PROPS_STANDALONE
1314 bool interpolate(
const std::string& type,
1316 double duration = 0.6,
1317 const std::string& easing =
"swing" );
1327 bool interpolate(
const std::string& type,
1328 const simgear::PropertyList& values,
1329 const double_list& deltas,
1330 const std::string& easing =
"swing" );
1335 static void setInterpolationMgr(simgear::PropertyInterpolationMgr* mgr);
1340 static simgear::PropertyInterpolationMgr* getInterpolationMgr();
1346 std::ostream&
printOn(std::ostream& stream)
const;
1361 template<
typename T>
1362 bool tie(
const SGRawValue<T> &rawValue,
bool useDefault =
true);
1385 {
return getType(relative_path.c_str()); }
1396 {
return hasValue(relative_path.c_str()); }
1402 bool defaultValue =
false)
const;
1408 bool defaultValue =
false)
const
1409 {
return getBoolValue(relative_path.c_str(), defaultValue); }
1415 int defaultValue = 0)
const;
1421 int defaultValue = 0)
const
1422 {
return getIntValue(relative_path.c_str(), defaultValue); }
1429 long defaultValue = 0L)
const;
1435 long defaultValue = 0L)
const
1436 {
return getLongValue(relative_path.c_str(), defaultValue); }
1442 float defaultValue = 0.0f)
const;
1448 float defaultValue = 0.0f)
const
1449 {
return getFloatValue(relative_path.c_str(), defaultValue); }
1456 double defaultValue = 0.0)
const;
1462 double defaultValue = 0.0)
const
1463 {
return getDoubleValue(relative_path.c_str(), defaultValue); }
1469 const char * defaultValue =
"")
const;
1476 const char * defaultValue =
"")
const
1477 {
return getStringValue(relative_path.c_str(), defaultValue); }
1489 {
return setBoolValue(relative_path.c_str(), value); }
1501 {
return setIntValue(relative_path.c_str(), value); }
1513 {
return setLongValue(relative_path.c_str(), value); }
1525 {
return setFloatValue(relative_path.c_str(), value); }
1537 {
return setDoubleValue(relative_path.c_str(), value); }
1545 bool setStringValue(
const char * relative_path,
const std::string& value)
1546 {
return setStringValue(relative_path, value.c_str()); }
1551 {
return setStringValue(relative_path.c_str(), value); }
1553 bool setStringValue (
const std::string& relative_path,
1554 const std::string& value)
1555 {
return setStringValue(relative_path.c_str(), value.c_str()); }
1566 bool isTied (
const char * relative_path)
const;
1571 bool isTied (
const std::string& relative_path)
const
1572 {
return isTied(relative_path.c_str()); }
1578 bool useDefault =
true);
1584 bool useDefault =
true)
1585 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1592 bool useDefault =
true);
1598 bool useDefault =
true)
1599 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1606 bool useDefault =
true);
1612 bool useDefault =
true)
1613 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1620 bool useDefault =
true);
1626 bool useDefault =
true)
1627 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1634 bool useDefault =
true);
1640 bool useDefault =
true)
1641 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1648 bool useDefault =
true);
1654 bool useDefault =
true)
1655 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1661 bool untie (
const char * relative_path);
1666 bool untie (
const std::string& relative_path)
1667 {
return untie(relative_path.c_str()); }
1675 bool initial =
false);
1687 int nListeners ()
const {
return _listeners ? (int)_listeners->size() : 0; }
1749 SGPropertyNode_ptr eraseChild(simgear::PropertyList::iterator child);
1755 template<
typename Itr>
1758 static simgear::PropertyInterpolationMgr* _interpolation_mgr;
1763 bool get_bool ()
const;
1764 int get_int ()
const;
1765 long get_long ()
const;
1766 float get_float ()
const;
1767 double get_double ()
const;
1768 const char * get_string ()
const;
1771 bool set_bool (
bool value);
1772 bool set_int (
int value);
1773 bool set_long (
long value);
1774 bool set_float (
float value);
1775 bool set_double (
double value);
1776 bool set_string (
const char * value);
1782 const char * make_string ()
const;
1787 void trace_read ()
const;
1793 void trace_write ()
const;
1800 simgear::PropertyList _children;
1801 mutable std::string _buffer;
1821 std::vector<SGPropertyChangeListener *> * _listeners;
1824 template<
typename Itr>
1825 SGPropertyNode * getChildImpl (Itr begin, Itr end,
int index = 0,
bool create =
false);
1827 template<
typename Itr>
1828 SGPropertyNode* getExistingChild (Itr begin, Itr end,
int index);
1830 template<
typename SplitItr>
1832 bool create,
int last_index);
1868inline const char * getValue<const char*>(
const SGPropertyNode* node)
1874inline std::string getValue<std::string>(
const SGPropertyNode* node)
1909inline bool setValue (
SGPropertyNode* node,
const std::string& value)
1918 if (_type == ALIAS || _tied)
1921 useDefault = useDefault &&
hasValue();
1924 old_val = getValue<T>(
this);
1931 _value.val = rawValue.clone();
1947 ::PropertyTraits<T>::Internal>::type* dummy)
const
1950 if (_attr == (READ|WRITE) && _type == EXTENDED
1965 return simgear::parseString<T>(make_string());
1975 ::PropertyTraits<T>::Internal>::type* dummy)
const
1977 return ::getValue<T>(
this);
1980template<
typename T,
typename T_get >
1983 const simgear::PropertyList& props =
getChildren(name);
1984 std::vector<T> values( props.size() );
1986 for(
size_t i = 0; i < props.size(); ++i )
1987 values[i] = props[i]->getValue<T_get>();
1996 return getChildValues<T, T>(name);
2000bool SGPropertyNode::setValue(
const T& val,
2002 ::PropertyTraits<T>::Internal>::type* dummy)
2005 if (_attr == (READ|WRITE) && _type == EXTENDED
2011 && ((_type == EXTENDED
2013 || _type == NONE || _type == UNSPECIFIED)) {
2014 if (_type == NONE || _type == UNSPECIFIED) {
2029inline bool SGPropertyNode::setValue(
const T& val,
2031 ::PropertyTraits<T>::Internal>::type* dummy)
2033 return ::setValue(
this, val);
2042 return parent->
getChild(name, index,
true);
2051template<
typename StringType>
2054 return parent->
getNode(name,
true);
2073 bool operator()(SGPropertyNode_ptr lhs,
const SGPropertyNode* rhs)
const
2077 bool operator()(
const SGPropertyNode* lhs, SGPropertyNode_ptr rhs)
const
2081 bool operator()(SGPropertyNode_ptr lhs, SGPropertyNode_ptr rhs)
const
2091 return hash_value(*node);
2093 size_t operator()(SGPropertyNode_ptr node)
const
2095 return hash_value(*node);
2111 SGPropertyNode_ptr property,
bool initial=
false)
2112 : _obj(obj), _callback(method), _property(property)
2114 _property->addChangeListener(
this,initial);
2118 _obj(other._obj), _callback(other._callback), _property(other._property)
2120 _property->addChangeListener(
this,
false);
2125 _property->removeChangeListener(
this);
2129 (_obj->*_callback)(node);
2134 SGPropertyNode_ptr _property;
Convenience class for change listener callbacks without creating a derived class implementing a "valu...
void valueChanged(SGPropertyNode *node)
Called if value of node has changed.
The property change listener interface.
virtual void childAdded(SGPropertyNode *parent, SGPropertyNode *child)
Called if child has been added to the given parent.
virtual void valueChanged(SGPropertyNode *node)
Called if value of node has changed.
virtual void childRemoved(SGPropertyNode *parent, SGPropertyNode *child)
Called if child has been removed from its parent.
A node in a property tree.
void removeChangeListener(SGPropertyChangeListener *listener)
Remove a change listener from the property.
bool setUnspecifiedValue(const char *value)
Set a value of unspecified type for this node.
SGPropertyNode * getNode(const std::string &relative_path, int index, bool create=false)
Get a pointer to another node by relative path.
bool setDoubleValue(const std::string &relative_path, double value)
Set another node's value as a double.
bool hasChild(const char *name, int index=0) const
Test whether a named child exists.
void fireChildRemoved(SGPropertyNode *child)
Fire a child-removed event to all listeners.
bool tie(const std::string &relative_path, const SGRawValue< long > &rawValue, bool useDefault=true)
Bind another node to an external long int source.
SGPropertyNode * getChild(const char *name, int index=0, bool create=false)
Get a child node by name and index.
SGPropertyNode_ptr removeChild(const std::string &name, int index=0)
Remove a child node.
void fireChildrenRemovedRecursive()
Fire a child-removed event for every child of this node (Unlimited depth)
bool untie()
Unbind this node from any external data source.
bool unalias()
Remove any alias for this node.
simgear::props::Type getType() const
Get the type of leaf value, if any, for this node.
Attribute
Access mode attributes.
int getIndex() const
Get the node's integer index.
bool setValueReadOnly(const std::string &relative_path, const T &value)
Set relative node to given value and afterwards make read only.
std::ostream & printOn(std::ostream &stream) const
Print the value of the property to a stream.
simgear::PropertyList removeChildren(const std::string &name)
Remove all children with the specified name.
bool setStringValue(const std::string &value)
Set a string value for this node.
bool getBoolValue(const char *relative_path, bool defaultValue=false) const
Get another node's value as a bool.
bool tie(const SGRawValue< T > &rawValue, bool useDefault=true)
Bind this node to an external source.
static const int LAST_USED_ATTRIBUTE
Last used attribute Update as needed when enum Attribute is changed.
simgear::PropertyList getChildren(const std::string &name) const
Get a vector of all children with the specified name.
bool hasValue(const char *relative_path) const
Test whether another node has a leaf value.
SGPropertyNode * getNode(const std::string &relative_path, bool create=false)
Get a pointer to another node by relative path.
bool tie(const char *relative_path, const SGRawValue< int > &rawValue, bool useDefault=true)
Bind another node to an external int source.
bool getBoolValue() const
Get a bool value for this node.
bool setStringValue(const std::string &relative_path, const char *value)
Set another node's value as a string.
bool getAttribute(Attribute attr) const
Check a single mode attribute for the property node.
const SGPropertyNode * getNode(const std::string &relative_path, int index) const
Get a const pointer to another node by relative path.
SGPropertyNode_ptr removeChild(const char *name, int index=0)
Remove a child node.
void setAttribute(Attribute attr, bool state)
Set a single mode attribute for the property node.
bool setStringValue(const char *relative_path, const char *value)
Set another node's value as a string.
simgear::props::Type getType(const std::string &relative_path) const
Get another node's type.
bool untie(const std::string &relative_path)
Unbind another node from any external data source.
static bool compare(const SGPropertyNode &lhs, const SGPropertyNode &rhs)
Compare two property trees.
const char * getStringValue(const std::string &relative_path, const char *defaultValue="") const
Get another node's value as a string.
bool isTied() const
Test whether this node is bound to an external data source.
double getDoubleValue() const
Get a double value for this node.
const SGPropertyNode * getNode(const char *relative_path, int index) const
Get a const pointer to another node by relative path.
const SGPropertyNode * getParent() const
Get a const pointer to the node's parent.
bool tie(const char *relative_path, const SGRawValue< float > &rawValue, bool useDefault=true)
Bind another node to an external float source.
std::vector< T > getChildValues(const std::string &name) const
Get a list of values from all children with the given name.
long getLongValue() const
Get a long int value for this node.
void setAttributes(int attr)
Set all of the mode attributes for the property node.
bool setLongValue(long value)
Set a long int value for this node.
bool setFloatValue(const char *relative_path, float value)
Set another node's value as a float.
void addChangeListener(SGPropertyChangeListener *listener, bool initial=false)
Add a change listener to the property.
SGPropertyNode * getAliasTarget()
Get a non-const pointer to the current alias target, if any.
int getAttributes() const
Get all of the mode attributes for the property node.
bool setBoolValue(bool value)
Set a bool value for this node.
simgear::PropertyList removeChildren(const char *name)
Remove all children with the specified name.
bool setBoolValue(const char *relative_path, bool value)
Set another node's value as a bool.
std::string getPath(bool simplify=false) const
Get the path to this node from the root.
SGPropertyNode(const std::string &name, int index, SGPropertyNode *parent)
Protected constructor for making new nodes on demand.
int getIntValue() const
Get an int value for this node.
bool setFloatValue(const std::string &relative_path, float value)
Set another node's value as a float.
bool hasChild(const std::string &name, int index=0) const
Test whether a named child exists.
const SGPropertyNode * getChild(const std::string &name, int index=0) const
Get a const child node by name and index.
T getValue(typename boost::enable_if_c< simgear::props::PropertyTraits< T >::Internal > ::type *dummy=0) const
Get a value from a node.
void clearValue()
Clear any existing value and set the type to NONE.
const SGPropertyNode * getRootNode() const
Get a const pointer to the root node.
void removeAllChildren()
Remove all children (does not change the value of the node)
float getFloatValue(const char *relative_path, float defaultValue=0.0f) const
Get another node's value as a float.
SGPropertyNode * getNode(const char *relative_path, int index, bool create=false)
Get a pointer to another node by relative path.
bool setDoubleValue(double value)
Set a double value for this node.
bool setLongValue(const char *relative_path, long value)
Set another node's value as a long int.
simgear::props::Type getType(const char *relative_path) const
Get another node's type.
simgear::PropertyList getChildren(const char *name) const
Get a vector of all children with the specified name.
double getDoubleValue(const char *relative_path, double defaultValue=0.0) const
Get another node's value as a double.
bool hasValue(const std::string &relative_path) const
Test whether another node has a leaf value.
int nListeners() const
Get the number of listeners.
int getIntValue(const char *relative_path, int defaultValue=0) const
Get another node's value as an int.
float getFloatValue() const
Get a float value for this node.
SGPropertyNode * getParent()
Get a non-const pointer to the node's parent.
void fireCreatedRecursive(bool fire_self=false)
Trigger a child-added and value-changed event for every child (Unlimited depth).
long getLongValue(const std::string &relative_path, long defaultValue=0L) const
Get another node's value as a long int.
bool setIntValue(int value)
Set an int value for this node.
bool tie(const std::string &relative_path, const SGRawValue< double > &rawValue, bool useDefault=true)
Bind another node to an external double source.
SGPropertyNode * getChild(int position)
Get a child node by position (NOT index).
bool setDoubleValue(const char *relative_path, double value)
Set another node's value as a double.
void fireChildAdded(SGPropertyNode *child)
Fire a child-added event to all listeners.
bool tie(const char *relative_path, const SGRawValue< const char * > &rawValue, bool useDefault=true)
Bind another node to an external string source.
bool alias(const char *path)
Alias this node's leaf value to another's by relative path.
int getIntValue(const std::string &relative_path, int defaultValue=0) const
Get another node's value as an int.
bool isAlias() const
Test whether the node's leaf value is aliased to another's.
float getFloatValue(const std::string &relative_path, float defaultValue=0.0f) const
Get another node's value as a float.
bool getBoolValue(const std::string &relative_path, bool defaultValue=false) const
Get another node's value as a bool.
bool setIntValue(const char *relative_path, int value)
Set another node's value as an int.
bool setBoolValue(const std::string &relative_path, bool value)
Set another node's value as a bool.
std::string getDisplayName(bool simplify=false) const
Get the node's pretty display name, with subscript when needed.
bool tie(const char *relative_path, const SGRawValue< bool > &rawValue, bool useDefault=true)
Bind another node to an external bool source.
SGPropertyNode(const SGPropertyNode &node)
Copy constructor.
bool tie(const std::string &relative_path, const SGRawValue< const char * > &rawValue, bool useDefault=true)
Bind another node to an external string source.
simgear::PropertyList addChildren(const std::string &name, size_t count, int min_index=0, bool append=true)
Create multiple child nodes with the given name an unused indices.
const SGPropertyNode * getNode(const char *relative_path) const
Get a const pointer to another node by relative path.
bool tie(const std::string &relative_path, const SGRawValue< int > &rawValue, bool useDefault=true)
Bind another node to an external int source.
const SGPropertyNode * getChild(int position) const
Get a const child node by position (NOT index).
bool alias(SGPropertyNode *target)
Alias this node's leaf value to another's.
long getLongValue(const char *relative_path, long defaultValue=0L) const
Get another node's value as a long int.
int nChildren() const
Get the number of child nodes.
bool setStringValue(const char *value)
Set a string value for this node.
void fireValueChanged()
Fire a value change event to all listeners.
bool isTied(const std::string &relative_path) const
Test whether another node is bound to an external data source.
SGPropertyNode * getNode(const char *relative_path, bool create=false)
Get a pointer to another node by relative path.
bool tie(const std::string &relative_path, const SGRawValue< float > &rawValue, bool useDefault=true)
Bind another node to an external float source.
SGPropertyNode_ptr removeChild(int pos)
Remove child by position.
bool tie(const char *relative_path, const SGRawValue< double > &rawValue, bool useDefault=true)
Bind another node to an external double source.
const char * getStringValue(const char *relative_path, const char *defaultValue="") const
Get another node's value as a string.
bool setFloatValue(float value)
Set a float value for this node.
SGPropertyNode()
Default constructor.
bool removeChild(SGPropertyNode *node)
Remove child by pointer (if it is a child of this node).
bool isTied(const char *relative_path) const
Test whether another node is bound to an external data source.
const SGPropertyNode * getChild(const char *name, int index=0) const
Get a const child node by name and index.
const SGPropertyNode * getAliasTarget() const
Get a const pointer to the current alias target, if any.
bool tie(const std::string &relative_path, const SGRawValue< bool > &rawValue, bool useDefault=true)
Bind another node to an external bool source.
bool setIntValue(const std::string &relative_path, int value)
Set another node's value as an int.
const std::string & getNameString() const
Get the node's simple name as a string.
bool setUnspecifiedValue(const char *relative_path, const char *value)
Set another node's value with no specified type.
bool tie(const char *relative_path, const SGRawValue< long > &rawValue, bool useDefault=true)
Bind another node to an external long int source.
bool hasValue() const
Test whether this node contains a primitive leaf value.
SGPropertyNode * getRootNode()
Get a pointer to the root node.
const char * getStringValue() const
Get a string value for this node.
SGPropertyNode * addChild(const char *name, int min_index=0, bool append=true)
Create a new child node with the given name and an unused index.
const SGPropertyNode * getNode(const std::string &relative_path) const
Get a const pointer to another node by relative path.
double getDoubleValue(const std::string &relative_path, double defaultValue=0.0) const
Get another node's value as a double.
bool alias(const std::string &path)
Alias this node's leaf value to another's by relative path.
virtual ~SGPropertyNode()
Destructor.
bool setLongValue(const std::string &relative_path, long value)
Set another node's value as a long int.
bool untie(const char *relative_path)
Unbind another node from any external data source.
virtual SGRawExtended * makeContainer() const =0
Make an SGRawValueContainer from the SGRawValue.
virtual std::ostream & printOn(std::ostream &stream) const =0
Write value out to a stream.
virtual std::istream & readFrom(std::istream &stream)=0
Read value from a stream and store it.
A raw value that contains its value.
virtual bool setValue(T value)
Set the underlying value.
virtual ~SGRawValueContainer()
Destructor.
virtual SGRaw * clone() const
Create a copy of this raw value.
virtual T getValue() const
Get the underlying value.
SGRawValueContainer(const T &obj)
Explicit constructor.
An indexed value bound to static functions.
virtual bool setValue(T value)
Assign a new underlying value.
virtual T getValue() const
Return the underlying value.
A value managed through static functions.
SGRawValueFunctions(getter_t getter=0, setter_t setter=0)
Explicit constructor.
virtual bool setValue(T value)
Set the underlying value.
virtual ~SGRawValueFunctions()
Destructor.
T(* getter_t)()
The template type of a static getter function.
void(* setter_t)(T)
The template type of a static setter function.
virtual SGRaw * clone() const
Create a copy of this raw value, bound to the same functions.
virtual T getValue() const
Get the underlying value.
An indexed value managed through an object and access methods.
virtual bool setValue(T value)
Assign a new underlying value.
virtual T getValue() const
Return the underlying value.
A value managed through an object and access methods.
virtual bool setValue(T value)
Assign a new underlying value.
virtual T getValue() const
Return the underlying value.
A raw value bound to a pointer.
virtual bool setValue(T value)
Set the underlying value.
SGRawValuePointer(T *ptr)
Explicit pointer constructor.
virtual SGRaw * clone() const
Create a copy of this raw value.
virtual T getValue() const
Get the underlying value.
virtual ~SGRawValuePointer()
Destructor.
Abstract base class for a raw value.
virtual simgear::props::Type getType() const
Return the type tag for this raw value type.
virtual ~SGRawValue()
Destructor.
virtual T getValue() const =0
Return the underlying value.
virtual bool setValue(T value)=0
Assign a new underlying value.
static T DefaultValue()
The default underlying value for this type.
Base class for SGRawValue classes that holds no type information.
virtual SGRaw * clone() const =0
Create a new deep copy of this raw value.
virtual simgear::props::Type getType() const =0
Get the type enumeration for the raw value.
Type
The possible types of an SGPropertyNode.
@ ALIAS
The node "points" to another node.
@ EXTENDED
The node's value is not stored in the property; the actual value and type is retrieved from an SGRawV...
@ NONE
The node hasn't been assigned a value yet.
Utility function for creation of a child property node using a relative path.
T parseString(const std::string &str)
Parse a string as an object of a given type.
SGPropertyNode * makeChild(SGPropertyNode *parent, const char *name, int index=0)
Utility function for creation of a child property node.