df_Stream Class Reference
[G_new_group]

#include <df_Stream.h>

Collaboration diagram for df_Stream:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 29 of file df_Stream.h.


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

Constructor & Destructor Documentation

df_Stream::df_Stream ( int  a_recordSize  )  [inline]

Definition at line 32 of file df_Stream.h.

00033         :
00034         m_recSize(a_recordSize),
00035         m_firstStream_p(new df_LimitedStream(a_recordSize)),
00036         m_currentStream_p(m_firstStream_p),
00037         m_currReadStream_p(m_firstStream_p),
00038         m_cutted(false)
00039     { };

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

Definition at line 41 of file df_Stream.h.

00042         :
00043         m_recSize(a_stream.m_recSize),
00044         m_firstStream_p(new df_LimitedStream(a_stream.m_recSize)),
00045         m_currentStream_p(m_firstStream_p),
00046         m_currReadStream_p(m_firstStream_p),
00047         m_cutted(false)
00048     { 
00049     };

df_Stream::~df_Stream ( void   )  [inline]

Definition at line 58 of file df_Stream.h.

00058                      {
00059         if (m_firstStream_p) {
00060             delete m_firstStream_p;
00061         }
00062     };


Member Function Documentation

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

Definition at line 36 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().

00036                                                       {
00037     log_FUNC_m(Write);
00038     if (m_cutted) {
00039         log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
00040         return;
00041     }
00042     int toWrite = a_size;
00043     const char *p = a_buff_p;
00044     int written;
00045     toWrite -= written = m_currentStream_p->Write(p, toWrite);
00046     while (toWrite > 0) { // need new limittedStream
00047         p += written;
00048         df_LimitedStream *ls_p = new df_LimitedStream(m_recSize);
00049         toWrite -= written = ls_p->Write(p, toWrite);
00050         m_currentStream_p->SetNextLimStream(ls_p);
00051         m_currentStream_p = ls_p;
00052     }
00053 }

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 56 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().

00056                                          {
00057     log_FUNC_m(Write(limStream));
00058     if (m_cutted) {
00059         log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
00060         return;
00061     }
00062     /*
00063     if a_limStream is equal to m_maxStreamSize, 
00064     m_currentStream_p->Write(a_limStream) will return true.
00065     */
00066     if (m_currentStream_p->Write(a_limStream)) {
00067         df_LimitedStream *ls_p = new df_LimitedStream(m_recSize);
00068         m_currentStream_p->SetNextLimStream(ls_p);
00069         m_currentStream_p = ls_p;
00070         // Next call of this function will write data to new limited stream
00071     }
00072 }

Here is the call graph for this function:

void df_Stream::WriteZeroes ( int  a_size  ) 

Definition at line 75 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().

00075                                       {
00076     log_FUNC_m(WriteZeroes);
00077     if (m_cutted) {
00078         log_DBG_m(dbg_DETAIL, "Nothing written, stream is in Cut mode.");
00079         return;
00080     }
00081     int toWrite = a_size;
00082     while (toWrite >= c_df_zeroBufSize) {
00083         m_currentStream_p->Write(c_df_zeroBuffer.data(), c_df_zeroBufSize);
00084         toWrite -= c_df_zeroBufSize;
00085     }
00086     m_currentStream_p->Write(c_df_zeroBuffer.data(), toWrite);
00087 }

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 90 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().

00090                                                {
00091     log_FUNC_m(Read);
00092     log_DBG_m(dbg_DETAIL, " get data from stream. sized " << a_size 
00093                     << " a_buff_p " << a_buff_p);
00094     int toRead = a_size;
00095     char *p = a_buff_p;
00096     int read;
00097     toRead -= read = m_currReadStream_p->Read(p, toRead);
00098     while (toRead > 0) { // need new limittedStream
00099         p += read;
00100         m_currReadStream_p = m_currReadStream_p->GetNextLimStream();
00101         if (m_currReadStream_p == NULL) {
00102             return p - a_buff_p; // return the amount of read data
00103         }
00104         toRead -= read = m_currReadStream_p->Read(p, toRead);
00105     }
00106     return a_size;
00107 }

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Stream::ReadReset (  )  [inline]

Definition at line 77 of file df_Stream.h.

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

00077                      {
00078         m_currReadStream_p = m_firstStream_p;
00079         m_currentStream_p->ReadReset();
00080     };

Here is the caller graph for this function:

void df_Stream::Cut ( UInt32_t  a_cutSize  ) 

Definition at line 110 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().

00110                                       {
00111     log_FUNC_m(Cut);
00112     log_DBG_m(dbg_DETAIL, "Cut stream to size " << a_cutSize);
00113     m_currentStream_p = m_firstStream_p;
00114     m_currReadStream_p = m_firstStream_p;
00115     m_currentStream_p->Cut(a_cutSize);
00116     m_cutted = true;
00117 }

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Stream::Clear ( void   )  [inline]

Definition at line 84 of file df_Stream.h.

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

00084                  {
00085         m_currentStream_p = m_firstStream_p;
00086         m_currReadStream_p = m_firstStream_p;
00087         m_currentStream_p->Clear();
00088         m_cutted = false;
00089     };

Here is the caller graph for this function:

df_LimitedStream* df_Stream::StealFirstStream (  )  [inline]

Definition at line 91 of file df_Stream.h.

Referenced by fsc_nsAttrMgr::ChgAttributes().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 97 of file df_Stream.h.

int df_Stream::m_recSize [private]

Definition at line 101 of file df_Stream.h.

Referenced by Write().

Definition at line 102 of file df_Stream.h.

Referenced by Cut().

Definition at line 103 of file df_Stream.h.

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

Definition at line 104 of file df_Stream.h.

Referenced by Cut(), and Read().

bool df_Stream::m_cutted [private]

Definition at line 107 of file df_Stream.h.

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


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

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