iRoCS Toolbox  1.1.0
TList.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2004-2015 Olaf Ronneberger, Florian Pigorsch, Jörg Mechnich,
4  * Thorsten Falk
5  *
6  * Image Analysis Lab, University of Freiburg, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  **************************************************************************/
23 
24 /**************************************************************************
25 ** Title: template list classes
26 ** $RCSfile$
27 ** $Revision: 601 $$Name$
28 ** $Date: 2005-02-11 10:32:28 +0100 (Fri, 11 Feb 2005) $
29 ** Copyright: GPL $Author: ronneber $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log$
37 ** Revision 1.2 2005/02/11 09:32:28 ronneber
38 ** - extended TLIST_.. macros until 16
39 **
40 ** Revision 1.1 2004/08/26 08:36:59 ronneber
41 ** initital import
42 **
43 **
44 **
45 **************************************************************************/
46 
47 #ifndef TLIST_HH
48 #define TLIST_HH
49 
50 #ifdef HAVE_CONFIG_H
51 #include <config.hh>
52 #endif
53 
54 namespace svt
55 {
56  /*-------------------------------------------------------------------------
57  * Template list for normal classes (e.g. int, Kernel_RBF, ...)
58  *-------------------------------------------------------------------------*/
59  template<typename T, typename Tnext> struct TList {
60  typedef T val_t;
61  typedef Tnext next_t;
62  };
63 
64  struct TList_end {};
65 
66  /*-----------------------------------------------------------------------
67  * Convinience macros to create TList's
68  *-----------------------------------------------------------------------*/
69 #define TLIST_1(T1) svt::TList< T1, svt::TList_end >
70 #define TLIST_2(T1,T2) svt::TList< T1, TLIST_1(T2) >
71 #define TLIST_3(T1,T2,T3) svt::TList< T1, TLIST_2(T2,T3) >
72 #define TLIST_4(T1,T2,T3,T4) svt::TList< T1, TLIST_3(T2,T3,T4) >
73 #define TLIST_5(T1,T2,T3,T4,T5) svt::TList< T1, TLIST_4(T2,T3,T4,T5) >
74 #define TLIST_6(T1,T2,T3,T4,T5,T6) svt::TList< T1, TLIST_5(T2,T3,T4,T5,T6) >
75 #define TLIST_7(T1,T2,T3,T4,T5,T6,T7) svt::TList< T1, TLIST_6(T2,T3,T4,T5,T6,T7) >
76 #define TLIST_8(T1,T2,T3,T4,T5,T6,T7,T8) svt::TList< T1, TLIST_7(T2,T3,T4,T5,T6,T7,T8) >
77 #define TLIST_9(T1,T2,T3,T4,T5,T6,T7,T8,T9) svt::TList< T1, TLIST_8(T2,T3,T4,T5,T6,T7,T8,T9) >
78 #define TLIST_10(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) svt::TList< T1, TLIST_9(T2,T3,T4,T5,T6,T7,T8,T9,T10) >
79 #define TLIST_11(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) svt::TList< T1, TLIST_10(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) >
80 #define TLIST_12(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12) svt::TList< T1, TLIST_11(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12) >
81 #define TLIST_13(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13) svt::TList< T1, TLIST_12(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13) >
82 #define TLIST_14(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) svt::TList< T1, TLIST_13(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) >
83 #define TLIST_15(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15) svt::TList< T1, TLIST_14(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15) >
84 #define TLIST_16(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16) svt::TList< T1, TLIST_15(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16) >
85 
86 
87 //
88 // template<typename T1=TList_end,
89 // typename T2=TList_end,
90 // typename T3=TList_end,
91 // typename T4=TList_end,
92 // typename T5=TList_end,
93 // typename T6=TList_end,
94 // typename T7=TList_end,
95 // typename T8=TList_end,
96 // typename T9=TList_end,
97 // typename T10=TList_end>
98 // struct MakeTList
99 // {
100 // typedef TList<
101 // T1, TList<
102 // T2, TList<
103 // T3, TList<
104 // T4, TList<
105 // T5, TList<
106 // T6, TList<
107 // T7, TList<
108 // T8, TList<
109 // T9, TList<
110 // T10, TList<TList_end, TList_end> > > > > > > > > > > the_list;
111 // };
112 //
113  /*-------------------------------------------------------------------------
114  * Template list for classes, that take 1 template parameter
115  * (e.g. std::vector, TwoClassSVMc, MultiClassSVMOneVsOne, ...)
116  *-------------------------------------------------------------------------*/
117  template<template<typename> class T, typename Tnext>
118  struct TTList
119  {
120  template<typename T2>
121  struct Traits
122  {
123  typedef T<T2> val_t;
124  };
125 
126 
127  typedef Tnext next_t;
128  };
129 
130 // template<typename DUMMY>
131 // struct TTList_end {};
132 
133  /*-----------------------------------------------------------------------
134  * Convinience macros to create TTList's
135  *-----------------------------------------------------------------------*/
136 #define TTLIST_1(T1) svt::TTList< T1, svt::TList_end >
137 #define TTLIST_2(T1,T2) svt::TTList< T1, TTLIST_1(T2) >
138 #define TTLIST_3(T1,T2,T3) svt::TTList< T1, TTLIST_2(T2,T3) >
139 #define TTLIST_4(T1,T2,T3,T4) svt::TTList< T1, TTLIST_3(T2,T3,T4) >
140 #define TTLIST_5(T1,T2,T3,T4,T5) svt::TTList< T1, TTLIST_4(T2,T3,T4,T5) >
141 #define TTLIST_6(T1,T2,T3,T4,T5,T6) svt::TTList< T1, TTLIST_5(T2,T3,T4,T5,T6) >
142 #define TTLIST_7(T1,T2,T3,T4,T5,T6,T7) svt::TTList< T1, TTLIST_6(T2,T3,T4,T5,T6,T7) >
143 #define TTLIST_8(T1,T2,T3,T4,T5,T6,T7,T8) svt::TTList< T1, TTLIST_7(T2,T3,T4,T5,T6,T7,T8) >
144 #define TTLIST_9(T1,T2,T3,T4,T5,T6,T7,T8,T9) svt::TTList< T1, TTLIST_8(T2,T3,T4,T5,T6,T7,T8,T9) >
145 #define TTLIST_10(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) svt::TTList< T1, TTLIST_9(T2,T3,T4,T5,T6,T7,T8,T9,T10) >
146 #define TTLIST_11(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) svt::TTList< T1, TTLIST_10(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) >
147 #define TTLIST_12(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12) svt::TTList< T1, TTLIST_11(T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12) >
148 
149 // template<template<typename> class T1=TTList_end,
150 // template<typename> class T2=TTList_end,
151 // template<typename> class T3=TTList_end,
152 // template<typename> class T4=TTList_end,
153 // template<typename> class T5=TTList_end,
154 // template<typename> class T6=TTList_end,
155 // template<typename> class T7=TTList_end,
156 // template<typename> class T8=TTList_end,
157 // template<typename> class T9=TTList_end,
158 // template<typename> class T10=TTList_end>
159 // struct MakeTTList
160 // {
161 // typedef TTList<
162 // T1, TTList<
163 // T2, TTList<
164 // T3, TTList<
165 // T4, TTList<
166 // T5, TTList<
167 // T6, TTList<
168 // T7, TTList<
169 // T8, TTList<
170 // T9, TTList<
171 // T10, TTList<TTList_end, TList_end> > > > > > > > > > > the_list;
172 // };
173 //
174 
175 }
176 
177 #endif
T val_t
Definition: TList.hh:60
Tnext next_t
Definition: TList.hh:61
Tnext next_t
Definition: TList.hh:127