eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // PluginManager.h Core.Component package 00003 //============================================================================ 00004 // Usage : definition of tool class to manage plugins 00005 //---------------------------------------------------------------------------- 00006 // Inheritance : 00007 // PluginManager 00008 //---------------------------------------------------------------------------- 00009 // Copyright (C) 2006 by eLynx project 00010 // 00011 // This library is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU Library General Public 00013 // License as published by the Free Software Foundation; either 00014 // version 2 of the License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00019 // See the GNU Library General Public License for more details. 00020 //---------------------------------------------------------------------------- 00021 #ifndef __PluginManager_h__ 00022 #define __PluginManager_h__ 00023 00024 #include "CoreLib.h" 00025 #include "UUID.h" 00026 #include <vector> 00027 #include <map> 00028 00029 namespace eLynx { 00030 00031 class IPlugin; 00032 class IPluginPackage; 00033 class PluginFile; 00034 00040 class ExportedByCore PluginManager 00041 { 00042 public: 00046 PluginManager(const UUID& iFamilyType); 00047 00050 virtual ~PluginManager(); 00051 00052 00055 00058 bool IsEmpty() const; 00059 00064 void Register(const char * iprPath, const char * iprExt); 00065 00069 bool RegisterFile(const char * iprFilename); 00070 00073 void Unregister(); 00074 00078 bool Unregister(const IPluginPackage * iprPackage); 00079 00083 bool Unregister(const IPlugin * iprPlugin); 00084 00088 bool UnregisterPackage(const char * iprFilename); 00089 00093 bool UnregisterPackage(const UUID& iUUID); 00094 00098 bool UnregisterPlugin(const char * iprName); 00099 00103 bool UnregisterPlugin(const UUID& iUUID); 00105 00106 00109 00113 size_t GetPackageCount() const; 00114 00118 const IPluginPackage * GetPackage(size_t iIndex=0) const; 00119 00124 const IPluginPackage * GetPackage(const IPlugin& iPlugin) const; 00125 00131 const IPluginPackage * GetPackage(const UUID& iUUID, bool ibPlugin=false) const; 00132 00138 const IPluginPackage * GetPackage(const char * iprName, bool ibPlugin=true) const; 00139 00140 const IPluginPackage * GetPackageFromPackageID(const UUID& iUUID) const; 00141 const IPluginPackage * GetPackageFromFilename(const char * iprFilename) const; 00142 const IPluginPackage * GetPackageFromPluginName(const char * iprName) const; 00143 const IPluginPackage * GetPackageFromPluginID(const UUID& iUUID) const; 00144 00146 00147 00150 00154 size_t GetPluginCount() const; 00155 00159 const IPlugin * GetPlugin(size_t iIndex=0) const; 00160 00165 const IPlugin * GetPlugin(const UUID& iUUID) const; 00166 00171 const IPlugin * GetPlugin(const char * iprName) const; 00173 00174 protected: 00175 static bool FileEnumCallback(const char * iprFilename, void * iprUserData); 00176 00177 UUID _familyType; 00178 std::vector<PluginFile*> _files; 00179 00181 typedef std::map<const IPlugin *, const IPluginPackage *> PluginMap; 00182 PluginMap _plugins; 00183 00184 private: 00185 // useless default methods intentionally not accessible (and not generated) 00186 PluginManager(); 00187 PluginManager(const PluginManager&); 00188 PluginManager& operator=(const PluginManager&); 00189 }; 00190 00191 } // namespace eLynx 00192 00193 #endif // __PluginManager_h__