OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
factory_macros.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 //
6 // Generated by base/factory_macros.py
7 //
8 
9 #define FACTORY_TYPE_N0(_Module, _T)\
10  public:\
11  template <class U>\
12  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
13  Register(boost::function<_T *()> function) {\
14  _Module *obj = GetInstance();\
15  obj->make_ ## _T ## _ = function;\
16  }\
17  template <class U>\
18  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
19  Create() {\
20  _Module *obj = GetInstance();\
21  return obj->make_ ## _T ## _();\
22  }\
23  private:\
24  boost::function<_T *()> make_ ## _T ##_\
25 
26 #define FACTORY_PARAM_TYPE_N0(_Module, _T, _P)\
27  public:\
28  template <class U, int UP>\
29  static typename boost::enable_if_c<\
30  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
31  Register(boost::function<_T *()> function) {\
32  _Module *obj = GetInstance();\
33  obj->make_ ## _T ## _ ## _P ## _ = function;\
34  }\
35  template <class U, int UP>\
36  static typename boost::enable_if_c<\
37  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
38  Create() {\
39  _Module *obj = GetInstance();\
40  return obj->make_ ## _T ## _ ## _P ##_();\
41  }\
42  private:\
43  boost::function<_T *()> make_ ## _T ## _ ## _P ## _\
44 
45 #define FACTORY_TYPE_N1(_Module, _T, A0)\
46  public:\
47  template <class U>\
48  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
49  Register(boost::function<_T *(A0)> function) {\
50  _Module *obj = GetInstance();\
51  obj->make_ ## _T ## _ = function;\
52  }\
53  template <class U>\
54  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
55  Create(A0 a0) {\
56  _Module *obj = GetInstance();\
57  return obj->make_ ## _T ## _(a0);\
58  }\
59  private:\
60  boost::function<_T *(A0)> make_ ## _T ##_\
61 
62 #define FACTORY_PARAM_TYPE_N1(_Module, _T, _P, A0)\
63  public:\
64  template <class U, int UP>\
65  static typename boost::enable_if_c<\
66  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
67  Register(boost::function<_T *(A0)> function) {\
68  _Module *obj = GetInstance();\
69  obj->make_ ## _T ## _ ## _P ## _ = function;\
70  }\
71  template <class U, int UP>\
72  static typename boost::enable_if_c<\
73  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
74  Create(A0 a0) {\
75  _Module *obj = GetInstance();\
76  return obj->make_ ## _T ## _ ## _P ##_(a0);\
77  }\
78  private:\
79  boost::function<_T *(A0)> make_ ## _T ## _ ## _P ## _\
80 
81 #define FACTORY_TYPE_N2(_Module, _T, A0, A1)\
82  public:\
83  template <class U>\
84  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
85  Register(boost::function<_T *(A0, A1)> function) {\
86  _Module *obj = GetInstance();\
87  obj->make_ ## _T ## _ = function;\
88  }\
89  template <class U>\
90  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
91  Create(A0 a0, A1 a1) {\
92  _Module *obj = GetInstance();\
93  return obj->make_ ## _T ## _(a0, a1);\
94  }\
95  private:\
96  boost::function<_T *(A0, A1)> make_ ## _T ##_\
97 
98 #define FACTORY_PARAM_TYPE_N2(_Module, _T, _P, A0, A1)\
99  public:\
100  template <class U, int UP>\
101  static typename boost::enable_if_c<\
102  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
103  Register(boost::function<_T *(A0, A1)> function) {\
104  _Module *obj = GetInstance();\
105  obj->make_ ## _T ## _ ## _P ## _ = function;\
106  }\
107  template <class U, int UP>\
108  static typename boost::enable_if_c<\
109  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
110  Create(A0 a0, A1 a1) {\
111  _Module *obj = GetInstance();\
112  return obj->make_ ## _T ## _ ## _P ##_(a0, a1);\
113  }\
114  private:\
115  boost::function<_T *(A0, A1)> make_ ## _T ## _ ## _P ## _\
116 
117 #define FACTORY_TYPE_N3(_Module, _T, A0, A1, A2)\
118  public:\
119  template <class U>\
120  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
121  Register(boost::function<_T *(A0, A1, A2)> function) {\
122  _Module *obj = GetInstance();\
123  obj->make_ ## _T ## _ = function;\
124  }\
125  template <class U>\
126  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
127  Create(A0 a0, A1 a1, A2 a2) {\
128  _Module *obj = GetInstance();\
129  return obj->make_ ## _T ## _(a0, a1, a2);\
130  }\
131  private:\
132  boost::function<_T *(A0, A1, A2)> make_ ## _T ##_\
133 
134 #define FACTORY_PARAM_TYPE_N3(_Module, _T, _P, A0, A1, A2)\
135  public:\
136  template <class U, int UP>\
137  static typename boost::enable_if_c<\
138  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
139  Register(boost::function<_T *(A0, A1, A2)> function) {\
140  _Module *obj = GetInstance();\
141  obj->make_ ## _T ## _ ## _P ## _ = function;\
142  }\
143  template <class U, int UP>\
144  static typename boost::enable_if_c<\
145  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
146  Create(A0 a0, A1 a1, A2 a2) {\
147  _Module *obj = GetInstance();\
148  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2);\
149  }\
150  private:\
151  boost::function<_T *(A0, A1, A2)> make_ ## _T ## _ ## _P ## _\
152 
153 #define FACTORY_TYPE_N4(_Module, _T, A0, A1, A2, A3)\
154  public:\
155  template <class U>\
156  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
157  Register(boost::function<_T *(A0, A1, A2, A3)> function) {\
158  _Module *obj = GetInstance();\
159  obj->make_ ## _T ## _ = function;\
160  }\
161  template <class U>\
162  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
163  Create(A0 a0, A1 a1, A2 a2, A3 a3) {\
164  _Module *obj = GetInstance();\
165  return obj->make_ ## _T ## _(a0, a1, a2, a3);\
166  }\
167  private:\
168  boost::function<_T *(A0, A1, A2, A3)> make_ ## _T ##_\
169 
170 #define FACTORY_PARAM_TYPE_N4(_Module, _T, _P, A0, A1, A2, A3)\
171  public:\
172  template <class U, int UP>\
173  static typename boost::enable_if_c<\
174  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
175  Register(boost::function<_T *(A0, A1, A2, A3)> function) {\
176  _Module *obj = GetInstance();\
177  obj->make_ ## _T ## _ ## _P ## _ = function;\
178  }\
179  template <class U, int UP>\
180  static typename boost::enable_if_c<\
181  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
182  Create(A0 a0, A1 a1, A2 a2, A3 a3) {\
183  _Module *obj = GetInstance();\
184  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2, a3);\
185  }\
186  private:\
187  boost::function<_T *(A0, A1, A2, A3)> make_ ## _T ## _ ## _P ## _\
188 
189 #define FACTORY_TYPE_N5(_Module, _T, A0, A1, A2, A3, A4)\
190  public:\
191  template <class U>\
192  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
193  Register(boost::function<_T *(A0, A1, A2, A3, A4)> function) {\
194  _Module *obj = GetInstance();\
195  obj->make_ ## _T ## _ = function;\
196  }\
197  template <class U>\
198  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
199  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {\
200  _Module *obj = GetInstance();\
201  return obj->make_ ## _T ## _(a0, a1, a2, a3, a4);\
202  }\
203  private:\
204  boost::function<_T *(A0, A1, A2, A3, A4)> make_ ## _T ##_\
205 
206 #define FACTORY_PARAM_TYPE_N5(_Module, _T, _P, A0, A1, A2, A3, A4)\
207  public:\
208  template <class U, int UP>\
209  static typename boost::enable_if_c<\
210  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
211  Register(boost::function<_T *(A0, A1, A2, A3, A4)> function) {\
212  _Module *obj = GetInstance();\
213  obj->make_ ## _T ## _ ## _P ## _ = function;\
214  }\
215  template <class U, int UP>\
216  static typename boost::enable_if_c<\
217  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
218  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {\
219  _Module *obj = GetInstance();\
220  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2, a3, a4);\
221  }\
222  private:\
223  boost::function<_T *(A0, A1, A2, A3, A4)> make_ ## _T ## _ ## _P ## _\
224 
225 #define FACTORY_TYPE_N6(_Module, _T, A0, A1, A2, A3, A4, A5)\
226  public:\
227  template <class U>\
228  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
229  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5)> function) {\
230  _Module *obj = GetInstance();\
231  obj->make_ ## _T ## _ = function;\
232  }\
233  template <class U>\
234  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
235  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {\
236  _Module *obj = GetInstance();\
237  return obj->make_ ## _T ## _(a0, a1, a2, a3, a4, a5);\
238  }\
239  private:\
240  boost::function<_T *(A0, A1, A2, A3, A4, A5)> make_ ## _T ##_\
241 
242 #define FACTORY_PARAM_TYPE_N6(_Module, _T, _P, A0, A1, A2, A3, A4, A5)\
243  public:\
244  template <class U, int UP>\
245  static typename boost::enable_if_c<\
246  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
247  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5)> function) {\
248  _Module *obj = GetInstance();\
249  obj->make_ ## _T ## _ ## _P ## _ = function;\
250  }\
251  template <class U, int UP>\
252  static typename boost::enable_if_c<\
253  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
254  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {\
255  _Module *obj = GetInstance();\
256  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2, a3, a4, a5);\
257  }\
258  private:\
259  boost::function<_T *(A0, A1, A2, A3, A4, A5)> make_ ## _T ## _ ## _P ## _\
260 
261 #define FACTORY_TYPE_N7(_Module, _T, A0, A1, A2, A3, A4, A5, A6)\
262  public:\
263  template <class U>\
264  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
265  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5, A6)> function) {\
266  _Module *obj = GetInstance();\
267  obj->make_ ## _T ## _ = function;\
268  }\
269  template <class U>\
270  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
271  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {\
272  _Module *obj = GetInstance();\
273  return obj->make_ ## _T ## _(a0, a1, a2, a3, a4, a5, a6);\
274  }\
275  private:\
276  boost::function<_T *(A0, A1, A2, A3, A4, A5, A6)> make_ ## _T ##_\
277 
278 #define FACTORY_PARAM_TYPE_N7(_Module, _T, _P, A0, A1, A2, A3, A4, A5, A6)\
279  public:\
280  template <class U, int UP>\
281  static typename boost::enable_if_c<\
282  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
283  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5, A6)> function) {\
284  _Module *obj = GetInstance();\
285  obj->make_ ## _T ## _ ## _P ## _ = function;\
286  }\
287  template <class U, int UP>\
288  static typename boost::enable_if_c<\
289  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
290  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {\
291  _Module *obj = GetInstance();\
292  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2, a3, a4, a5, a6);\
293  }\
294  private:\
295  boost::function<_T *(A0, A1, A2, A3, A4, A5, A6)> make_ ## _T ## _ ## _P ## _\
296 
297 #define FACTORY_TYPE_N8(_Module, _T, A0, A1, A2, A3, A4, A5, A6, A7)\
298  public:\
299  template <class U>\
300  static typename boost::enable_if<boost::is_same<U, _T>, void>::type\
301  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5, A6, A7)> function) {\
302  _Module *obj = GetInstance();\
303  obj->make_ ## _T ## _ = function;\
304  }\
305  template <class U>\
306  static typename boost::enable_if<boost::is_same<U, _T>, _T *>::type\
307  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {\
308  _Module *obj = GetInstance();\
309  return obj->make_ ## _T ## _(a0, a1, a2, a3, a4, a5, a6, a7);\
310  }\
311  private:\
312  boost::function<_T *(A0, A1, A2, A3, A4, A5, A6, A7)> make_ ## _T ##_\
313 
314 #define FACTORY_PARAM_TYPE_N8(_Module, _T, _P, A0, A1, A2, A3, A4, A5, A6, A7)\
315  public:\
316  template <class U, int UP>\
317  static typename boost::enable_if_c<\
318  boost::is_same<U, _T>::value && (UP == (_P)), void>::type\
319  Register(boost::function<_T *(A0, A1, A2, A3, A4, A5, A6, A7)> function) {\
320  _Module *obj = GetInstance();\
321  obj->make_ ## _T ## _ ## _P ## _ = function;\
322  }\
323  template <class U, int UP>\
324  static typename boost::enable_if_c<\
325  boost::is_same<U, _T>::value && (UP == (_P)), _T *>::type\
326  Create(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {\
327  _Module *obj = GetInstance();\
328  return obj->make_ ## _T ## _ ## _P ##_(a0, a1, a2, a3, a4, a5, a6, a7);\
329  }\
330  private:\
331  boost::function<_T *(A0, A1, A2, A3, A4, A5, A6, A7)> make_ ## _T ## _ ## _P ## _\
332