Public Member Functions | Public Attributes | Private Attributes

df_FileBlockReader Class Reference
[IVD Data format.]

#include <df.h>

Inheritance diagram for df_FileBlockReader:
Inheritance graph
[legend]
Collaboration diagram for df_FileBlockReader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 df_FileBlockReader (const cmn_Path &a_file, UInt32_t a_blkType, bbt_BufType_t a_bufType, UInt32_t a_blkSize)
 reserve a_blkSize block buffer open file read first block and set it
virtual ~df_FileBlockReader (void)
virtual void GetNextBlock ()
 get next block and check its header
virtual void GetRawNextBlock ()
 just get next block

Public Attributes

 log_CLASSID_m
 Macro to add class name member s_className.

Private Attributes

cmn_File m_dfFile
UInt8_tm_block_p

Detailed Description

Definition at line 1432 of file df.h.


Constructor & Destructor Documentation

df_FileBlockReader::df_FileBlockReader ( const cmn_Path a_file,
UInt32_t  a_blkType,
bbt_BufType_t  a_bufType,
UInt32_t  a_blkSize 
)

reserve a_blkSize block buffer open file read first block and set it

Definition at line 50 of file df_fileblockreader.cpp.

References fom_OPEN_EXISTING, fom_READ, log_FUNC_m, m_block_p, m_dfFile, and cmn_File::OpenF().

:   df_BlockProxy(a_blkType, a_bufType, a_blkSize),
    m_dfFile(a_file)
{
    log_FUNC_m(df_FileBlockReader);
    m_block_p = new UInt8_t[a_blkSize];
    m_dfFile.OpenF(fom_READ | fom_OPEN_EXISTING);
}

Here is the call graph for this function:

df_FileBlockReader::~df_FileBlockReader ( void   )  [virtual]

Definition at line 64 of file df_fileblockreader.cpp.

References log_FUNC_m, and m_block_p.


Member Function Documentation

void df_FileBlockReader::GetNextBlock (  )  [virtual]

get next block and check its header

Reimplemented from df_BlockProxy.

Definition at line 71 of file df_fileblockreader.cpp.

References df_BlockProxy::GetBlkSize(), ie_DF_INV_BLK, ivd_Error, m_block_p, df_BlockProxy::m_curBlock_p, m_dfFile, cmn_File::ReadF(), and df_BlockProxy::SetPtrToDataBlock().

                                      {

    UInt32_t bytesRead = m_dfFile.ReadF(m_block_p, GetBlkSize());
    
    if (bytesRead > 0 && bytesRead < GetBlkSize()) {
        ostringstream sstr;
        sstr
            << "Read less than requested: "
            << bytesRead << " < " << GetBlkSize() << ".";

        throw ivd_Error(ie_DF_INV_BLK, sstr.str(), true);
    }

    if (bytesRead > 0) {
        SetPtrToDataBlock(m_block_p, 0);
    }
    else {
        m_curBlock_p = NULL;
    }
}

Here is the call graph for this function:

void df_FileBlockReader::GetRawNextBlock (  )  [virtual]

just get next block

Reimplemented from df_BlockProxy.

Definition at line 94 of file df_fileblockreader.cpp.

References df_BlockProxy::GetBlkSize(), ie_DF_INV_BLK, ivd_Error, m_block_p, df_BlockProxy::m_curBlock_p, m_dfFile, and cmn_File::ReadF().

                                         {

    UInt32_t bytesRead = m_dfFile.ReadF(m_block_p, GetBlkSize());
    
    if (bytesRead > 0 && bytesRead < GetBlkSize()) {
        ostringstream sstr;
        sstr
            << "Read less than requested: "
            << bytesRead << " < " << GetBlkSize() << ".";

        throw ivd_Error(ie_DF_INV_BLK, sstr.str(), true);
    }
    
    if (bytesRead == 0) {
        m_curBlock_p = NULL;
    }
}

Here is the call graph for this function:


Member Data Documentation

Macro to add class name member s_className.

Reimplemented from df_BlockProxy.

Definition at line 1443 of file df.h.

Definition at line 1447 of file df.h.

Referenced by df_FileBlockReader(), GetNextBlock(), GetRawNextBlock(), and ~df_FileBlockReader().

Definition at line 1445 of file df.h.

Referenced by df_FileBlockReader(), GetNextBlock(), and GetRawNextBlock().


The documentation for this class was generated from the following files: