Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::protocol_feature_manager::const_iterator Class Reference

#include <protocol_feature_manager.hpp>

Collaboration diagram for sysio::chain::protocol_feature_manager::const_iterator:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using value_type = const protocol_feature
 
using difference_type = std::ptrdiff_t
 
using pointer = const protocol_feature*
 
using reference = const protocol_feature&
 

Public Member Functions

 const_iterator ()=default
 
uint32_t activation_ordinal () const
 
uint32_t activation_block_num () const
 
const protocol_featureoperator* () const
 
const protocol_featureoperator-> () const
 
const_iteratoroperator++ ()
 
const_iteratoroperator-- ()
 
const_iterator operator++ (int)
 
const_iterator operator-- (int)
 

Protected Member Functions

 const_iterator (const protocol_feature_manager *pfm, std::size_t i=end_index)
 
const protocol_featureget_pointer () const
 

Protected Attributes

const protocol_feature_manager_pfm = nullptr
 
std::size_t _index = 0
 

Static Protected Attributes

static constexpr std::size_t end_index = std::numeric_limits<std::size_t>::max()
 

Friends

class protocol_feature_manager
 
bool operator== (const const_iterator &lhs, const const_iterator &rhs)
 
bool operator!= (const const_iterator &lhs, const const_iterator &rhs)
 

Detailed Description

Definition at line 270 of file protocol_feature_manager.hpp.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

Definition at line 272 of file protocol_feature_manager.hpp.

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ const_iterator() [1/2]

sysio::chain::protocol_feature_manager::const_iterator::const_iterator ( const protocol_feature_manager * pfm,
std::size_t i = end_index )
inlineexplicitprotected

◆ const_iterator() [2/2]

sysio::chain::protocol_feature_manager::const_iterator::const_iterator ( )
default

Member Function Documentation

◆ activation_block_num()

uint32_t sysio::chain::protocol_feature_manager::const_iterator::activation_block_num ( ) const

Definition at line 621 of file protocol_feature_manager.cpp.

621 {
623 protocol_feature_iterator_exception,
624 "called activation_block_num() on singular iterator"
625 );
627 protocol_feature_iterator_exception,
628 "called activation_block_num() on end iterator"
629 );
630
631 return _pfm->_activated_protocol_features[_index].activation_block_num;
632 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
vector< protocol_feature_entry > _activated_protocol_features

◆ activation_ordinal()

uint32_t sysio::chain::protocol_feature_manager::const_iterator::activation_ordinal ( ) const

Definition at line 608 of file protocol_feature_manager.cpp.

608 {
610 protocol_feature_iterator_exception,
611 "called activation_ordinal() on singular iterator"
612 );
614 protocol_feature_iterator_exception,
615 "called activation_ordinal() on end iterator"
616 );
617
618 return _index;
619 }

◆ get_pointer()

const protocol_feature * sysio::chain::protocol_feature_manager::const_iterator::get_pointer ( ) const
protected

Definition at line 602 of file protocol_feature_manager.cpp.

602 {
603 //SYS_ASSERT( _pfm, protocol_feature_iterator_exception, "cannot dereference singular iterator" );
604 //SYS_ASSERT( _index != end_index, protocol_feature_iterator_exception, "cannot dereference end iterator" );
605 return &*(_pfm->_activated_protocol_features[_index].iterator_to_protocol_feature);
606 }
Here is the caller graph for this function:

◆ operator*()

const protocol_feature & sysio::chain::protocol_feature_manager::const_iterator::operator* ( ) const
inline

Definition at line 309 of file protocol_feature_manager.hpp.

309 {
310 return *get_pointer();
311 }
Here is the call graph for this function:

◆ operator++() [1/2]

protocol_feature_manager::const_iterator & sysio::chain::protocol_feature_manager::const_iterator::operator++ ( )

Definition at line 634 of file protocol_feature_manager.cpp.

634 {
635 SYS_ASSERT( _pfm, protocol_feature_iterator_exception, "cannot increment singular iterator" );
636 SYS_ASSERT( _index != end_index, protocol_feature_iterator_exception, "cannot increment end iterator" );
637
638 ++_index;
639 if( _index >= _pfm->_activated_protocol_features.size() ) {
641 }
642
643 return *this;
644 }

◆ operator++() [2/2]

const_iterator sysio::chain::protocol_feature_manager::const_iterator::operator++ ( int )
inline

Definition at line 321 of file protocol_feature_manager.hpp.

321 {
322 const_iterator result(*this);
323 ++(*this);
324 return result;
325 }

◆ operator--() [1/2]

protocol_feature_manager::const_iterator & sysio::chain::protocol_feature_manager::const_iterator::operator-- ( )

Definition at line 646 of file protocol_feature_manager.cpp.

646 {
647 SYS_ASSERT( _pfm, protocol_feature_iterator_exception, "cannot decrement singular iterator" );
648 if( _index == end_index ) {
650 protocol_feature_iterator_exception,
651 "cannot decrement end iterator when no protocol features have been activated"
652 );
654 } else {
655 SYS_ASSERT( _index > 0,
656 protocol_feature_iterator_exception,
657 "cannot decrement iterator at the beginning of protocol feature activation list" )
658 ;
659 --_index;
660 }
661 return *this;
662 }

◆ operator--() [2/2]

const_iterator sysio::chain::protocol_feature_manager::const_iterator::operator-- ( int )
inline

Definition at line 327 of file protocol_feature_manager.hpp.

327 {
328 const_iterator result(*this);
329 --(*this);
330 return result;
331 }

◆ operator->()

const protocol_feature * sysio::chain::protocol_feature_manager::const_iterator::operator-> ( ) const
inline

Definition at line 313 of file protocol_feature_manager.hpp.

313 {
314 return get_pointer();
315 }
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const const_iterator & lhs,
const const_iterator & rhs )
friend

Definition at line 301 of file protocol_feature_manager.hpp.

301 {
302 return !(lhs == rhs);
303 }

◆ operator==

bool operator== ( const const_iterator & lhs,
const const_iterator & rhs )
friend

Definition at line 297 of file protocol_feature_manager.hpp.

297 {
298 return std::tie( lhs._pfm, lhs._index ) == std::tie( rhs._pfm, rhs._index );
299 }

◆ protocol_feature_manager

Definition at line 292 of file protocol_feature_manager.hpp.

Member Data Documentation

◆ _index

std::size_t sysio::chain::protocol_feature_manager::const_iterator::_index = 0
protected

Definition at line 280 of file protocol_feature_manager.hpp.

◆ _pfm

const protocol_feature_manager* sysio::chain::protocol_feature_manager::const_iterator::_pfm = nullptr
protected

Definition at line 279 of file protocol_feature_manager.hpp.

◆ end_index

std::size_t sysio::chain::protocol_feature_manager::const_iterator::end_index = std::numeric_limits<std::size_t>::max()
staticconstexprprotected

Definition at line 283 of file protocol_feature_manager.hpp.


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