rtVTK  0.6.0
PluginManager.h
00001 
00002 /******************************************************************************
00003  * Copyright (c) 2012, Grove City College
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are
00008  * met:
00009  * 
00010  *  * Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  *
00013  *  * Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  *  * Neither the name of Grove City College nor the names of its
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  */
00035 
00036 
00055 #ifndef StandAlone_PluginManager_h
00056 #define StandAlone_PluginManager_h
00057 
00058 #include <map>
00059 using std::map;
00060 
00061 #include <string>
00062 using std::string;
00063 
00064 #include <vector>
00065 using std::vector;
00066 
00067 #include <StandAlone/DLL.h>
00068 #include <StandAlone/Plugin.h>
00069 
00070 
00071 namespace rtVTK
00072 {
00073 
00075   class PluginManager
00076   {
00077   public:
00081     PluginManager() { /* no-op */ }
00082     ~PluginManager();
00083 
00084     Plugin* load(const string&, bool verbose = true);
00085 
00086     bool unload(const string&);
00087 
00088     bool findValidDLLs(vector<string>&, const QDir&);
00089 
00090     Plugin* getPluginByName(const string&);
00091 
00092     vector<string> getInitPluginNames();
00093 
00094   private:
00103     struct dpWrap
00104     {
00105       dpWrap() : dll(0), plugin(0), dllPath("") {/*no-op*/}
00106       dll_t dll;
00107       Plugin* plugin;
00108       string dllPath;
00109     }; // struct dpWrap
00110   
00116     map<string,dpWrap> plugins;
00117   }; // class PluginManager
00118 
00119 } // namespace rtVTK
00120 
00121 #endif // StandAlone_PluginManager_h
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends