9 inline PTR_T(
SCALAR(T1)) write(const
int recid, const T1 &v1)
11 typedef internal::pktsize<header, T1> P;
15 int len = P::len_with_padding(v1);
16 int at = A::atomicAdd(this->at, len);
17 if(has_overflowed(at + len))
19 A::atomicAdd(this->at, -len);
22 char *ptr = buffer + at;
25 header v0(recid, len);
26 P::IO0::put(ptr, v0, P::begin0, P::len0);
27 P::IO1::put(ptr, v1, P::begin1, P::len1);
30 P::store_arginfo(ptr, v1);
33 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
34 return (
SCALAR(T1)*)(ptr + P::begin1);
37 template<
typename T1,
typename T2>
41 inline PTR_T(
SCALAR(T2)) write(const
int recid, const T1 &v1, const T2 &v2)
43 typedef internal::pktsize<header, T1, T2> P;
47 int len = P::len_with_padding(v2);
48 int at = A::atomicAdd(this->at, len);
49 if(has_overflowed(at + len))
51 A::atomicAdd(this->at, -len);
54 char *ptr = buffer + at;
57 header v0(recid, len);
58 P::IO0::put(ptr, v0, P::begin0, P::len0);
59 P::IO1::put(ptr, v1, P::begin1, P::len1);
60 P::IO2::put(ptr, v2, P::begin2, P::len2);
63 P::store_arginfo(ptr, v2);
66 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
67 return (
SCALAR(T2)*)(ptr + P::begin2);
70 template<
typename T1,
typename T2,
typename T3>
74 inline PTR_T(
SCALAR(T3)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3)
76 typedef internal::pktsize<header, T1, T2, T3> P;
80 int len = P::len_with_padding(v3);
81 int at = A::atomicAdd(this->at, len);
82 if(has_overflowed(at + len))
84 A::atomicAdd(this->at, -len);
87 char *ptr = buffer + at;
90 header v0(recid, len);
91 P::IO0::put(ptr, v0, P::begin0, P::len0);
92 P::IO1::put(ptr, v1, P::begin1, P::len1);
93 P::IO2::put(ptr, v2, P::begin2, P::len2);
94 P::IO3::put(ptr, v3, P::begin3, P::len3);
97 P::store_arginfo(ptr, v3);
100 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
101 return (
SCALAR(T3)*)(ptr + P::begin3);
104 template<
typename T1,
typename T2,
typename T3,
typename T4>
108 inline PTR_T(
SCALAR(T4)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
110 typedef internal::pktsize<header, T1, T2, T3, T4> P;
114 int len = P::len_with_padding(v4);
115 int at = A::atomicAdd(this->at, len);
116 if(has_overflowed(at + len))
118 A::atomicAdd(this->at, -len);
121 char *ptr = buffer + at;
124 header v0(recid, len);
125 P::IO0::put(ptr, v0, P::begin0, P::len0);
126 P::IO1::put(ptr, v1, P::begin1, P::len1);
127 P::IO2::put(ptr, v2, P::begin2, P::len2);
128 P::IO3::put(ptr, v3, P::begin3, P::len3);
129 P::IO4::put(ptr, v4, P::begin4, P::len4);
132 P::store_arginfo(ptr, v4);
135 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
136 return (
SCALAR(T4)*)(ptr + P::begin4);
139 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
143 inline PTR_T(
SCALAR(T5)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
145 typedef internal::pktsize<header, T1, T2, T3, T4, T5> P;
149 int len = P::len_with_padding(v5);
150 int at = A::atomicAdd(this->at, len);
151 if(has_overflowed(at + len))
153 A::atomicAdd(this->at, -len);
156 char *ptr = buffer + at;
159 header v0(recid, len);
160 P::IO0::put(ptr, v0, P::begin0, P::len0);
161 P::IO1::put(ptr, v1, P::begin1, P::len1);
162 P::IO2::put(ptr, v2, P::begin2, P::len2);
163 P::IO3::put(ptr, v3, P::begin3, P::len3);
164 P::IO4::put(ptr, v4, P::begin4, P::len4);
165 P::IO5::put(ptr, v5, P::begin5, P::len5);
168 P::store_arginfo(ptr, v5);
171 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
172 return (
SCALAR(T5)*)(ptr + P::begin5);
175 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
179 inline PTR_T(
SCALAR(T6)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6)
181 typedef internal::pktsize<header, T1, T2, T3, T4, T5, T6> P;
185 int len = P::len_with_padding(v6);
186 int at = A::atomicAdd(this->at, len);
187 if(has_overflowed(at + len))
189 A::atomicAdd(this->at, -len);
192 char *ptr = buffer + at;
195 header v0(recid, len);
196 P::IO0::put(ptr, v0, P::begin0, P::len0);
197 P::IO1::put(ptr, v1, P::begin1, P::len1);
198 P::IO2::put(ptr, v2, P::begin2, P::len2);
199 P::IO3::put(ptr, v3, P::begin3, P::len3);
200 P::IO4::put(ptr, v4, P::begin4, P::len4);
201 P::IO5::put(ptr, v5, P::begin5, P::len5);
202 P::IO6::put(ptr, v6, P::begin6, P::len6);
205 P::store_arginfo(ptr, v6);
208 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
209 return (
SCALAR(T6)*)(ptr + P::begin6);
212 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
216 inline PTR_T(
SCALAR(T7)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7)
218 typedef internal::pktsize<header, T1, T2, T3, T4, T5, T6, T7> P;
222 int len = P::len_with_padding(v7);
223 int at = A::atomicAdd(this->at, len);
224 if(has_overflowed(at + len))
226 A::atomicAdd(this->at, -len);
229 char *ptr = buffer + at;
232 header v0(recid, len);
233 P::IO0::put(ptr, v0, P::begin0, P::len0);
234 P::IO1::put(ptr, v1, P::begin1, P::len1);
235 P::IO2::put(ptr, v2, P::begin2, P::len2);
236 P::IO3::put(ptr, v3, P::begin3, P::len3);
237 P::IO4::put(ptr, v4, P::begin4, P::len4);
238 P::IO5::put(ptr, v5, P::begin5, P::len5);
239 P::IO6::put(ptr, v6, P::begin6, P::len6);
240 P::IO7::put(ptr, v7, P::begin7, P::len7);
243 P::store_arginfo(ptr, v7);
246 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
247 return (
SCALAR(T7)*)(ptr + P::begin7);
250 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
254 inline PTR_T(
SCALAR(T8)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
256 typedef internal::pktsize<header, T1, T2, T3, T4, T5, T6, T7, T8> P;
260 int len = P::len_with_padding(v8);
261 int at = A::atomicAdd(this->at, len);
262 if(has_overflowed(at + len))
264 A::atomicAdd(this->at, -len);
267 char *ptr = buffer + at;
270 header v0(recid, len);
271 P::IO0::put(ptr, v0, P::begin0, P::len0);
272 P::IO1::put(ptr, v1, P::begin1, P::len1);
273 P::IO2::put(ptr, v2, P::begin2, P::len2);
274 P::IO3::put(ptr, v3, P::begin3, P::len3);
275 P::IO4::put(ptr, v4, P::begin4, P::len4);
276 P::IO5::put(ptr, v5, P::begin5, P::len5);
277 P::IO6::put(ptr, v6, P::begin6, P::len6);
278 P::IO7::put(ptr, v7, P::begin7, P::len7);
279 P::IO8::put(ptr, v8, P::begin8, P::len8);
282 P::store_arginfo(ptr, v8);
285 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
286 return (
SCALAR(T8)*)(ptr + P::begin8);
289 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
293 inline PTR_T(
SCALAR(T9)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8, const T9 &v9)
295 typedef internal::pktsize<header, T1, T2, T3, T4, T5, T6, T7, T8, T9> P;
299 int len = P::len_with_padding(v9);
300 int at = A::atomicAdd(this->at, len);
301 if(has_overflowed(at + len))
303 A::atomicAdd(this->at, -len);
306 char *ptr = buffer + at;
309 header v0(recid, len);
310 P::IO0::put(ptr, v0, P::begin0, P::len0);
311 P::IO1::put(ptr, v1, P::begin1, P::len1);
312 P::IO2::put(ptr, v2, P::begin2, P::len2);
313 P::IO3::put(ptr, v3, P::begin3, P::len3);
314 P::IO4::put(ptr, v4, P::begin4, P::len4);
315 P::IO5::put(ptr, v5, P::begin5, P::len5);
316 P::IO6::put(ptr, v6, P::begin6, P::len6);
317 P::IO7::put(ptr, v7, P::begin7, P::len7);
318 P::IO8::put(ptr, v8, P::begin8, P::len8);
319 P::IO9::put(ptr, v9, P::begin9, P::len9);
322 P::store_arginfo(ptr, v9);
325 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
326 return (
SCALAR(T9)*)(ptr + P::begin9);
329 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
333 inline PTR_T(
SCALAR(T10)) write(const
int recid, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8, const T9 &v9, const T10 &v10)
335 typedef internal::pktsize<header, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> P;
339 int len = P::len_with_padding(v10);
340 int at = A::atomicAdd(this->at, len);
341 if(has_overflowed(at + len))
343 A::atomicAdd(this->at, -len);
346 char *ptr = buffer + at;
349 header v0(recid, len);
350 P::IO0::put(ptr, v0, P::begin0, P::len0);
351 P::IO1::put(ptr, v1, P::begin1, P::len1);
352 P::IO2::put(ptr, v2, P::begin2, P::len2);
353 P::IO3::put(ptr, v3, P::begin3, P::len3);
354 P::IO4::put(ptr, v4, P::begin4, P::len4);
355 P::IO5::put(ptr, v5, P::begin5, P::len5);
356 P::IO6::put(ptr, v6, P::begin6, P::len6);
357 P::IO7::put(ptr, v7, P::begin7, P::len7);
358 P::IO8::put(ptr, v8, P::begin8, P::len8);
359 P::IO9::put(ptr, v9, P::begin9, P::len9);
360 P::IO10::put(ptr, v10, P::begin10, P::len10);
363 P::store_arginfo(ptr, v10);
366 DHOST( std::cerr <<
"Total packet len = " << len <<
"\n"; )
367 return (
SCALAR(T10)*)(ptr + P::begin10);