Pointer.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2014 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00023 #ifndef VARIANT_TOPIC_TOOLS_POINTER_H
00024 #define VARIANT_TOPIC_TOOLS_POINTER_H
00025 
00026 #include <ros/ros.h>
00027 
00028 #include <variant_topic_tools/Forwards.h>
00029 
00030 namespace variant_topic_tools {
00033   template <typename T> class Pointer {
00034   public:
00037     Pointer(T* pointer = 0);
00038     
00041     Pointer(const Pointer<T>& src);
00042     
00045     ~Pointer();
00046 
00049     T* get() const;
00050       
00053     void reset();
00054       
00057     T& operator*() const;
00058     
00061     T* operator->() const;
00062     
00065     operator void*() const;
00066     
00069     bool operator==(const Pointer<T>& pointer) const;
00070     
00073     bool operator!=(const Pointer<T>& pointer) const;
00074     
00075   protected:
00078     class ImplA {
00079     public:
00082       ImplA();
00083       
00086       virtual ~ImplA();
00087       
00090       virtual T* get() const = 0;
00091     };
00092     
00095     class Impl :
00096       public ImplA {
00097     public:
00100       Impl(const boost::shared_ptr<T>& pointer = boost::shared_ptr<T>());
00101       
00104       virtual ~Impl();
00105       
00108       T* get() const;
00109       
00112       boost::shared_ptr<T> pointer;
00113     };
00114     
00117     typedef boost::shared_ptr<ImplA> ImplPtr;
00118     
00122     typedef boost::weak_ptr<ImplA> ImplWPtr;
00123     
00126     ImplPtr impl;
00127   };
00128 };
00129 
00130 #include <variant_topic_tools/Pointer.tpp>
00131 
00132 #endif


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Tue Jul 9 2019 03:18:42