SGSubsystem classes: Subsystem and subsystem group API declaration standardisation.

This is a cleanup commit.
This commit is contained in:
Edward d'Auvergne 2018-04-03 11:45:18 +02:00
parent b73dfb08ae
commit 10662e4ca5
8 changed files with 55 additions and 50 deletions

View File

@ -34,8 +34,9 @@ class SGInterpolator : public SGSubsystem
{ {
public: public:
SGInterpolator() { _list = 0; } SGInterpolator() { _list = 0; }
virtual void init() {}
virtual void update(double delta_time_sec); // Subsystem API.
void update(double delta_time_sec) override;
// Simple method that interpolates a double property value from // Simple method that interpolates a double property value from
// its current value (default of zero) to the specified target // its current value (default of zero) to the specified target

View File

@ -33,9 +33,9 @@ class PropertyBasedMgr : public SGSubsystem,
public SGPropertyChangeListener public SGPropertyChangeListener
{ {
public: public:
// Subsystem API.
void init() override; void init() override;
void shutdown() override; void shutdown() override;
void update(double delta_time_sec) override; void update(double delta_time_sec) override;
/** /**

View File

@ -51,10 +51,8 @@ public:
PropertyInterpolationMgr(); PropertyInterpolationMgr();
/** // Subsystem API.
* Update all active interpolators. void update(double dt) override;
*/
void update(double dt);
/** /**
* Create a new property interpolator. * Create a new property interpolator.

View File

@ -42,12 +42,13 @@ public:
SGTerraSync(); SGTerraSync();
virtual ~SGTerraSync(); virtual ~SGTerraSync();
virtual void init(); // Subsystem API.
virtual void shutdown(); void bind() override;
virtual void reinit(); void init() override;
virtual void bind(); void reinit() override;
virtual void unbind(); void shutdown() override;
virtual void update(double); void unbind() override;
void update(double) override;
/// notify terrasync that the sim was repositioned, as opposed to /// notify terrasync that the sim was repositioned, as opposed to
/// us travelling in a direction. Avoid last_lat / last_lon blocking /// us travelling in a direction. Avoid last_lat / last_lon blocking

View File

@ -52,15 +52,18 @@ public:
SGSoundMgr(); SGSoundMgr();
~SGSoundMgr(); ~SGSoundMgr();
void init(); // Subsystem API.
void update(double dt); void init() override;
void reinit() override;
void resume() override;
void suspend() override;
void update(double dt) override;
// Subsystem identification.
static const char* subsystemName() { return "sound"; }
void suspend();
void resume();
void stop(); void stop();
void reinit();
/** /**
* Select a specific sound device. * Select a specific sound device.
* Requires a init/reinit call before sound is actually switched. * Requires a init/reinit call before sound is actually switched.
@ -323,8 +326,6 @@ public:
bool testForError(std::string s, std::string name = "sound manager"); bool testForError(std::string s, std::string name = "sound manager");
static const char* subsystemName() { return "sound"; };
private: private:
class SoundManagerPrivate; class SoundManagerPrivate;
/// private implementation object /// private implementation object

View File

@ -37,10 +37,11 @@ class SGPerformanceMonitor : public SGSubsystem
public: public:
SGPerformanceMonitor(SGSubsystemMgr* subSysMgr, SGPropertyNode_ptr root); SGPerformanceMonitor(SGSubsystemMgr* subSysMgr, SGPropertyNode_ptr root);
virtual void bind (void); // Subsystem API.
virtual void unbind (void); void bind() override;
virtual void init (void); void init() override;
virtual void update (double dt); void unbind() override;
void update(double dt) override;
private: private:
static void subSystemMgrHook(void* userData, const std::string& name, SampleStatistic* timeStat); static void subSystemMgrHook(void* userData, const std::string& name, SampleStatistic* timeStat);

View File

@ -76,10 +76,11 @@ public:
SGEventMgr(); SGEventMgr();
~SGEventMgr(); ~SGEventMgr();
virtual void init(); // Subsystem API.
virtual void update(double delta_time_sec); void init() override;
virtual void unbind(); void shutdown() override;
virtual void shutdown(); void unbind() override;
void update(double delta_time_sec) override;
void setRealtimeProperty(SGPropertyNode* node) { _rtProp = node; } void setRealtimeProperty(SGPropertyNode* node) { _rtProp = node; }

View File

@ -382,17 +382,18 @@ public:
SGSubsystemGroup (const char *name); SGSubsystemGroup (const char *name);
virtual ~SGSubsystemGroup (); virtual ~SGSubsystemGroup ();
// Subsystem API.
void bind() override;
InitStatus incrementalInit() override;
void init() override; void init() override;
InitStatus incrementalInit () override; void postinit() override;
void postinit () override; void reinit() override;
void reinit () override; void resume() override;
void shutdown () override; void shutdown() override;
void bind () override; void suspend() override;
void unbind () override; void unbind() override;
void update (double delta_time_sec) override; void update(double delta_time_sec) override;
void suspend () override; bool is_suspended() const override;
void resume () override;
bool is_suspended () const override;
virtual void set_subsystem (const std::string &name, virtual void set_subsystem (const std::string &name,
SGSubsystem * subsystem, SGSubsystem * subsystem,
@ -506,17 +507,18 @@ public:
SGSubsystemMgr (const char *name); SGSubsystemMgr (const char *name);
virtual ~SGSubsystemMgr (); virtual ~SGSubsystemMgr ();
void init () override; // Subsystem API.
InitStatus incrementalInit () override; void bind() override;
void postinit () override; void init() override;
void reinit () override; InitStatus incrementalInit() override;
void shutdown () override; void postinit() override;
void bind () override; void reinit() override;
void unbind () override; void resume() override;
void update (double delta_time_sec) override; void shutdown() override;
void suspend () override; void suspend() override;
void resume () override; void unbind() override;
bool is_suspended () const override; void update(double delta_time_sec) override;
bool is_suspended() const override;
virtual void add (const char * name, virtual void add (const char * name,
SGSubsystem * subsystem, SGSubsystem * subsystem,