Return TypeFunction nameArguments
hzEcodehdbBinRepos::Integ(hzLogger&,)

Declared in file: hzDatabase.h
Defined in file : hdbBinRepos.cpp

Function Logic:

0:START 1:m_nInitState<1 2:Return E_NOINIT 3:open ifstream::fail 4:is.fail() 5:Return hzerr(E_OPENFAIL,Could not open index file %s\n,*m_FileIndx) 6:; 7:ifstream::read ifstream::gcount nBytes 8:nBytes%sizeof(_datum_hd) 9:hzLogger::Log 10:nItems 11:nC 12:items totalSize 13:nItems<128 14:close hzLogger::Log hzLogger::Log 15:Return rc

Function body:

hzEcode hdbBinRepos::Integ (hzLogger& log)
{
   _hzfunc("hdbBinRepos::Integ") ;
   ifstream    is ;
   _datum_hd*  pHd ;
   _datum_hd   arrHd[128];
   uint32_t    nBytes ;
   uint32_t    nItems ;
   uint32_t    nC ;
   uint32_t    totalItems = 0;
   uint32_t    totalSize ;
   hzEcode     rc = E_OK ;
   if (m_nInitState < 1)
       return E_NOINIT ;
   is.open(*m_FileIndx) ;
   if (is.fail())
       return hzerr(E_OPENFAIL, "Could not open index file %s\n", *m_FileIndx) ;
   for (;;)
   {
       is.read((char*) arrHd, 4096);
       nBytes = is.gcount() ;
       if (nBytes % sizeof(_datum_hd))
       {
           log.Log("Unexpected read size %d\n", nBytes) ;
           break ;
       }
       nItems = nBytes/sizeof(_datum_hd) ;
       for (pHd = arrHd, nC = 0; nC < nItems ; nC++, pHd++)
       {
           totalItems++ ;
           totalSize += pHd->m_Size ;
       }
       if (nItems < 128)
           break ;
   }
   is.close() ;
   log.Log("Total items %u\n", totalItems) ;
   log.Log("Total size %u\n", totalSize) ;
   return rc ;
}