1
0
Fork 0

SGSubsystem classes: Switch to the new SGSubsystemMgr::add() functions.

Most subsystems are now created via the subsystem manager using the global
subsystem registrations.

The FGGlobals add_subsystem() and add_new_subsystem() methods have been removed
as the subsystem manager addition and creation function interface now exceeds
the functionality of these helper functions.
This commit is contained in:
Edward d'Auvergne 2018-05-07 09:09:20 +02:00 committed by James Turner
parent ad33e50324
commit c5aa3ca0f1
34 changed files with 127 additions and 142 deletions

View file

@ -91,7 +91,11 @@ The bind() and unbind() functions can be used to tie and untie properties.
Finally to create and have the subsystem managed:
globals->add_subsystem("example", new FGSubsystemExample);
globals->get_subsystem_mgr()->add<FGSubsystemExample>();
or:
globals->get_subsystem_mgr()->add("example");
Now the subsystem manager calls the update() function of this class every
frame. dt is the time (in seconds) elapsed since the last call.

View file

@ -782,7 +782,7 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
if (gps == NULL) {
gps = new KLN89(instrument);
globals->add_subsystem("kln89", gps, SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add("kln89", gps);
}
//gps->init(); // init seems to get called automagically.
FGSpecialInstrument* gpsinst = new FGSpecialInstrument(gps);

View file

@ -77,7 +77,6 @@
#include <simgear/package/Catalog.hxx>
#include <Add-ons/AddonManager.hxx>
#include <Aircraft/controls.hxx>
#include <Aircraft/replay.hxx>
#include <Aircraft/FlightHistory.hxx>
@ -981,6 +980,9 @@ void fgCreateSubsystems(bool duringReset) {
SG_LOG( SG_GENERAL, SG_INFO, "== Creating Subsystems");
// Fetch the subsystem manager.
auto mgr = globals->get_subsystem_mgr();
globals->get_event_mgr()->init();
globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
@ -988,21 +990,20 @@ void fgCreateSubsystems(bool duringReset) {
{
// Initialize the property interpolator subsystem. Put into the INIT
// group because the "nasal" subsystem may need it at GENERAL take-down.
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
globals->add_new_subsystem<Highlight>(SGSubsystemMgr::INIT);
globals->add_subsystem("gui", new NewGUI, SGSubsystemMgr::INIT);
mgr->add<FGInterpolator>();
mgr->add<Highlight>();
mgr->add<NewGUI>();
}
// SGSubsystemMgr::GENERAL
{
globals->add_subsystem("properties", new FGProperties, SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->add_subsystem("performance-mon",
mgr->add<FGProperties>();
mgr->add<flightgear::AirportDynamicsManager>();
mgr->add("performance-mon",
new SGPerformanceMonitor(
globals->get_subsystem_mgr(),
mgr,
fgGetNode("/sim/performance-monitor", true)
),
SGSubsystemMgr::GENERAL
)
);
// Initialize the material property subsystem.
@ -1014,54 +1015,54 @@ void fgCreateSubsystems(bool duringReset) {
// may exist already due to GUI startup or --load-tape=http...
if (!globals->get_subsystem<FGHTTPClient>()) {
globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
mgr->add<FGHTTPClient>();
}
globals->add_new_subsystem<FGDNSClient>(SGSubsystemMgr::GENERAL);
mgr->add<FGDNSClient>();
// Initialize the weather modeling subsystem
globals->add_subsystem("environment", new FGEnvironmentMgr, SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<Ephemeris>(SGSubsystemMgr::GENERAL);
globals->add_subsystem( "xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"), SGSubsystemMgr::GENERAL );
mgr->add<FGEnvironmentMgr>();
mgr->add<Ephemeris>();
mgr->add("xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"));
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
globals->add_subsystem( "io", new FGIO, SGSubsystemMgr::GENERAL );
globals->add_subsystem("logger", new FGLogger, SGSubsystemMgr::GENERAL);
mgr->add<FGRouteMgr>();
mgr->add<FGIO>();
mgr->add<FGLogger>();
globals->add_new_subsystem<FGControls>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGInput>(SGSubsystemMgr::GENERAL);
globals->add_subsystem("history", new FGFlightHistory, SGSubsystemMgr::GENERAL);
mgr->add<FGControls>();
mgr->add<FGInput>();
mgr->add<FGFlightHistory>();
{
SGSubsystem * httpd = flightgear::http::FGHttpd::createInstance( fgGetNode(flightgear::http::PROPERTY_ROOT) );
if( NULL != httpd )
globals->add_subsystem("httpd", httpd, SGSubsystemMgr::GENERAL );
mgr->add("httpd", httpd);
}
if (!duringReset) {
globals->add_subsystem("tides", new FGTide, SGSubsystemMgr::GENERAL );
mgr->add<FGTide>();
}
}
// SGSubsystemMgr::FDM
{
globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM);
mgr->add<FDMShell>();
// Initialize the aircraft systems and instrumentation (before the
// autopilot.)
globals->add_subsystem("systems", new FGSystemMgr, SGSubsystemMgr::FDM);
globals->add_subsystem("instrumentation", new FGInstrumentMgr, SGSubsystemMgr::FDM);
globals->add_subsystem( "xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"), SGSubsystemMgr::FDM );
mgr->add<FGSystemMgr>();
mgr->add<FGInstrumentMgr>();
mgr->add("xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"));
}
// SGSubsystemMgr::POST_FDM
{
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::POST_FDM);
globals->add_subsystem("ATC", new FGATCManager, SGSubsystemMgr::POST_FDM);
globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
globals->add_subsystem("mp", new FGMultiplayMgr, SGSubsystemMgr::POST_FDM);
mgr->add<PerformanceDB>();
mgr->add<FGATCManager>();
mgr->add<FGAIManager>();
mgr->add<FGMultiplayMgr>();
#ifdef ENABLE_SWIFT
globals->add_subsystem("swift", new SwiftConnection, SGSubsystemMgr::POST_FDM);
mgr->add<SwiftConnection>();
#endif
// FGReplay.
@ -1077,16 +1078,16 @@ void fgCreateSubsystems(bool duringReset) {
// problem where JSBSim appears to rely on FGReplay creating certain
// properties before it is initialised. This caused problems when
// FGReplay was changed to be POST_FDM.
globals->add_new_subsystem<FGReplay>(SGSubsystemMgr::POST_FDM)
->init(); // Special case.
mgr->add<FGReplay>();
mgr->get_subsystem("replay")->init(); // Special case.
//globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
globals->add_subsystem("submodel-mgr", new FGSubmodelMgr, SGSubsystemMgr::POST_FDM);
//mgr->add<FGAIManager>();
mgr->add<FGSubmodelMgr>();
// It's probably a good idea to initialize the top level traffic manager
// After the AI and ATC systems have been initialized properly.
// AI Traffic manager
globals->add_subsystem("traffic-manager", new FGTrafficManager, SGSubsystemMgr::POST_FDM);
mgr->add<FGTrafficManager>();
fgSetArchivable("/sim/panel/visibility");
fgSetArchivable("/sim/panel/x-offset");
@ -1096,32 +1097,32 @@ void fgCreateSubsystems(bool duringReset) {
// SGSubsystemMgr::DISPLAY
{
globals->add_subsystem("hud", new HUD, SGSubsystemMgr::DISPLAY);
globals->add_subsystem("cockpit-displays", new flightgear::CockpitDisplayManager, SGSubsystemMgr::DISPLAY);
mgr->add<HUD>();
mgr->add<flightgear::CockpitDisplayManager>();
simgear::canvas::Canvas::setSystemAdapter(
simgear::canvas::SystemAdapterPtr(new canvas::FGCanvasSystemAdapter)
);
globals->add_subsystem("Canvas", new CanvasMgr, SGSubsystemMgr::DISPLAY);
mgr->add<CanvasMgr>();
auto canvasGui = new GUIMgr;
globals->add_subsystem("CanvasGUI", canvasGui, SGSubsystemMgr::DISPLAY);
mgr->add("CanvasGUI", canvasGui);
auto guiCamera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
canvasGui->setGUIViewAndCamera(globals->get_renderer()->getView(), guiCamera);
#ifdef ENABLE_AUDIO_SUPPORT
globals->add_subsystem("voice", new FGVoiceMgr, SGSubsystemMgr::DISPLAY);
mgr->add<FGVoiceMgr>();
#endif
// ordering here is important : Nasal (via events), then models, then views
if (!duringReset) {
globals->add_subsystem("lighting", new FGLight, SGSubsystemMgr::DISPLAY);
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
mgr->add<FGLight>();
mgr->add("events", globals->get_event_mgr());
}
globals->add_new_subsystem<FGAircraftModel>(SGSubsystemMgr::DISPLAY);
globals->add_new_subsystem<FGModelMgr>(SGSubsystemMgr::DISPLAY);
globals->add_new_subsystem<FGViewMgr>(SGSubsystemMgr::DISPLAY);
mgr->add<FGAircraftModel>();
mgr->add<FGModelMgr>();
mgr->add<FGViewMgr>();
}
// SGSubsystemMgr::SOUND
@ -1130,7 +1131,7 @@ void fgCreateSubsystems(bool duringReset) {
// to be updated in every loop.
// Sound manager is updated last so it can use the CPU while the GPU
// is processing the scenery (doubled the frame-rate for me) -EMH-
globals->add_new_subsystem<FGSoundManager>(SGSubsystemMgr::SOUND);
mgr->add<FGSoundManager>();
#ifdef ENABLE_IAX
// Initialize the FGCom subsystem.
@ -1138,7 +1139,7 @@ void fgCreateSubsystems(bool duringReset) {
// depends on OpenAL, which is shutdown when the SOUND group
// shutdown.
// Sentry: FLIGHTGEAR-66
globals->add_new_subsystem<FGCom>(SGSubsystemMgr::SOUND);
mgr->add<FGCom>();
#endif
}
}
@ -1147,16 +1148,19 @@ void fgPostInitSubsystems()
{
SGTimeStamp st;
st.stamp();
// Fetch the subsystem manager.
auto mgr = globals->get_subsystem_mgr();
////////////////////////////////////////////////////////////////////////
// Initialize the Nasal interpreter.
// Do this last, so that the loaded scripts see initialized state
////////////////////////////////////////////////////////////////////////
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
mgr->add<FGNasalSys>();
// initialize methods that depend on other subsystems.
st.stamp();
globals->get_subsystem_mgr()->postinit();
mgr->postinit();
SG_LOG(SG_GENERAL, SG_INFO, "Subsystems postinit took:" << st.elapsedMSec());
////////////////////////////////////////////////////////////////////////
@ -1189,10 +1193,9 @@ void fgStartReposition()
// set this signal so Nasal scripts can take action.
fgSetBool("/sim/signals/reinit", true);
fgSetBool("/sim/crashed", false);
FDMShell* fdm = globals->get_subsystem<FDMShell>();
fdm->unbind();
globals->get_subsystem("flight")->unbind();
// update our position based on current presets
// this will mark position as needed finalized which we'll do in the
// main-loop
@ -1227,7 +1230,7 @@ void fgStartReposition()
}
// need to bind FDMshell again
fdm->bind();
globals->get_subsystem("flight")->bind();
// need to reset aircraft (systems/instruments/autopilot)
// so they can adapt to current environment

View file

@ -602,15 +602,6 @@ FGGlobals::get_subsystem (const char * name) const
return subsystem_mgr->get_subsystem(name);
}
void
FGGlobals::add_subsystem (const char * name,
SGSubsystem * subsystem,
SGSubsystemMgr::GroupType type,
double min_time_sec)
{
subsystem_mgr->add(name, subsystem, type, min_time_sec);
}
SGEventMgr *
FGGlobals::get_event_mgr () const
{

View file

@ -180,19 +180,6 @@ public:
}
void add_subsystem (const char * name,
SGSubsystem * subsystem,
SGSubsystemMgr::GroupType type,
double min_time_sec = 0);
template<class T>
T* add_new_subsystem (SGSubsystemMgr::GroupType type, double min_time_sec = 0)
{
T* sub = new T;
add_subsystem(T::staticSubsystemClassId(), sub, type, min_time_sec);
return sub;
}
SGEventMgr *get_event_mgr () const;
inline double get_sim_time_sec () const { return sim_time_sec; }

View file

@ -186,9 +186,8 @@ static void initTerrasync()
// hence not downloaded again.
fgSetString("/sim/terrasync/installation-dir", (globals->get_fg_root() / "Scenery").utf8Str());
simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync();
auto terra_sync = globals->get_subsystem_mgr()->add<simgear::SGTerraSync>();
terra_sync->setRoot(globals->get_props());
globals->add_subsystem("terrasync", terra_sync, SGSubsystemMgr::GENERAL);
terra_sync->bind();
terra_sync->init();
@ -338,7 +337,7 @@ static void fgIdleFunction ( void ) {
} else if ( idle_state == 4 ) {
idle_state++;
globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<TimeManager>();
// Do some quick general initializations
if( !fgInitGeneral()) {
@ -375,9 +374,9 @@ static void fgIdleFunction ( void ) {
// Initialize the TG scenery subsystem.
////////////////////////////////////////////////////////////////////
globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
globals->get_scenery()->init();
globals->get_scenery()->bind();
auto scenery = globals->get_subsystem_mgr()->add<FGScenery>();
scenery->init();
scenery->bind();
fgSplashProgress("creating-subsystems");
} else if (( idle_state == 7 ) || (idle_state == 2007)) {
@ -705,7 +704,7 @@ int fgMainInit( int argc, char **argv )
fgInitSecureMode();
fgInitAircraftPaths(false);
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
auto errorManager = globals->get_subsystem_mgr()->add<flightgear::ErrorReporter>();
errorManager->preinit();
configResult = fgInitAircraft(false, didUseLauncher);
@ -756,7 +755,7 @@ int fgMainInit( int argc, char **argv )
// Copy the property nodes for the menus added by registered add-ons
addons::AddonManager::instance()->addAddonMenusToFGMenubar();
auto presets = globals->add_new_subsystem<flightgear::GraphicsPresets>(SGSubsystemMgr::DISPLAY);
auto presets = globals->get_subsystem_mgr()->add<flightgear::GraphicsPresets>();
presets->applyInitialPreset();
// Initialize the Window/Graphics environment.

View file

@ -93,7 +93,7 @@ FGHTTPClient* FGHTTPClient::getOrCreate()
return ext;
}
ext = globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
ext = globals->get_subsystem_mgr()->add<FGHTTPClient>();
ext->init();
return ext;
}

View file

@ -228,7 +228,7 @@ fgviewerMain(int argc, char** argv)
// Now init the renderer, as we've got all the options, globals etc.
fgrenderer->init();
FGScenery* scenery = globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
auto scenery = globals->get_subsystem_mgr()->add<FGScenery>();
scenery->init();
scenery->bind();

View file

@ -49,7 +49,7 @@ TestPilot::TestPilot(SGPropertyNode_ptr props) :
_groundspeedKnotsProp = _propRoot->getNode("velocities/groundspeed-kt", true);
_verticalFPMProp = _propRoot->getNode("velocities/vertical-fpm", true);
globals->add_subsystem("flight", this, SGSubsystemMgr::FDM);
globals->get_subsystem_mgr()->add("flight", this);
}
TestPilot::~TestPilot()

View file

@ -48,7 +48,7 @@ void initScenery()
render->setView(viewer.get());
// Start up the scenery subsystem.
globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
globals->get_subsystem_mgr()->add<FGScenery>();
globals->get_scenery()->init();
globals->get_scenery()->bind();
}

View file

@ -69,7 +69,7 @@ void initTestGlobals(const std::string& testName)
fgSetDefaults();
auto t = globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
auto t = globals->get_subsystem_mgr()->add<TimeManager>();
t->bind();
t->init(); // establish mag-var data
@ -79,7 +79,7 @@ void initTestGlobals(const std::string& testName)
* Here the event manager is added to the subsystem manager so it can be
* destroyed via the subsystem manager.
*/
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
globals->get_subsystem_mgr()->add("events", globals->get_event_mgr());
// necessary to avoid asserts: mark FGLocale as initialized
globals->get_locale()->selectLanguage({});
@ -169,10 +169,10 @@ void initStandardNasal(bool withCanvas)
nasalNode->setBoolValue("local_weather/enabled", false);
// Nasal needs the interpolator running
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGInterpolator>();
// will be inited, since we already did that
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGNasalSys>();
}
void populateFPWithoutNasal(flightgear::FlightPlanRef f,

View file

@ -31,7 +31,7 @@ void CanvasTests::setUp()
simgear::canvas::SystemAdapterPtr(new canvas::FGCanvasSystemAdapter)
);
globals->add_subsystem("Canvas", new CanvasMgr, SGSubsystemMgr::DISPLAY);
globals->get_subsystem_mgr()->add<CanvasMgr>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -85,9 +85,10 @@ void AeroMeshTests::testLiftComputation()
props->setDoubleValue("geometry/wing/chord-ft", c);
props->setDoubleValue("geometry/weight-lbs", weight);
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::POST_FDM);
globals->get_subsystem<PerformanceDB>()->bind();
globals->get_subsystem<PerformanceDB>()->init();
auto subsystem_mgr = globals->get_subsystem_mgr();
subsystem_mgr->add<PerformanceDB>();
subsystem_mgr->get_subsystem<PerformanceDB>()->bind();
subsystem_mgr->get_subsystem<PerformanceDB>()->init();
FGAIManager *aiManager = new FGAIManager;
FGAIAircraft *ai = new FGAIAircraft;

