BsDynLibManager.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPrerequisitesUtil.h"
  5. #include "BsModule.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup General
  9. * @{
  10. */
  11. /**
  12. * This manager keeps a track of all the open dynamic-loading libraries, opens them and returns references to
  13. * already-open libraries.
  14. *
  15. * @note Not thread safe.
  16. */
  17. class BS_UTILITY_EXPORT DynLibManager : public Module<DynLibManager>
  18. {
  19. public:
  20. DynLibManager();
  21. virtual ~DynLibManager();
  22. /**
  23. * Loads the given file as a dynamic library.
  24. *
  25. * @param[in] name The name of the library. The extension can be omitted.
  26. */
  27. DynLib* load(const String& name);
  28. /** Unloads the given library. */
  29. void unload(DynLib* lib);
  30. protected:
  31. Map<String, DynLib*> mLoadedLibraries;
  32. };
  33. /** Easy way of accessing DynLibManager. */
  34. BS_UTILITY_EXPORT DynLibManager& gDynLibManager();
  35. /** @} */
  36. }