Dash Core  0.12.2.1
P2P Digital Currency
CGovernanceObjectVoteFile Class Reference

#include <governance-votedb.h>

Public Types

typedef std::list< CGovernanceVotevote_l_t
 
typedef vote_l_t::iterator vote_l_it
 
typedef vote_l_t::const_iterator vote_l_cit
 
typedef std::map< uint256, vote_l_itvote_m_t
 
typedef vote_m_t::iterator vote_m_it
 
typedef vote_m_t::const_iterator vote_m_cit
 

Public Member Functions

 CGovernanceObjectVoteFile ()
 
 CGovernanceObjectVoteFile (const CGovernanceObjectVoteFile &other)
 
void AddVote (const CGovernanceVote &vote)
 
bool HasVote (const uint256 &nHash) const
 
bool GetVote (const uint256 &nHash, CGovernanceVote &vote) const
 
int GetVoteCount ()
 
std::vector< CGovernanceVoteGetVotes () const
 
CGovernanceObjectVoteFileoperator= (const CGovernanceObjectVoteFile &other)
 
void RemoveVotesFromMasternode (const COutPoint &outpointMasternode)
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 

Private Member Functions

void RebuildIndex ()
 

Private Attributes

int nMemoryVotes
 
vote_l_t listVotes
 
vote_m_t mapVoteIndex
 

Static Private Attributes

static const int MAX_MEMORY_VOTES = -1
 

Detailed Description

Represents the collection of votes associated with a given CGovernanceObject Recently received votes are held in memory until a maximum size is reached after which older votes a flushed to a disk file.

Note: This is a stub implementation that doesn't limit the number of votes held in memory and doesn't flush to disk.

Definition at line 23 of file governance-votedb.h.

Member Typedef Documentation

◆ vote_l_cit

typedef vote_l_t::const_iterator CGovernanceObjectVoteFile::vote_l_cit

Definition at line 30 of file governance-votedb.h.

◆ vote_l_it

typedef vote_l_t::iterator CGovernanceObjectVoteFile::vote_l_it

Definition at line 28 of file governance-votedb.h.

◆ vote_l_t

Definition at line 26 of file governance-votedb.h.

◆ vote_m_cit

typedef vote_m_t::const_iterator CGovernanceObjectVoteFile::vote_m_cit

Definition at line 36 of file governance-votedb.h.

◆ vote_m_it

typedef vote_m_t::iterator CGovernanceObjectVoteFile::vote_m_it

Definition at line 34 of file governance-votedb.h.

◆ vote_m_t

Definition at line 32 of file governance-votedb.h.

Constructor & Destructor Documentation

◆ CGovernanceObjectVoteFile() [1/2]

CGovernanceObjectVoteFile::CGovernanceObjectVoteFile ( )

Definition at line 7 of file governance-votedb.cpp.

◆ CGovernanceObjectVoteFile() [2/2]

CGovernanceObjectVoteFile::CGovernanceObjectVoteFile ( const CGovernanceObjectVoteFile other)

Definition at line 13 of file governance-votedb.cpp.

Member Function Documentation

◆ AddVote()

void CGovernanceObjectVoteFile::AddVote ( const CGovernanceVote vote)

Add a vote to the file

Definition at line 21 of file governance-votedb.cpp.

Referenced by CGovernanceObject::ProcessVote().

◆ GetVote()

bool CGovernanceObjectVoteFile::GetVote ( const uint256 nHash,
CGovernanceVote vote 
) const

Retrieve a vote cached in memory

Definition at line 37 of file governance-votedb.cpp.

Referenced by CGovernanceManager::SerializeVoteForHash().

◆ GetVoteCount()

int CGovernanceObjectVoteFile::GetVoteCount ( )
inline

Definition at line 67 of file governance-votedb.h.

Referenced by CGovernanceObject::SerializationOp().

◆ GetVotes()

◆ HasVote()

bool CGovernanceObjectVoteFile::HasVote ( const uint256 nHash) const

Return true if the vote with this hash is currently cached in memory

Definition at line 28 of file governance-votedb.cpp.

Referenced by CGovernanceManager::HaveVoteForHash(), and CGovernanceObject::ProcessVote().

◆ operator=()

CGovernanceObjectVoteFile & CGovernanceObjectVoteFile::operator= ( const CGovernanceObjectVoteFile other)

Definition at line 71 of file governance-votedb.cpp.

◆ RebuildIndex()

void CGovernanceObjectVoteFile::RebuildIndex ( )
private

Definition at line 79 of file governance-votedb.cpp.

Referenced by CGovernanceObjectVoteFile(), operator=(), and SerializationOp().

◆ RemoveVotesFromMasternode()

void CGovernanceObjectVoteFile::RemoveVotesFromMasternode ( const COutPoint outpointMasternode)

Definition at line 56 of file governance-votedb.cpp.

Referenced by CGovernanceObject::ClearMasternodeVotes().

◆ SerializationOp()

template<typename Stream , typename Operation >
void CGovernanceObjectVoteFile::SerializationOp ( Stream &  s,
Operation  ser_action,
int  nType,
int  nVersion 
)
inline

Definition at line 80 of file governance-votedb.h.

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CGovernanceObjectVoteFile::ADD_SERIALIZE_METHODS

Definition at line 77 of file governance-votedb.h.

◆ listVotes

vote_l_t CGovernanceObjectVoteFile::listVotes
private

◆ mapVoteIndex

vote_m_t CGovernanceObjectVoteFile::mapVoteIndex
private

◆ MAX_MEMORY_VOTES

const int CGovernanceObjectVoteFile::MAX_MEMORY_VOTES = -1
staticprivate

Definition at line 39 of file governance-votedb.h.

◆ nMemoryVotes

int CGovernanceObjectVoteFile::nMemoryVotes
private

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