veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::adaptors::InmemStorageIterator Struct Reference

Detailed Description

Definition at line 20 of file inmem_storage_impl.hpp.

+ Inheritance diagram for altintegration::adaptors::InmemStorageIterator:
+ Collaboration diagram for altintegration::adaptors::InmemStorageIterator:

Public Member Functions

 InmemStorageIterator (std::map< std::vector< uint8_t >, std::vector< uint8_t > > &storage)
 
bool value (std::vector< uint8_t > &out) const override
 
bool key (std::vector< uint8_t > &out) const override
 
void next () override
 
bool valid () const override
 
void seek_start () override
 
void seek (const std::vector< uint8_t > &val) override
 
virtual bool value (std::vector< uint8_t > &out) const =0
 
virtual bool key (std::vector< uint8_t > &out) const =0
 
virtual void next ()=0
 
virtual bool valid () const =0
 
virtual void seek_start ()=0
 
virtual void seek (const std::vector< uint8_t > &val)=0
 

Constructor & Destructor Documentation

◆ InmemStorageIterator()

altintegration::adaptors::InmemStorageIterator::InmemStorageIterator ( std::map< std::vector< uint8_t >, std::vector< uint8_t > > &  storage)
inline

Definition at line 23 of file inmem_storage_impl.hpp.

25 : storage_(storage), it_(storage.begin()) {}

Member Function Documentation

◆ key()

bool altintegration::adaptors::InmemStorageIterator::key ( std::vector< uint8_t > &  out) const
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 32 of file inmem_storage_impl.hpp.

32 {
33 out = it_->first;
34 return true;
35 }

◆ next()

void altintegration::adaptors::InmemStorageIterator::next ( )
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 37 of file inmem_storage_impl.hpp.

37{ ++it_; }

◆ seek()

void altintegration::adaptors::InmemStorageIterator::seek ( const std::vector< uint8_t > &  val)
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 43 of file inmem_storage_impl.hpp.

43 {
44 it_ = storage_.begin();
45 for (; it_ != storage_.end(); ++it_) {
46 if (is_sub_vec(it_->first, val)) {
47 break;
48 }
49 }
50 }

◆ seek_start()

void altintegration::adaptors::InmemStorageIterator::seek_start ( )
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 41 of file inmem_storage_impl.hpp.

41{ it_ = storage_.begin(); }

◆ valid()

bool altintegration::adaptors::InmemStorageIterator::valid ( ) const
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 39 of file inmem_storage_impl.hpp.

39{ return it_ != storage_.end(); }

◆ value()

bool altintegration::adaptors::InmemStorageIterator::value ( std::vector< uint8_t > &  out) const
inlineoverridevirtual

Implements altintegration::adaptors::StorageIterator.

Definition at line 27 of file inmem_storage_impl.hpp.

27 {
28 out = it_->second;
29 return true;
30 }

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