Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 ()
 
 CBufferedFile (const CBufferedFile &)=delete
 
CBufferedFileoperator= (const CBufferedFile &)=delete
 
int GetVersion () const
 
int GetType () const
 
void fclose ()
 
bool eof () const
 
void read (char *pch, size_t nSize)
 
uint64_t GetPos () const
 
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 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 519 of file streams.h.

Constructor & Destructor Documentation

◆ CBufferedFile() [1/2]

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

Definition at line 552 of file streams.h.

References src.

◆ ~CBufferedFile()

CBufferedFile::~CBufferedFile ( )
inline

Definition at line 558 of file streams.h.

References fclose().

◆ CBufferedFile() [2/2]

CBufferedFile::CBufferedFile ( const CBufferedFile )
delete

Member Function Documentation

◆ eof()

bool CBufferedFile::eof ( ) const
inline

Definition at line 579 of file streams.h.

References nReadPos, nSrcPos, and src.

Referenced by LoadExternalBlockFile().

◆ fclose()

void CBufferedFile::fclose ( )
inline

Definition at line 570 of file streams.h.

References src.

Referenced by ~CBufferedFile().

◆ Fill()

bool CBufferedFile::Fill ( )
inlineprotected

Definition at line 534 of file streams.h.

References nReadPos, nRewind, nSrcPos, src, and vchBuf.

Referenced by FindByte(), and read().

◆ FindByte()

void CBufferedFile::FindByte ( char  ch)
inline

Definition at line 653 of file streams.h.

References Fill(), nReadPos, nSrcPos, and vchBuf.

Referenced by LoadExternalBlockFile().

◆ GetPos()

uint64_t CBufferedFile::GetPos ( ) const
inline

Definition at line 606 of file streams.h.

References nReadPos.

Referenced by LoadExternalBlockFile().

◆ GetType()

int CBufferedFile::GetType ( ) const
inline

Definition at line 568 of file streams.h.

References nType.

◆ GetVersion()

int CBufferedFile::GetVersion ( ) const
inline

Definition at line 567 of file streams.h.

References nVersion.

◆ operator=()

CBufferedFile& CBufferedFile::operator= ( const CBufferedFile )
delete

◆ operator>>()

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

Definition at line 646 of file streams.h.

References Unserialize().

◆ read()

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

Definition at line 584 of file streams.h.

References Fill(), memcpy(), nReadLimit, nReadPos, nRewind, nSrcPos, and vchBuf.

◆ Seek()

bool CBufferedFile::Seek ( uint64_t  nPos)
inline

Definition at line 624 of file streams.h.

References nReadPos, nSrcPos, and src.

◆ SetLimit()

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

Definition at line 638 of file streams.h.

References nReadLimit, and nReadPos.

Referenced by LoadExternalBlockFile().

◆ SetPos()

bool CBufferedFile::SetPos ( uint64_t  nPos)
inline

Definition at line 611 of file streams.h.

References nReadPos, nRewind, and nSrcPos.

Referenced by LoadExternalBlockFile().

Member Data Documentation

◆ nReadLimit

uint64_t CBufferedFile::nReadLimit
private

Definition at line 528 of file streams.h.

Referenced by read(), and SetLimit().

◆ nReadPos

uint64_t CBufferedFile::nReadPos
private

Definition at line 527 of file streams.h.

Referenced by eof(), Fill(), FindByte(), GetPos(), read(), Seek(), SetLimit(), and SetPos().

◆ nRewind

uint64_t CBufferedFile::nRewind
private

Definition at line 529 of file streams.h.

Referenced by Fill(), read(), and SetPos().

◆ nSrcPos

uint64_t CBufferedFile::nSrcPos
private

Definition at line 526 of file streams.h.

Referenced by eof(), Fill(), FindByte(), read(), Seek(), and SetPos().

◆ nType

const int CBufferedFile::nType
private

Definition at line 522 of file streams.h.

Referenced by GetType().

◆ nVersion

const int CBufferedFile::nVersion
private

Definition at line 523 of file streams.h.

Referenced by GetVersion().

◆ src

FILE* CBufferedFile::src
private

Definition at line 525 of file streams.h.

Referenced by CBufferedFile(), eof(), fclose(), Fill(), and Seek().

◆ vchBuf

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

Definition at line 530 of file streams.h.

Referenced by Fill(), FindByte(), and read().


The documentation for this class was generated from the following file:
Released under the MIT license