Game Develop Core: PlatformManager.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
PlatformManager.h
Go to the documentation of this file.
1
6 #if defined(GD_IDE_ONLY)
7 #ifndef PLATFORMMANAGER_H
8 #define PLATFORMMANAGER_H
9 #include <vector>
10 #include <boost/shared_ptr.hpp>
11 #include "GDCore/PlatformDefinition/Platform.h"
12
13 namespace gd
14 {
15
25 class GD_CORE_API PlatformManager
26 {
27 public:
28
32 bool AddPlatform(boost::shared_ptr<gd::Platform> newPlatform);
33
38 gd::Platform* GetPlatform(const std::string & platformName) const;
39
43 const std::vector< boost::shared_ptr<gd::Platform> > & GetAllPlatforms() const { return platformsLoaded; };
44
48 void NotifyPlatformIDEInitialized() const;
49
50 static PlatformManager *GetInstance()
51 {
52 if ( NULL == _singleton )
53 {
54 _singleton = new PlatformManager;
55 }
56
57 return ( static_cast<PlatformManager*>( _singleton ) );
58 }
59
66 static void DestroySingleton()
67 {
68 if ( NULL != _singleton )
69 {
70 for (unsigned int i = 0;i<_singleton->platformsLoaded.size();++i)
71 {
72 if ( _singleton->platformsLoaded[i] != boost::shared_ptr<gd::Platform>() )
73 _singleton->platformsLoaded[i]->OnIDEClosed();
74 }
75
76 delete _singleton;
77 _singleton = NULL;
78 }
79 }
80
81 private:
82 std::vector< boost::shared_ptr<gd::Platform> > platformsLoaded;
83
84 PlatformManager();
85 virtual ~PlatformManager();
86 static PlatformManager *_singleton;
87 };
88
89 }
90 #endif // PLATFORMMANAGER_H
91 #endif