Melchior FRANZ:

This is the more elegant solution that Andy had proposed in a response
to my RFC on Nasal initialization code in joystick configuration files.
As Nasal is initialized last (for good reason), subsystem can currently
not use it for initializing. postinit() is called on all subsystems
after all have been initialized.
This commit is contained in:
ehofman
2005-06-11 08:39:26 +00:00
parent d4e760efe1
commit 5d34eb12e0
2 changed files with 33 additions and 0 deletions

View File

@@ -25,6 +25,11 @@ SGSubsystem::init ()
{
}
void
SGSubsystem::postinit ()
{
}
void
SGSubsystem::reinit ()
{
@@ -87,6 +92,13 @@ SGSubsystemGroup::init ()
_members[i]->subsystem->init();
}
void
SGSubsystemGroup::postinit ()
{
for (unsigned int i = 0; i < _members.size(); i++)
_members[i]->subsystem->postinit();
}
void
SGSubsystemGroup::reinit ()
{
@@ -250,6 +262,13 @@ SGSubsystemMgr::init ()
_groups[i].init();
}
void
SGSubsystemMgr::postinit ()
{
for (int i = 0; i < MAX_GROUPS; i++)
_groups[i].postinit();
}
void
SGSubsystemMgr::reinit ()
{

View File

@@ -140,6 +140,18 @@ public:
virtual void init ();
/**
* Initialize parts that depend on other subsystems having been initialized.
*
* <p>This method should set up all parts that depend on other
* subsystems. One example is the scripting/Nasal subsystem, which
* is initialized last. So, if a subsystem wants to execute Nasal
* code in subsystem-specific configuration files, it has to do that
* in its postinit() method.</p>
*/
virtual void postinit ();
/**
* Reinitialize the subsystem.
*
@@ -243,6 +255,7 @@ public:
virtual ~SGSubsystemGroup ();
virtual void init ();
virtual void postinit ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
@@ -315,6 +328,7 @@ public:
virtual ~SGSubsystemMgr ();
virtual void init ();
virtual void postinit ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();