00001 #ifndef Impala_Core_Array_PrintData_h
00002 #define Impala_Core_Array_PrintData_h
00003
00004 #include "Core/Array/Array2dTem.h"
00005
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012
00013
00014 template<class ArrayT>
00015 inline void
00016 PrintData(ArrayT* array, bool printBorder, int bx, int by, int width, int height)
00017 {
00018 typedef typename ArrayT::StorType StorT;
00019
00020 std::cout << "Array sizes: cw = " << array->CW() << ", ch = "
00021 << array->CH() << ", bw = " << array->BW() << ", bh = "
00022 << array->BH() << std::endl;
00023
00024
00025 for (int y=0 ; y<height ; y++)
00026 {
00027 std::cout << " Y = " << y << " :- ";
00028 for (int x=0 ; x<width ; x++)
00029 {
00030
00031
00032 StorT* p = (printBorder) ? array->PB(bx + x, by + y)
00033 : array->CPB(bx + x, by + y);
00034 ArrayPrintElem(std::cout, array, p);
00035 std::cout << ", ";
00036 }
00037 std::cout << std::endl;
00038 }
00039 }
00040
00041 template<class ArrayT>
00042 inline void
00043 PrintData(ArrayT* array, bool printBorder=false)
00044 {
00045 int width = (printBorder) ? array->W() : array->CW();
00046 int height = (printBorder) ? array->H() : array->CH();
00047 PrintData(array, printBorder, 0, 0, width, height);
00048 }
00049
00050 template<class ArrayT>
00051 inline void
00052 PrintDataCorners(ArrayT* array, int cornerWidth, int cornerHeight)
00053 {
00054 typedef typename ArrayT::StorType StorT;
00055
00056 std::cout << "Array sizes: cw = " << array->CW() << ", ch = "
00057 << array->CH() << ", bw = " << array->BW() << ", bh = "
00058 << array->BH() << std::endl;
00059 if (cornerWidth > array->CW())
00060 {
00061 std::cout << "cornerWidth > width" << std::endl;
00062 return;
00063 }
00064 if (cornerHeight > array->CH())
00065 {
00066 std::cout << "cornerHeight > height" << std::endl;
00067 return;
00068 }
00069 for (int y=0 ; y<array->CH() ; y++)
00070 {
00071 if ((y < cornerHeight) || (y >= (array->CH()-cornerHeight)))
00072 {
00073 std::cout << " Y = " << y << " :- ";
00074 for (int x=0 ; x<array->CW() ; x++)
00075 {
00076 if ((x < cornerWidth) || (x >= (array->CW()-cornerWidth)))
00077 {
00078 StorT* p = array->CPB(x, y);
00079 ArrayPrintElem(std::cout, array, p);
00080 std::cout << ", ";
00081 }
00082 else
00083 {
00084 if (x == cornerWidth)
00085 std::cout << "..., ";
00086 }
00087 }
00088 std::cout << std::endl;
00089 }
00090 else
00091 {
00092 if (y == cornerHeight)
00093 std::cout << "................." << std::endl;
00094 }
00095 }
00096 }
00097
00098 }
00099 }
00100 }
00101
00102 #endif