PCMPluginManager.h

Go to the documentation of this file.
00001 
00002 //
00003 // This source file is a part of ParCompMark
00004 // Parallel Compositing Benchmark Framework
00005 //
00006 // for latest info see http://parcompmark.sourceforge.net
00007 
00008 //
00009 // Copyright (C) 2006 IT2 ParCompMark Dev. Team
00010 // 
00011 // This program is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License
00013 // as published by the Free Software Foundation; either version 2
00014 // of the License, or (at your option) any later version.
00015 // 
00016 // This program 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. See the
00019 // GNU General Public License for more details.
00020 // 
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 
00027 
00028 #ifndef __PCM_PLUGINMANAGER_H__
00029 #  define __PCM_PLUGINMANAGER_H__
00030 
00031 //
00032 // Inner includes
00033 //
00034 
00035 #  include "PCMPremeditations.h"
00036 
00037 #  include "PCMSingleton.h"
00038 
00039 #  include "PCMException.h"
00040 
00041 #  include "PCMLogger.h"
00042 
00043 #  include "PCMContainer.h"
00044 
00045 #  include "PCMPointer.h"
00046 
00047 #  include "PCMPlugin.h"
00048 
00049 namespace ParCompMark
00050 {
00051 
00056   class PluginManager:public Singleton < PluginManager >
00057   {
00058 
00059         //
00060         // Unit test class
00061         //
00062 #  ifdef PARCOMPMARK_TEST
00063         friend class ParCompMarkTest::TestPluginManager;
00064 #  endif
00065 
00066         //
00067         // Variables
00068         //
00069 
00071 
00072 
00073    protected:
00074 
00080         Container < Plugin, Mutex >::Pointer mPlugins;
00081 
00087         std::string mPluginDirectory;
00088 
00094         std::string mPluginIniFile;
00095 
00101         bool mInitialized;
00102 
00104 
00105         //
00106         // Constructors & destructor
00107         //
00108 
00110 
00111 
00112    public:
00113 
00119         PluginManager(const std::string & pluginDirectory = "plugins/", const std::string & iniFile =
00120                         "plugins.ini");
00121 
00125         virtual ~ PluginManager();
00126 
00128 
00129         //
00130         // Getters & setters
00131         //
00132 
00134 
00135 
00136    public:
00137 
00143         const std::string & getPluginDirectory() const;
00144 
00150         const std::string & getPluginIniFile() const;
00151 
00157         const bool & getInitialized() const;
00158 
00160 
00161         //
00162         // Methods
00163         //
00164 
00166 
00167 
00168    public:
00169 
00173         virtual void initialize();
00174 
00178         virtual void finalize();
00179 
00183         virtual void loadPlugins();
00184 
00188         virtual void loadPlugins_old();
00189 
00193         virtual void unloadPlugins();
00194 
00200         virtual Plugin::Pointer getPlugin(const std::string & name);
00201 
00202    protected:
00203 
00210         virtual Plugin::Pointer _loadPlugin(const Plugin::PluginType & type,
00211                                           const std::string & filename);
00212 
00217         virtual void _checkNeededLibs(Plugin::Pointer & plugin);
00218 
00220 
00221   };
00222 
00223   //
00224   // Include header implementation
00225   //
00226 
00227 #  include "PCMPluginManager_impl.h"
00228 
00229 }
00230 
00231 #endif