ArrayMemberPointer.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_ARRAY_MEMBER_POINTER_H
24 #define VARIANT_TOPIC_TOOLS_ARRAY_MEMBER_POINTER_H
25 
28 
29 namespace variant_topic_tools {
32  template <typename T> class ArrayMemberPointer :
33  public Pointer<typename type_traits::ArrayType<T>::MemberValueType> {
34  public:
36 
40 
45 
49 
52  ArrayMemberPointer(ValueType* array = 0, int index = 0);
53 
57  ArrayMemberPointer(const Pointer<ValueType>& array, int index);
58 
62 
66 
70 
73  void setArray(const Pointer<ValueType>& array);
74 
77  const Pointer<ValueType>& getArray() const;
78 
81  void setIndex(int index);
82 
85  size_t getIndex() const;
86 
87  protected:
90  class Impl :
91  public Pointer<MemberValueType>::ImplA {
92  public:
96  index = 0);
97 
100  virtual ~Impl();
101 
104  MemberValueType* get() const;
105 
109 
112  int index;
113  };
114  };
115 };
116 
117 #include <variant_topic_tools/ArrayMemberPointer.tpp>
118 
119 #endif
Shared pointer to an array member.
Header file providing the array type traits.
ArrayMemberPointer(ValueType *array=0, int index=0)
Default constructor.
size_t getIndex() const
Retrieve the array member index.
void setIndex(int index)
Set the array member index.
Array member pointer implementation.
Shared pointer.
Definition: Pointer.h:33
type_traits::ArrayType< T >::ValueType ValueType
Definition of the array value type.
type_traits::ArrayType< T >::MemberValueType MemberValueType
Definition of the array member type.
Header file providing the Pointer class interface.
static const size_t NumMembers
Definition of the number of array members.
void setArray(const Pointer< ValueType > &array)
Set the array.
Pointer< ValueType > array
The shared array.
BOOST_STATIC_ASSERT(type_traits::IsArray< T >::value)
const Pointer< ValueType > & getArray() const
Retrieve the array.
Impl(const Pointer< ValueType > &array=Pointer< ValueType >(), size_t index=0)
Default constructor.


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