View file

@ -120,10 +120,10 @@ void GPSTests::testGPS()
FGRouteMgr* rm = new FGRouteMgr;
globals->add_subsystem( "route-manager", rm );
globals->get_subsystem_mgr()->add( "route-manager", rm );
// FGEnvironmentMgr* envMgr = new FGEnvironmentMgr;
// globals->add_subsystem("environment", envMgr);
// globals->get_subsystem_mgr()->add("environment", envMgr);
// envMgr->init();
fgSetBool("/sim/realism/simple-gps", true);
@ -132,7 +132,7 @@ void GPSTests::testGPS()
SGPropertyNode* nd = fgGetNode("/instrumentation/gps", true);
GPS* gps = new GPS(nd);
globals->add_subsystem("gps", gps);
globals->get_subsystem_mgr()->add("gps", gps);
const FGAirport* egph = fgFindAirportID("EGPH");
testSetPosition(egph->geod());

View file

@ -49,7 +49,7 @@ void AIFlightPlanTests::setUp()
FGTestApi::setUp::initTestGlobals("AI");
FGTestApi::setUp::initNavDataCache();
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<FGAIManager>();
auto props = globals->get_props();
props->setBoolValue("sim/ai/enabled", true);

View file

@ -45,7 +45,7 @@ void AIManagerTests::setUp()
FGTestApi::setUp::initTestGlobals("AI");
FGTestApi::setUp::initNavDataCache();
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<FGAIManager>();
auto props = globals->get_props();
props->setBoolValue("sim/ai/enabled", true);

