Formal shutdown interface on SGSubsystem.

This commit is contained in:
James Turner 2010-11-05 09:19:22 +00:00
parent 4bf16243fc
commit 5f2f95676c
2 changed files with 34 additions and 0 deletions

View File

@ -38,6 +38,11 @@ SGSubsystem::reinit ()
{
}
void
SGSubsystem::shutdown ()
{
}
void
SGSubsystem::bind ()
{
@ -141,6 +146,14 @@ SGSubsystemGroup::reinit ()
_members[i]->subsystem->reinit();
}
void
SGSubsystemGroup::shutdown ()
{
// reverse order to prevent order dependency problems
for (unsigned int i = _members.size(); i > 0; i--)
_members[i-1]->subsystem->shutdown();
}
void
SGSubsystemGroup::bind ()
{
@ -420,6 +433,15 @@ SGSubsystemMgr::reinit ()
_groups[i]->reinit();
}
void
SGSubsystemMgr::shutdown ()
{
// reverse order to prevent order dependency problems
for (int i = MAX_GROUPS-1; i >= 0; i--)
_groups[i]->shutdown();
}
void
SGSubsystemMgr::bind ()
{

View File

@ -169,6 +169,16 @@ public:
virtual void reinit ();
/**
* Shutdown the subsystem.
*
* <p>Release any state associated with subsystem. Shutdown happens in
* the reverse order to init(), so this is the correct place to do
* shutdown that depends on other subsystems.
* </p>
*/
virtual void shutdown ();
/**
* Acquire the subsystem's property bindings.
*
@ -297,6 +307,7 @@ public:
virtual void init ();
virtual void postinit ();
virtual void reinit ();
virtual void shutdown ();
virtual void bind ();
virtual void unbind ();
virtual void update (double delta_time_sec);
@ -392,6 +403,7 @@ public:
virtual void init ();
virtual void postinit ();
virtual void reinit ();
virtual void shutdown ();
virtual void bind ();
virtual void unbind ();
virtual void update (double delta_time_sec);