Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CBufferedFile Class Reference

Non-refcounted RAII wrapper around a FILE* that implements a ring buffer to deserialize from. More...

#include <streams.h>

Public Member Functions

 CBufferedFile (FILE *fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn)
 
 ~CBufferedFile ()
 
int GetVersion () const
 
int GetType () const
 
void fclose ()
 
bool eof () const
 
void read (char *pch, size_t nSize)
 
uint64_t GetPos ()
 
bool SetPos (uint64_t nPos)
 
bool Seek (uint64_t nPos)
 
bool SetLimit (uint64_t nPos=(uint64_t)(-1))
 
template<typename T >
CBufferedFileoperator>> (T &obj)
 
void FindByte (char ch)
 

Protected Member Functions

bool Fill ()
 

Private Member Functions

 CBufferedFile (const CBufferedFile &)
 
CBufferedFileoperator= (const CBufferedFile &)
 

Private Attributes

const int nType
 
const int nVersion
 
FILE * src
 
uint64_t nSrcPos
 
uint64_t nReadPos
 
uint64_t nReadLimit
 
uint64_t nRewind
 
std::vector< char > vchBuf
 

Detailed Description

Non-refcounted RAII wrapper around a FILE* that implements a ring buffer to deserialize from.

It guarantees the ability to rewind a given number of bytes.

Will automatically close the file when it goes out of scope if not null. If you need to close the file early, use file.fclose() instead of fclose(file).

Definition at line 564 of file streams.h.

Constructor & Destructor Documentation

CBufferedFile::CBufferedFile ( const CBufferedFile )
private
CBufferedFile::CBufferedFile ( FILE *  fileIn,
uint64_t  nBufSize,
uint64_t  nRewindIn,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 601 of file streams.h.

CBufferedFile::~CBufferedFile ( )
inline

Definition at line 607 of file streams.h.

Member Function Documentation

bool CBufferedFile::eof ( ) const
inline

Definition at line 624 of file streams.h.

Here is the caller graph for this function:

void CBufferedFile::fclose ( )
inline

Definition at line 615 of file streams.h.

bool CBufferedFile::Fill ( )
inlineprotected

Definition at line 583 of file streams.h.

void CBufferedFile::FindByte ( char  ch)
inline

Definition at line 698 of file streams.h.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t CBufferedFile::GetPos ( )
inline

Definition at line 651 of file streams.h.

Here is the caller graph for this function:

int CBufferedFile::GetType ( ) const
inline

Definition at line 613 of file streams.h.

int CBufferedFile::GetVersion ( ) const
inline

Definition at line 612 of file streams.h.

CBufferedFile& CBufferedFile::operator= ( const CBufferedFile )
private
template<typename T >
CBufferedFile& CBufferedFile::operator>> ( T obj)
inline

Definition at line 691 of file streams.h.

Here is the call graph for this function:

void CBufferedFile::read ( char *  pch,
size_t  nSize 
)
inline

Definition at line 629 of file streams.h.

Here is the call graph for this function:

bool CBufferedFile::Seek ( uint64_t  nPos)
inline

Definition at line 669 of file streams.h.

bool CBufferedFile::SetLimit ( uint64_t  nPos = (uint64_t)(-1))
inline

Definition at line 683 of file streams.h.

Here is the caller graph for this function:

bool CBufferedFile::SetPos ( uint64_t  nPos)
inline

Definition at line 656 of file streams.h.

Here is the caller graph for this function:

Member Data Documentation

uint64_t CBufferedFile::nReadLimit
private

Definition at line 577 of file streams.h.

uint64_t CBufferedFile::nReadPos
private

Definition at line 576 of file streams.h.

uint64_t CBufferedFile::nRewind
private

Definition at line 578 of file streams.h.

uint64_t CBufferedFile::nSrcPos
private

Definition at line 575 of file streams.h.

const int CBufferedFile::nType
private

Definition at line 571 of file streams.h.

const int CBufferedFile::nVersion
private

Definition at line 572 of file streams.h.

FILE* CBufferedFile::src
private

Definition at line 574 of file streams.h.

std::vector<char> CBufferedFile::vchBuf
private

Definition at line 579 of file streams.h.


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