source: GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLibManager.h @ 1812

Revision 1812, 4.0 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __DynLibManager_H__
26#define __DynLibManager_H__
27
28#include "OgrePrerequisites.h"
29#include "OgreSingleton.h"
30
31namespace Ogre {
32    /** Manager for Dynamic-loading Libraries.
33        @remarks
34            This manager keeps a track of all the open dynamic-loading
35            libraries, opens them and returns references to already-open
36            libraries.
37    */
38    class _OgreExport DynLibManager: public Singleton<DynLibManager>
39    {
40        protected:
41                typedef std::map<String, DynLib*> DynLibList;
42                DynLibList mLibList;
43    public:
44        /** Default constructor.
45            @note
46                <br>Should never be called as the singleton is automatically
47                created during the creation of the Root object.
48            @see
49                Root::Root
50        */
51        DynLibManager();
52
53        /** Default destructor.
54            @see
55                Root::~Root
56        */
57        virtual ~DynLibManager();
58
59        /** Loads the passed library.
60            @param
61                filename The name of the library. The extension can be ommitted
62        */
63        DynLib* load(const String& filename);
64
65                /** Unloads the passed library.
66                @param
67                filename The name of the library. The extension can be ommitted
68                */
69                void unload(DynLib* lib);
70
71                /** Override standard Singleton retrieval.
72        @remarks
73        Why do we do this? Well, it's because the Singleton
74        implementation is in a .h file, which means it gets compiled
75        into anybody who includes it. This is needed for the
76        Singleton template to work, but we actually only want it
77        compiled into the implementation of the class based on the
78        Singleton, not all of them. If we don't change this, we get
79        link errors when trying to use the Singleton-based class from
80        an outside dll.
81        @par
82        This method just delegates to the template version anyway,
83        but the implementation stays in this single compilation unit,
84        preventing link errors.
85        */
86        static DynLibManager& getSingleton(void);
87        /** Override standard Singleton retrieval.
88        @remarks
89        Why do we do this? Well, it's because the Singleton
90        implementation is in a .h file, which means it gets compiled
91        into anybody who includes it. This is needed for the
92        Singleton template to work, but we actually only want it
93        compiled into the implementation of the class based on the
94        Singleton, not all of them. If we don't change this, we get
95        link errors when trying to use the Singleton-based class from
96        an outside dll.
97        @par
98        This method just delegates to the template version anyway,
99        but the implementation stays in this single compilation unit,
100        preventing link errors.
101        */
102        static DynLibManager* getSingletonPtr(void);
103    };
104}
105
106#endif
Note: See TracBrowser for help on using the repository browser.