]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/input_output/FGPropertyManager.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / input_output / FGPropertyManager.h
index 2db5408e33806115cf077c9d6d5336b8ea58d5e1..a08f896814213dcdf0306ce2edf3b8512549b355 100644 (file)
@@ -53,7 +53,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPERTYMANAGER "$Id$"
+#define ID_PROPERTYMANAGER "$Id: FGPropertyManager.h,v 1.17 2010/07/08 11:36:28 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -77,6 +77,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
 {
   private:
     static bool suppress_warning;
+    static std::vector<std::string> tied_properties;
   public:
     /// Constructor
     FGPropertyManager(void) {suppress_warning = false;}
@@ -129,6 +130,15 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      */
     std::string GetFullyQualifiedName(void);
 
+    /**
+     * Get the qualified name of a node relative to given base path,
+     * otherwise the fully qualified name.
+     * This function is very slow, so is probably useful for debugging only.
+     *
+     * @param path The path to strip off, if found.
+     */
+    std::string GetRelativeName( const std::string &path = "/fdm/jsbsim/" );
+
     /**
      * Get a bool value for a property.
      *
@@ -390,6 +400,13 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      */
     void Untie (const std::string &name);
 
+    /**
+     * Unbind all properties bound by this manager to an external data source.
+     *
+     * Classes should use this function to release control of any
+     * properties they have bound using this property manager.
+     */
+    void Unbind (void);
 
         // Templates cause ambiguity here
 
@@ -517,8 +534,10 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
     {
       if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter), useDefault))
         std::cout << "Failed to tie property " << name << " to functions" << std::endl;
-      else if (debug_lvl & 0x20)
-        std::cout << name << std::endl;
+      else {
+        tied_properties.push_back(name);
+        if (debug_lvl & 0x20) std::cout << name << std::endl;
+      }
     }
 
 
@@ -545,8 +564,10 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
     {
       if (!tie(name.c_str(), SGRawValueFunctionsIndexed<V>(index, getter, setter), useDefault))
         std::cout << "Failed to tie property " << name << " to indexed functions" << std::endl;
-      else if (debug_lvl & 0x20)
-        std::cout << name << std::endl;
+      else {
+        tied_properties.push_back(name);
+        if (debug_lvl & 0x20) std::cout << name << std::endl;
+      }
     }
 
 
@@ -575,8 +596,10 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
     {
       if (!tie(name.c_str(), SGRawValueMethods<T,V>(*obj, getter, setter), useDefault))
         std::cout << "Failed to tie property " << name << " to object methods" << std::endl;
-      else if (debug_lvl & 0x20)
-        std::cout << name << std::endl;
+      else {
+        tied_properties.push_back(name);
+        if (debug_lvl & 0x20) std::cout << name << std::endl;
+      }
     }
 
     /**
@@ -604,8 +627,10 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
     {
       if (!tie(name.c_str(), SGRawValueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault))
         std::cout << "Failed to tie property " << name << " to indexed object methods" << std::endl;
-      else if (debug_lvl & 0x20)
-        std::cout << name << std::endl;
+      else {
+        tied_properties.push_back(name);
+        if (debug_lvl & 0x20) std::cout << name << std::endl;
+      }
    }
 };
 }