00001 /*************************************************************************** 00002 * Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, * 00003 * Matthias Hardt, Guido Madaus * 00004 * * 00005 * Copyright (C) 2007-2008 BerLinux Solutions GbR * 00006 * Stefan Schwarzer & Guido Madaus * 00007 * * 00008 * Copyright (C) 2009-2013 BerLinux Solutions GmbH * 00009 * * 00010 * Authors: * 00011 * Stefan Schwarzer <stefan.schwarzer@diskohq.org>, * 00012 * Matthias Hardt <matthias.hardt@diskohq.org>, * 00013 * Jens Schneider <jens.schneider@diskohq.org>, * 00014 * Guido Madaus <guido.madaus@diskohq.org>, * 00015 * Patrick Helterhoff <patrick.helterhoff@diskohq.org>, * 00016 * René Bählkow <rene.baehlkow@diskohq.org> * 00017 * * 00018 * This library is free software; you can redistribute it and/or * 00019 * modify it under the terms of the GNU Lesser General Public * 00020 * License version 2.1 as published by the Free Software Foundation. * 00021 * * 00022 * This library is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Lesser General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Lesser General Public * 00028 * License along with this library; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00031 **************************************************************************/ 00032 00033 #ifndef MMSPLUGINMANAGER_H_ 00034 #define MMSPLUGINMANAGER_H_ 00035 00036 #include "mmsbase/mmsosdpluginhandler.h" 00037 #include "mmsbase/mmscentralpluginhandler.h" 00038 #include "mmsbase/mmsimportpluginhandler.h" 00039 #include "mmsbase/mmsbackendpluginhandler.h" 00040 #include "mmsconfig/mmspluginservice.h" 00041 00042 MMS_CREATEERROR(MMSPluginManagerError); 00043 00044 class MMSPluginManager { 00045 private: 00046 DataSource *source; 00047 MMSPluginService *service; 00048 vector<MMSOSDPluginHandler *> osdPluginHandlers; 00049 vector<MMSCentralPluginHandler *> centralPluginHandlers; 00050 vector<MMSImportPluginHandler *> importPluginHandlers; 00051 vector<MMSBackendPluginHandler *> backendPluginHandlers; 00052 MMSPluginData *activeosdplugin; 00053 MMSPluginData *activecentralplugin; 00054 IMMSSwitcher *switcher; 00055 00056 map<string, IMMSOSDPlugin*> staticOSDPlugins; 00057 map<string, IMMSCentralPlugin*> staticCentralPlugins; 00058 map<string, IMMSImportPlugin*> staticImportPlugins; 00059 map<string, IMMSBackendPlugin*> staticBackendPlugins; 00060 00061 public: 00062 MMSPluginManager(); 00063 ~MMSPluginManager(); 00064 00065 /** 00066 * Register an already instantiated OSD plugin object. 00067 * 00068 * This is necessary for statically linked plugins. You have to call 00069 * this method before loadOSDPlugins() otherwise your static OSD plugins 00070 * won't be loaded. 00071 * 00072 * @param name plugin name as used in plugindata 00073 * @param plugin instantiated plugin object 00074 */ 00075 void registerStaticOSDPlugin(string, IMMSOSDPlugin*); 00076 00077 /** 00078 * Register an already instantiated central plugin object. 00079 * 00080 * This is necessary for statically linked plugins. You have to call 00081 * this method before loadCentralPlugins() otherwise your static central plugins 00082 * won't be loaded. 00083 * 00084 * @param name plugin name as used in plugindata 00085 * @param plugin instantiated plugin object 00086 */ 00087 void registerStaticCentralPlugin(string, IMMSCentralPlugin*); 00088 00089 /** 00090 * Register an already instantiated import plugin object. 00091 * 00092 * This is necessary for statically linked plugins. You have to call 00093 * this method before loadImportPlugins() otherwise your static import plugins 00094 * won't be loaded. 00095 * 00096 * @param name plugin name as used in plugindata 00097 * @param plugin instantiated plugin object 00098 */ 00099 void registerStaticImportPlugin(string, IMMSImportPlugin*); 00100 00101 /** 00102 * Register an already instantiated backend plugin object. 00103 * 00104 * This is necessary for statically linked plugins. You have to call 00105 * this method before loadBackendPlugins() otherwise your static backend plugins 00106 * won't be loaded. 00107 * 00108 * @param name plugin name as used in plugindata 00109 * @param plugin instantiated plugin object 00110 */ 00111 void registerStaticBackendPlugin(string, IMMSBackendPlugin*); 00112 00113 void loadOSDPlugins(); 00114 void loadCentralPlugins(); 00115 void loadImportPlugins(); 00116 void loadBackendPlugins(); 00117 00118 void initializeOSDPlugins(); 00119 void initializeCentralPlugins(); 00120 void initializeImportPlugins(); 00121 void initializeBackendPlugins(); 00122 00123 void setActiceOSDPlugin(MMSPluginData *plugin); 00124 MMSPluginData *getActiveOSDPlugin(); 00125 00126 void setActiceCentralPlugin(MMSPluginData *plugin); 00127 MMSPluginData *getActiveCentralPlugin(); 00128 00129 void setSwitcher(IMMSSwitcher *switcher); 00130 00131 vector<MMSOSDPluginHandler *> getOSDPluginHandlers(vector<MMSPluginData *> data); 00132 MMSOSDPluginHandler *getOSDPluginHandler(int pluginid); 00133 00134 vector<MMSCentralPluginHandler *> getCentralPluginHandlers(vector<MMSPluginData *> data); 00135 MMSCentralPluginHandler *getCentralPluginHandler(int pluginid); 00136 00137 vector<MMSImportPluginHandler *> getImportPluginHandlers(vector<MMSPluginData *> data); 00138 MMSImportPluginHandler *getImportPluginHandler(int pluginid); 00139 00140 vector<MMSBackendPluginHandler *> getBackendPluginHandlers(vector<MMSPluginData *> data); 00141 MMSBackendPluginHandler *getBackendPluginHandler(int pluginid); 00142 }; 00143 #endif /*MMSPLUGINMANAGER_H_*/