Gazebo Common

API Reference

5.7.0
PluginLoader.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef IGNITION_COMMON_PLUGINLOADER_HH_
19 #define IGNITION_COMMON_PLUGINLOADER_HH_
20 
21 #include <memory>
22 #include <string>
23 #include <typeinfo>
24 #include <unordered_set>
25 
27 #include <gz/common/Export.hh>
29 #include <gz/utils/SuppressWarning.hh>
30 
31 namespace gz
32 {
33  namespace common
34  {
36  class PluginLoaderPrivate;
37  struct PluginInfo;
38 
40  class IGNITION_COMMON_VISIBLE PluginLoader
41  {
43  public: GZ_DEPRECATED(5) PluginLoader();
44 
46  public: ~PluginLoader();
47 
50  public: std::string PrettyStr() const;
51 
54  public: std::unordered_set<std::string> InterfacesImplemented() const;
55 
59  public: std::unordered_set<std::string> PluginsImplementing(
60  const std::string &_interface) const;
61 
65  public: std::unordered_set<std::string> LoadLibrary(
66  const std::string &_pathToLibrary);
67 
72  public: PluginPtr Instantiate(const std::string &_pluginName) const;
73 
82  public: template <typename PluginPtrType>
83  PluginPtrType Instantiate(
84  const std::string &_pluginName) const;
85 
91  private: const PluginInfo *PrivateGetPluginInfo(
92  const std::string &_pluginName) const;
93 
94  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
96  private: std::unique_ptr<PluginLoaderPrivate> dataPtr;
97  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
98  };
99  }
100 }
101 
102 #include "ignition/common/detail/PluginLoader.hh"
103 
104 #endif