home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / startupmanager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.2 KB  |  76 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.     Boston, MA 02111-1307, USA.
  20.  
  21.     */
  22.  
  23. #ifndef STARTUPMANAGER_H
  24. #define STARTUPMANAGER_H
  25.  
  26. #include "arts_export.h"
  27.  
  28. #include <list>
  29.  
  30. /*
  31.  * BC - Status (2002-03-08): StartupClass, StartupManager.
  32.  *
  33.  * The class needs to be kept BC, as the startup system bases on inheritance
  34.  * and virtual functions. Do not change.
  35.  *
  36.  * The manager is a collection class without nonstatic data, so no BC issues
  37.  * here.
  38.  */
  39.  
  40. namespace Arts {
  41.  
  42. class ARTS_EXPORT StartupClass {
  43. public:
  44.     StartupClass();
  45.     virtual void startup() = 0;
  46.     virtual void shutdown();
  47. };
  48.  
  49. class StartupManager {
  50.     static std::list<StartupClass *> *startupClasses;
  51.     static class ExtensionLoader *activeExtensionLoader;
  52.     static bool running;
  53. public:
  54.     static void add(StartupClass *sc);
  55.     static void startup();
  56.     static void shutdown();
  57.  
  58.     /**
  59.      * since extensions will register startup classes in the same global way
  60.      * all other classes do (with StartupManager::add(<some startup class>)),
  61.      * the StartupManager supports forwarding all add requests to the
  62.      * active extension, which will allow synchronizing the lt_dlopen
  63.      * lt_dlclose with the calls of startup()/shutdown() of all StartupClasses
  64.      * present in the extension
  65.      */
  66.     static void setExtensionLoader(class ExtensionLoader *extension);
  67.  
  68.     /**
  69.      * to free all resources when the application terminates (internal use only)
  70.      */
  71.     static void internalFreeAll();
  72. };
  73.  
  74. }
  75. #endif /* STARTUPMANAGER_H */
  76.