SGPropertyNode Class Reference

#include <props.hxx>

Inherits SGReferenced.

Inherited by FGPropertyManager.

List of all members.


Detailed Description

Definition at line 493 of file props.hxx.


Public Types

enum  { MAX_STRING_LEN = 1024 }
 Public constants.
enum  Attribute {
  READ = 1, WRITE = 2, ARCHIVE = 4, REMOVED = 8,
  TRACE_READ = 16, TRACE_WRITE = 32, USERARCHIVE = 64
}
 Access mode attributes. More...
enum  Type {
  NONE = 0, ALIAS, BOOL, INT,
  LONG, FLOAT, DOUBLE, STRING,
  UNSPECIFIED
}
 Property value types.

Public Member Functions

void addChangeListener (SGPropertyChangeListener *listener, bool initial=false)
 Add a change listener to the property.
bool alias (const char *path)
 Alias this node's leaf value to another's by relative path.
bool alias (SGPropertyNode *target)
 Alias this node's leaf value to another's.
void clearValue ()
 Clear any existing value and set the type to NONE.
void fireChildAdded (SGPropertyNode *child)
 Fire a child-added event to all listeners.
void fireChildRemoved (SGPropertyNode *child)
 Fire a child-removed event to all listeners.
void fireValueChanged ()
 Fire a value change event to all listeners.
const SGPropertyNodegetAliasTarget () const
 Get a const pointer to the current alias target, if any.
SGPropertyNodegetAliasTarget ()
 Get a non-const pointer to the current alias target, if any.
bool getAttribute (Attribute attr) const
 Check a single mode attribute for the property node.
int getAttributes () const
 Get all of the mode attributes for the property node.
bool getBoolValue (const char *relative_path, bool defaultValue=false) const
 Get another node's value as a bool.
bool getBoolValue () const
 Get a bool value for this node.
const SGPropertyNodegetChild (const char *name, int index=0) const
 Get a const child node by name and index.
SGPropertyNodegetChild (const char *name, int index=0, bool create=false)
 Get a child node by name and index.
const SGPropertyNodegetChild (int position) const
 Get a const child node by position (*NOT* index).
SGPropertyNodegetChild (int position)
 Get a child node by position (*NOT* index).
vector< SGPropertyNode_ptrgetChildren (const char *name) const
 Get a vector of all children with the specified name.
const char * getDisplayName (bool simplify=false) const
 Get the node's pretty display name, with subscript when needed.
double getDoubleValue (const char *relative_path, double defaultValue=0.0L) const
 Get another node's value as a double.
double getDoubleValue () const
 Get a double value for this node.
float getFloatValue (const char *relative_path, float defaultValue=0.0) const
 Get another node's value as a float.
float getFloatValue () const
 Get a float value for this node.
int getIndex () const
 Get the node's integer index.
int getIntValue (const char *relative_path, int defaultValue=0) const
 Get another node's value as an int.
int getIntValue () const
 Get an int value for this node.
long getLongValue (const char *relative_path, long defaultValue=0L) const
 Get another node's value as a long int.
long getLongValue () const
 Get a long int value for this node.
const char * getName () const
 Get the node's simple (XML) name.
const SGPropertyNodegetNode (const char *relative_path, int index) const
 Get a const pointer to another node by relative path.
const SGPropertyNodegetNode (const char *relative_path) const
 Get a const pointer to another node by relative path.
SGPropertyNodegetNode (const char *relative_path, int index, bool create=false)
 Get a pointer to another node by relative path.
SGPropertyNodegetNode (const char *relative_path, bool create=false)
 Get a pointer to another node by relative path.
const SGPropertyNodegetParent () const
 Get a const pointer to the node's parent.
SGPropertyNodegetParent ()
 Get a non-const pointer to the node's parent.
const char * getPath (bool simplify=false) const
 Get the path to this node from the root.
const SGPropertyNodegetRootNode () const
 Get a const pointer to the root node.
SGPropertyNodegetRootNode ()
 Get a pointer to the root node.
const char * getStringValue (const char *relative_path, const char *defaultValue="") const
 Get another node's value as a string.
const char * getStringValue () const
 Get a string value for this node.
Type getType (const char *relative_path) const
 Get another node's type.
Type getType () const
 Get the type of leaf value, if any, for this node.
bool hasChild (const char *name, int index=0) const
 Test whether a named child exists.
bool hasValue (const char *relative_path) const
 Test whether another node has a leaf value.
bool hasValue () const
 Test whether this node contains a primitive leaf value.
bool isAlias () const
 Test whether the node's leaf value is aliased to another's.
bool isTied (const char *relative_path) const
 Test whether another node is bound to an external data source.
bool isTied () const
 Test whether this node is bound to an external data source.
