BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface 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;
108  restriction(const unsigned_int& member_index, function_type type, const argument_type& argument)
109  : member_index(member_index), restriction_type(type), argument(argument) {}
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)
132 
134  (member_index)
136  (argument)
137  (extensions))
138 
139 
future_extensions::flat_set_type extensions_type
Definition: base.hpp:141
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:386
Definition: api.cpp:56
restriction(const unsigned_int &member_index, function_type type, const argument_type &argument)
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
pair< int64_t, vector< restriction >> variant_assert_argument_type
Definition: restriction.hpp:53
Sentry value which contains the number of different types.
Definition: restriction.hpp:48