+class SGCondition;
+
+/** Nasal model data container.
+ * load and unload methods must be run in main thread (not thread-safe). */
+class FGNasalModelData : public SGReferenced
+{
+public:
+ /** Constructor to be run in an arbitrary thread. */
+ FGNasalModelData(SGPropertyNode *root, const string& path, SGPropertyNode *prop,
+ SGPropertyNode* load, SGPropertyNode* unload) :
+ _path(path),
+ _root(root), _prop(prop),
+ _load(load), _unload(unload)
+ {
+ }
+
+ /** Load hook. Always call from inside the main loop. */
+ void load();
+
+ /** Unload hook. Always call from inside the main loop. */
+ void unload();
+
+private:
+ static unsigned int _module_id;
+
+ string _module, _path;
+ SGPropertyNode_ptr _root, _prop;
+ SGConstPropertyNode_ptr _load, _unload;
+};
+
+/** Thread-safe proxy for FGNasalModelData.
+ * modelLoaded/destroy methods only register the requested
+ * operation. Actual (un)loading of Nasal module is deferred
+ * and done in the main loop. */
+class FGNasalModelDataProxy : public simgear::SGModelData
+{
+public:
+ FGNasalModelDataProxy(SGPropertyNode *root = 0) :
+ _root(root), _data(0)
+ {
+ }
+
+ ~FGNasalModelDataProxy();
+
+ void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *);
+
+protected:
+ SGPropertyNode_ptr _root;
+ SGSharedPtr<FGNasalModelData> _data;
+};
+
+SGPropertyNode* ghostToPropNode(naRef ref);
+SGCondition* conditionGhost(naRef r);