CatapultServer  v0.5.0.1 (Elephant)
catapult::tree::MemoryDataSource Class Reference

A patricia tree memory data source. More...

Public Member Functions

 MemoryDataSource (DataSourceVerbosity verbosity=DataSourceVerbosity::Off)
 Creates a data source with specified verbosity. More...
 
size_t size () const
 Gets the number of saved nodes. More...
 
std::unique_ptr< const TreeNodeget (const Hash256 &hash) const
 Gets the tree node associated with hash. More...
 
void forEach (const consumer< const TreeNode & > &consumer) const
 Gets all nodes and passes them to consumer. More...
 
void set (const LeafTreeNode &node)
 Saves a leaf tree node. More...
 
void set (const BranchTreeNode &node)
 Saves a branch tree node. More...
 
void clear ()
 Clears all nodes. More...
 

Private Member Functions

template<typename TNode >
void save (const TNode &node)
 

Private Attributes

bool m_isVerbose
 
std::unordered_map< Hash256, std::unique_ptr< TreeNode >, utils::ArrayHasher< Hash256 > > m_nodes
 

Detailed Description

A patricia tree memory data source.

Constructor & Destructor Documentation

◆ MemoryDataSource()

catapult::tree::MemoryDataSource::MemoryDataSource ( DataSourceVerbosity  verbosity = DataSourceVerbosity::Off)
explicit

Creates a data source with specified verbosity.

Member Function Documentation

◆ clear()

void catapult::tree::MemoryDataSource::clear ( )

Clears all nodes.

Here is the caller graph for this function:

◆ forEach()

void catapult::tree::MemoryDataSource::forEach ( const consumer< const TreeNode & > &  consumer) const

Gets all nodes and passes them to consumer.

Here is the caller graph for this function:

◆ get()

std::unique_ptr< const TreeNode > catapult::tree::MemoryDataSource::get ( const Hash256 hash) const

Gets the tree node associated with hash.

Here is the caller graph for this function:

◆ save()

template<typename TNode >
void catapult::tree::MemoryDataSource::save ( const TNode &  node)
inlineprivate
Here is the caller graph for this function:

◆ set() [1/2]

void catapult::tree::MemoryDataSource::set ( const BranchTreeNode node)

Saves a branch tree node.

Here is the call graph for this function:

◆ set() [2/2]

void catapult::tree::MemoryDataSource::set ( const LeafTreeNode node)

Saves a leaf tree node.

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

◆ size()

size_t catapult::tree::MemoryDataSource::size ( ) const

Gets the number of saved nodes.

Here is the caller graph for this function:

Member Data Documentation

◆ m_isVerbose

bool catapult::tree::MemoryDataSource::m_isVerbose
private

◆ m_nodes

std::unordered_map<Hash256, std::unique_ptr<TreeNode>, utils::ArrayHasher<Hash256> > catapult::tree::MemoryDataSource::m_nodes
private

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