Author Topic: Question on the managers  (Read 3219 times)

Offline jmccay

  • Almost regular
  • **
  • Posts: 202
Question on the managers
« 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
OS: WinXP, Win98 SE, & sometimes Linux

a little light reading from the wxWidgets 2.6.2 readme: A detailed 2000-page reference manual is supplied in HTML, PDF and Windows Help form: see the docs hierarchy.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Question on the managers
« Reply #1 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."