Pointer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2014 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
23 #ifndef VARIANT_TOPIC_TOOLS_POINTER_H
24 #define VARIANT_TOPIC_TOOLS_POINTER_H
25 
26 #include <ros/ros.h>
27 
29 
30 namespace variant_topic_tools {
33  template <typename T> class Pointer {
34  public:
37  Pointer(T* pointer = 0);
38 
41  Pointer(const Pointer<T>& src);
42 
45  ~Pointer();
46 
49  T* get() const;
50 
53  void reset();
54 
57  T& operator*() const;
58 
61  T* operator->() const;
62 
65  operator void*() const;
66 
69  bool operator==(const Pointer<T>& pointer) const;
70 
73  bool operator!=(const Pointer<T>& pointer) const;
74 
75  protected:
78  class ImplA {
79  public:
82  ImplA();
83 
86  virtual ~ImplA();
87 
90  virtual T* get() const = 0;
91  };
92 
95  class Impl :
96  public ImplA {
97  public:
100  Impl(const boost::shared_ptr<T>& pointer = boost::shared_ptr<T>());
101 
104  virtual ~Impl();
105 
108  T* get() const;
109 
113  };
114 
118 
122  typedef boost::weak_ptr<ImplA> ImplWPtr;
123 
126  ImplPtr impl;
127  };
128 };
129 
130 #include <variant_topic_tools/Pointer.tpp>
131 
132 #endif
bool operator==(const Pointer< T > &pointer) const
Equality comparison operator.
boost::shared_ptr< T > pointer
The stored pointer.
Definition: Pointer.h:112
Header file providing forward declarations for the variant topic tools.
Pointer implementation.
Definition: Pointer.h:95
bool operator!=(const Pointer< T > &pointer) const
Inequality comparison operator.
Pointer(T *pointer=0)
Default constructor.
void reset()
Reset this pointer.
Pointer implementation (abstract base)
Definition: Pointer.h:78
boost::shared_ptr< ImplA > ImplPtr
Declaration of the pointer implementation pointer type.
Definition: Pointer.h:117
Shared pointer.
Definition: Pointer.h:33
ImplPtr impl
The pointer&#39;s implementation.
Definition: Pointer.h:126
T * operator->() const
Pointer operator.
boost::weak_ptr< ImplA > ImplWPtr
Declaration of the pointer implementation weak pointer type.
Definition: Pointer.h:122
T & operator*() const
Reference operator.


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:50