BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
restriction.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Abit More, and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #pragma once
27 
28 namespace graphene { namespace protocol {
29 
33 struct restriction {
49  };
50 
51  // A variant assertion argument is a pair of the tag expected to be in the variant, and the restrictions to apply
52  // to the value
53  using variant_assert_argument_type = pair<int64_t, vector<restriction>>;
54 
55 #define GRAPHENE_OP_RESTRICTION_ARGUMENTS_VARIADIC \
56  /* 0 */ void_t, \
57  /* 1 */ bool, \
58  /* 2 */ int64_t, \
59  /* 3 */ string, \
60  /* 4 */ time_point_sec, \
61  /* 5 */ public_key_type, \
62  /* 6 */ fc::sha256, \
63  /* 7 */ account_id_type, \
64  /* 8 */ asset_id_type, \
65  /* 9 */ force_settlement_id_type, \
66  /* 10 */ committee_member_id_type, \
67  /* 11 */ witness_id_type, \
68  /* 12 */ limit_order_id_type, \
69  /* 13 */ call_order_id_type, \
70  /* 14 */ custom_id_type, \
71  /* 15 */ proposal_id_type, \
72  /* 16 */ withdraw_permission_id_type, \
73  /* 17 */ vesting_balance_id_type, \
74  /* 18 */ worker_id_type, \
75  /* 19 */ balance_id_type, \
76  /* 20 */ flat_set<bool>, \
77  /* 21 */ flat_set<int64_t>, \
78  /* 22 */ flat_set<string>, \
79  /* 23 */ flat_set<time_point_sec>, \
80  /* 24 */ flat_set<public_key_type>, \
81  /* 25 */ flat_set<fc::sha256>, \
82  /* 26 */ flat_set<account_id_type>, \
83  /* 27 */ flat_set<asset_id_type>, \
84  /* 28 */ flat_set<force_settlement_id_type>, \
85  /* 29 */ flat_set<committee_member_id_type>, \
86  /* 30 */ flat_set<witness_id_type>, \
87  /* 31 */ flat_set<limit_order_id_type>, \
88  /* 32 */ flat_set<call_order_id_type>, \
89  /* 33 */ flat_set<custom_id_type>, \
90  /* 34 */ flat_set<proposal_id_type>, \
91  /* 35 */ flat_set<withdraw_permission_id_type>, \
92  /* 36 */ flat_set<vesting_balance_id_type>, \
93  /* 37 */ flat_set<worker_id_type>, \
94  /* 38 */ flat_set<balance_id_type>, \
95  /* 39 */ vector<restriction>, \
96  /* 40 */ vector<vector<restriction>>, \
97  /* 41 */ variant_assert_argument_type
98 
100 
104 
106 
107  restriction() = default;
110 
111  static size_t restriction_count(const vector<restriction>& restrictions);
112  size_t restriction_count() const;
113 };
114 
115 } } // graphene::protocol
116 
118  (func_eq)
119  (func_ne)
120  (func_lt)
121  (func_le)
122  (func_gt)
123  (func_ge)
124  (func_in)
125  (func_not_in)
126  (func_has_all)
127  (func_has_none)
128  (func_attr)
129  (func_logical_or)
130  (func_variant_assert)
131  (FUNCTION_TYPE_COUNT))
132 
134  (member_index)
135  (restriction_type)
136  (argument)
137  (extensions))
138 
139 
graphene::protocol::restriction::function_type
function_type
Definition: restriction.hpp:34
graphene::protocol::restriction::func_logical_or
@ func_logical_or
Definition: restriction.hpp:46
graphene::protocol::restriction::func_ge
@ func_ge
Definition: restriction.hpp:40
graphene::protocol::restriction
Definition: restriction.hpp:33
fc::static_variant< GRAPHENE_OP_RESTRICTION_ARGUMENTS_VARIADIC >
graphene::protocol::restriction::restriction
restriction()=default
graphene::protocol::restriction::func_has_none
@ func_has_none
Definition: restriction.hpp:44
graphene::protocol::restriction::argument
argument_type argument
Definition: restriction.hpp:103
graphene::protocol::restriction::func_ne
@ func_ne
Definition: restriction.hpp:36
graphene::protocol::restriction::member_index
unsigned_int member_index
Definition: restriction.hpp:101
graphene::protocol::restriction::func_not_in
@ func_not_in
Definition: restriction.hpp:42
graphene::protocol::restriction::func_variant_assert
@ func_variant_assert
Definition: restriction.hpp:47
graphene::protocol::restriction::FUNCTION_TYPE_COUNT
@ FUNCTION_TYPE_COUNT
Sentry value which contains the number of different types.
Definition: restriction.hpp:48
types.hpp
graphene::protocol::restriction::restriction_count
size_t restriction_count() const
Definition: restriction.cpp:39
graphene::protocol::restriction::func_has_all
@ func_has_all
Definition: restriction.hpp:43
fc::unsigned_int
Definition: varint.hpp:6
graphene::protocol::restriction::func_attr
@ func_attr
Definition: restriction.hpp:45
graphene::protocol::restriction::restriction
restriction(const unsigned_int &member_index, function_type type, const argument_type &argument)
Definition: restriction.hpp:108
graphene::protocol::restriction::func_eq
@ func_eq
Definition: restriction.hpp:35
FC_REFLECT_ENUM
FC_REFLECT_ENUM(graphene::net::core_message_type_enum,(trx_message_type)(block_message_type)(core_message_type_first)(item_ids_inventory_message_type)(blockchain_item_ids_inventory_message_type)(fetch_blockchain_item_ids_message_type)(fetch_items_message_type)(item_not_available_message_type)(hello_message_type)(connection_accepted_message_type)(connection_rejected_message_type)(address_request_message_type)(address_message_type)(closing_connection_message_type)(current_time_request_message_type)(current_time_reply_message_type)(check_firewall_message_type)(check_firewall_reply_message_type)(get_current_connections_request_message_type)(get_current_connections_reply_message_type)(core_message_type_last))(different_chain)(already_connected)(connected_to_self)(not_accepting_connections)(blocked)(invalid_hello_message)(client_too_old))(inbound)(outbound))(firewalled)(not_firewalled))(unable_to_connect)(connection_successful)) namespace std
Definition: core_messages.hpp:404
graphene::protocol::restriction::func_le
@ func_le
Definition: restriction.hpp:38
base.hpp
graphene::protocol::restriction::func_gt
@ func_gt
Definition: restriction.hpp:39
graphene::protocol::restriction::extensions
extensions_type extensions
Definition: restriction.hpp:105
graphene::protocol::restriction::func_lt
@ func_lt
Definition: restriction.hpp:37
FC_REFLECT
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:388
graphene::protocol::restriction::variant_assert_argument_type
pair< int64_t, vector< restriction > > variant_assert_argument_type
Definition: restriction.hpp:53
graphene::protocol::restriction::restriction_type
unsigned_int restriction_type
Definition: restriction.hpp:102
graphene
Definition: api.cpp:48
graphene::protocol::restriction::func_in
@ func_in
Definition: restriction.hpp:41
graphene::protocol::extensions_type
future_extensions::flat_set_type extensions_type
Definition: base.hpp:156