Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/platform/PlatformManager.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _PLATFORM_MANAGER_H_
00004 #define _PLATFORM_MANAGER_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 #include <core/Singleton.h>
00009 #include <core/Utils.h>
00010 #include <engine/Object.h>
00011 
00012 #include <string>
00013 #include <map>
00014 
00015 namespace platform
00016 {
00017 
00018 class Thread;
00019 class Timer;
00020 class File;
00021 class FileSystem;
00022 class FileSystemFactory;
00023 class PlatformDriver;
00024 enum CpuTechnology;
00025 
00026 typedef FileSystem* (ENGINE_CALLBACK *FILESYSTEM_FACTORY)(const std::string& filename, const std::string& type);
00027 typedef void (ENGINE_CALLBACK *FILESYSTEM_RELEASE)(FileSystem* fs);
00028 
00035 class ENGINE_PUBLIC_EXPORT PlatformManager: public engine::Object, public core::Singleton<PlatformManager>
00036 {
00037 public:
00038         
00040         PlatformManager();
00041 
00042         ~PlatformManager();
00043 
00044         void start();
00045 
00046         void stop();
00047 
00048         Timer* getTimer();
00049 
00052         const char* getCPUVendorId();
00053 
00055         f32 getCPUFrequency();
00056 
00058         bool checkCPUTechnology(CpuTechnology tech);
00059 
00061         u16 getLogicalProcessorsNum();
00062 
00064         u16 getPhysicalProcessorsNum();
00065 
00067         u32 getCPUCacheSize(u32 level);
00068 
00071         u32 getTotalMemory();
00072         
00075         u32 getFreeMemory();
00076 
00079         u32 getSharedMemory();
00080 
00083         u32 getBufferMemory();
00084 
00087         u32 getTotalSwap();
00088 
00091         u32 getFreeSwap();
00092 
00094         void copyToClipboard(const c8* text);
00095 
00098         c8* getTextFromClipboard();
00099         
00102         void sleep(u32 miliseconds);
00103 
00104         FileSystem* createFileSystem(const std::string& path, const std::string& type);
00105 
00106         void removeFileSystem(FileSystem* fs);
00107 
00108         void removeAllFileSystems();
00109 
00110         void registerFileSystemFactory(const std::string& type, FileSystemFactory* factory);
00111         void removeFileSystemFactory(const std::string& type);
00112 
00113         void setTimer(Timer *timer);
00114         void removeTimer();
00115 
00116         Thread* createThread();
00117 
00118         void removeThread(Thread* thread);
00119         void removeThread(const u32& id);
00120 
00121         void removeAllThreads();
00122 
00123         void setPlatformDriver(PlatformDriver *driver);
00124         void removePlatformDriver();
00125 
00126         static PlatformManager* getInstance();
00127 
00128 protected:
00129 
00130         void initializeImpl();
00131         void uninitializeImpl();
00132         void updateImpl(f32 elapsedTime);
00133 
00134         Timer* mTimer;
00135         PlatformDriver* mPlatformDriver;
00136 
00138         std::map<std::string, FileSystemFactory*> mFileSystemFactories;
00139 
00141         struct FileSystemInfo
00142         {
00143                 FileSystemInfo()
00144                 {
00145                         mFileSystem = NULL;
00146                         mType = core::STRING_BLANK;
00147                 }
00148 
00149                 FileSystemInfo& operator=(const FileSystemInfo& other)
00150                 {
00151                         mFileSystem = other.mFileSystem;
00152                         mType = other.mType;
00153                         return *this;
00154                 }
00155 
00156                 FileSystem* mFileSystem;
00157                 std::string mType;
00158         };
00159         std::map<u32, FileSystemInfo> mFileSystems;
00160 
00161         std::map<u32, Thread*> mThreads;
00162 };
00163 
00164 } // end namespace platform
00165 
00166 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)