ArrayMemberPointer.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_ARRAY_MEMBER_POINTER_H
00024 #define VARIANT_TOPIC_TOOLS_ARRAY_MEMBER_POINTER_H
00025 
00026 #include <variant_topic_tools/ArrayTypeTraits.h>
00027 #include <variant_topic_tools/Pointer.h>
00028 
00029 namespace variant_topic_tools {
00032   template <typename T> class ArrayMemberPointer :
00033     public Pointer<typename type_traits::ArrayType<T>::MemberValueType> {
00034   public:
00035     BOOST_STATIC_ASSERT(type_traits::IsArray<T>::value);
00036 
00039     typedef typename type_traits::ArrayType<T>::ValueType ValueType;
00040 
00043     typedef typename type_traits::ArrayType<T>::MemberValueType
00044       MemberValueType;
00045 
00048     static const size_t NumMembers = type_traits::ArrayType<T>::NumMembers;
00049 
00052     ArrayMemberPointer(ValueType* array = 0, int index = 0);
00053 
00057     ArrayMemberPointer(const Pointer<ValueType>& array, int index);
00058 
00061     ArrayMemberPointer(const ArrayMemberPointer<T>& src);
00062 
00065     ArrayMemberPointer(const Pointer<MemberValueType>& src);
00066 
00069     ~ArrayMemberPointer();
00070 
00073     void setArray(const Pointer<ValueType>& array);
00074 
00077     const Pointer<ValueType>& getArray() const;
00078 
00081     void setIndex(int index);
00082 
00085     size_t getIndex() const;
00086 
00087   protected:
00090     class Impl :
00091       public Pointer<MemberValueType>::ImplA {
00092     public:
00095       Impl(const Pointer<ValueType>& array = Pointer<ValueType>(), size_t
00096         index = 0);
00097 
00100       virtual ~Impl();
00101 
00104       MemberValueType* get() const;
00105 
00108       Pointer<ValueType> array;
00109 
00112       int index;
00113     };
00114   };
00115 };
00116 
00117 #include <variant_topic_tools/ArrayMemberPointer.tpp>
00118 
00119 #endif


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