00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00053 #ifndef LUMIERA_META_GENERATOR_H
00054 #define LUMIERA_META_GENERATOR_H
00055
00056 #include "lib/meta/typelist.hpp"
00057
00058
00059
00060 namespace lumiera
00061 {
00062 namespace typelist
00063 {
00064
00071 template
00072 < class TYPES
00073 , template<class> class _X_
00074 , class BASE = NullType
00075 >
00076 class InstantiateForEach;
00077
00078
00079 template<template<class> class _X_, class BASE>
00080 class InstantiateForEach<NullType, _X_, BASE>
00081 : public BASE
00082 {
00083 public:
00084 typedef BASE Unit;
00085 typedef NullType Next;
00086 };
00087
00088
00089 template
00090 < class TY, typename TYPES
00091 , template<class> class _X_
00092 , class BASE
00093 >
00094 class InstantiateForEach<Node<TY, TYPES>, _X_, BASE>
00095 : public _X_<TY>,
00096 public InstantiateForEach<TYPES, _X_, BASE>
00097 {
00098 public:
00099 typedef _X_<TY> Unit;
00100 typedef InstantiateForEach<TYPES,_X_> Next;
00101 };
00102
00103
00104
00113 template
00114 < class TYPES
00115 , template<class,class> class _X_
00116 , class BASE = NullType
00117 >
00118 class InstantiateChained;
00119
00120
00121 template<template<class,class> class _X_, class BASE>
00122 class InstantiateChained<NullType, _X_, BASE>
00123 : public BASE
00124 {
00125 public:
00126 typedef BASE Unit;
00127 typedef NullType Next;
00128 };
00129
00130
00131 template
00132 < class TY, typename TYPES
00133 , template<class,class> class _X_
00134 , class BASE
00135 >
00136 class InstantiateChained<Node<TY, TYPES>, _X_, BASE>
00137 : public _X_< TY
00138 , InstantiateChained<TYPES, _X_, BASE>
00139 >
00140 {
00141 public:
00142 typedef InstantiateChained<TYPES,_X_,BASE> Next;
00143 typedef _X_<TY,Next> Unit;
00144 };
00145
00146
00147
00157 template
00158 < class TYPES
00159 , template<class,class,uint> class _X_
00160 , class BASE = NullType
00161 , uint i = 0
00162 >
00163 class InstantiateWithIndex;
00164
00165
00166 template< template<class,class,uint> class _X_
00167 , class BASE
00168 , uint i
00169 >
00170 class InstantiateWithIndex<NullType, _X_, BASE, i>
00171 : public BASE
00172 {
00173 public:
00174 typedef BASE Unit;
00175 typedef NullType Next;
00176 enum{ COUNT = i };
00177 };
00178
00179
00180 template
00181 < class TY, typename TYPES
00182 , template<class,class,uint> class _X_
00183 , class BASE
00184 , uint i
00185 >
00186 class InstantiateWithIndex<Node<TY, TYPES>, _X_, BASE, i>
00187 : public _X_< TY
00188 , InstantiateWithIndex<TYPES, _X_, BASE, i+1 >
00189 , i
00190 >
00191 {
00192 public:
00193 typedef InstantiateWithIndex<TYPES,_X_,BASE,i+1> Next;
00194 typedef _X_<TY,Next,i> Unit;
00195 enum{ COUNT = Next::COUNT };
00196 };
00197
00198
00199 }
00200
00201 }
00202 #endif