dlvhex  2.5.0
include/dlvhex2/PluginContainer.h
Go to the documentation of this file.
00001 /* dlvhex -- Answer-Set Programming with external interfaces.
00002  * Copyright (C) 2005-2007 Roman Schindlauer
00003  * Copyright (C) 2006-2015 Thomas Krennwallner
00004  * Copyright (C) 2009-2016 Peter Schüller
00005  * Copyright (C) 2011-2016 Christoph Redl
00006  * Copyright (C) 2015-2016 Tobias Kaminski
00007  * Copyright (C) 2015-2016 Antonius Weinzierl
00008  *
00009  * This file is part of dlvhex.
00010  *
00011  * dlvhex is free software; you can redistribute it and/or modify it
00012  * under the terms of the GNU Lesser General Public License as
00013  * published by the Free Software Foundation; either version 2.1 of
00014  * the License, or (at your option) any later version.
00015  *
00016  * dlvhex is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with dlvhex; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00038 #if !defined(_DLVHEX_PLUGINCONTAINER_H)
00039 #define _DLVHEX_PLUGINCONTAINER_H
00040 
00041 #include "dlvhex2/PlatformDefinitions.h"
00042 #include "dlvhex2/fwd.h"
00043 #include "dlvhex2/PluginInterface.h"
00044 
00045 #include <string>
00046 #include <vector>
00047 
00048 #include <boost/shared_ptr.hpp>
00049 
00050 DLVHEX_NAMESPACE_BEGIN
00051 
00067 class DLVHEX_EXPORT PluginContainer
00068 {
00069     private:
00075         PluginContainer(const PluginContainer& p);
00076 
00077     public:
00079         PluginContainer();
00080 
00084         ~PluginContainer();
00085 
00086         //
00087         // loading and accessing
00088         //
00089 
00095         void loadPlugins(const std::string& searchpath="");
00096 
00102         void addInternalPlugin(PluginInterfacePtr plugin);
00103 
00106         const std::vector<PluginInterfacePtr>& getPlugins() const
00107             { return pluginInterfaces; }
00108 
00109         //
00110         // batch operations on all plugins
00111         //
00112 
00115         void printUsage(std::ostream& o);
00116 
00117     public:
00118         struct LoadedPlugin;
00119         typedef boost::shared_ptr<LoadedPlugin> LoadedPluginPtr;
00120         typedef std::vector<LoadedPluginPtr> LoadedPluginVector;
00121         typedef std::vector<PluginInterfacePtr> PluginInterfaceVector;
00122 
00123     private:
00126         void addInternalPlugin(LoadedPluginPtr lplugin);
00127 
00129         std::string searchPath;
00130 
00132         LoadedPluginVector plugins;
00133 
00135         PluginInterfaceVector pluginInterfaces;
00136 };
00137 typedef boost::shared_ptr<PluginContainer> PluginContainerPtr;
00138 
00139 DLVHEX_NAMESPACE_END
00140 #endif                           /* _DLVHEX_PLUGINCONTAINER_H */
00141 
00142 
00143 // vim:expandtab:ts=4:sw=4:
00144 // mode: C++
00145 // End: