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
31 template<size_t Index>
34 struct ERROR_TypeListElementIndexIsOutOfBounds;
35 typedef ERROR_TypeListElementIndexIsOutOfBounds Type;
38 static const size_t Size = 0;
41 template<typename HeadType, typename TailType>
48 template<typename List, size_t Enum>
49 struct TypeCounter : public TypeCounter<typename List::Tail, Enum + 1>
53 struct TypeCounter<TypeListGuard, Enum>
55 static const size_t Size = Enum;
59 typedef TailType Tail;
60 typedef HeadType Head;
61 typedef TypeList<HeadType, TailType> ThisType;
63 template<size_t Index, typename DummyType = DummyClass>
66 typedef typename TailType::template Element<Index - 1>::Type Type;
69 template<typename DummyType>
70 struct Element<0, DummyType>
72 typedef HeadType Type;
75 template<typename Type, typename DummyType = DummyClass>
78 typedef typename TailType::template Contains<Type>::Yes Yes;
81 template<typename DummyType>
82 struct Contains<HeadType, DummyType>
87 static const size_t Size = TypeCounter<ThisType, 0>::Size;
90 template<typename T1 = TypeListGuard, typename T2 = TypeListGuard,
91 typename T3 = TypeListGuard, typename T4 = TypeListGuard,
92 typename T5 = TypeListGuard, typename T6 = TypeListGuard,
93 typename T7 = TypeListGuard, typename T8 = TypeListGuard,
94 typename T9 = TypeListGuard, typename T10 = TypeListGuard,
95 typename T11 = TypeListGuard, typename T12 = TypeListGuard,
96 typename T13 = TypeListGuard, typename T14 = TypeListGuard,
97 typename T15 = TypeListGuard, typename T16 = TypeListGuard,
98 typename T17 = TypeListGuard, typename T18 = TypeListGuard,
99 typename T19 = TypeListGuard, typename T20 = TypeListGuard,
100 typename T21 = TypeListGuard, typename T22 = TypeListGuard,
101 typename T23 = TypeListGuard, typename T24 = TypeListGuard,
102 typename T25 = TypeListGuard, typename T26 = TypeListGuard,
103 typename T27 = TypeListGuard, typename T28 = TypeListGuard,
104 typename T29 = TypeListGuard, typename T30 = TypeListGuard,
105 typename T31 = TypeListGuard, typename T32 = TypeListGuard,
106 typename T33 = TypeListGuard, typename T34 = TypeListGuard,
107 typename T35 = TypeListGuard, typename T36 = TypeListGuard,
108 typename T37 = TypeListGuard, typename T38 = TypeListGuard,
109 typename T39 = TypeListGuard, typename T40 = TypeListGuard,
110 typename T41 = TypeListGuard, typename T42 = TypeListGuard,
111 typename T43 = TypeListGuard, typename T44 = TypeListGuard,
112 typename T45 = TypeListGuard, typename T46 = TypeListGuard,
113 typename T47 = TypeListGuard, typename T48 = TypeListGuard,
114 typename T49 = TypeListGuard, typename T50 = TypeListGuard,
115 typename T51 = TypeListGuard, typename T52 = TypeListGuard,
116 typename T53 = TypeListGuard, typename T54 = TypeListGuard,
117 typename T55 = TypeListGuard, typename T56 = TypeListGuard,
118 typename T57 = TypeListGuard, typename T58 = TypeListGuard,
119 typename T59 = TypeListGuard, typename T60 = TypeListGuard,
120 typename T61 = TypeListGuard, typename T62 = TypeListGuard,
121 typename T63 = TypeListGuard, typename T64 = TypeListGuard>
125 typename TypeListDecl<
126 T2, T3, T4, T5, T6, T7, T8,
127 T9, T10, T11, T12, T13, T14, T15,
128 T16, T17, T18, T19, T20, T21, T22,
129 T23, T24, T25, T26, T27, T28, T29,
130 T30, T31, T32, T33, T34, T35, T36,
131 T37, T38, T39, T40, T41, T42, T43,
132 T44, T45, T46, T47, T48, T49, T50,
133 T51, T52, T53, T54, T55, T56, T57,
134 T58, T59, T60, T61, T62, T63, T64>::Type> Type;
138 struct TypeListDecl<TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
139 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
140 TypeListGuard, TypeListGuard, TypeListGuard, TypeListGuard,
141 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>
155 typedef TypeListGuard Type;
159 #endif // DPL_TYPE_LIST_H