RSC  0.17.1
Manager.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is part of the RSC project.
4  *
5  * Copyright (C) 2012, 2014 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
6  *
7  * This file may be licensed under the terms of the
8  * GNU Lesser General Public License Version 3 (the ``LGPL''),
9  * or (at your option) any later version.
10  *
11  * Software distributed under the License is distributed
12  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13  * express or implied. See the LGPL for the specific language
14  * governing rights and limitations.
15  *
16  * You should have received a copy of the LGPL along with this
17  * program. If not, go to http://www.gnu.org/licenses/lgpl.html
18  * or write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * The development of this software was supported by:
22  * CoR-Lab, Research Institute for Cognition and Robotics
23  * Bielefeld University
24  *
25  * ============================================================ */
26 
27 #pragma once
28 
29 #include <vector>
30 #include <set>
31 #include <map>
32 
33 #include <boost/regex.hpp>
34 #include <boost/filesystem/path.hpp>
35 #include <boost/noncopyable.hpp>
36 #include <boost/shared_ptr.hpp>
37 
38 #include "../logging/Logger.h"
39 
40 #include "Plugin.h"
41 
42 #include "rsc/rscexports.h"
43 
44 namespace rsc {
45 namespace plugins {
46 
60 class RSC_EXPORT Manager: public boost::noncopyable {
61 public:
62 
63  Manager();
64 
65  virtual ~Manager();
66 
72  std::vector<boost::filesystem::path> getPath() const;
73 
86  void addPath(const boost::filesystem::path& path);
87 
97  std::set<PluginPtr> getPlugins(const boost::regex& regex
98  = boost::regex(".*")) const;
99 
109  std::set<PluginPtr> getPlugins(const std::string& regex) const;
110 
118  PluginPtr getPlugin(const std::string& name) const;
119 private:
120 
121  typedef std::vector<boost::filesystem::path> PathList;
122  typedef std::map<std::string, PluginPtr> PluginMap;
123 
125 
126  PathList path;
127  PluginMap plugins;
128 
129 };
130 
131 typedef boost::shared_ptr<Manager> ManagerPtr;
132 
133 }
134 }
std::vector< boost::filesystem::path > PathList
Definition: Manager.h:121
boost::shared_ptr< Plugin > PluginPtr
Definition: Plugin.h:106
Instances of this class manages plugin search path entries and plugins.
Definition: Manager.h:60
std::map< std::string, PluginPtr > PluginMap
Definition: Manager.h:122
PluginMap plugins
Definition: Manager.h:127
boost::shared_ptr< Manager > ManagerPtr
Definition: Manager.h:131
logging::LoggerPtr logger
Definition: Manager.h:124
boost::shared_ptr< Logger > LoggerPtr
Definition: Logger.h:41