Gazebo Plugin

API Reference

3.0.0
PluginPtr.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_PLUGINPTR_HH_
20#define GZ_PLUGIN_PLUGINPTR_HH_
21
22#include <map>
23#include <string>
24#include <memory>
25
26#include <gz/plugin/Plugin.hh>
27
28namespace gz
29{
30 namespace plugin
31 {
32 // Forward declarations
33 namespace detail { template<class, class> class ComposePlugin; }
34
51 template <typename PluginType>
53 {
57 public: ~TemplatePluginPtr() = default;
58
63
67 public: TemplatePluginPtr(const TemplatePluginPtr &_other);
68
75
84 public: template <typename OtherPluginType>
87
94
102 public: template <typename OtherPluginType>
105
113
118
123 public: PluginType *operator->() const;
124
128 public: PluginType &operator*() const;
129
134 public: bool operator ==(const TemplatePluginPtr &_other) const;
135
141 public: bool operator <(const TemplatePluginPtr &_other) const;
142
148 public: bool operator >(const TemplatePluginPtr &_other) const;
149
154 public: bool operator !=(const TemplatePluginPtr &_other) const;
155
161 public: bool operator <=(const TemplatePluginPtr &_other) const;
162
168 public: bool operator >=(const TemplatePluginPtr &_other) const;
169
176 public: std::size_t Hash() const;
177
181 public: bool IsEmpty() const;
182
185 public: operator bool() const;
186
190 public: void Clear();
191
193 private: std::unique_ptr<PluginType> dataPtr;
194
195 // Declare friendship
196 friend class Loader;
197 template <class> friend class TemplatePluginPtr;
198
206 private: explicit TemplatePluginPtr(
207 const ConstInfoPtr &_info,
208 const std::shared_ptr<void> &_dlHandlePtr);
209
213 private: explicit TemplatePluginPtr(const ConstInfoPtr &_info);
214 };
215
219
223 }
224}
225
226#include "gz/plugin/detail/PluginPtr.hh"
227
228#endif