25#include <simgear/structure/subsystem_mgr.hxx>
26#include <simgear/structure/exception.hxx>
27#include <simgear/debug/logstream.hxx>
28#include <simgear/structure/commands.hxx>
29#include <simgear/structure/event_mgr.hxx>
55#if defined(ENABLE_SWIFT)
77#define MAKE_SUB(cl, n) \
78 if (name == n) return new cl;
104#ifdef ENABLE_AUDIO_SUPPORT
120 throw sg_range_exception(
"unknown subsystem:" +
name);
125 if (s ==
"init")
return SGSubsystemMgr::INIT;
126 if (s ==
"general")
return SGSubsystemMgr::GENERAL;
127 if (s ==
"fdm")
return SGSubsystemMgr::FDM;
128 if (s ==
"post-fdm")
return SGSubsystemMgr::POST_FDM;
129 if (s ==
"display")
return SGSubsystemMgr::DISPLAY;
130 if (s ==
"sound")
return SGSubsystemMgr::SOUND;
132 SG_LOG(SG_GENERAL, SG_ALERT,
"unrecognized subsystem group:" << s);
133 return SGSubsystemMgr::GENERAL;
136static SGSubsystem*
getSubsystem(
const SGPropertyNode* arg,
bool create)
138 std::string subsystem(arg->getStringValue(
"subsystem"));
139 std::string
name = arg->getStringValue(
"name");
146 SGSubsystem* sys =
globals->get_subsystem_mgr()->get_subsystem(
name);
150 if( subsystem.empty() ) {
153 "do_add_subsystem: no subsystem/name supplied" );
160 "do_add_subsystem: duplicate subsystem name:" <<
name );
164 std::string groupname = arg->getStringValue(
"group");
165 SGSubsystemMgr::GroupType group = SGSubsystemMgr::GENERAL;
166 if (!groupname.empty()) {
172 }
catch (sg_exception& e) {
175 "subsystem creation failed:" <<
name
176 <<
":" << e.getFormattedMessage() );
180 bool doInit = arg->getBoolValue(
"do-bind-init",
false);
186 double minTime = arg->getDoubleValue(
"min-time-sec", 0.0);
188 ->add(
name.c_str(), sys, group, minTime);
207 std::string
name = arg->getStringValue(
"subsystem");
209 SGSubsystem* instance =
globals->get_subsystem_mgr()->get_subsystem(
name);
211 SG_LOG(SG_GENERAL, SG_ALERT,
"do_remove_subsystem: unknown subsytem:" <<
name);
216 instance->shutdown();
220 globals->get_subsystem_mgr()->remove(
name.c_str());
232do_reinit (
const SGPropertyNode * arg, SGPropertyNode * root)
236 vector<SGPropertyNode_ptr> subsystems = arg->getChildren(
"subsystem");
237 if (subsystems.empty()) {
238 globals->get_subsystem_mgr()->reinit();
240 for (
unsigned int i = 0;
i < subsystems.size();
i++ ) {
241 std::string
name = subsystems[
i]->getStringValue();
242 SGSubsystem * subsystem =
globals->get_subsystem_mgr()->get_subsystem(
name.c_str());
243 if (subsystem == 0) {
245 SG_LOG( SG_GENERAL, SG_ALERT,
246 "Subsystem " <<
name <<
" not found" );
253 globals->get_event_mgr()->reinit();
264do_suspend (
const SGPropertyNode * arg, SGPropertyNode * root)
268 vector<SGPropertyNode_ptr> subsystems = arg->getChildren(
"subsystem");
269 for (
unsigned int i = 0;
i < subsystems.size();
i++ ) {
270 std::string
name = subsystems[
i]->getStringValue();
271 SGSubsystem * subsystem =
globals->get_subsystem_mgr()->get_subsystem(
name.c_str());
272 if (subsystem == 0) {
274 SG_LOG(SG_GENERAL, SG_ALERT,
"Subsystem " <<
name <<
" not found");
276 subsystem->suspend();
288do_resume (
const SGPropertyNode * arg, SGPropertyNode * root)
292 vector<SGPropertyNode_ptr> subsystems = arg->getChildren(
"subsystem");
293 for (
unsigned int i = 0;
i < subsystems.size();
i++ ) {
294 std::string
name = subsystems[
i]->getStringValue();
295 SGSubsystem * subsystem =
globals->get_subsystem_mgr()->get_subsystem(
name.c_str());
296 if (subsystem == 0) {
298 SG_LOG(SG_GENERAL, SG_ALERT,
"Subsystem " <<
name <<
" not found");
Wrap SGEphemeris in a subsystem/property interface.
Wrap an FDM implementation in a subsystem with standard semantics Notably, deal with the various case...
Manage environment information.
record the history of the aircraft's movements, making it available as a contiguous block.
Manage aircraft instruments.
Log any property values to any number of CSV files.
Manage a list of user-specified models.
Top level route manager class.
XML-configured GUI subsystem.
static struct @067026177365276227015073311113211264353134373250 built_ins[]
Table of built-in commands.
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
static bool do_resume(const SGPropertyNode *arg, SGPropertyNode *root)
Built-in command: suspend one or more subsystems.
SGSubsystem * createSubsystemByName(const std::string &name)
create a subsystem by name, and return it.
SGSubsystemMgr::GroupType mapGroupNameToType(const std::string &s)
void registerSubsystemCommands(SGCommandMgr *cmdMgr)
static bool do_reinit(const SGPropertyNode *arg, SGPropertyNode *root)
Built-in command: reinitialize one or more subsystems.
static struct flightgear::@155217300064376130365011127241277321035041155211 built_ins[]
static bool do_check_subsystem_running(const SGPropertyNode *arg, SGPropertyNode *root)
static bool do_add_subsystem(const SGPropertyNode *arg, SGPropertyNode *root)
static bool do_suspend(const SGPropertyNode *arg, SGPropertyNode *root)
Built-in command: suspend one or more subsystems.
static bool do_remove_subsystem(const SGPropertyNode *arg, SGPropertyNode *root)
SGCommandMgr::command_t command
static SGSubsystem * getSubsystem(const SGPropertyNode *arg, bool create)