Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
chain_config_helper.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sysio/chain/types.hpp> /* vector */
4
5namespace sysio { namespace chain {
6
10template<typename T, typename Validator>
11struct data_range {
12
15 Validator validator;
16
17 data_range(T& c, Validator val) : config(c), validator(val){}
18 data_range(T& c, vector<fc::unsigned_int>&& id_list, const Validator& val)
19 : data_range(c, val){
20 ids = std::move(id_list);
21 }
22};
23
27template<typename T, typename Validator>
28struct data_entry {
29private:
30 struct _dummy{};
31public:
32
35 Validator validator;
36 data_entry(T& c, uint32_t entry_id, Validator validate)
37 : config(c),
38 id(entry_id),
40 template <typename Y>
41 explicit data_entry(const data_entry<Y, Validator>& another,
42 typename std::enable_if_t<std::is_base_of_v<T, Y>, _dummy> = _dummy{})
43 : data_entry(another.config, another.id, another.validator)
44 {}
45
46 bool is_allowed() const{
47 return validator(id);
48 }
49};
50
51}} // namespace sysio::chain
bool validate(const Authority &auth)
#define T(meth, val, expected)
unsigned int uint32_t
Definition stdint.h:126
Validator validator
data_entry(T &c, uint32_t entry_id, Validator validate)
data_entry(const data_entry< Y, Validator > &another, typename std::enable_if_t< std::is_base_of_v< T, Y >, _dummy >=_dummy{})
bool is_allowed() const
T & config
uint32_t id
data_range(T &c, vector< fc::unsigned_int > &&id_list, const Validator &val)
data_range(T &c, Validator val)
vector< fc::unsigned_int > ids