Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::index_utils< Index > Class Template Reference

#include <database_utils.hpp>

Public Types

using index_t = Index
 

Static Public Member Functions

template<typename F >
static void walk (const chainbase::database &db, F function)
 
template<typename Secondary , typename Key , typename F >
static void walk_range (const chainbase::database &db, const Key &begin_key, const Key &end_key, F function)
 
template<typename Secondary , typename Key >
static size_t size_range (const chainbase::database &db, const Key &begin_key, const Key &end_key)
 
template<typename F >
static void create (chainbase::database &db, F cons)
 

Detailed Description

template<typename Index>
class sysio::chain::index_utils< Index >

Definition at line 13 of file database_utils.hpp.

Member Typedef Documentation

◆ index_t

template<typename Index >
using sysio::chain::index_utils< Index >::index_t = Index

Definition at line 15 of file database_utils.hpp.

Member Function Documentation

◆ create()

template<typename Index >
template<typename F >
static void sysio::chain::index_utils< Index >::create ( chainbase::database & db,
F cons )
inlinestatic

Definition at line 50 of file database_utils.hpp.

50 {
51 db.create<typename index_t::value_type>(cons);
52 }
const ObjectType & create(Constructor &&con)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size_range()

template<typename Index >
template<typename Secondary , typename Key >
static size_t sysio::chain::index_utils< Index >::size_range ( const chainbase::database & db,
const Key & begin_key,
const Key & end_key )
inlinestatic

Definition at line 38 of file database_utils.hpp.

38 {
39 const auto& idx = db.get_index<Index, Secondary>();
40 auto begin_itr = idx.lower_bound(begin_key);
41 auto end_itr = idx.lower_bound(end_key);
42 size_t res = 0;
43 while (begin_itr != end_itr) {
44 res++; ++begin_itr;
45 }
46 return res;
47 }
const generic_index< MultiIndexType > & get_index() const
Here is the call graph for this function:

◆ walk()

template<typename Index >
template<typename F >
static void sysio::chain::index_utils< Index >::walk ( const chainbase::database & db,
F function )
inlinestatic

Definition at line 18 of file database_utils.hpp.

18 {
19 auto const& index = db.get_index<Index>().indices();
20 const auto& first = index.begin();
21 const auto& last = index.end();
22 for (auto itr = first; itr != last; ++itr) {
23 function(*itr);
24 }
25 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ walk_range()

template<typename Index >
template<typename Secondary , typename Key , typename F >
static void sysio::chain::index_utils< Index >::walk_range ( const chainbase::database & db,
const Key & begin_key,
const Key & end_key,
F function )
inlinestatic

Definition at line 28 of file database_utils.hpp.

28 {
29 const auto& idx = db.get_index<Index, Secondary>();
30 auto begin_itr = idx.lower_bound(begin_key);
31 auto end_itr = idx.lower_bound(end_key);
32 for (auto itr = begin_itr; itr != end_itr; ++itr) {
33 function(*itr);
34 }
35 }
Here is the call graph for this function:

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