]> 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 c29b5a412e55b9a72e786a2d675e4efeb1acd133..a08f896814213dcdf0306ce2edf3b8512549b355 100644 (file)
@@ -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;}
@@ -399,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
 
@@ -526,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;
+      }
     }
 
 
@@ -554,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;
+      }
     }
 
 
@@ -584,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;
+      }
     }
 
     /**
@@ -613,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;
+      }
    }
 };
 }