14#ifndef PROPS_STANDALONE
15#define PROPS_STANDALONE 1
24#include "simgear/compiler.h"
25#include "JSBSim_API.h"
29#if !defined(BOOST_UTILITY_ENABLE_IF_HPP) && !defined(BOOST_CORE_ENABLE_IF_HPP)
32 template <
bool B,
class T =
void>
40 template <
class Cond,
class T =
void>
43 template <
bool B,
class T =
void>
51 template <
class Cond,
class T =
void>
56# include <boost/utility.hpp>
57# include <boost/type_traits/is_enum.hpp>
59# include <simgear/debug/logstream.hxx>
60# include <simgear/math/SGMathFwd.hxx>
61# include <simgear/math/sg_types.hxx>
63#include <simgear/structure/SGReferenced.hxx>
64#include <simgear/structure/SGSharedPtr.hxx>
72 class PropertyInterpolationMgr;
75std::istream& readFrom(std::istream& stream, T& result)
92 std::istringstream stream(str);
94 readFrom(stream, result);
103#pragma warn A sloppy coder has defined NONE as a macro!
108#pragma warn A sloppy coder has defined ALIAS as a macro!
113#pragma warn A sloppy coder has defined UNSPECIFIED as a macro!
118#pragma warn A sloppy coder has defined BOOL as a macro!
123#pragma warn A sloppy coder has defined INT as a macro!
128#pragma warn A sloppy coder has defined LONG as a macro!
133#pragma warn A sloppy coder has defined FLOAT as a macro!
138#pragma warn A sloppy coder has defined DOUBLE as a macro!
143#pragma warn A sloppy coder has defined STRING as a macro!
175#define DEFINTERNALPROP(TYPE, PROP) \
177struct PropertyTraits<TYPE> \
179 static const Type type_tag = PROP; \
180 enum { Internal = 1 }; \
183DEFINTERNALPROP(
bool, BOOL);
184DEFINTERNALPROP(
int, INT);
185DEFINTERNALPROP(
long, LONG);
186DEFINTERNALPROP(
float, FLOAT);
187DEFINTERNALPROP(
double, DOUBLE);
188DEFINTERNALPROP(
const char *, STRING);
189DEFINTERNALPROP(
const char[], STRING);
190#undef DEFINTERNALPROP
251 virtual std::ostream&
printOn(std::ostream& stream)
const = 0;
255 virtual std::istream&
readFrom(std::istream& stream) = 0;
262template<typename T, int internal = simgear::props::PropertyTraits<T>::Internal>
274 virtual std::ostream& printOn(std::ostream& stream)
const;
275 virtual std::istream& readFrom(std::istream& stream);
439 virtual bool setValue (T value) { *_ptr = value;
return true; }
487 : _getter(getter), _setter(setter) {}
502 if (_getter)
return (*_getter)();
514 if (_setter) { (*_setter)(value);
return true; }
545 typedef T (*getter_t)(int);
546 typedef void (*setter_t)(int,T);
548 : _index(index), _getter(getter), _setter(setter) {}
551 if (_getter)
return (*_getter)(_index);
555 if (_setter) { (*_setter)(_index, value);
return true; }
558 virtual SGRaw* clone ()
const {
574template <
class C,
class T>
578 typedef T (C::*getter_t)()
const;
579 typedef void (C::*setter_t)(T);
581 : _obj(obj), _getter(getter), _setter(setter) {}
584 if (_getter) {
return (_obj.*_getter)(); }
588 if (_setter) { (_obj.*_setter)(value);
return true; }
591 virtual SGRaw* clone ()
const {
607template <
class C,
class T>
611 typedef T (C::*getter_t)(
int)
const;
612 typedef void (C::*setter_t)(
int, T);
614 getter_t getter = 0, setter_t setter = 0)
615 : _obj(obj), _index(index), _getter(getter), _setter(setter) {}
618 if (_getter) {
return (_obj.*_getter)(_index); }
622 if (_setter) { (_obj.*_setter)(_index, value);
return true; }
625 virtual SGRaw* clone ()
const {
666 virtual bool setValue (T value) { _obj = value;
return true; }
689 return stream << static_cast<SGRawValue<T>*>(
this)->getValue();
696 simgear::readFrom(stream, value);
705typedef SGSharedPtr<SGPropertyNode> SGPropertyNode_ptr;
706typedef SGSharedPtr<const SGPropertyNode> SGConstPropertyNode_ptr;
710typedef std::vector<SGPropertyNode_ptr> PropertyList;
739 std::vector<SGPropertyNode *> _properties;
754 MAX_STRING_LEN = 1024
849 int nChildren ()
const {
return (
int)_children.size(); }
867 bool hasChild (
const char * name,
int index = 0)
const
869 return (getChild(name, index) != 0);
875 bool hasChild (
const std::string& name,
int index = 0)
const
877 return (getChild(name, index) != 0);
889 bool append =
true );
893 {
return addChild(name.c_str(), min_index, append); }
906 bool append =
true );
912 bool create =
false);
913 SGPropertyNode * getChild (
const std::string& name,
int index = 0,
914 bool create =
false);
924 {
return getChild(name.c_str(), index); }
936 {
return getChildren(name.c_str()); }
960 SGPropertyNode_ptr
removeChild(
const std::string& name,
int index = 0)
961 {
return removeChild(name.c_str(), index); }
972 {
return removeChildren(name.c_str()); }
998 bool alias (
const std::string& path)
999 {
return alias(path.c_str()); }
1034 std::string
getPath (
bool simplify =
false)
const;
1058 {
return getNode(relative_path.c_str(), create); }
1071 bool create =
false);
1084 bool create =
false)
1085 {
return getNode(relative_path.c_str(), index, create); }
1096 {
return getNode(relative_path.c_str()); }
1116 {
return getNode(relative_path.c_str(), index); }
1132 (state ? _attr |= attr : _attr &= ~attr);
1198 template<
typename T>
1200 ::type* dummy = 0)
const;
1202 template<
typename T>
1204 ::type* dummy = 0)
const;
1209 template<
typename T,
typename T_get >
1210 std::vector<T> getChildValues(
const std::string& name)
const;
1215 template<
typename T>
1216 std::vector<T> getChildValues(
const std::string& name)
const;
1257 {
return setStringValue(value.c_str()); }
1265 template<
typename T>
1266 bool setValue(
const T& val,
1270 template<
typename T>
1271 bool setValue(
const T& val,
1276 bool setValue(
const char (&val)[N])
1278 return setValue(&val[0]);
1289 template<
typename T>
1293 bool ret = node->setValue(value);
1298#if !PROPS_STANDALONE
1307 bool interpolate(
const std::string& type,
1309 double duration = 0.6,
1310 const std::string& easing =
"swing" );
1320 bool interpolate(
const std::string& type,
1321 const simgear::PropertyList& values,
1322 const double_list& deltas,
1323 const std::string& easing =
"swing" );
1328 static void setInterpolationMgr(simgear::PropertyInterpolationMgr* mgr);
1333 static simgear::PropertyInterpolationMgr* getInterpolationMgr();
1339 std::ostream&
printOn(std::ostream& stream)
const;
1354 template<
typename T>
1355 bool tie(
const SGRawValue<T> &rawValue,
bool useDefault =
true);
1378 {
return getType(relative_path.c_str()); }
1389 {
return hasValue(relative_path.c_str()); }
1395 bool defaultValue =
false)
const;
1401 bool defaultValue =
false)
const
1402 {
return getBoolValue(relative_path.c_str(), defaultValue); }
1408 int defaultValue = 0)
const;
1414 int defaultValue = 0)
const
1415 {
return getIntValue(relative_path.c_str(), defaultValue); }
1422 long defaultValue = 0L)
const;
1428 long defaultValue = 0L)
const
1429 {
return getLongValue(relative_path.c_str(), defaultValue); }
1435 float defaultValue = 0.0f)
const;
1441 float defaultValue = 0.0f)
const
1442 {
return getFloatValue(relative_path.c_str(), defaultValue); }
1449 double defaultValue = 0.0)
const;
1455 double defaultValue = 0.0)
const
1456 {
return getDoubleValue(relative_path.c_str(), defaultValue); }
1462 const char * defaultValue =
"")
const;
1469 const char * defaultValue =
"")
const
1470 {
return getStringValue(relative_path.c_str(), defaultValue); }
1482 {
return setBoolValue(relative_path.c_str(), value); }
1494 {
return setIntValue(relative_path.c_str(), value); }
1506 {
return setLongValue(relative_path.c_str(), value); }
1518 {
return setFloatValue(relative_path.c_str(), value); }
1530 {
return setDoubleValue(relative_path.c_str(), value); }
1538 bool setStringValue(
const char * relative_path,
const std::string& value)
1539 {
return setStringValue(relative_path, value.c_str()); }
1544 {
return setStringValue(relative_path.c_str(), value); }
1546 bool setStringValue (
const std::string& relative_path,
1547 const std::string& value)
1548 {
return setStringValue(relative_path.c_str(), value.c_str()); }
1559 bool isTied (
const char * relative_path)
const;
1564 bool isTied (
const std::string& relative_path)
const
1565 {
return isTied(relative_path.c_str()); }
1571 bool useDefault =
true);
1577 bool useDefault =
true)
1578 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1585 bool useDefault =
true);
1591 bool useDefault =
true)
1592 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1599 bool useDefault =
true);
1605 bool useDefault =
true)
1606 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1613 bool useDefault =
true);
1619 bool useDefault =
true)
1620 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1627 bool useDefault =
true);
1633 bool useDefault =
true)
1634 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1641 bool useDefault =
true);
1647 bool useDefault =
true)
1648 {
return tie(relative_path.c_str(), rawValue, useDefault); }
1654 bool untie (
const char * relative_path);
1659 bool untie (
const std::string& relative_path)
1660 {
return untie(relative_path.c_str()); }
1668 bool initial =
false);
1680 int nListeners ()
const {
return _listeners ? (int)_listeners->size() : 0; }
1742 SGPropertyNode_ptr eraseChild(simgear::PropertyList::iterator child);
1748 template<
typename Itr>
1751 static simgear::PropertyInterpolationMgr* _interpolation_mgr;
1756 bool get_bool ()
const;
1757 int get_int ()
const;
1758 long get_long ()
const;
1759 float get_float ()
const;
1760 double get_double ()
const;
1761 const char * get_string ()
const;
1764 bool set_bool (
bool value);
1765 bool set_int (
int value);
1766 bool set_long (
long value);
1767 bool set_float (
float value);
1768 bool set_double (
double value);
1769 bool set_string (
const char * value);
1775 const char * make_string ()
const;
1780 void trace_read ()
const;
1786 void trace_write ()
const;
1793 simgear::PropertyList _children;
1794 mutable std::string _buffer;
1814 std::vector<SGPropertyChangeListener *> * _listeners;
1817 template<
typename Itr>
1818 SGPropertyNode * getChildImpl (Itr begin, Itr end,
int index = 0,
bool create =
false);
1820 template<
typename Itr>
1821 SGPropertyNode* getExistingChild (Itr begin, Itr end,
int index);
1823 template<
typename SplitItr>
1825 bool create,
int last_index);
1861inline const char * getValue<const char*>(
const SGPropertyNode* node)
1867inline std::string getValue<std::string>(
const SGPropertyNode* node)
1902inline bool setValue (
SGPropertyNode* node,
const std::string& value)
1911 if (_type == ALIAS || _tied)
1914 useDefault = useDefault &&
hasValue();
1917 old_val = getValue<T>(
this);
1924 _value.val = rawValue.clone();
1940 ::PropertyTraits<T>::Internal>::type* dummy)
const
1943 if (_attr == (READ|WRITE) && _type == EXTENDED
1958 return simgear::parseString<T>(make_string());
1968 ::PropertyTraits<T>::Internal>::type* dummy)
const
1970 return ::getValue<T>(
this);
1973template<
typename T,
typename T_get >
1976 const simgear::PropertyList& props =
getChildren(name);
1977 std::vector<T> values( props.size() );
1979 for(
size_t i = 0; i < props.size(); ++i )
1980 values[i] = props[i]->getValue<T_get>();
1989 return getChildValues<T, T>(name);
1993bool SGPropertyNode::setValue(
const T& val,
1995 ::PropertyTraits<T>::Internal>::type* dummy)
1998 if (_attr == (READ|WRITE) && _type == EXTENDED
2004 && ((_type == EXTENDED
2006 || _type == NONE || _type == UNSPECIFIED)) {
2007 if (_type == NONE || _type == UNSPECIFIED) {
2022inline bool SGPropertyNode::setValue(
const T& val,
2024 ::PropertyTraits<T>::Internal>::type* dummy)
2026 return ::setValue(
this, val);
2035 return parent->
getChild(name, index,
true);
2044template<
typename StringType>
2047 return parent->
getNode(name,
true);
2066 bool operator()(SGPropertyNode_ptr lhs,
const SGPropertyNode* rhs)
const
2070 bool operator()(
const SGPropertyNode* lhs, SGPropertyNode_ptr rhs)
const
2074 bool operator()(SGPropertyNode_ptr lhs, SGPropertyNode_ptr rhs)
const
2084 return hash_value(*node);
2086 size_t operator()(SGPropertyNode_ptr node)
const
2088 return hash_value(*node);
2104 SGPropertyNode_ptr property,
bool initial=
false)
2105 : _obj(obj), _callback(method), _property(property)
2107 _property->addChangeListener(
this,initial);
2111 _obj(other._obj), _callback(other._callback), _property(other._property)
2113 _property->addChangeListener(
this,
false);
2118 _property->removeChangeListener(
this);
2122 (_obj->*_callback)(node);
2127 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.