CatapultServer  v0.5.0.1 (Elephant)
catapult::model::ChainScore Class Reference

Public Member Functions

 ChainScore ()
 Creates a default chain score. More...
 
 ChainScore (uint64_t score)
 Creates a chain score from a 64-bit value (score). More...
 
 ChainScore (uint64_t scoreHigh, uint64_t scoreLow)
 Creates a chain score from a 128-bit value composed of two 64-bit values (scoreHigh and scoreLow). More...
 
 ChainScore (const ChainScore &)=default
 
ChainScoreoperator= (const ChainScore &)=default
 
ArrayType toArray () const
 Gets an array representing the underlying score. More...
 
ChainScoreoperator+= (const ChainScore &rhs)
 Adds rhs to this chain score. More...
 
ChainScoreoperator-= (const ChainScore &rhs)
 Subtracts rhs from this chain score. More...
 
bool operator== (const ChainScore &rhs) const
 Returns true if this score is equal to rhs. More...
 
bool operator!= (const ChainScore &rhs) const
 Returns true if this score is not equal to rhs. More...
 
bool operator< (const ChainScore &rhs) const
 Returns true if this score is less than rhs. More...
 
bool operator<= (const ChainScore &rhs) const
 Returns true if this score is less than or equal to rhs. More...
 
bool operator> (const ChainScore &rhs) const
 Returns true if this score is greater than rhs. More...
 
bool operator>= (const ChainScore &rhs) const
 Returns true if this score is greater than or equal to rhs. More...
 

Private Types

using ArrayType = std::array< uint64_t, 2 >
 

Private Attributes

boost::multiprecision::uint128_t m_score
 

Static Private Attributes

static constexpr uint32_t Bits_Per_Value = 64
 

Friends

std::ostream & operator<< (std::ostream &out, const ChainScore &score)
 Insertion operator for outputting score to out. More...
 

Detailed Description

Score of a block chain.

Note
This is a 128-bit value.

Member Typedef Documentation

◆ ArrayType

using catapult::model::ChainScore::ArrayType = std::array<uint64_t, 2>
private

Constructor & Destructor Documentation

◆ ChainScore() [1/4]

catapult::model::ChainScore::ChainScore ( )
inline

Creates a default chain score.

◆ ChainScore() [2/4]

catapult::model::ChainScore::ChainScore ( uint64_t  score)
inlineexplicit

Creates a chain score from a 64-bit value (score).

◆ ChainScore() [3/4]

catapult::model::ChainScore::ChainScore ( uint64_t  scoreHigh,
uint64_t  scoreLow 
)
inlineexplicit

Creates a chain score from a 128-bit value composed of two 64-bit values (scoreHigh and scoreLow).

◆ ChainScore() [4/4]

catapult::model::ChainScore::ChainScore ( const ChainScore )
default

Member Function Documentation

◆ operator!=()

bool catapult::model::ChainScore::operator!= ( const ChainScore rhs) const
inline

Returns true if this score is not equal to rhs.

◆ operator+=()

ChainScore& catapult::model::ChainScore::operator+= ( const ChainScore rhs)
inline

Adds rhs to this chain score.

◆ operator-=()

ChainScore& catapult::model::ChainScore::operator-= ( const ChainScore rhs)
inline

Subtracts rhs from this chain score.

◆ operator<()

bool catapult::model::ChainScore::operator< ( const ChainScore rhs) const
inline

Returns true if this score is less than rhs.

◆ operator<=()

bool catapult::model::ChainScore::operator<= ( const ChainScore rhs) const
inline

Returns true if this score is less than or equal to rhs.

◆ operator=()

ChainScore& catapult::model::ChainScore::operator= ( const ChainScore )
default

◆ operator==()

bool catapult::model::ChainScore::operator== ( const ChainScore rhs) const
inline

Returns true if this score is equal to rhs.

◆ operator>()

bool catapult::model::ChainScore::operator> ( const ChainScore rhs) const
inline

Returns true if this score is greater than rhs.

◆ operator>=()

bool catapult::model::ChainScore::operator>= ( const ChainScore rhs) const
inline

Returns true if this score is greater than or equal to rhs.

◆ toArray()

ArrayType catapult::model::ChainScore::toArray ( ) const
inline

Gets an array representing the underlying score.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ChainScore score 
)
friend

Insertion operator for outputting score to out.

Member Data Documentation

◆ Bits_Per_Value

constexpr uint32_t catapult::model::ChainScore::Bits_Per_Value = 64
staticconstexprprivate

◆ m_score

boost::multiprecision::uint128_t catapult::model::ChainScore::m_score
private

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