CmDynLibManager.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #pragma once
  25. #include "CmPrerequisitesUtil.h"
  26. #include "CmModule.h"
  27. namespace CamelotFramework {
  28. /** \addtogroup Core
  29. * @{
  30. */
  31. /** \addtogroup General
  32. * @{
  33. */
  34. /** Manager for Dynamic-loading Libraries.
  35. @remarks
  36. This manager keeps a track of all the open dynamic-loading
  37. libraries, opens them and returns references to already-open
  38. libraries.
  39. */
  40. class CM_UTILITY_EXPORT DynLibManager: public Module<DynLibManager>
  41. {
  42. protected:
  43. typedef Map<String, DynLib*>::type DynLibList;
  44. DynLibList mLibList;
  45. public:
  46. /** Default constructor.
  47. @note
  48. <br>Should never be called as the singleton is automatically
  49. created during the creation of the Root object.
  50. @see
  51. Root::Root
  52. */
  53. DynLibManager();
  54. /** Default destructor.
  55. @see
  56. Root::~Root
  57. */
  58. virtual ~DynLibManager();
  59. /** Loads the passed library.
  60. @param
  61. filename The name of the library. The extension can be omitted
  62. */
  63. DynLib* load(const String& filename);
  64. /** Unloads the passed library.
  65. @param
  66. filename The name of the library. The extension can be omitted
  67. */
  68. void unload(DynLib* lib);
  69. };
  70. CM_UTILITY_EXPORT DynLibManager& gDynLibManager();
  71. /** @} */
  72. /** @} */
  73. }