unsigned int nChildren () const
 Get the number of child nodes.
void removeChangeListener (SGPropertyChangeListener *listener)
 Remove a change listener from the property.
SGPropertyNode_ptr removeChild (const char *name, int index=0, bool keep=true)
 Remove a child node.
SGPropertyNode_ptr removeChild (int pos, bool keep=true)
 Remove child by position.
vector< SGPropertyNode_ptrremoveChildren (const char *name, bool keep=true)
 Remove all children with the specified name.
void setAttribute (Attribute attr, bool state)
 Set a single mode attribute for the property node.
void setAttributes (int attr)
 Set all of the mode attributes for the property node.
bool setBoolValue (const char *relative_path, bool value)
 Set another node's value as a bool.
bool setBoolValue (bool value)
 Set a bool value for this node.
bool setDoubleValue (const char *relative_path, double value)
 Set another node's value as a double.
bool setDoubleValue (double value)
 Set a double value for this node.
bool setFloatValue (const char *relative_path, float value)
 Set another node's value as a float.
bool setFloatValue (float value)
 Set a float value for this node.
bool setIntValue (const char *relative_path, int value)
 Set another node's value as an int.
bool setIntValue (int value)
 Set an int value for this node.
bool setLongValue (const char *relative_path, long value)
 Set another node's value as a long int.
bool setLongValue (long value)
 Set a long int value for this node.
bool setStringValue (const char *relative_path, const char *value)
 Set another node's value as a string.
bool setStringValue (const char *value)
 Set a string value for this node.
bool setUnspecifiedValue (const char *relative_path, const char *value)
 Set another node's value with no specified type.
bool setUnspecifiedValue (const char *value)
 Set a value of unspecified type for this node.
 SGPropertyNode (const SGPropertyNode &node)
 Copy constructor.
 SGPropertyNode ()
 Default constructor.
bool tie (const char *relative_path, const SGRawValue< const char * > &rawValue, bool useDefault=true)
 Bind another node to an external string source.
bool tie (const char *relative_path, const SGRawValue< double > &rawValue, bool useDefault=true)
 Bind another node to an external double source.
bool tie (const char *relative_path, const SGRawValue< float > &rawValue, bool useDefault=true)
 Bind another node to an external float source.
bool tie (const char *relative_path, const SGRawValue< long > &rawValue, bool useDefault=true)
 Bind another node to an external long int source.
bool tie (const char *relative_path, const SGRawValue< int > &rawValue, bool useDefault=true)
 Bind another node to an external int source.
bool tie (const char *relative_path, const SGRawValue< bool > &rawValue, bool useDefault=true)
 Bind another node to an external bool source.
bool tie (const SGRawValue< const char * > &rawValue, bool useDefault=true)
 Bind this node to an external string source.
bool tie (const SGRawValue< double > &rawValue, bool useDefault=true)
 Bind this node to an external double source.
bool tie (const SGRawValue< float > &rawValue, bool useDefault=true)
 Bind this node to an external float source.
bool tie (const SGRawValue< long > &rawValue, bool useDefault=true)
 Bind this node to an external long int source.
bool tie (const SGRawValue< int > &rawValue, bool useDefault=true)
 Bind this node to an external int source.
bool tie (const SGRawValue< bool > &rawValue, bool useDefault=true)
 Bind this node to an external bool source.
bool unalias ()
 Remove any alias for this node.
bool untie (const char *relative_path)
 Unbind another node from any external data source.
bool untie ()
 Unbind this node from any external data source.
virtual ~SGPropertyNode ()
 Destructor.

Static Public Attributes

static const int LAST_USED_ATTRIBUTE = TRACE_WRITE
 Last used attribute Update as needed when enum Attribute is changed.

Protected Member Functions

void fireChildAdded (SGPropertyNode *parent, SGPropertyNode *child)
void fireChildRemoved (SGPropertyNode *parent, SGPropertyNode *child)
void fireValueChanged (SGPropertyNode *node)
 SGPropertyNode (const char *name, int index, SGPropertyNode *parent)
 Protected constructor for making new nodes on demand.

Classes

class  hash_table
 A very simple hash table with no remove functionality.

Member Enumeration Documentation

enum Attribute

The ARCHIVE attribute is strictly advisory, and controls whether the property should normally be saved and restored.

Definition at line 526 of file props.hxx.


Constructor & Destructor Documentation

SGPropertyNode (  ) 

Default constructor: always creates a root node.

Definition at line 637 of file props.cxx.

SGPropertyNode ( const char *  name,
int  index,
SGPropertyNode parent 
) [protected]

Convenience constructor.

Definition at line 733 of file props.cxx.


Member Function Documentation

void addChangeListener ( SGPropertyChangeListener listener,
bool  initial = false 
)

