1
0
Fork 0

SGSubsystem classes: Renaming of the subsystem ID variables and functions.

This commit is contained in:
Edward d'Auvergne 2018-05-04 14:18:07 +02:00
parent a9e0ec843b
commit fb5c36fc82
29 changed files with 32 additions and 32 deletions

View file

@ -65,7 +65,7 @@ SGSubsystem and define at least a small set of functions:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "subsystem-example"; } static const char* staticSubsystemClassId() { return "subsystem-example"; }
}; };
The init() functions should make sure everything is set and ready so the The init() functions should make sure everything is set and ready so the

View file

@ -51,7 +51,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "ai-model"; } static const char* staticSubsystemClassId() { return "ai-model"; }
void updateLOD(SGPropertyNode* node); void updateLOD(SGPropertyNode* node);
void attach(FGAIBase *model); void attach(FGAIBase *model);

View file

@ -31,7 +31,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "aircraft-performance-db"; } static const char* staticSubsystemClassId() { return "aircraft-performance-db"; }
bool havePerformanceDataForAircraftType(const std::string& acType) const; bool havePerformanceDataForAircraftType(const std::string& acType) const;

View file

@ -265,7 +265,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "controls"; } static const char* staticSubsystemClassId() { return "controls"; }
// Reset function // Reset function
void reset_all(void); void reset_all(void);

View file

@ -73,7 +73,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "replay"; } static const char* staticSubsystemClassId() { return "replay"; }
bool start(bool NewTape=false); bool start(bool NewTape=false);

View file

@ -45,7 +45,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "airport-dynamics"; } static const char* staticSubsystemClassId() { return "airport-dynamics"; }
static FGAirportDynamicsRef find(const std::string& icao); static FGAirportDynamicsRef find(const std::string& icao);

View file

@ -53,7 +53,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "route-manager"; } static const char* staticSubsystemClassId() { return "route-manager"; }
bool isRouteActive() const; bool isRouteActive() const;

View file

