Public Member Functions | Public Attributes | Private Attributes | Friends

df_LimitedStream Class Reference
[G_new_group]

#include <df_LimitedStream.h>

Collaboration diagram for df_LimitedStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 df_LimitedStream (int a_recordSize)
 ~df_LimitedStream (void)
int Write (const char *a_buff_p, int a_size)
bool Write (string &a_limStream)
 limStream will be replaced with current return true if limStream is full length
int Read (char *a_buff_p, int a_size)
 read the a_size of data from limited stream.
void SetNextLimStream (df_LimitedStream *a_nextLimStream_p)
df_LimitedStreamGetNextLimStream ()
string & GetLimStreamBufRef ()
void ReadReset ()
void Cut (UInt32_t a_cutSize)
void Clear ()

Public Attributes

 log_CLASSID_m

Private Attributes

unsigned int m_recSize
unsigned int m_maxStreamSize
 stream size is limited by vector size and record size.
string m_limStream
UInt32_t m_readPos
 current read position
df_LimitedStreamm_nextLimStream_p

Friends

class ut_fio_LimitedStream

Detailed Description

Definition at line 50 of file df_LimitedStream.h.


Constructor & Destructor Documentation

df_LimitedStream::df_LimitedStream ( int  a_recordSize  )  [inline]

Definition at line 53 of file df_LimitedStream.h.

    :
    m_recSize(a_recordSize),
    m_maxStreamSize(ivd_MAX_STREAM_SIZE(a_recordSize)),
    m_readPos (0),
    m_nextLimStream_p(NULL)
    { };

df_LimitedStream::~df_LimitedStream ( void   )  [inline]

Definition at line 61 of file df_LimitedStream.h.

References m_nextLimStream_p, and NULL.

                            {
        if (m_nextLimStream_p != NULL) {
            delete m_nextLimStream_p;
        }
    };


Member Function Documentation

void df_LimitedStream::Clear ( void   )  [inline]

Definition at line 107 of file df_LimitedStream.h.

References m_limStream, and m_nextLimStream_p.

                 {
        if (m_nextLimStream_p) {
            delete m_nextLimStream_p;
            m_nextLimStream_p = NULL;
        }
        m_limStream.clear();
    };

void df_LimitedStream::Cut ( UInt32_t  a_cutSize  ) 

Definition at line 86 of file df_LimitedStream.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_limStream, and m_nextLimStream_p.

Referenced by df_Stream::Cut().

                                             {
    log_FUNC_m(Cut);    
    m_limStream.resize(a_cutSize);
    log_DBG_m(dbg_DETAIL, "Cut size " << a_cutSize
                          << " m_limStream.size() after Cut " << m_limStream.size() );
    if (m_nextLimStream_p) {
        delete m_nextLimStream_p;
        m_nextLimStream_p = NULL;
    }
}

Here is the caller graph for this function:

string& df_LimitedStream::GetLimStreamBufRef (  )  [inline]

Definition at line 96 of file df_LimitedStream.h.

References m_limStream.

Referenced by fsc_nsAttrStream::Dump(), and fsc_nsStream::Write2DB().

{ return m_limStream;};

Here is the caller graph for this function:

df_LimitedStream* df_LimitedStream::GetNextLimStream (  )  [inline]

Definition at line 92 of file df_LimitedStream.h.

References m_nextLimStream_p.

Referenced by df_Stream::Read(), and fsc_nsStream::Write2DB().

                                         {
        return m_nextLimStream_p;
    }

Here is the caller graph for this function:

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

read the a_size of data from limited stream.

Return size of data read from this stream. If it's less than a_size then missing data is read from next limitedStream.

Definition at line 66 of file df_LimitedStream.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_limStream, and m_readPos.

Referenced by df_Stream::Read().

                                                      {   
    log_FUNC_m(Read);    
    log_DBG_m(dbg_DETAIL, " get data from limited stream. sized " << a_size
                       << " readPos " << m_readPos
                       << " m_limStream.size() " << m_limStream.size() );
    if (m_readPos + a_size > m_limStream.size()) {
        int read = m_limStream.size() - m_readPos;
        memcpy(a_buff_p, m_limStream.data() + m_readPos, read);
        m_readPos += read;
        return read;
    }
    else {
        memcpy(a_buff_p, m_limStream.data() + m_readPos, a_size);
        m_readPos += a_size;
        return a_size;
    }
}

Here is the caller graph for this function:

void df_LimitedStream::ReadReset (  )  [inline]

Definition at line 98 of file df_LimitedStream.h.

References m_nextLimStream_p, m_readPos, and ReadReset().

Referenced by ReadReset().

Here is the call graph for this function:

Here is the caller graph for this function:

void df_LimitedStream::SetNextLimStream ( df_LimitedStream a_nextLimStream_p  )  [inline]

Definition at line 88 of file df_LimitedStream.h.

References m_nextLimStream_p.

Referenced by df_Stream::Write().

                                                                 {
        m_nextLimStream_p = a_nextLimStream_p;
    }

Here is the caller graph for this function:

int df_LimitedStream::Write ( const char *  a_buff_p,
int  a_size 
)

Definition at line 49 of file df_LimitedStream.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_limStream, and m_maxStreamSize.

Referenced by df_Stream::Write(), Write(), and df_Stream::WriteZeroes().

                                                            {
    log_FUNC_m(Write);
    log_DBG_m(dbg_DETAIL, " limStream string size " << m_limStream.size()
                        << " adding data size = " <<  a_size);
    if (m_limStream.size() + a_size > m_maxStreamSize) {
        int written = m_maxStreamSize - m_limStream.size();
        m_limStream.append(a_buff_p, written);
        return written;
    }
    else {
        m_limStream.append(a_buff_p, a_size);
        return a_size;
    }
}

Here is the caller graph for this function:

bool df_LimitedStream::Write ( string &  a_limStream  )  [inline]

limStream will be replaced with current return true if limStream is full length

Definition at line 72 of file df_LimitedStream.h.

References m_limStream, m_maxStreamSize, and Write().

                                    {
        if (m_limStream.size() == 0) {
            a_limStream.swap(m_limStream);
        }
        else {
            Write(a_limStream.data(), a_limStream.size());
        }
        return (m_limStream.size() == m_maxStreamSize);
    };

Here is the call graph for this function:


Friends And Related Function Documentation

friend class ut_fio_LimitedStream [friend]

Definition at line 51 of file df_LimitedStream.h.


Member Data Documentation

Definition at line 113 of file df_LimitedStream.h.

Definition at line 125 of file df_LimitedStream.h.

Referenced by Clear(), Cut(), GetLimStreamBufRef(), Read(), and Write().

unsigned int df_LimitedStream::m_maxStreamSize [private]

stream size is limited by vector size and record size.

vector can contain 256 records. Thus max limited stream size is 256 * record size. NOTE: not all buffer is used for data. The last few bytes are reserved for next vector size and its index in DB.

Definition at line 124 of file df_LimitedStream.h.

Referenced by Write().

current read position

Definition at line 127 of file df_LimitedStream.h.

Referenced by Read(), and ReadReset().

unsigned int df_LimitedStream::m_recSize [private]

Definition at line 117 of file df_LimitedStream.h.


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