If "initial" is set call the listener initially.

Definition at line 2036 of file props.cxx.

SGPropertyNode * getAliasTarget (  ) 

Get the target of an alias.

Definition at line 803 of file props.cxx.

bool getBoolValue ( const char *  relative_path,
bool  defaultValue = false 
) const

Get a bool value for another node.

Definition at line 1803 of file props.cxx.

const SGPropertyNode * getChild ( const char *  name,
int  index = 0 
) const

Get a const child by name and index.

Definition at line 876 of file props.cxx.

SGPropertyNode * getChild ( const char *  name,
int  index = 0,
bool  create = false 
)

Get a non-const child by name and index, creating if necessary.

Definition at line 846 of file props.cxx.

const SGPropertyNode * getChild ( int  position  )  const

Get a const child by index.

Definition at line 833 of file props.cxx.

SGPropertyNode * getChild ( int  position  ) 

Get a non-const child by index.

Definition at line 820 of file props.cxx.

vector< SGPropertyNode_ptr > getChildren ( const char *  name  )  const

Get all children with the same name (but different indices).

Definition at line 890 of file props.cxx.

double getDoubleValue ( const char *  relative_path,
double  defaultValue = 0.0L 
) const

Get a double value for another node.

Definition at line 1851 of file props.cxx.

float getFloatValue ( const char *  relative_path,
float  defaultValue = 0.0 
) const

Get a float value for another node.

Definition at line 1839 of file props.cxx.

int getIntValue ( const char *  relative_path,
int  defaultValue = 0 
) const

Get an int value for another node.

Definition at line 1815 of file props.cxx.

long getLongValue ( const char *  relative_path,
long  defaultValue = 0L 
) const

Get a long value for another node.

Definition at line 1827 of file props.cxx.

const SGPropertyNode * getNode ( const char *  relative_path,
int  index 
) const

This method leaves the index off the last member of the path, so that the user can specify it separate.

Definition at line 1766 of file props.cxx.

SGPropertyNode * getNode ( const char *  relative_path,
int  index,
bool  create = false 
)

This method leaves the index off the last member of the path, so that the user can specify it separately (and save some string building). For example, getNode("/bar[1]/foo", 3) is exactly equivalent to getNode("bar[1]/foo[3]"). The index provided overrides any given in the path itself for the last component.

Definition at line 1750 of file props.cxx.

const char * getStringValue ( const char *  relative_path,
const char *  defaultValue = "" 
) const

Get a string value for another node.

Definition at line 1863 of file props.cxx.

SGPropertyNode::Type getType ( const char *  relative_path  )  const

Get the value type for another node.

Definition at line 1792 of file props.cxx.

bool hasValue ( const char *  relative_path  )  const

Test whether another node has a value attached.

Definition at line 1781 of file props.cxx.

bool isTied ( const char *  relative_path  )  const

Test whether another node is tied.

Definition at line 1946 of file props.cxx.

bool setBoolValue ( const char *  relative_path,
bool  value 
)

Set a bool value for another node.

Definition at line 1875 of file props.cxx.

bool setDoubleValue ( const char *  relative_path,
double  value 
)

Set a double value for another node.

Definition at line 1915 of file props.cxx.

bool setFloatValue ( const char *  relative_path,
float  value 
)

Set a float value for another node.

Definition at line 1905 of file props.cxx.

bool setIntValue ( const char *  relative_path,
int  value 
)

Set an int value for another node.

Definition at line 1885 of file props.cxx.

bool setLongValue ( const char *  relative_path,
long  value 
)

Set a long value for another node.

Definition at line 1895 of file props.cxx.

bool setStringValue ( const char *  relative_path,
const char *  value 
)

Set a string value for another node.

Definition at line 1925 of file props.cxx.

bool setUnspecifiedValue ( const char *  relative_path,
const char *  value 
)

Set an unknown value for another node.

Definition at line 1935 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< const char * > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 2017 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< double > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 2005 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< float > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 1993 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< long > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 1981 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< int > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 1969 of file props.cxx.

bool tie ( const char *  relative_path,
const SGRawValue< bool > &  rawValue,
bool  useDefault = true 
)

Tie a node reached by a relative path, creating it if necessary.

Definition at line 1957 of file props.cxx.

bool unalias (  ) 

Remove an alias.

Definition at line 789 of file props.cxx.

bool untie ( const char *  relative_path  ) 

Attempt to untie another node reached by a relative path.

Definition at line 2029 of file props.cxx.


Member Data Documentation

bool alias

Alias to another node by path.

Definition at line 1208 of file props.hxx.


The documentation for this class was generated from the following files:

Generated on Tue May 26 00:55:08 2009 for JSBSim Flight Dynamics Model by  doxygen 1.5.5