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

template<class ArrayT>
bool Impala::Core::Array::ReadRawHeader ( Util::IOBuffer *  ioBuf,
Int64 *  version,
Int64 *  binary,
Int64 *  elemSize,
Int64 *  width,
Int64 *  height,
Int64 *  nrA,
String compressor,
Int64 *  linesPerCompressedBlock 
) [inline]

Definition at line 104 of file ReadRaw.h.

References Impala::Util::IOBuffer::Gets(), ILOG_ERROR, and ILOG_VAR.

00108 {
00109     typedef typename ArrayT::StorType StorT;
00110 
00111     ILOG_VAR(Impala.Core.Array.ReadRawHeader);
00112     char buf[200];
00113     for (int i=0 ; i<200 ; i++)
00114         buf[i] = 0;
00115     ioBuf->Gets(buf, 200);
00116     int res = sscanf(buf, "version: %lld", version);
00117     if (res != 1)
00118     {
00119         ILOG_ERROR("Could not determine version");
00120         return false;
00121     }
00122 
00123     *linesPerCompressedBlock = 0;
00124     String typeStr = Element::TypeString<StorT>(0);
00125     if (*version == 1)
00126     {
00127         String formatStr = "version: 1, binary: %lld, type: " + typeStr +
00128             ", elemSize: %lld, width: %lld, height: %lld, nr: %lld";
00129         int res = sscanf(buf, formatStr.c_str(),
00130                          binary, elemSize, width, height, nrA);
00131         if ((res != 5) || (*elemSize != ArrayT::ElemSize()))
00132         {
00133             ILOG_ERROR("Header type 1 is not compatible: res==" << res <<
00134                        " (should be 5), elemSize==" << elemSize << " (should be "
00135                        << ArrayT::ElemSize() << "), buf==[" << buf << "]");
00136             return false;
00137         }
00138         return true;
00139     }
00140     if (*version == 2)
00141     {
00142         String formatStr = "version: 2, binary: %lld, type: " + typeStr +
00143             ", elemSize: %lld, nr: %lld";
00144         int res = sscanf(buf, formatStr.c_str(), binary, elemSize, nrA);
00145         if ((res != 3) || (*elemSize != ArrayT::ElemSize()))
00146         {
00147             ILOG_ERROR("Header type 2 is not compatible: res==" << res <<
00148                        " (should be 3), elemSize==" << elemSize << " (should be "
00149                        << ArrayT::ElemSize() << "), buf==[" << buf << "]");
00150             return false;
00151         }
00152         return true;
00153     }
00154     if (*version == 3)
00155     {
00156         char compressor2[5];
00157         String formatStr = "version: 3, binary: %lld, type: " + typeStr +
00158             ", elemSize: %lld, width: %lld, height: %lld, nr: %lld, %4s: %lld";
00159         int res = sscanf(buf, formatStr.c_str(),
00160                          binary, elemSize, width, height, nrA, compressor2, 
00161                          linesPerCompressedBlock);
00162         compressor2[4] = '\0';
00163         compressor = String(compressor2);
00164         if ((res != 7) || (*elemSize != ArrayT::ElemSize()))
00165         {
00166             ILOG_ERROR("Header type 3 is not compatible: res==" << res <<
00167                        " (should be 6), elemSize==" << elemSize << " (should be "
00168                        << ArrayT::ElemSize() << "), buf==[" << buf << "]");
00169             return false;
00170         }
00171         return true;
00172     }
00173     ILOG_ERROR("Unknown version " << *version);
00174     return false;
00175 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:17:08 2011 for ImpalaSrc by  doxygen 1.5.1