26#ifndef __itkOpenCLOstreamSupport_h
27#define __itkOpenCLOstreamSupport_h
38template<
typename u
charT,
typename traits >
40std::basic_ostream< ucharT, traits > &
42 std::basic_ostream< ucharT, traits > & strm,
45 strm <<
"(uchar)(" << _v <<
")";
50template<
typename u
charT,
typename traits >
52std::basic_ostream< ucharT, traits > &
54 std::basic_ostream< ucharT, traits > & strm,
55 const cl_uchar2 & _v )
58 for(
unsigned int i = 0; i < 2; ++i )
61 if( i != 1 ) { strm <<
", "; }
68template<
typename u
charT,
typename traits >
70std::basic_ostream< ucharT, traits > &
72 std::basic_ostream< ucharT, traits > & strm,
73 const cl_uchar4 & _v )
76 for(
unsigned int i = 0; i < 4; ++i )
79 if( i != 3 ) { strm <<
", "; }
86template<
typename u
charT,
typename traits >
88std::basic_ostream< ucharT, traits > &
90 std::basic_ostream< ucharT, traits > & strm,
91 const cl_uchar8 & _v )
94 for(
unsigned int i = 0; i < 8; ++i )
97 if( i != 7 ) { strm <<
", "; }
104template<
typename u
charT,
typename traits >
106std::basic_ostream< ucharT, traits > &
108 std::basic_ostream< ucharT, traits > & strm,
109 const cl_uchar16 & _v )
111 strm <<
"(uchar16)(";
112 for(
unsigned int i = 0; i < 16; ++i )
115 if( i != 15 ) { strm <<
", "; }
124template<
typename charT,
typename traits >
126std::basic_ostream< charT, traits > &
128 std::basic_ostream< charT, traits > & strm,
131 strm <<
"(char)(" << _v <<
")";
136template<
typename charT,
typename traits >
138std::basic_ostream< charT, traits > &
140 std::basic_ostream< charT, traits > & strm,
141 const cl_char2 & _v )
144 for(
unsigned int i = 0; i < 2; ++i )
147 if( i != 1 ) { strm <<
", "; }
154template<
typename charT,
typename traits >
156std::basic_ostream< charT, traits > &
158 std::basic_ostream< charT, traits > & strm,
159 const cl_char4 & _v )
162 for(
unsigned int i = 0; i < 4; ++i )
165 if( i != 3 ) { strm <<
", "; }
172template<
typename charT,
typename traits >
174std::basic_ostream< charT, traits > &
176 std::basic_ostream< charT, traits > & strm,
177 const cl_char8 & _v )
180 for(
unsigned int i = 0; i < 8; ++i )
183 if( i != 7 ) { strm <<
", "; }
190template<
typename charT,
typename traits >
192std::basic_ostream< charT, traits > &
194 std::basic_ostream< charT, traits > & strm,
195 const cl_char16 & _v )
198 for(
unsigned int i = 0; i < 16; ++i )
201 if( i != 15 ) { strm <<
", "; }
210template<
typename u
shortT,
typename traits >
212std::basic_ostream< ushortT, traits > &
214 std::basic_ostream< ushortT, traits > & strm,
215 const cl_ushort & _v )
217 strm <<
"(ushort)(" << _v <<
")";
222template<
typename u
shortT,
typename traits >
224std::basic_ostream< ushortT, traits > &
226 std::basic_ostream< ushortT, traits > & strm,
227 const cl_ushort2 & _v )
229 strm <<
"(ushort2)(";
230 for(
unsigned int i = 0; i < 2; ++i )
233 if( i != 1 ) { strm <<
", "; }
240template<
typename u
shortT,
typename traits >
242std::basic_ostream< ushortT, traits > &
244 std::basic_ostream< ushortT, traits > & strm,
245 const cl_ushort4 & _v )
247 strm <<
"(ushort4)(";
248 for(
unsigned int i = 0; i < 4; ++i )
251 if( i != 3 ) { strm <<
", "; }
258template<
typename u
shortT,
typename traits >
260std::basic_ostream< ushortT, traits > &
262 std::basic_ostream< ushortT, traits > & strm,
263 const cl_ushort8 & _v )
265 strm <<
"(ushort8)(";
266 for(
unsigned int i = 0; i < 8; ++i )
269 if( i != 7 ) { strm <<
", "; }
276template<
typename u
shortT,
typename traits >
278std::basic_ostream< ushortT, traits > &
280 std::basic_ostream< ushortT, traits > & strm,
281 const cl_ushort16 & _v )
283 strm <<
"(ushort16)(";
284 for(
unsigned int i = 0; i < 16; ++i )
287 if( i != 15 ) { strm <<
", "; }
296template<
typename shortT,
typename traits >
298std::basic_ostream< shortT, traits > &
300 std::basic_ostream< shortT, traits > & strm,
301 const cl_short & _v )
303 strm <<
"(short)(" << _v <<
")";
308template<
typename shortT,
typename traits >
310std::basic_ostream< shortT, traits > &
312 std::basic_ostream< shortT, traits > & strm,
313 const cl_short2 & _v )
316 for(
unsigned int i = 0; i < 2; ++i )
319 if( i != 1 ) { strm <<
", "; }
326template<
typename shortT,
typename traits >
328std::basic_ostream< shortT, traits > &
330 std::basic_ostream< shortT, traits > & strm,
331 const cl_short4 & _v )
334 for(
unsigned int i = 0; i < 4; ++i )
337 if( i != 3 ) { strm <<
", "; }
344template<
typename shortT,
typename traits >
346std::basic_ostream< shortT, traits > &
348 std::basic_ostream< shortT, traits > & strm,
349 const cl_short8 & _v )
352 for(
unsigned int i = 0; i < 8; ++i )
355 if( i != 7 ) { strm <<
", "; }
362template<
typename shortT,
typename traits >
364std::basic_ostream< shortT, traits > &
366 std::basic_ostream< shortT, traits > & strm,
367 const cl_short16 & _v )
369 strm <<
"(short16)(";
370 for(
unsigned int i = 0; i < 16; ++i )
373 if( i != 15 ) { strm <<
", "; }
382template<
typename charT,
typename traits >
384std::basic_ostream< charT, traits > &
386 std::basic_ostream< charT, traits > & strm,
389 strm <<
"(uint)(" << _v <<
")";
394template<
typename charT,
typename traits >
396std::basic_ostream< charT, traits > &
398 std::basic_ostream< charT, traits > & strm,
399 const cl_uint2 & _v )
402 for(
unsigned int i = 0; i < 2; ++i )
405 if( i != 1 ) { strm <<
", "; }
412template<
typename charT,
typename traits >
414std::basic_ostream< charT, traits > &
416 std::basic_ostream< charT, traits > & strm,
417 const cl_uint4 & _v )
420 for(
unsigned int i = 0; i < 4; ++i )
423 if( i != 3 ) { strm <<
", "; }
430template<
typename charT,
typename traits >
432std::basic_ostream< charT, traits > &
434 std::basic_ostream< charT, traits > & strm,
435 const cl_uint8 & _v )
438 for(
unsigned int i = 0; i < 8; ++i )
441 if( i != 7 ) { strm <<
", "; }
448template<
typename charT,
typename traits >
450std::basic_ostream< charT, traits > &
452 std::basic_ostream< charT, traits > & strm,
453 const cl_uint16 & _v )
456 for(
unsigned int i = 0; i < 16; ++i )
459 if( i != 15 ) { strm <<
", "; }
468template<
typename charT,
typename traits >
470std::basic_ostream< charT, traits > &
472 std::basic_ostream< charT, traits > & strm,
475 strm <<
"(int)(" << _v <<
")";
480template<
typename charT,
typename traits >
482std::basic_ostream< charT, traits > &
484 std::basic_ostream< charT, traits > & strm,
488 for(
unsigned int i = 0; i < 2; ++i )
491 if( i != 1 ) { strm <<
", "; }
498template<
typename charT,
typename traits >
500std::basic_ostream< charT, traits > &
502 std::basic_ostream< charT, traits > & strm,
506 for(
unsigned int i = 0; i < 4; ++i )
509 if( i != 3 ) { strm <<
", "; }
516template<
typename charT,
typename traits >
518std::basic_ostream< charT, traits > &
520 std::basic_ostream< charT, traits > & strm,
524 for(
unsigned int i = 0; i < 8; ++i )
527 if( i != 7 ) { strm <<
", "; }
534template<
typename charT,
typename traits >
536std::basic_ostream< charT, traits > &
538 std::basic_ostream< charT, traits > & strm,
539 const cl_int16 & _v )
542 for(
unsigned int i = 0; i < 16; ++i )
545 if( i != 15 ) { strm <<
", "; }
554template<
typename u
longT,
typename traits >
556std::basic_ostream< ulongT, traits > &
558 std::basic_ostream< ulongT, traits > & strm,
559 const cl_ulong & _v )
561 strm <<
"(ulong)(" << _v <<
")";
566template<
typename u
longT,
typename traits >
568std::basic_ostream< ulongT, traits > &
570 std::basic_ostream< ulongT, traits > & strm,
571 const cl_ulong2 & _v )
574 for(
unsigned int i = 0; i < 2; ++i )
577 if( i != 1 ) { strm <<
", "; }
584template<
typename u
longT,
typename traits >
586std::basic_ostream< ulongT, traits > &
588 std::basic_ostream< ulongT, traits > & strm,
589 const cl_ulong4 & _v )
592 for(
unsigned int i = 0; i < 4; ++i )
595 if( i != 3 ) { strm <<
", "; }
602template<
typename u
longT,
typename traits >
604std::basic_ostream< ulongT, traits > &
606 std::basic_ostream< ulongT, traits > & strm,
607 const cl_ulong8 & _v )
610 for(
unsigned int i = 0; i < 8; ++i )
613 if( i != 7 ) { strm <<
", "; }
620template<
typename u
longT,
typename traits >
622std::basic_ostream< ulongT, traits > &
624 std::basic_ostream< ulongT, traits > & strm,
625 const cl_ulong16 & _v )
627 strm <<
"(ulong16)(";
628 for(
unsigned int i = 0; i < 16; ++i )
631 if( i != 15 ) { strm <<
", "; }
640template<
typename longT,
typename traits >
642std::basic_ostream< longT, traits > &
644 std::basic_ostream< longT, traits > & strm,
647 strm <<
"(long)(" << _v <<
")";
652template<
typename longT,
typename traits >
654std::basic_ostream< longT, traits > &
656 std::basic_ostream< longT, traits > & strm,
657 const cl_long2 & _v )
660 for(
unsigned int i = 0; i < 2; ++i )
663 if( i != 1 ) { strm <<
", "; }
670template<
typename longT,
typename traits >
672std::basic_ostream< longT, traits > &
674 std::basic_ostream< longT, traits > & strm,
675 const cl_long4 & _v )
678 for(
unsigned int i = 0; i < 4; ++i )
681 if( i != 3 ) { strm <<
", "; }
688template<
typename longT,
typename traits >
690std::basic_ostream< longT, traits > &
692 std::basic_ostream< longT, traits > & strm,
693 const cl_long8 & _v )
696 for(
unsigned int i = 0; i < 8; ++i )
699 if( i != 7 ) { strm <<
", "; }
706template<
typename longT,
typename traits >
708std::basic_ostream< longT, traits > &
710 std::basic_ostream< longT, traits > & strm,
711 const cl_long16 & _v )
714 for(
unsigned int i = 0; i < 16; ++i )
717 if( i != 15 ) { strm <<
", "; }
726template<
typename charT,
typename traits >
728std::basic_ostream< charT, traits > &
730 std::basic_ostream< charT, traits > & strm,
731 const cl_float & _v )
733 strm <<
"(float)(" << _v <<
")";
738template<
typename charT,
typename traits >
740std::basic_ostream< charT, traits > &
742 std::basic_ostream< charT, traits > & strm,
743 const cl_float2 & _v )
746 for(
unsigned int i = 0; i < 2; ++i )
748 strm << std::fixed << std::setprecision( 8 ) << _v.s[ i ];
749 if( i != 1 ) { strm <<
", "; }
756template<
typename charT,
typename traits >
758std::basic_ostream< charT, traits > &
760 std::basic_ostream< charT, traits > & strm,
761 const cl_float4 & _v )
764 for(
unsigned int i = 0; i < 4; ++i )
766 strm << std::fixed << std::setprecision( 8 ) << _v.s[ i ];
767 if( i != 3 ) { strm <<
", "; }
774template<
typename charT,
typename traits >
776std::basic_ostream< charT, traits > &
778 std::basic_ostream< charT, traits > & strm,
779 const cl_float8 & _v )
782 for(
unsigned int i = 0; i < 8; ++i )
784 strm << std::fixed << std::setprecision( 8 ) << _v.s[ i ];
785 if( i != 7 ) { strm <<
", "; }
792template<
typename charT,
typename traits >
794std::basic_ostream< charT, traits > &
796 std::basic_ostream< charT, traits > & strm,
797 const cl_float16 & _v )
799 strm <<
"(float16)(";
800 for(
unsigned int i = 0; i < 16; ++i )
802 strm << std::fixed << std::setprecision( 8 ) << _v.s[ i ];
803 if( i != 15 ) { strm <<
", "; }
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)