View file

@ -55,7 +55,7 @@ void TrafficMgrTests::tearDown()
}
void TrafficMgrTests::testParse() {
globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<FGTrafficManager>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
@ -107,7 +107,7 @@ void TrafficMgrTests::testTrafficManager()
FGTestApi::setPositionAndStabilise(egeo->geod());
auto tmgr = globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
auto tmgr = globals->get_subsystem_mgr()->add<FGTrafficManager>();
tmgr->bind();
tmgr->init();

View file

@ -68,10 +68,10 @@ void GroundnetTests::setUp()
ybbn->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "YBBN.groundnet.xml");
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<PerformanceDB>();
globals->get_subsystem_mgr()->add<FGATCManager>();
globals->get_subsystem_mgr()->add<FGAIManager>();
globals->get_subsystem_mgr()->add<flightgear::AirportDynamicsManager>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -49,8 +49,8 @@ void SubmodelsTests::setUp()
props->setBoolValue("sim/ai/enabled", true);
props->setStringValue("sim/submodels/path", "Aircraft/Test/submodels.xml");
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGSubmodelMgr>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<FGAIManager>();
globals->get_subsystem_mgr()->add<FGSubmodelMgr>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -89,11 +89,11 @@ void TrafficTests::setUp()
FGAirportRef ybbn = FGAirport::getByIdent("YBBN");
ybbn->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "YBBN.groundnet.xml");
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<PerformanceDB>();
globals->get_subsystem_mgr()->add<FGATCManager>();
globals->get_subsystem_mgr()->add<FGAIManager>();
globals->get_subsystem_mgr()->add<flightgear::AirportDynamicsManager>();
globals->get_subsystem_mgr()->add<FGTrafficManager>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -56,7 +56,7 @@ void DigitalFilterTests::testNoise()
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
globals->get_subsystem_mgr()->add("ap", ap);
ap->bind();
ap->init();

