2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Bartosz Janiak (b.janiak@samsung.com)
20 * @brief Generic type list template
22 #ifndef DPL_TYPE_LIST_H
23 #define DPL_TYPE_LIST_H
32 template<size_t Index>
35 struct ERROR_TypeListElementIndexIsOutOfBounds;
36 typedef ERROR_TypeListElementIndexIsOutOfBounds Type;
39 static const size_t Size = 0;
42 template<typename HeadType, typename TailType>
50 template<typename List, size_t Enum>
51 struct TypeCounter : public TypeCounter<typename List::Tail, Enum+1>
56 struct TypeCounter<TypeListGuard, Enum>
58 static const size_t Size = Enum;
62 typedef TailType Tail;
63 typedef HeadType Head;
64 typedef TypeList<HeadType, TailType> ThisType;
66 template<size_t Index, typename DummyType = DummyClass>
69 typedef typename TailType::template Element<Index - 1>::Type Type;
72 template<typename DummyType>
73 struct Element<0, DummyType>
75 typedef HeadType Type;
78 template<typename Type, typename DummyType = DummyClass>
81 typedef typename TailType::template Contains<Type>::Yes Yes;
84 template<typename DummyType>
85 struct Contains<HeadType, DummyType>
90 static const size_t Size = TypeCounter<ThisType, 0>::Size;
93 template<typename T1 = TypeListGuard, typename T2 = TypeListGuard,
94 typename T3 = TypeListGuard, typename T4 = TypeListGuard,
95 typename T5 = TypeListGuard, typename T6 = TypeListGuard,
96 typename T7 = TypeListGuard, typename T8 = TypeListGuard,
97 typename T9 = TypeListGuard, typename T10 = TypeListGuard,
98 typename T11 = TypeListGuard, typename T12 = TypeListGuard,
99 typename T13 = TypeListGuard, typename T14 = TypeListGuard,
100 typename T15 = TypeListGuard, typename T16 = TypeListGuard,
101 typename T17 = TypeListGuard, typename T18 = TypeListGuard,
102 typename T19 = TypeListGuard, typename T20 = TypeListGuard,
103 typename T21 = TypeListGuard, typename T22 = TypeListGuard,
104 typename T23 = TypeListGuard, typename T24 = TypeListGuard,
105 typename T25 = TypeListGuard, typename T26 = TypeListGuard,
106 typename T27 = TypeListGuard, typename T28 = TypeListGuard,
107 typename T29 = TypeListGuard, typename T30 = TypeListGuard,
108 typename T31 = TypeListGuard, typename T32 = TypeListGuard,
109 typename T33 = TypeListGuard, typename T34 = TypeListGuard,
110 typename T35 = TypeListGuard, typename T36 = TypeListGuard,
111 typename T37 = TypeListGuard, typename T38 = TypeListGuard,
112 typename T39 = TypeListGuard, typename T40 = TypeListGuard,
113 typename T41 = TypeListGuard, typename T42 = TypeListGuard,
114 typename T43 = TypeListGuard, typename T44 = TypeListGuard,
115 typename T45 = TypeListGuard, typename T46 = TypeListGuard,
116 typename T47 = TypeListGuard, typename T48 = TypeListGuard,
117 typename T49 = TypeListGuard, typename T50 = TypeListGuard,
118 typename T51 = TypeListGuard, typename T52 = TypeListGuard,
119 typename T53 = TypeListGuard, typename T54 = TypeListGuard,
120 typename T55 = TypeListGuard, typename T56 = TypeListGuard,
121 typename T57 = TypeListGuard, typename T58 = TypeListGuard,
122 typename T59 = TypeListGuard, typename T60 = TypeListGuard,
123 typename T61 = TypeListGuard, typename T62 = TypeListGuard,
124 typename T63 = TypeListGuard, typename T64 = TypeListGuard>
128 typename TypeListDecl<
129 T2, T3, T4, T5, T6, T7, T8,
130 T9, T10, T11, T12, T13, T14, T15,
131 T16, T17, T18, T19, T20, T21, T22,
132 T23, T24, T25, T26, T27, T28, T29,
133 T30, T31, T32, T33, T34, T35, T36,
134 T37, T38, T39, T40, T41, T42, T43,
135 T44, T45, T46, T47, T48, T49, T50,
136 T51, T52, T53, T54, T55, T56, T57,
137 T58, T59, T60, T61, T62, T63, T64>::Type> Type;
141 struct TypeListDecl<TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
142 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
143 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
144 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
145 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
146 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
147 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
148 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
149 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
150 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
151 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
152 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
153 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
154 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
155 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
156 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard>
158 typedef TypeListGuard Type;
162 #endif // DPL_TYPE_LIST_H