Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

blk_NetWriter Class Reference
[IVD Data format.]

Class for transferring disk buffer over the network (CORBA). More...

#include <df.h>

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

List of all members.

Public Member Functions

 blk_NetWriter (df_BlockManager &a_mgr, i_UploadAgent_ptr a_uploadAgt)
virtual ~blk_NetWriter ()

Protected Member Functions

virtual void Run (void *a_arg)

Protected Attributes

df_BlockManagerm_blkManager
df_MgrReader m_mgrReader
i_UploadAgent_var m_uploadAgent

Private Attributes

 log_CLASSID_m

Detailed Description

Class for transferring disk buffer over the network (CORBA).

Definition at line 458 of file df.h.


Constructor & Destructor Documentation

blk_NetWriter::blk_NetWriter ( df_BlockManager a_mgr,
i_UploadAgent_ptr  a_uploadAgt 
)

Definition at line 48 of file blk_netwriter.cpp.

  : m_blkManager(a_mgr),
    m_mgrReader(a_mgr),
    m_uploadAgent( i_UploadAgent::_duplicate(a_uploadAgt) ) {
      // Empty
}

blk_NetWriter::~blk_NetWriter (  )  [virtual]

Definition at line 57 of file blk_netwriter.cpp.

References log_FUNC_m.


Member Function Documentation

void blk_NetWriter::Run ( void *  a_arg  )  [protected, virtual]

Reimplemented from cmn_Thread.

Definition at line 61 of file blk_netwriter.cpp.

References dbg_DETAIL, dbg_LOW, dbg_NORM, df_BlockManager::GetBlocksWritten(), ivd_BaseException::GetDescription(), ivd_BaseException::GetError(), df_MgrReader::GetFull(), df_MgrReader::GetReaderIdx(), ipc_EXEC_m, ivd_Error, log_DBG_INT_m, log_DBG_m, log_ERR_m, log_FUNC_m, m_blkManager, m_mgrReader, m_uploadAgent, NULL, df_MgrReader::Release(), and df_MgrReader::SetError().

                                   {
    log_FUNC_m(Run);

    UInt64_t    blksFromMgr = 0;

    try {
        log_DBG_m(dbg_NORM, m_mgrReader.GetReaderIdx() << " Writer thread started.");

        const df_DataBlock *blk = NULL;
        while ( (blk = m_mgrReader.GetFull() ) != NULL) {
            blksFromMgr++;
            log_DBG_INT_m(dbg_DETAIL, m_mgrReader.GetReaderIdx() << " Got block. Writing.");

            try {
                i_DataBlock_t dataBlock(
                    blk->GetUsedSize(),
                    blk->GetUsedSize(),
                    blk->GetData(),
                    0);

                ipc_EXEC_m(
                    m_uploadAgent->Write(
                        dataBlock,
                        blk->GetBlockSize() );
                );
            }
            catch (ivd_SysError &ie) {
                m_mgrReader.SetError(
                    new ivd_SysError(ie.GetError(), ie.GetDescription()) );
                throw;
            }
            catch (ivd_Error &ie) {
                m_mgrReader.SetError(
                    new ivd_Error(ie.GetError(), ie.GetDescription()) );
                throw;
            }
            catch (ivd_Exception &ie) {
                m_mgrReader.SetError(
                    new ivd_Error(ie.GetError(), ie.GetDescription()) );
                throw;
            }
            m_mgrReader.Release();
        }
    }
    catch (ivd_Error &ie) {
        log_DBG_m(dbg_LOW,
            "Problems writing over network. Thread going down." << endl <<
            "Error: " << ie);
    }
    catch (ivd_Exception &ie) {
        log_DBG_m(dbg_LOW,
            "Problems writing over network. Thread going down." << endl <<
            "Error: " << ie);
    }
    if (m_blkManager.GetBlocksWritten() != blksFromMgr) {
        log_ERR_m(
            "Written: " << m_blkManager.GetBlocksWritten() <<
            " Read : " << blksFromMgr);
    }
    log_DBG_m(dbg_NORM,
        m_mgrReader.GetReaderIdx() <<
        " End of data. Blocks: " << blksFromMgr);
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from cmn_Thread.

Definition at line 472 of file df.h.

Definition at line 465 of file df.h.

Referenced by Run().

Definition at line 466 of file df.h.

Referenced by Run().

i_UploadAgent_var blk_NetWriter::m_uploadAgent [protected]

Definition at line 467 of file df.h.

Referenced by Run().


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