MessageMemberPointer.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_MESSAGE_MEMBER_POINTER_H
00024 #define VARIANT_TOPIC_TOOLS_MESSAGE_MEMBER_POINTER_H
00025 
00026 #include <variant_topic_tools/DataTypeTraits.h>
00027 #include <variant_topic_tools/MessageTypeTraits.h>
00028 #include <variant_topic_tools/Pointer.h>
00029 
00030 namespace variant_topic_tools {
00033   template <typename T, typename M> class MessageMemberPointer :
00034     public Pointer<typename type_traits::DataType<M>::ValueType> {
00035   public:
00036     BOOST_STATIC_ASSERT(type_traits::IsMessage<T>::value);
00037     
00040     typedef typename type_traits::MessageType<T>::ValueType ValueType;
00041     
00044     typedef typename type_traits::DataType<M>::ValueType MemberValueType;
00045       
00048     MessageMemberPointer(ValueType* message = 0, size_t offset = 0);
00049     
00053     MessageMemberPointer(const Pointer<ValueType>& message, size_t offset);
00054     
00057     MessageMemberPointer(const MessageMemberPointer<T, M>& src);
00058     
00061     MessageMemberPointer(const Pointer<MemberValueType>& src);
00062     
00065     ~MessageMemberPointer();
00066     
00069     void setMessage(const Pointer<ValueType>& message);
00070     
00073     const Pointer<ValueType>& getMessage() const;
00074     
00077     void setOffset(size_t offset);
00078     
00081     size_t getOffset() const;
00082 
00083   protected:
00086     class Impl :
00087       public Pointer<MemberValueType>::ImplA {
00088     public:
00091       Impl(const Pointer<ValueType>& message = Pointer<ValueType>(), size_t
00092         offset = 0);
00093       
00096       virtual ~Impl();
00097       
00100       MemberValueType* get() const;
00101       
00104       Pointer<ValueType> message;
00105       
00108       size_t offset;
00109     };
00110   };
00111 };
00112 
00113 #include <variant_topic_tools/MessageMemberPointer.tpp>
00114 
00115 #endif


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