View file

@ -102,7 +102,7 @@ void PidControllerTests::test(bool startup_current)
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
globals->get_subsystem_mgr()->add("ap", ap);
ap->bind();
ap->init();

View file

@ -51,7 +51,7 @@ SGSubsystemRef CommRadioTests::setupStandardRadio(const std::string& name, int i
r->bind();
r->init();
globals->add_subsystem("comm-radio", r, SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add("comm-radio", r);
return r;
}

View file

@ -104,13 +104,13 @@ GPS* GPSTests::setupStandardGPS(SGPropertyNode_ptr config,
gps->bind();
gps->init();
globals->add_subsystem("gps", gps, SGSubsystemMgr::POST_FDM);
globals->get_subsystem_mgr()->add("gps", gps);
return gps;
}
void GPSTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
auto rm = globals->get_subsystem_mgr()->add<FGRouteMgr>();
rm->bind();
rm->init();
rm->postinit();

View file

@ -111,13 +111,13 @@ GPS* HoldControllerTests::setupStandardGPS(SGPropertyNode_ptr config,
gps->bind();
gps->init();
globals->add_subsystem("gps", gps, SGSubsystemMgr::POST_FDM);
globals->get_subsystem_mgr()->add("gps", gps);
return gps;
}
void HoldControllerTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
auto rm = globals->get_subsystem_mgr()->add<FGRouteMgr>();
rm->bind();
rm->init();
rm->postinit();

View file

@ -170,13 +170,13 @@ GPS* RNAVProcedureTests::setupStandardGPS(SGPropertyNode_ptr config,
gps->bind();
gps->init();
globals->add_subsystem("gps", gps, SGSubsystemMgr::POST_FDM);
globals->get_subsystem_mgr()->add("gps", gps);
return gps;
}
void RNAVProcedureTests::setupRouteManager()
{
auto rm = globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
auto rm = globals->get_subsystem_mgr()->add<FGRouteMgr>();
rm->bind();
rm->init();
rm->postinit();

View file

@ -40,7 +40,7 @@ SGSubsystemRef TransponderTests::setupStandardTransponder(const std::string& nam
r->bind();
r->init();
globals->add_subsystem("transponder", r, SGSubsystemMgr::FDM);
globals->get_subsystem_mgr()->add("transponder", r);
return r;
}

View file

@ -61,10 +61,10 @@ void PosInitTests::setUp()
apt->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "EDDF.groundnet.xml");
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<flightgear::AirportDynamicsManager>();
globals->get_subsystem_mgr()->add<PerformanceDB>();
globals->get_subsystem_mgr()->add<FGATCManager>();
globals->get_subsystem_mgr()->add<FGAIManager>();
}

