Gazebo Plugin

API Reference

1.4.0
gz/plugin/Loader.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
19#ifndef GZ_PLUGIN_LOADER_HH_
20#define GZ_PLUGIN_LOADER_HH_
21
22#include <memory>
23#include <set>
24#include <string>
25#include <typeinfo>
26#include <unordered_set>
27
28#include <gz/utilities/SuppressWarning.hh>
29
30#include <gz/plugin/loader/Export.hh>
32
33namespace ignition
34{
35 namespace plugin
36 {
39 {
41 public: Loader();
42
44 public: ~Loader();
45
49 public: std::string PrettyStr() const;
50
56
60 public: template <typename Interface>
62
84 const bool _demangled = true) const;
85
90
105 const std::string &_alias) const;
106
114 const std::string &_pluginName) const;
115
126
135
143 const std::string &_pluginNameOrAlias) const;
144
156 public: template <typename PluginPtrType>
158
182 public: template <typename InterfaceType>
184 const std::string &_pluginNameOrAlias) const;
185
211
221
230 private: ConstInfoPtr PrivateGetInfo(
231 const std::string &_resolvedName) const;
232
242 private: std::shared_ptr<void> PrivateGetPluginDlHandlePtr(
243 const std::string &_resolvedName) const;
244
245 class Implementation;
248 private: std::unique_ptr<Implementation> dataPtr;
250 };
251 }
252}
253
254#include <gz/plugin/detail/Loader.hh>
255
256#endif
Class for loading plugins.
Definition gz/plugin/Loader.hh:39
std::set< std::string > AllPlugins() const
Get a set of the names of all plugins that are currently known to this Loader.
std::set< std::string > PluginsWithAlias(const std::string &_alias) const
Get plugin names that correspond to the specified alias string.
std::shared_ptr< InterfaceType > Factory(const std::string &_pluginNameOrAlias) const
Instantiates a plugin for the given plugin name, and then returns a reference-counting interface corr...
PluginPtr Instantiate(const std::string &_pluginNameOrAlias) const
Instantiates a plugin for the given plugin name.
std::unordered_set< std::string > InterfacesImplemented() const
Get demangled names of interfaces that the loader has plugins for.
bool ForgetLibraryOfPlugin(const std::string &_pluginNameOrAlias)
Forget the library that provides the plugin with the given name. Note that this will also forget all ...
PluginPtrType Instantiate(const std::string &_pluginNameOrAlias) const
Instantiates a plugin of PluginType for the given plugin name. This can be used to create a specializ...
std::unordered_set< std::string > LoadLib(const std::string &_pathToLibrary)
Load a library at the given path.
std::string PrettyStr() const
Makes a printable string with info about plugins.
std::unordered_set< std::string > PluginsImplementing() const
Get plugin names that implement the specified interface.
std::unordered_set< std::string > PluginsImplementing(const std::string &_interface, const bool _demangled=true) const
Get plugin names that implement the specified interface string. Note that the templated version of th...
std::string LookupPlugin(const std::string &_nameOrAlias) const
Resolve the plugin name or alias into the name of the plugin that it maps to. If this is a name or al...
bool ForgetLibrary(const std::string &_pathToLibrary)
This loader will forget about the library at the given path location. If you want to instantiate a pl...
std::set< std::string > AliasesOfPlugin(const std::string &_pluginName) const
Get the aliases of the plugin with the given name.
This class manages the lifecycle of a plugin instance. It can receive a plugin instance from the igni...
Definition gz/plugin/PluginPtr.hh:53
detail::ConstCompatible< To, From > ConstCompatible
Contains a static constexpr field named value which will be true if the type From has a const-quality...
Definition gz/plugin/utility.hh:50
Definition gz/plugin/EnablePluginFromThis.hh:26