@ -32,7 +32,7 @@ public:
void shutdown() override; void shutdown() override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "Canvas"; } static const char* staticSubsystemClassId() { return "Canvas"; }
/** /**
* Get OpenGL texture name for given canvas * Get OpenGL texture name for given canvas

View file

@ -48,7 +48,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "ephemeris"; } static const char* staticSubsystemClassId() { return "ephemeris"; }
SGEphemeris* data(); SGEphemeris* data();

View file

@ -54,7 +54,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "flight"; } static const char* staticSubsystemClassId() { return "flight"; }
FGInterface* getInterface() const; FGInterface* getInterface() const;

View file

@ -49,7 +49,7 @@ public:
void update(double delta_time_sec) override; void update(double delta_time_sec) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "gui"; } static const char* staticSubsystemClassId() { return "gui"; }
/** /**
* Redraw the GUI picking up new GUI colors. * Redraw the GUI picking up new GUI colors.

View file

@ -47,7 +47,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "input-hid"; } static const char* staticSubsystemClassId() { return "input-hid"; }
private: private:
class FGHIDEventInputPrivate; class FGHIDEventInputPrivate;

View file

@ -52,7 +52,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "input-mouse"; } static const char* staticSubsystemClassId() { return "input-mouse"; }
void doMouseClick (int b, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter* ea); void doMouseClick (int b, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter* ea);
void doMouseMotion (int x, int y, const osgGA::GUIEventAdapter*); void doMouseMotion (int x, int y, const osgGA::GUIEventAdapter*);

View file

@ -62,7 +62,7 @@ FGInput::FGInput () : SGSubsystemGroup("FGInput")
if( fgGetBool("/sim/input/no-mouse-input",false) ) { if( fgGetBool("/sim/input/no-mouse-input",false) ) {
SG_LOG(SG_INPUT,SG_ALERT,"Mouse input disabled!"); SG_LOG(SG_INPUT,SG_ALERT,"Mouse input disabled!");
} else { } else {
set_subsystem( FGMouseInput::subsystemName(), new FGMouseInput() ); set_subsystem( FGMouseInput::staticSubsystemClassId(), new FGMouseInput() );
} }
if( fgGetBool("/sim/input/no-keyboard-input",false) ) { if( fgGetBool("/sim/input/no-keyboard-input",false) ) {

View file

@ -56,7 +56,7 @@ public:
virtual ~FGInput(); virtual ~FGInput();
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "input"; } static const char* staticSubsystemClassId() { return "input"; }
}; };
#endif // _INPUT_HXX #endif // _INPUT_HXX

View file

@ -1153,7 +1153,7 @@ void fgStartNewReset()
SGSubsystemGroup* grp = subsystemManger->get_group(static_cast<SGSubsystemMgr::GroupType>(g)); SGSubsystemGroup* grp = subsystemManger->get_group(static_cast<SGSubsystemMgr::GroupType>(g));
for (auto nm : grp->member_names()) { for (auto nm : grp->member_names()) {
if ((nm == "time") || (nm == "terrasync") || (nm == "events") if ((nm == "time") || (nm == "terrasync") || (nm == "events")
|| (nm == "lighting") || (nm == FGScenery::subsystemName())) || (nm == "lighting") || (nm == FGScenery::staticSubsystemClassId()))
{ {
continue; continue;
} }
@ -1176,7 +1176,7 @@ void fgStartNewReset()
// order is important here since tile-manager shutdown needs to // order is important here since tile-manager shutdown needs to
// access the scenery object // access the scenery object
subsystemManger->remove(FGScenery::subsystemName()); subsystemManger->remove(FGScenery::staticSubsystemClassId());
FGScenery::getPagerSingleton()->clearRequests(); FGScenery::getPagerSingleton()->clearRequests();
flightgear::CameraGroup::setDefault(NULL); flightgear::CameraGroup::setDefault(NULL);

View file

@ -213,7 +213,7 @@ FGGlobals::~FGGlobals()
} }
osgDB::Registry::instance()->clearObjectCache(); osgDB::Registry::instance()->clearObjectCache();
subsystem_mgr->remove(FGScenery::subsystemName()); subsystem_mgr->remove(FGScenery::staticSubsystemClassId());
// renderer touches subsystems during its destruction // renderer touches subsystems during its destruction
set_renderer(NULL); set_renderer(NULL);

View file

@ -174,7 +174,7 @@ public:
template<class T> template<class T>
T* get_subsystem() const T* get_subsystem() const
{ {
return dynamic_cast<T*>(get_subsystem(T::subsystemName())); return dynamic_cast<T*>(get_subsystem(T::staticSubsystemClassId()));
} }
@ -190,7 +190,7 @@ public:
double min_time_sec = 0) double min_time_sec = 0)
{ {
T* sub = new T; T* sub = new T;
add_subsystem(T::subsystemName(), sub, type, min_time_sec); add_subsystem(T::staticSubsystemClassId(), sub, type, min_time_sec);
return sub; return sub;
} }

View file

@ -33,7 +33,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "aircraft-model"; } static const char* staticSubsystemClassId() { return "aircraft-model"; }
virtual SGModelPlacement * get3DModel() { return _aircraft.get(); } virtual SGModelPlacement * get3DModel() { return _aircraft.get(); }
virtual SGVec3d& getVelocity() { return _velocity; } virtual SGVec3d& getVelocity() { return _velocity; }

View file

@ -62,7 +62,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "model-manager"; } static const char* staticSubsystemClassId() { return "model-manager"; }
virtual void add_model (SGPropertyNode * node); virtual void add_model (SGPropertyNode * node);

View file

@ -38,7 +38,7 @@ public:
void update(double) override; void update(double) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "dns"; } static const char* staticSubsystemClassId() { return "dns"; }
void makeRequest(const simgear::DNS::Request_ptr& req); void makeRequest(const simgear::DNS::Request_ptr& req);

View file

@ -38,7 +38,7 @@ public:
void update(double) override; void update(double) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "http"; } static const char* staticSubsystemClassId() { return "http"; }
void makeRequest(const simgear::HTTP::Request_ptr& req); void makeRequest(const simgear::HTTP::Request_ptr& req);

View file

@ -80,7 +80,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "scenery"; } static const char* staticSubsystemClassId() { return "scenery"; }
/// Compute the elevation of the scenery at geodetic latitude lat, /// Compute the elevation of the scenery at geodetic latitude lat,
/// geodetic longitude lon and not higher than max_alt. /// geodetic longitude lon and not higher than max_alt.

View file

@ -111,7 +111,7 @@ public:
bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0); bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0);
void materialLibChanged(); void materialLibChanged();
static const char* subsystemName() { return "scenery"; } static const char* staticSubsystemClassId() { return "scenery"; }
private: private:
// terrain branch of scene graph // terrain branch of scene graph

View file

@ -109,7 +109,7 @@ public:
bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0); bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0);
void materialLibChanged(); void materialLibChanged();
static const char* subsystemName() { return "scenery"; } static const char* staticSubsystemClassId() { return "scenery"; }
private: private:
// tile manager // tile manager

View file

@ -44,7 +44,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "nasal"; } static const char* staticSubsystemClassId() { return "nasal"; }
// Loads a nasal script from an external file and inserts it as a // Loads a nasal script from an external file and inserts it as a
// global module of the specified name. // global module of the specified name.

View file

@ -45,7 +45,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "sound"; } static const char* staticSubsystemClassId() { return "sound"; }
void activate(bool State); void activate(bool State);
void update_device_list(); void update_device_list();
@ -81,7 +81,7 @@ public:
void update(double dt) {} override void update(double dt) {} override
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "sound"; } static const char* staticSubsystemClassId() { return "sound"; }
}; };
#endif // ENABLE_AUDIO_SUPPORT #endif // ENABLE_AUDIO_SUPPORT

View file

@ -43,7 +43,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "time"; } static const char* staticSubsystemClassId() { return "time"; }
void computeTimeDeltas(double& simDt, double& realDt); void computeTimeDeltas(double& simDt, double& realDt);

View file

@ -59,7 +59,7 @@ public:
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
static const char* subsystemName() { return "view-manager"; } static const char* staticSubsystemClassId() { return "view-manager"; }
// getters // getters
inline int size() const { return views.size(); } inline int size() const { return views.size(); }