Scorum
history_object.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <boost/multi_index/composite_key.hpp>
6 
7 namespace scorum {
8 namespace blockchain_history {
9 namespace impl {
10 
11 template <uint16_t HistoryType>
12 struct account_history_object : public object<HistoryType, account_history_object<HistoryType>>
13 {
14  CHAINBASE_DEFAULT_CONSTRUCTOR(account_history_object)
15 
16  typedef typename object<HistoryType, account_history_object<HistoryType>>::id_type id_type;
17 
18  id_type id;
19 
21  uint32_t sequence = 0;
23 };
24 
25 template <uint16_t HistoryType>
26 struct withdrawals_account_history_object : public object<HistoryType, withdrawals_account_history_object<HistoryType>>
27 {
28  CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(withdrawals_account_history_object, (progress))
29 
30  typedef typename object<HistoryType, withdrawals_account_history_object<HistoryType>>::id_type id_type;
31 
32  id_type id;
33 
35  uint32_t sequence = 0;
37 
38  fc::shared_vector<operation_object::id_type> progress;
39 };
40 
41 template <uint16_t HistoryType>
42 struct devcommittee_history_object : public object<HistoryType, devcommittee_history_object<HistoryType>>
43 {
44  CHAINBASE_DEFAULT_CONSTRUCTOR(devcommittee_history_object)
45 
46  typedef typename object<HistoryType, devcommittee_history_object<HistoryType>>::id_type id_type;
47 
48  id_type id;
50 };
51 
52 template <uint16_t HistoryType>
54  : public object<HistoryType, withdrawals_devcommittee_history_object<HistoryType>>
55 {
56  CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(withdrawals_devcommittee_history_object, (progress))
57 
58  typedef typename object<HistoryType, withdrawals_devcommittee_history_object<HistoryType>>::id_type id_type;
59 
60  id_type id;
62  fc::shared_vector<operation_object::id_type> progress;
63 };
64 }
65 
66 struct by_account;
67 struct by_id_desc;
68 
69 template <typename history_object_t>
71  = shared_multi_index_container<history_object_t,
72  indexed_by<ordered_unique<tag<by_id>,
73  member<history_object_t,
74  typename history_object_t::id_type,
75  &history_object_t::id>>,
76  ordered_unique<tag<by_account>,
77  composite_key<history_object_t,
78  member<history_object_t,
80  &history_object_t::account>,
81  member<history_object_t,
82  uint32_t,
83  &history_object_t::sequence>>,
84  composite_key_compare<std::less<account_name_type>,
85  // for derect oder iteration from
86  // grater value to less
87  std::greater<uint32_t>>>>>;
88 
89 template <typename history_object_t>
91  = shared_multi_index_container<history_object_t,
92  indexed_by<ordered_unique<tag<by_id>,
93  member<history_object_t,
94  typename history_object_t::id_type,
95  &history_object_t::id>>,
96  ordered_unique<tag<by_id_desc>,
97  member<history_object_t,
98  typename history_object_t::id_type,
99  &history_object_t::id>,
100  std::greater<typename history_object_t::id_type>>>>;
101 
106  = impl::withdrawals_account_history_object<account_sp_to_scr_withdrawals_history>;
107 
112  = impl::withdrawals_devcommittee_history_object<devcommittee_sp_to_scr_withdrawals_history>;
113 
118 
124 
125 } // namespace blockchain_history
126 } // namespace scorum
127 
128 FC_REFLECT(scorum::blockchain_history::account_history_object, (id)(account)(sequence)(op))
131 FC_REFLECT(scorum::blockchain_history::account_withdrawals_to_scr_history_object, (id)(account)(sequence)(op)(progress))
132 
133 FC_REFLECT(scorum::blockchain_history::devcommittee_history_object, (id)(op))
135 FC_REFLECT(scorum::blockchain_history::devcommittee_withdrawals_to_scr_history_object, (id)(op)(progress))
136 
137 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::account_history_object,
138  scorum::blockchain_history::account_operations_full_history_index)
139 
140 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::account_transfers_to_scr_history_object,
141  scorum::blockchain_history::account_transfers_to_scr_history_index)
142 
143 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::account_transfers_to_sp_history_object,
144  scorum::blockchain_history::account_transfers_to_sp_history_index)
145 
146 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::account_withdrawals_to_scr_history_object,
148 
149 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::devcommittee_history_object,
151 
152 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::devcommittee_transfers_to_scr_history_object,
154 
155 CHAINBASE_SET_INDEX_TYPE(scorum::blockchain_history::devcommittee_withdrawals_to_scr_history_object,
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
Definition: game.cpp:4
devcommittee_history_index< devcommittee_withdrawals_to_scr_history_object > devcommittee_withdrawals_to_scr_history_index
shared_multi_index_container< history_object_t, indexed_by< ordered_unique< tag< by_id >, member< history_object_t, typename history_object_t::id_type, &history_object_t::id > >, ordered_unique< tag< by_id_desc >, member< history_object_t, typename history_object_t::id_type, &history_object_t::id >, std::greater< typename history_object_t::id_type > >> > devcommittee_history_index
account_history_index< account_withdrawals_to_scr_history_object > account_withdrawals_to_scr_history_index
devcommittee_history_index< devcommittee_history_object > devcommittee_operations_full_history_index
shared_multi_index_container< history_object_t, indexed_by< ordered_unique< tag< by_id >, member< history_object_t, typename history_object_t::id_type, &history_object_t::id > >, ordered_unique< tag< by_account >, composite_key< history_object_t, member< history_object_t, account_name_type, &history_object_t::account >, member< history_object_t, uint32_t, &history_object_t::sequence > >, composite_key_compare< std::less< account_name_type >, std::greater< uint32_t > >> >> account_history_index
account_history_index< account_transfers_to_sp_history_object > account_transfers_to_sp_history_index
devcommittee_history_index< devcommittee_transfers_to_scr_history_object > devcommittee_transfers_to_scr_history_index
account_history_index< account_history_object > account_operations_full_history_index
account_history_index< account_transfers_to_scr_history_object > account_transfers_to_scr_history_index
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
Definition: asset.cpp:15
object< HistoryType, account_history_object< HistoryType > >::id_type id_type
object< HistoryType, devcommittee_history_object< HistoryType > >::id_type id_type
object< HistoryType, withdrawals_account_history_object< HistoryType > >::id_type id_type
object< HistoryType, withdrawals_devcommittee_history_object< HistoryType > >::id_type id_type