]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/input_output/FGPropertyManager.cpp
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / input_output / FGPropertyManager.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 6e62fef..c0218ec
@@ -49,6 +49,19 @@ COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
 namespace JSBSim {
 
 bool FGPropertyManager::suppress_warning = true;
+std::vector<std::string> FGPropertyManager::tied_properties;
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGPropertyManager::Unbind(void)
+{
+    vector<string>::iterator it;
+    for (it = tied_properties.begin();it < tied_properties.end();it++)
+    {
+        Untie(*it);
+    }
+    tied_properties.clear();
+}
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -74,7 +87,7 @@ FGPropertyManager::GetNode (const string &path, bool create)
 {
   SGPropertyNode* node=this->getNode(path.c_str(), create);
   if (node == 0 && !suppress_warning) {
-    cout << "FGPropertyManager::GetNode() No node found for " << path << endl;
+    cerr << "FGPropertyManager::GetNode() No node found for " << path << endl;
   }
   return (FGPropertyManager*)node;
 }
@@ -256,8 +269,8 @@ void FGPropertyManager::SetArchivable (const string &name, bool state )
 {
   SGPropertyNode * node = getNode(name.c_str());
   if (node == 0)
-    cout <<
-           "Attempt to set archive flag for non-existant property "
+    cerr <<
+           "Attempt to set archive flag for non-existent property "
            << name << endl;
   else
     node->setAttribute(SGPropertyNode::ARCHIVE, state);
@@ -269,7 +282,7 @@ void FGPropertyManager::SetReadable (const string &name, bool state )
 {
   SGPropertyNode * node = getNode(name.c_str());
   if (node == 0)
-    cout <<
+    cerr <<
            "Attempt to set read flag for non-existant property "
            << name << endl;
   else
@@ -282,7 +295,7 @@ void FGPropertyManager::SetWritable (const string &name, bool state )
 {
   SGPropertyNode * node = getNode(name.c_str());
   if (node == 0)
-    cout <<
+    cerr <<
            "Attempt to set write flag for non-existant property "
            << name << endl;
   else
@@ -294,7 +307,7 @@ void FGPropertyManager::SetWritable (const string &name, bool state )
 void FGPropertyManager::Untie (const string &name)
 {
   if (!untie(name.c_str()))
-    cout << "Failed to untie property " << name << endl;
+    cerr << "Failed to untie property " << name << endl;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -302,9 +315,11 @@ void FGPropertyManager::Untie (const string &name)
 void FGPropertyManager::Tie (const string &name, bool *pointer, bool useDefault)
 {
   if (!tie(name.c_str(), SGRawValuePointer<bool>(pointer), useDefault))
-    cout << "Failed to tie property " << name << " to a pointer" << endl;
-  else if (debug_lvl & 0x20)
-    cout << name << endl;
+    cerr << "Failed to tie property " << name << " to a pointer" << endl;
+  else {
+    tied_properties.push_back(name);
+    if (debug_lvl & 0x20) std::cout << name << std::endl;
+  }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -313,9 +328,11 @@ void FGPropertyManager::Tie (const string &name, int *pointer,
                                           bool useDefault )
 {
   if (!tie(name.c_str(), SGRawValuePointer<int>(pointer), useDefault))
-    cout << "Failed to tie property " << name << " to a pointer" << endl;
-  else if (debug_lvl & 0x20)
-    cout << name << endl;
+    cerr << "Failed to tie property " << name << " to a pointer" << endl;
+  else {
+    tied_properties.push_back(name);
+    if (debug_lvl & 0x20) std::cout << name << std::endl;
+  }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -324,9 +341,11 @@ void FGPropertyManager::Tie (const string &name, long *pointer,
                                           bool useDefault )
 {
   if (!tie(name.c_str(), SGRawValuePointer<long>(pointer), useDefault))
-    cout << "Failed to tie property " << name << " to a pointer" << endl;
-  else if (debug_lvl & 0x20)
-    cout << name << endl;
+    cerr << "Failed to tie property " << name << " to a pointer" << endl;
+  else {
+    tied_properties.push_back(name);
+    if (debug_lvl & 0x20) std::cout << name << std::endl;
+  }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -335,9 +354,11 @@ void FGPropertyManager::Tie (const string &name, float *pointer,
                                           bool useDefault )
 {
   if (!tie(name.c_str(), SGRawValuePointer<float>(pointer), useDefault))
-    cout << "Failed to tie property " << name << " to a pointer" << endl;
-  else if (debug_lvl & 0x20)
-    cout << name << endl;
+    cerr << "Failed to tie property " << name << " to a pointer" << endl;
+  else {
+    tied_properties.push_back(name);
+    if (debug_lvl & 0x20) std::cout << name << std::endl;
+  }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -345,9 +366,11 @@ void FGPropertyManager::Tie (const string &name, float *pointer,
 void FGPropertyManager::Tie (const string &name, double *pointer, bool useDefault)
 {
   if (!tie(name.c_str(), SGRawValuePointer<double>(pointer), useDefault))
-    cout << "Failed to tie property " << name << " to a pointer" << endl;
-  else if (debug_lvl & 0x20)
-    cout << name << endl;
+    cerr << "Failed to tie property " << name << " to a pointer" << endl;
+  else {
+    tied_properties.push_back(name);
+    if (debug_lvl & 0x20) std::cout << name << std::endl;
+  }
 }
 
 } // namespace JSBSim