Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<class ArrayT>
void Impala::Core::Array::WriteRaw ( ArrayT *  src,
Util::IOBuffer *  buffer,
bool  binary 
) [inline]

Definition at line 21 of file WriteRaw.h.

References Endian(), Impala::Util::IOBuffer::NativeTypeWrite(), Impala::Util::IOBuffer::Puts(), and Impala::Util::IOBuffer::Write().

Referenced by WriteFile(), and WriteRaw().

00022 {
00023     typedef typename ArrayT::StorType StorT;
00024 
00025     String typeStr = Element::TypeString<StorT>(0);
00026     String formatStr = "version: 1, binary: %d, type: " + typeStr +
00027                        ", elemSize: %lld, width: %lld, height: %lld, nr: %lld";
00028     Int64 width = src->CW();
00029     Int64 height = src->CH();
00030     Int64 elemSize = ArrayT::ElemSize();
00031     Int64 nrA = 1;
00032     char buf[200];
00033     memset(buf, 0, 200);
00034     sprintf(buf, formatStr.c_str(), binary, elemSize, width, height, nrA);
00035 
00036     if (binary)
00037     { // write binary data
00038         Endian(src, src);
00039         buffer->Write(buf, 200);
00040         if ((src->BW() == 0) && (src->BH() == 0))
00041         {
00042             StorT* srcPtr = src->CPB(0, 0);
00043             buffer->Write(srcPtr, sizeof(StorT) * width * height * elemSize);
00044         }
00045         else
00046         {
00047             for (Int64 y=0 ; y<height ; y++)
00048             {
00049                 StorT* srcPtr = src->CPB(0, y);
00050                 buffer->Write(srcPtr, sizeof(StorT) * width * elemSize);
00051             }
00052         }
00053     }
00054     else
00055     { // write text data
00056         buffer->Puts(buf);
00057         for (Int64 n=0 ; n<nrA ; n++)
00058         {
00059             for(Int64 i=0 ; i<height ; i++)
00060             {
00061                 StorT* srcPtr = src->CPB(0, i);
00062                 for(Int64 j=0 ; j<width ; j++)
00063                     for (Int64 k=0 ; k<elemSize ; k++)
00064                         buffer->NativeTypeWrite(*srcPtr++);
00065                 buffer->Puts(""); // adds newline
00066             }
00067         }
00068     }
00069 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:58:56 2010 for ImpalaSrc by  doxygen 1.5.1