blk_StdIOReader Class Reference
[IVD Data format.]

#include <df.h>

Inheritance diagram for blk_StdIOReader:

Inheritance graph
[legend]
Collaboration diagram for blk_StdIOReader:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 538 of file df.h.


Public Member Functions

 blk_StdIOReader (df_BlockManager &a_mgr, const string &a_fName)
virtual ~blk_StdIOReader ()

Private Member Functions

virtual UInt32_t Read (UInt8_t *a_data, const UInt32_t a_size)

Private Attributes

 log_CLASSID_m
int m_fHandle

Constructor & Destructor Documentation

blk_StdIOReader::blk_StdIOReader ( df_BlockManager a_mgr,
const string &  a_fName 
)

Definition at line 44 of file blk_stdioreader.cpp.

References dbg_NORM, errno, log_DBG_m, log_FUNC_A_m, m_fHandle, and O_BINARY.

00047     : blk_BufferReader(a_mgr) {
00048 
00049     log_FUNC_A_m(blk_StdIOReader, "fName=" << a_fName);
00050 
00051     if (a_fName.empty()) {
00052         log_DBG_m(dbg_NORM, "Using stdin for DF input");
00053         m_fHandle = dup(fileno(stdin));
00054         if (m_fHandle == -1) {
00055             throw ivd_SysError(errno, "dup()", true);
00056         }
00057 #if TGT_OS_windows
00058         setmode(m_fHandle, O_BINARY);
00059 #endif
00060     }
00061     else {
00062         m_fHandle = open(a_fName.c_str(), O_RDONLY | O_BINARY);
00063         if (m_fHandle == -1) {
00064            throw ivd_SysError(errno, "open()", true);
00065         }
00066     }
00067 }

blk_StdIOReader::~blk_StdIOReader (  )  [virtual]

Definition at line 69 of file blk_stdioreader.cpp.

References errno, log_ERR_m, log_FUNC_m, and m_fHandle.

00069                                   {
00070     log_FUNC_m(~blk_StdIOReader);
00071 
00072     /* if (m_fHandle != stdin) */ {
00073         if (close(m_fHandle) != 0) {
00074            log_ERR_m(
00075                 "close() failed. Ignored. Error: " << errno);
00076         }
00077     }
00078 }


Member Function Documentation

UInt32_t blk_StdIOReader::Read ( UInt8_t a_data,
const UInt32_t  a_size 
) [private, virtual]

Implements blk_BufferReader.

Definition at line 80 of file blk_stdioreader.cpp.

References errno, log_FUNC_m, and m_fHandle.

00080                                                                      {
00081     log_FUNC_m(Read);
00082 
00083     Int32_t bytesRead = read(m_fHandle, a_data, a_size);
00084     if (bytesRead == -1) {
00085         throw ivd_SysError(errno, "read()", true);
00086     }
00087     return bytesRead;
00088 }


Member Data Documentation

Reimplemented from blk_BufferReader.

Definition at line 549 of file df.h.

Definition at line 551 of file df.h.

Referenced by blk_StdIOReader(), Read(), and ~blk_StdIOReader().


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

Generated on Mon Feb 27 19:02:13 2012 for OPENARCHIVE by  doxygen 1.5.6