file:
@code
- fdmex = new FGFDMExec( \85 );
- result = fdmex->LoadModel( \85 );
+ fdmex = new FGFDMExec( ... );
+ result = fdmex->LoadModel( ... );
@endcode
When an aircraft model is loaded, the config file is parsed and for each of the
/// Default destructor
~FGFDMExec();
+ /** Unbind all tied JSBSim properties. */
+ void unbind(void) {instance->unbind();}
+
/** This routine places a model into the runlist at the specified rate. The
"rate" is not really a clock rate. It represents how many calls to the
FGFDMExec::Run() method must be made before the model is executed. A
/******************************************************************************/
-void checkTied ( FGPropertyManager *node )
-{
- int N = node->nChildren();
- string name;
-
- for (int i=0; i<N; i++) {
- if (node->getChild(i)->nChildren() ) {
- checkTied( (FGPropertyManager*)node->getChild(i) );
- }
- if ( node->getChild(i)->isTied() ) {
- name = ((FGPropertyManager*)node->getChild(i))->GetFullyQualifiedName();
- node->Untie(name);
- }
- }
-}
-
-/******************************************************************************/
-
void FGJSBsim::unbind()
{
- SGPropertyNode* instance = globals->get_props()->getNode("/fdm/jsbsim");
- checkTied((FGPropertyManager*)instance);
+ fdmex->unbind();
FGInterface::unbind();
}
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();
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropertyManager::Tie (const string &name, bool *pointer, bool useDefault)
{
+ tied_properties.push_back(name);
if (!tie(name.c_str(), SGRawValuePointer<bool>(pointer), useDefault))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
else if (debug_lvl & 0x20)
void FGPropertyManager::Tie (const string &name, int *pointer,
bool useDefault )
{
+ tied_properties.push_back(name);
if (!tie(name.c_str(), SGRawValuePointer<int>(pointer), useDefault))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
else if (debug_lvl & 0x20)
void FGPropertyManager::Tie (const string &name, long *pointer,
bool useDefault )
{
+ tied_properties.push_back(name);
if (!tie(name.c_str(), SGRawValuePointer<long>(pointer), useDefault))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
else if (debug_lvl & 0x20)
void FGPropertyManager::Tie (const string &name, float *pointer,
bool useDefault )
{
+ tied_properties.push_back(name);
if (!tie(name.c_str(), SGRawValuePointer<float>(pointer), useDefault))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
else if (debug_lvl & 0x20)
void FGPropertyManager::Tie (const string &name, double *pointer, bool useDefault)
{
+ tied_properties.push_back(name);
if (!tie(name.c_str(), SGRawValuePointer<double>(pointer), useDefault))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
else if (debug_lvl & 0x20)
{
private:
static bool suppress_warning;
+ static std::vector<std::string> tied_properties;
public:
/// Constructor
FGPropertyManager(void) {suppress_warning = false;}
*/
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