Lunchbox  1.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pluginRegistry.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2014, Stefan Eilemann <eile@eyescale.ch>
4  *
5  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef LUNCHBOX_PLUGINREGISTRY_H
22 #define LUNCHBOX_PLUGINREGISTRY_H
23 
24 #include <lunchbox/api.h>
25 #include <lunchbox/types.h>
26 #include <lunchbox/visitorResult.h> // enum
27 #include <boost/noncopyable.hpp>
28 #include <string>
29 
30 namespace lunchbox
31 {
32 namespace detail { class PluginRegistry; }
33 
44 class PluginRegistry : public boost::noncopyable
45 {
46 public:
48  LUNCHBOX_API PluginRegistry();
49 
51  LUNCHBOX_API ~PluginRegistry();
52 
58  LUNCHBOX_API void addDirectory( const std::string& path );
59 
61  LUNCHBOX_API void removeDirectory( const std::string& path );
62 
68  LUNCHBOX_API const Strings& getDirectories() const;
69 
75  LUNCHBOX_API bool addLunchboxPlugins();
76 
78  LUNCHBOX_API void init();
79 
81  LUNCHBOX_API void exit();
82 
91  LUNCHBOX_API VisitorResult accept( PluginVisitor& visitor );
92 
94  LUNCHBOX_API VisitorResult accept( ConstPluginVisitor& visitor ) const;
95 
97  LUNCHBOX_API const Plugins& getPlugins() const;
98 
100  LUNCHBOX_API Plugin* findPlugin( const uint32_t name );
101 
103  LUNCHBOX_API const Plugin* findPlugin( const uint32_t name ) const;
104 
106  LUNCHBOX_API bool addPlugin( const std::string& filename );
107 
108 private:
109  detail::PluginRegistry* const impl_;
110 };
111 }
112 #endif // LUNCHBOX_PLUGINREGISTRY_H
A registry for loaded plugins.
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
std::vector< std::string > Strings
A vector of std::strings.
Definition: types.h:221
LUNCHBOX_API void addDirectory(const std::string &path)
Add a new directory to search for compressor DSOs during init().
LUNCHBOX_API PluginRegistry()
Construct a new plugin registry.
Visitor for all plugins and compressors of a Plugin or PluginRegistry.
Definition: pluginVisitor.h:31
LUNCHBOX_API ~PluginRegistry()
Destruct this plugin registry.
LUNCHBOX_API VisitorResult accept(PluginVisitor &visitor)
Visit all plugins and compressors.
VisitorResult
The result code from any visit operation.
Definition: visitorResult.h:29
Holder for all functions and information of one compression plugin DSO.
Definition: plugin.h:38
LUNCHBOX_API const Strings & getDirectories() const
LUNCHBOX_API bool addLunchboxPlugins()
Add the lunchbox library plugins to this registry.
LUNCHBOX_API void removeDirectory(const std::string &path)
Remove a plugin directory.