View file

@ -34,7 +34,7 @@ void FPNasalTests::setUp()
}
// flightplan() acces needs the route manager
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
globals->get_subsystem_mgr()->add<FGRouteMgr>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -50,7 +50,7 @@ void RouteManagerTests::setUp()
globals->append_fg_scenery(proceduresPath);
}
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::FDM);
globals->get_subsystem_mgr()->add<FGRouteMgr>();
// setup the default GPS, which is needed for waypoint
// sequencing to work
@ -63,7 +63,7 @@ void RouteManagerTests::setUp()
SGPropertyNode_ptr node = globals->get_props()->getNode("instrumentation", true)->getChild("gps", 0, true);
// node->setBoolValue("serviceable", true);
// globals->get_props()->setDoubleValue("systems/electrical/outputs/gps", 6.0);
globals->add_subsystem("gps", gps, SGSubsystemMgr::POST_FDM);
globals->get_subsystem_mgr()->add("gps", gps);
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();

View file

@ -29,7 +29,7 @@ std::vector<SGSharedPtr<FGAIBase>> SwiftAircraftManagerTest::getAIList()
void SwiftAircraftManagerTest::testAircraftManager()
{
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::POST_FDM);
globals->get_subsystem_mgr()->add<FGAIManager>();
globals->get_subsystem<FGAIManager>()->bind();
globals->get_subsystem<FGAIManager>()->init();

View file

@ -38,13 +38,13 @@ void NasalGCTests::setUp()
fgInitAllowedPaths();
auto nasalNode = globals->get_props()->getNode("nasal", true);
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGInterpolator>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
global_nasalMinimalInit = true;
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGNasalSys>();
globals->get_subsystem_mgr()->postinit();
}

View file

@ -42,12 +42,12 @@ void NasalSysTests::setUp()
fgInitAllowedPaths();
globals->get_props()->getNode("nasal", true);
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGInterpolator>();
globals->get_subsystem_mgr()->bind();
globals->get_subsystem_mgr()->init();
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
globals->get_subsystem_mgr()->add<FGNasalSys>();
globals->get_subsystem_mgr()->postinit();
}

View file

@ -49,7 +49,7 @@ void ViewsTests::tearDown()
void ViewsTests::testBasic()
{
auto vm = globals->add_new_subsystem<FGViewMgr>(SGSubsystemMgr::DISPLAY);
auto vm = globals->get_subsystem_mgr()->add<FGViewMgr>();
CPPUNIT_ASSERT_EQUAL(static_cast<flightgear::View*>(nullptr), vm->get_current_view());