fio_AlterJourBlock Class Reference
[Classes for large file i/o, relative file, and DataBase]

#include <fio_AlterJourBlock.h>

List of all members.


Detailed Description

Definition at line 26 of file fio_AlterJourBlock.h.


Public Member Functions

 fio_AlterJourBlock ()
virtual ~fio_AlterJourBlock ()
int Insert (UInt16_t a_fileID, ivd_FilePosition_t a_filePosition, ivd_FileBufSize_t a_bufSize)
 return size of inserted data
int Insert (const UInt8_t *a_data, int a_size)
int Insert (fio_Alter_t &a_alter)
void WriteToLog (fio_JourHandle *m_jourHnd_p)
int Size ()
UInt8_tGetBlock ()
int GetDataSizeOn (UInt8_t *a_pos_p, int a_size)
int SizeAvail ()
bool IsAlterHdrOn (UInt8_t *a_pos_p)
void Clear ()

Private Attributes

int m_blockSize
UInt8_tm_block
UInt8_tm_fillPos
UInt8_tm_endPos
 one byte past last
 log_CLASSID_m

Constructor & Destructor Documentation

fio_AlterJourBlock::fio_AlterJourBlock (  ) 

Definition at line 38 of file fio_AlterJourBlock.cpp.

00039     :
00040     m_blockSize(c_fio_alterJourBlockSize),
00041     m_block (new UInt8_t[c_fio_alterJourBlockSize]),
00042     m_fillPos(m_block),
00043     m_endPos(m_block + c_fio_alterJourBlockSize)
00044 {
00045     // empty
00046 }
//============================================================================//

fio_AlterJourBlock::~fio_AlterJourBlock (  )  [virtual]

Definition at line 50 of file fio_AlterJourBlock.cpp.

References m_block.

00051 {
00052     delete [] m_block;
00053 }


Member Function Documentation

int fio_AlterJourBlock::Insert ( UInt16_t  a_fileID,
ivd_FilePosition_t  a_filePosition,
ivd_FileBufSize_t  a_bufSize 
)

return size of inserted data

Definition at line 57 of file fio_AlterJourBlock.cpp.

References fio_Alter_t::Init(), m_endPos, and m_fillPos.

Referenced by fio_AlterJour::Insert().

00059                                           {
00060     if ((m_fillPos + sizeof(fio_Alter_t)) < m_endPos) {
00061         fio_Alter_t &alterHdr = *reinterpret_cast<fio_Alter_t*>(m_fillPos);
00062         alterHdr.Init(a_fileID, a_filePosition, a_bufSize);
00063         m_fillPos += sizeof(fio_Alter_t);
00064         return sizeof(fio_Alter_t);
00065     }
00066     return 0;
00067 }

Here is the call graph for this function:

Here is the caller graph for this function:

int fio_AlterJourBlock::Insert ( const UInt8_t a_data,
int  a_size 
)

Definition at line 71 of file fio_AlterJourBlock.cpp.

References m_endPos, m_fillPos, and size.

00071                                                                 {
00072     if ((m_fillPos + a_size) < m_endPos) {
00073         memcpy(m_fillPos, a_data, a_size);
00074         m_fillPos += a_size;
00075         return a_size;
00076     }
00077     else { // fill up to the end of buffer;
00078         int size = m_endPos - m_fillPos;
00079         memcpy(m_fillPos, a_data, size);
00080         m_fillPos += size;
00081         return size;
00082     }
00083 }

int fio_AlterJourBlock::Insert ( fio_Alter_t a_alter  ) 

Definition at line 87 of file fio_AlterJourBlock.cpp.

References m_endPos, and m_fillPos.

00087                                                       {
00088     if ((m_fillPos + sizeof(fio_Alter_t)) < m_endPos) {
00089         fio_Alter_t &alterHdr = *reinterpret_cast<fio_Alter_t*>(m_fillPos);
00090         alterHdr = a_alter;
00091         m_fillPos += sizeof(fio_Alter_t);
00092         return sizeof(fio_Alter_t);
00093     }
00094     return 0;
00095 }

void fio_AlterJourBlock::WriteToLog ( fio_JourHandle m_jourHnd_p  ) 

Definition at line 99 of file fio_AlterJourBlock.cpp.

References fio_JourHandle::JourWrite(), m_block, and Size().

00099                                                                {
00100     m_jourHnd_p->JourWrite(m_block, Size());
00101 }

Here is the call graph for this function:

int fio_AlterJourBlock::Size (  )  [inline]

Definition at line 42 of file fio_AlterJourBlock.h.

Referenced by WriteToLog().

00042                {
00043         return m_fillPos - m_block;
00044     };

Here is the caller graph for this function:

UInt8_t* fio_AlterJourBlock::GetBlock (  )  [inline]

Definition at line 46 of file fio_AlterJourBlock.h.

Referenced by fio_AlterJour::UpdateDB().

00046 { return m_block; };

Here is the caller graph for this function:

int fio_AlterJourBlock::GetDataSizeOn ( UInt8_t a_pos_p,
int  a_size 
) [inline]

Definition at line 48 of file fio_AlterJourBlock.h.

Referenced by fio_AlterJour::UpdateDB().

00048                                                      {
00049         return (a_pos_p + a_size <= m_fillPos) 
00050                 ? a_size
00051                 : m_fillPos - a_pos_p;
00052     };

Here is the caller graph for this function:

int fio_AlterJourBlock::SizeAvail (  )  [inline]

Definition at line 54 of file fio_AlterJourBlock.h.

Referenced by fio_AlterJour::Insert().

00054                     {
00055         return m_endPos - m_fillPos;
00056     };

Here is the caller graph for this function:

bool fio_AlterJourBlock::IsAlterHdrOn ( UInt8_t a_pos_p  )  [inline]

Definition at line 58 of file fio_AlterJourBlock.h.

Referenced by fio_AlterJour::UpdateDB().

00058                                          {
00059         return ((a_pos_p + sizeof(fio_Alter_t)) <= m_fillPos);
00060     };

Here is the caller graph for this function:

void fio_AlterJourBlock::Clear ( void   )  [inline]

Definition at line 62 of file fio_AlterJourBlock.h.

00062                  {
00063         m_fillPos = m_block;
00064     };


Member Data Documentation

Definition at line 64 of file fio_AlterJourBlock.h.

Definition at line 69 of file fio_AlterJourBlock.h.

Referenced by WriteToLog(), and ~fio_AlterJourBlock().

Definition at line 70 of file fio_AlterJourBlock.h.

Referenced by Insert().

one byte past last

Definition at line 72 of file fio_AlterJourBlock.h.

Referenced by Insert().

Definition at line 74 of file fio_AlterJourBlock.h.


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

Generated on Mon Feb 27 19:14:30 2012 for OPENARCHIVE by  doxygen 1.5.6