PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
CDB Class Reference

RAII class that provides access to a Berkeley database. More...

#include <db.h>

Inheritance diagram for CDB:
[legend]

Public Member Functions

void Flush ()
 
void Close ()
 
bool TxnBegin ()
 
bool TxnCommit ()
 
bool TxnAbort ()
 
bool ReadVersion (int &nVersion)
 
bool WriteVersion (int nVersion)
 

Static Public Member Functions

static bool Rewrite (const std::string &strFile, const char *pszSkip=NULL)
 

Protected Member Functions

 CDB (const std::string &strFilename, const char *pszMode="r+", bool fFlushOnCloseIn=true)
 
 ~CDB ()
 
template<typename K , typename T >
bool Read (const K &key, T &value)
 
template<typename K , typename T >
bool Write (const K &key, const T &value, bool fOverwrite=true)
 
template<typename K >
bool Erase (const K &key)
 
template<typename K >
bool Exists (const K &key)
 
Dbc * GetCursor ()
 
int ReadAtCursor (Dbc *pcursor, CDataStream &ssKey, CDataStream &ssValue, unsigned int fFlags=DB_NEXT)
 

Protected Attributes

Db * pdb
 
std::string strFile
 
DbTxn * activeTxn
 
bool fReadOnly
 
bool fFlushOnClose
 

Private Member Functions

 CDB (const CDB &)
 
void operator= (const CDB &)
 

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 95 of file db.h.

Constructor & Destructor Documentation

◆ CDB() [1/2]

CDB::CDB ( const std::string &  strFilename,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicitprotected

Definition at line 273 of file db.cpp.

Here is the call graph for this function:

◆ ~CDB()

CDB::~CDB ( )
inlineprotected

Definition at line 105 of file db.h.

Here is the call graph for this function:

◆ CDB() [2/2]

CDB::CDB ( const CDB )
private

Member Function Documentation

◆ Close()

void CDB::Close ( )

Definition at line 346 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Erase()

template<typename K >
bool CDB::Erase ( const K &  key)
inlineprotected

Definition at line 181 of file db.h.

◆ Exists()

template<typename K >
bool CDB::Exists ( const K &  key)
inlineprotected

Definition at line 203 of file db.h.

Here is the caller graph for this function:

◆ Flush()

void CDB::Flush ( )

Definition at line 333 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCursor()

Dbc* CDB::GetCursor ( )
inlineprotected

Definition at line 222 of file db.h.

Here is the caller graph for this function:

◆ operator=()

void CDB::operator= ( const CDB )
private

◆ Read()

template<typename K , typename T >
bool CDB::Read ( const K &  key,
T &  value 
)
inlineprotected

Definition at line 117 of file db.h.

Here is the caller graph for this function:

◆ ReadAtCursor()

int CDB::ReadAtCursor ( Dbc *  pcursor,
CDataStream ssKey,
CDataStream ssValue,
unsigned int  fFlags = DB_NEXT 
)
inlineprotected

Definition at line 233 of file db.h.

Here is the call graph for this function:

◆ ReadVersion()

bool CDB::ReadVersion ( int &  nVersion)
inline

Definition at line 314 of file db.h.

Here is the call graph for this function:

◆ Rewrite()

bool CDB::Rewrite ( const std::string &  strFile,
const char *  pszSkip = NULL 
)
static

Definition at line 387 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TxnAbort()

bool CDB::TxnAbort ( )
inline

Definition at line 305 of file db.h.

Here is the caller graph for this function:

◆ TxnBegin()

bool CDB::TxnBegin ( )
inline

Definition at line 285 of file db.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TxnCommit()

bool CDB::TxnCommit ( )
inline

Definition at line 296 of file db.h.

Here is the caller graph for this function:

◆ Write()

template<typename K , typename T >
bool CDB::Write ( const K &  key,
const T &  value,
bool  fOverwrite = true 
)
inlineprotected

Definition at line 152 of file db.h.

Here is the caller graph for this function:

◆ WriteVersion()

bool CDB::WriteVersion ( int  nVersion)
inline

Definition at line 320 of file db.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ activeTxn

DbTxn* CDB::activeTxn
protected

Definition at line 100 of file db.h.

◆ fFlushOnClose

bool CDB::fFlushOnClose
protected

Definition at line 102 of file db.h.

◆ fReadOnly

bool CDB::fReadOnly
protected

Definition at line 101 of file db.h.

◆ pdb

Db* CDB::pdb
protected

Definition at line 98 of file db.h.

◆ strFile

std::string CDB::strFile
protected

Definition at line 99 of file db.h.


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