veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::StoredBlockIndex< Block > Struct Template Reference

Detailed Description

template<typename Block>
struct altintegration::StoredBlockIndex< Block >

Definition at line 18 of file stored_block_index.hpp.

+ Collaboration diagram for altintegration::StoredBlockIndex< Block >:

Public Types

using block_t = Block
 
using height_t = typename block_t::height_t
 
using stored_addon_t = typename block_t::stored_addon_t
 

Public Member Functions

bool isDeleted () const
 
void toVbkEncoding (WriteStream &stream) const
 
std::vector< uint8_t > toVbkEncoding () const
 
std::string toPrettyString (size_t level=0) const
 

Public Attributes

height_t height = 0
 height of the entry in the chain More...
 
std::shared_ptr< block_t > header = std::make_shared<block_t>()
 block header More...
 
uint32_t status = BLOCK_VALID_UNKNOWN
 contains status flags More...
 
stored_addon_t addon
 

Member Typedef Documentation

◆ block_t

template<typename Block >
using altintegration::StoredBlockIndex< Block >::block_t = Block

Definition at line 19 of file stored_block_index.hpp.

◆ height_t

template<typename Block >
using altintegration::StoredBlockIndex< Block >::height_t = typename block_t::height_t

Definition at line 20 of file stored_block_index.hpp.

◆ stored_addon_t

template<typename Block >
using altintegration::StoredBlockIndex< Block >::stored_addon_t = typename block_t::stored_addon_t

Definition at line 21 of file stored_block_index.hpp.

Member Function Documentation

◆ isDeleted()

template<typename Block >
bool altintegration::StoredBlockIndex< Block >::isDeleted ( ) const
inline

Definition at line 25 of file stored_block_index.hpp.

25{ return this->status & BLOCK_DELETED; };
@ BLOCK_DELETED
the block is temporarily deleted
uint32_t status
contains status flags

◆ toPrettyString()

template<typename Block >
std::string altintegration::StoredBlockIndex< Block >::toPrettyString ( size_t  level = 0) const
inline

Definition at line 41 of file stored_block_index.hpp.

41 {
42 return format(
43 "{}{}StoredBlockIndex(height={}, hash={}, status={}, header={}, {})",
44 std::string(level, ' '),
45 Block::name(),
46 height,
47 HexStr(header->getHash()),
48 status,
49 header->toPrettyString(),
50 addon.toPrettyString());
51 }
std::string HexStr(const T itbegin, const T itend)
Convert bytes to hex.
Definition: strutil.hpp:44
std::shared_ptr< block_t > header
block header
height_t height
height of the entry in the chain

◆ toVbkEncoding() [1/2]

template<typename Block >
std::vector< uint8_t > altintegration::StoredBlockIndex< Block >::toVbkEncoding ( ) const
inline

Definition at line 35 of file stored_block_index.hpp.

35 {
36 WriteStream stream;
37 toVbkEncoding(stream);
38 return stream.data();
39 }

◆ toVbkEncoding() [2/2]

template<typename Block >
void altintegration::StoredBlockIndex< Block >::toVbkEncoding ( WriteStream stream) const
inline

Definition at line 27 of file stored_block_index.hpp.

27 {
28 using height_t = typename Block::height_t;
29 stream.writeBE<height_t>(height);
30 header->toRaw(stream);
31 stream.writeBE<uint32_t>(status);
32 addon.toVbkEncoding(stream);
33 }

Member Data Documentation

◆ addon

template<typename Block >
stored_addon_t altintegration::StoredBlockIndex< Block >::addon

Definition at line 62 of file stored_block_index.hpp.

◆ header

template<typename Block >
std::shared_ptr<block_t> altintegration::StoredBlockIndex< Block >::header = std::make_shared<block_t>()

Definition at line 57 of file stored_block_index.hpp.

◆ height

template<typename Block >
height_t altintegration::StoredBlockIndex< Block >::height = 0

Definition at line 54 of file stored_block_index.hpp.

◆ status

template<typename Block >
uint32_t altintegration::StoredBlockIndex< Block >::status = BLOCK_VALID_UNKNOWN

Definition at line 60 of file stored_block_index.hpp.


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