Public Member Functions | Public Attributes | Private Attributes

df_Stream Class Reference
[G_new_group]

#include <df_Stream.h>

Collaboration diagram for df_Stream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 df_Stream (int a_recordSize)
 df_Stream (const df_Stream &a_stream)
 ~df_Stream (void)
void Write (const char *a_buff_p, int a_size)
void Write (string &a_limStream)
 limStream will be replaced with current and next is creatted
void WriteZeroes (int a_size)
int Read (char *a_buff_p, int a_size)
 read particular size from stream and move pointer for read size return the size of read data.
void ReadReset ()
void Cut (UInt32_t a_cutSize)
void Clear ()
df_LimitedStreamStealFirstStream ()

Public Attributes

 log_CLASSID_m

Private Attributes

int m_recSize
df_LimitedStreamm_firstStream_p
df_LimitedStreamm_currentStream_p
df_LimitedStreamm_currReadStream_p
bool m_cutted

Detailed Description

Definition at line 43 of file df_Stream.h.


Constructor & Destructor Documentation

df_Stream::df_Stream ( int  a_recordSize  )  [inline]

Definition at line 46 of file df_Stream.h.

df_Stream::df_Stream ( const df_Stream a_stream  )  [inline]
df_Stream::~df_Stream ( void   )  [inline]

Definition at line 72 of file df_Stream.h.

                     {
        if (m_firstStream_p) {
            delete m_firstStream_p;
        }
    };


Member Function Documentation

void df_Stream::Clear ( void   )  [inline]

Definition at line 98 of file df_Stream.h.

Referenced by fsc_nsAttrStream::MergeAttributes(), and df_SplitInfoUnpacker::ProcRecFileHdr().

Here is the caller graph for this function:

void df_Stream::Cut ( UInt32_t  a_cutSize  ) 

Definition at line 124 of file df_Stream.cpp.

References df_LimitedStream::Cut(), dbg_DETAIL, log_DBG_m, log_FUNC_m, m_currentStream_p, m_currReadStream_p, m_cutted, and m_firstStream_p.

Referenced by df_SplitInfoUnpacker::ProcRecBSEnd().

Here is the call graph for this function:

Here is the caller graph for this function:

int df_Stream::Read ( char *  a_buff_p,
int  a_size 
)

read particular size from stream and move pointer for read size return the size of read data.

When 0 end of stream reach. if a_size > read > 0, internal error.

Definition at line 104 of file df_Stream.cpp.

References dbg_DETAIL, df_LimitedStream::GetNextLimStream(), log_DBG_m, log_FUNC_m, m_currReadStream_p, NULL, and df_LimitedStream::Read().

Referenced by fsc_nsAttrStream::MergeAttributes(), fsc_nsAttrStream::ReadSplitsFromDB(), and fsc_nsAttrStream::ReadSplitStreamFromDfStream().

                                               {
    log_FUNC_m(Read);
    log_DBG_m(dbg_DETAIL, " get data from stream. sized " << a_size 
                    << " a_buff_p " << a_buff_p);
    int toRead = a_size;
    char *p = a_buff_p;
    int read;
    toRead -= read = m_currReadStream_p->Read(p, toRead);
    while (toRead > 0) { // need new limittedStream
        p += read;
        m_currReadStream_p = m_currReadStream_p->GetNextLimStream();
        if (m_currReadStream_p == NULL) {
            return p - a_buff_p; // return the amount of read data
        }
        toRead -= read = m_currReadStream_p->Read(p, toRead);
    }
    return a_size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Stream::ReadReset (  )  [inline]

Definition at line 91 of file df_Stream.h.

Referenced by fsc_nsAttrStream::MergeAttributes(), and fsc_nsAttrStream::ReadSplitsFromDB().

Here is the caller graph for this function:

df_LimitedStream* df_Stream::StealFirstStream (  )  [inline]

Definition at line 105 of file df_Stream.h.

Referenced by fsc_nsAttrMgr::ChgAttributes().

Here is the caller graph for this function:

void df_Stream::Write ( const char *  a_buff_p,
int  a_size 
)

Definition at line 50 of file df_Stream.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_currentStream_p, m_cutted, m_recSize, df_LimitedStream::SetNextLimStream(), and df_LimitedStream::Write().

Referenced by df_SplitInfoUnpacker::ProcRecBSStart(), df_SplitInfoUnpacker::ProcRecEmbData(), df_SplitInfoUnpacker::ProcRecFileEnd(), df_SplitInfoUnpacker::ProcRecFileHdr(), df_SplitInfoUnpacker::ProcRecFRIEnd(), df_SplitInfoUnpacker::ProcRecRawData(), fsc_nsStream::ReadFromDB(), Write(), and fsc_nsAttrStream::WriteAllSplitStreamsToDfStream().

                                                      {
    log_FUNC_m(Write);
    if (m_cutted) {
        log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
        return;
    }
    int toWrite = a_size;
    const char *p = a_buff_p;
    int written;
    toWrite -= written = m_currentStream_p->Write(p, toWrite);
    while (toWrite > 0) { // need new limittedStream
        p += written;
        df_LimitedStream *ls_p = new df_LimitedStream(m_recSize);
        toWrite -= written = ls_p->Write(p, toWrite);
        m_currentStream_p->SetNextLimStream(ls_p);
        m_currentStream_p = ls_p;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Stream::Write ( string &  a_limStream  ) 

limStream will be replaced with current and next is creatted

Definition at line 70 of file df_Stream.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_currentStream_p, m_cutted, m_recSize, df_LimitedStream::SetNextLimStream(), df_LimitedStream::Write(), and Write().

                                         {
    log_FUNC_m(Write(limStream));
    if (m_cutted) {
        log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
        return;
    }
    /*
    if a_limStream is equal to m_maxStreamSize, 
    m_currentStream_p->Write(a_limStream) will return true.
    */
    if (m_currentStream_p->Write(a_limStream)) {
        df_LimitedStream *ls_p = new df_LimitedStream(m_recSize);
        m_currentStream_p->SetNextLimStream(ls_p);
        m_currentStream_p = ls_p;
        // Next call of this function will write data to new limited stream
    }
}

Here is the call graph for this function:

void df_Stream::WriteZeroes ( int  a_size  ) 

Definition at line 89 of file df_Stream.cpp.

References c_df_zeroBuffer(), c_df_zeroBufSize, dbg_DETAIL, log_DBG_m, log_FUNC_m, m_currentStream_p, m_cutted, and df_LimitedStream::Write().

Referenced by df_SplitInfoUnpacker::ProcRecBSEnd(), and df_SplitInfoUnpacker::ProcRecFRIEnd().

                                      {
    log_FUNC_m(WriteZeroes);
    if (m_cutted) {
        log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
        return;
    }
    int toWrite = a_size;
    while (toWrite >= c_df_zeroBufSize) {
        m_currentStream_p->Write(c_df_zeroBuffer.data(), c_df_zeroBufSize);
        toWrite -= c_df_zeroBufSize;
    }
    m_currentStream_p->Write(c_df_zeroBuffer.data(), toWrite);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 111 of file df_Stream.h.

Definition at line 117 of file df_Stream.h.

Referenced by Cut(), Write(), and WriteZeroes().

Definition at line 118 of file df_Stream.h.

Referenced by Cut(), and Read().

bool df_Stream::m_cutted [private]

Definition at line 121 of file df_Stream.h.

Referenced by Cut(), Write(), and WriteZeroes().

Definition at line 116 of file df_Stream.h.

Referenced by Cut().

int df_Stream::m_recSize [private]

Definition at line 115 of file df_Stream.h.

Referenced by Write().


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