#include <map>
SG_USING_STD(map);
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
\f
* <pre>
* void MySubsystem::bind ()
* {
- * fgTie("/controls/elevator", &_elevator);
- * fgSetArchivable("/controls/elevator");
+ * fgTie("/controls/flight/elevator", &_elevator);
+ * fgSetArchivable("/controls/flight/elevator");
* }
*
* void MySubsystem::unbind ()
* {
- * fgUntie("/controls/elevator");
+ * fgUntie("/controls/flight/elevator");
* }
* </pre>
*
virtual void init ();
+ /**
+ * Reinitialize the subsystem.
+ *
+ * <p>This method should cause the subsystem to reinitialize itself,
+ * and (normally) to reload any configuration files.</p>
+ */
+ virtual void reinit ();
+
+
/**
* Acquire the subsystem's property bindings.
*
virtual ~FGSubsystemGroup ();
virtual void init ();
+ virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double delta_time_sec);
+ virtual void suspend ();
+ virtual void resume ();
+ virtual bool is_suspended () const;
virtual void set_subsystem (const string &name,
FGSubsystem * subsystem,
\f
/**
- * Manage subsystems for the application.
+ * Manage subsystems for FlightGear.
+ *
+ * This top-level subsystem will eventually manage all of the
+ * subsystems in FlightGear: it broadcasts its life-cycle events
+ * (init, bind, etc.) to all of the subsystems it manages. Subsystems
+ * are grouped to guarantee order of initialization and execution --
+ * currently, the only two groups are INIT and GENERAL, but others
+ * will appear in the future.
+ *
+ * All subsystems are named as well as grouped, and subsystems can be
+ * looked up by name and cast to the appropriate subtype when another
+ * subsystem needs to invoke specialized methods.
+ *
+ * The subsystem manager owns the pointers to all the subsystems in
+ * it.
*/
class FGSubsystemMgr : public FGSubsystem
{
public:
+ /**
+ * Types of subsystem groups.
+ */
enum GroupType {
INIT = 0,
GENERAL,
virtual ~FGSubsystemMgr ();
virtual void init ();
+ virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double delta_time_sec);
+ virtual void suspend ();
+ virtual void resume ();
+ virtual bool is_suspended () const;
- virtual void add (GroupType group, const string &name,
+ virtual void add (const char * name,
FGSubsystem * subsystem,
+ GroupType group = GENERAL,
double min_time_sec = 0);
virtual FGSubsystemGroup * get_group (GroupType group);
+ virtual FGSubsystem * get_subsystem(const string &name);
+
private:
FGSubsystemGroup _groups[MAX_GROUPS];
+ map<string,FGSubsystem *> _subsystem_map;
};