diff options
Diffstat (limited to '')
-rw-r--r-- | gensigs.bld | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gensigs.bld b/gensigs.bld index c452356..6cdd5d5 100644 --- a/gensigs.bld +++ b/gensigs.bld | |||
@@ -18,6 +18,7 @@ function genSigs( outName ) | |||
18 | "\n" | 18 | "\n" |
19 | "#include \"bu/util.h\"\n" | 19 | "#include \"bu/util.h\"\n" |
20 | "#include \"bu/exceptionbase.h\"\n" | 20 | "#include \"bu/exceptionbase.h\"\n" |
21 | "#include \"bu/list.h\"\n" | ||
21 | "\n" | 22 | "\n" |
22 | "namespace Bu\n" | 23 | "namespace Bu\n" |
23 | "{\n" | 24 | "{\n" |
@@ -28,9 +29,11 @@ function genSigs( outName ) | |||
28 | for i in range( 0, 10 ) do | 29 | for i in range( 0, 10 ) do |
29 | { | 30 | { |
30 | templParams = "typename ret"; | 31 | templParams = "typename ret"; |
32 | templSpecParams = ""; | ||
31 | funcParams = ""; | 33 | funcParams = ""; |
32 | funcAnonParams = ""; | 34 | funcAnonParams = ""; |
33 | templCallParams = "ret"; | 35 | templCallParams = "ret"; |
36 | templSpecCallParams = ""; | ||
34 | funcCallParams = ""; | 37 | funcCallParams = ""; |
35 | if i >= 1 then | 38 | if i >= 1 then |
36 | { | 39 | { |
@@ -41,11 +44,14 @@ function genSigs( outName ) | |||
41 | funcCallParams << ", "; | 44 | funcCallParams << ", "; |
42 | funcParams << ", "; | 45 | funcParams << ", "; |
43 | funcAnonParams << ", "; | 46 | funcAnonParams << ", "; |
47 | templSpecParams << ", "; | ||
44 | } | 48 | } |
45 | templParams << ", typename p${p}t"; | 49 | templParams << ", typename p${p}t"; |
50 | templSpecParams << "typename p${p}t"; | ||
46 | funcParams << "p${p}t p${p}"; | 51 | funcParams << "p${p}t p${p}"; |
47 | funcAnonParams << "p${p}t"; | 52 | funcAnonParams << "p${p}t"; |
48 | templCallParams << ", p${p}t"; | 53 | templCallParams << ", p${p}t"; |
54 | templSpecCallParams << ", p${p}t"; | ||
49 | funcCallParams << "p${p}"; | 55 | funcCallParams << "p${p}"; |
50 | } | 56 | } |
51 | } | 57 | } |
@@ -156,6 +162,53 @@ function genSigs( outName ) | |||
156 | " new __Slot${i}F<${templCallParams}>( pFnc )\n" | 162 | " new __Slot${i}F<${templCallParams}>( pFnc )\n" |
157 | " );\n" | 163 | " );\n" |
158 | " }\n" | 164 | " }\n" |
165 | " \n" | ||
166 | " template<${templParams}>\n" | ||
167 | " class SignalList${i} : public Bu::List<Bu::Signal${i}<${templCallParams}> >\n" | ||
168 | " {\n" | ||
169 | " typedef Bu::List<Bu::Signal${i}<${templCallParams}> > MyType;\n" | ||
170 | " public:\n" | ||
171 | " SignalList${i}()\n" | ||
172 | " {\n" | ||
173 | " }\n" | ||
174 | " \n" | ||
175 | " using MyType::iterator;\n" | ||
176 | " using MyType::const_iterator;\n" | ||
177 | " \n" | ||
178 | " ret operator()( ${funcParams} )\n" | ||
179 | " {\n" | ||
180 | " typename MyType::iterator i, n;\n" | ||
181 | " for(i = MyType::begin(); i; i=n)\n" | ||
182 | " {\n" | ||
183 | " n = i;\n" | ||
184 | " n++;\n" | ||
185 | " if( n )\n" | ||
186 | " (*i)( ${funcCallParams} );\n" | ||
187 | " else\n" | ||
188 | " return (*i)( ${funcCallParams} );\n" | ||
189 | " }\n" | ||
190 | " throw Bu::ExceptionBase(\"Empty SignalList with non-void return value called.\");\n" | ||
191 | " }\n" | ||
192 | " };\n" | ||
193 | " \n" | ||
194 | " template<${templSpecParams}>\n" | ||
195 | " class SignalList${i}<void${templSpecCallParams}> : public Bu::List<Bu::Signal${i}<void${templSpecCallParams}> >\n" | ||
196 | " {\n" | ||
197 | " typedef Bu::List<Bu::Signal${i}<void${templSpecCallParams}> > MyType;\n" | ||
198 | " public:\n" | ||
199 | " SignalList${i}()\n" | ||
200 | " {\n" | ||
201 | " }\n" | ||
202 | " \n" | ||
203 | " using MyType::iterator;\n" | ||
204 | " using MyType::const_iterator;\n" | ||
205 | " \n" | ||
206 | " void operator()( ${funcParams} )\n" | ||
207 | " {\n" | ||
208 | " for( typename MyType::iterator i = MyType::begin(); i; i++ )\n" | ||
209 | " (*i)( ${funcCallParams} );\n" | ||
210 | " }\n" | ||
211 | " };\n" | ||
159 | "#endif // BU_SIGNAL_PARAM_COUNT_${i}\n" | 212 | "#endif // BU_SIGNAL_PARAM_COUNT_${i}\n" |
160 | "\n" | 213 | "\n" |
161 | ); | 214 | ); |