Gazebo Common

API Reference

5.5.1
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#ifndef IGNITION_COMMON_PLUGINPTR_HH_
19#define IGNITION_COMMON_PLUGINPTR_HH_
20
21#include <map>
22#include <string>
23#include <memory>
24
27
28namespace gz
29{
30 namespace common
31 {
32 // Forward declarations
33 struct PluginInfo;
34 namespace detail { template<class, class> class ComposePlugin; }
35
52 template <typename PluginType>
54 {
58 public: ~TemplatePluginPtr() = default;
59
63 public: GZ_DEPRECATED(5) TemplatePluginPtr();
64
68 public: GZ_DEPRECATED(5) TemplatePluginPtr(
69 const TemplatePluginPtr &_other);
70
76 public: GZ_DEPRECATED(5) TemplatePluginPtr(TemplatePluginPtr &&_other);
77
86 public: template <typename OtherPluginType>
87 GZ_DEPRECATED(5) TemplatePluginPtr(
88 const TemplatePluginPtr<OtherPluginType> &_other);
89
95 public: TemplatePluginPtr &operator =(const TemplatePluginPtr &_other);
96
104 public: template <typename OtherPluginType>
105 TemplatePluginPtr &operator =(
106 const TemplatePluginPtr<OtherPluginType> &_other);
107
114 public: TemplatePluginPtr &operator =(TemplatePluginPtr &&_other);
115
119 public: TemplatePluginPtr &operator =(std::nullptr_t);
120
125 public: PluginType *operator ->() const;
126
130 public: PluginType &operator *() const;
131
136 public: bool operator ==(const TemplatePluginPtr &_other) const;
137
145 public: bool operator <(const TemplatePluginPtr &_other) const;
146
154 public: bool operator >(const TemplatePluginPtr &_other) const;
155
162 public: bool operator !=(const TemplatePluginPtr &_other) const;
163
171 public: bool operator <=(const TemplatePluginPtr &_other) const;
172
180 public: bool operator >=(const TemplatePluginPtr &_other) const;
181
188 public: std::size_t Hash() const;
189
193 public: bool IsEmpty() const;
194
197 public: operator bool() const;
198
202 public: void Clear();
203
210 private: explicit GZ_DEPRECATED(5) TemplatePluginPtr(
211 const PluginInfo *_info);
212
214 private: std::unique_ptr<PluginType> dataPtr;
215
216 // Declare friendship
217 friend class PluginLoader;
218 template <class> friend class TemplatePluginPtr;
219 };
220
224
228 }
229}
230
231#include "ignition/common/detail/PluginPtr.hh"
232
233#endif