\f
////////////////////////////////////////////////////////////////////////
-// Loading and saving properties.
+// Property management.
////////////////////////////////////////////////////////////////////////
+extern void fgInitProps (); // fixme: how are they untied?
+extern void fgUpdateProps ();
extern bool fgSaveFlight (ostream &output);
extern bool fgLoadFlight (istream &input);
// Convenience functions for getting property values.
////////////////////////////////////////////////////////////////////////
+
/**
- * Get an SGValue pointer that can be queried repeatedly.
+ * Get a property node.
*
- * If the property value is going to be accessed within the loop,
- * it is best to use this method for maximum efficiency.
+ * @param path The path of the node, relative to root.
+ * @param create true to create the node if it doesn't exist.
+ * @return The node, or 0 if none exists and none was created.
*/
-inline SGValue * fgGetValue (const string &name, bool create = false)
+inline SGPropertyNode *
+fgGetNode (const string &path, bool create = false)
{
- return globals->get_props()->getValue(name, create);
+ return globals->get_props()->getNode(path, create);
}
-inline bool fgHasValue (const string &name)
+
+/**
+ * Test whether a given node exists.
+ *
+ * @param path The path of the node, relative to root.
+ * @return true if the node exists, false otherwise.
+ */
+inline bool
+fgHasNode (const string &path)
{
- return globals->get_props()->hasValue(name);
+ return (fgGetNode(path, false) != 0);
}
+
inline bool fgGetBool (const string &name, bool defaultValue = false)
{
return globals->get_props()->getBoolValue(name, defaultValue);