Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: jmccay on November 07, 2007, 02:37:46 am

Title: Question on the managers
Post by: jmccay on November 07, 2007, 02:37:46 am
   I understand that the template Mgr is basically a Singleton pattern base class template for all the managers.  Mgr includes code to insure that another instance is not created when it is shutting down.  The class Manager appears to manage all the various managers.  It has similar code implementing the Singleton pattern, but it doesn't include the code to insure it is not created when shutting down.  How come?  Also, why are there two versions of Get in Manager?  What is the purpose of the second one (the one with the argument)?  Get() appears to be the one called most often.

Also, what was the rational for using the managers?  Was it to provide one location for the plug-ins to get various resources?  Or was there another rational?  I am just trying to understand the Code::Blocks code.  Thanks.
jmccay
Title: Re: Question on the managers
Post by: thomas on November 07, 2007, 09:14:02 am
Quote
The class Manager [...] doesn't include the code to insure it is not created when shutting down.  How come?
Because that's not what the code you're talking about does. Mgr does not re-create a Mgr-derived class once this particular class has been told to shut down.
Manger does not need such functionality. It exists from early in the application's lifetime until the very end.

Quote
Also, why are there two versions of Get in Manager?  What is the purpose of the second one (the one with the argument)?
There is no second version. Use Get(), nothing else.

Quote
Also, what was the rational for using the managers?  Was it to provide one location for the plug-ins to get various resources?
The rationale was to have a set of resources/features that are "just there" when some component needs them.