Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
abi_def.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace sysio { namespace chain {
6
9
10struct type_def {
11 type_def() = default;
13 :new_type_name(new_type_name), type(type)
14 {}
15
18};
19
20struct field_def {
21 field_def() = default;
22 field_def(const field_name& name, const type_name& type)
23 :name(name), type(type)
24 {}
25
28
29 bool operator==(const field_def& other) const {
30 return std::tie(name, type) == std::tie(other.name, other.type);
31 }
32};
33
34struct struct_def {
35 struct_def() = default;
37 :name(name), base(base), fields(fields)
38 {}
39
43
44 bool operator==(const struct_def& other) const {
45 return std::tie(name, base, fields) == std::tie(other.name, other.base, other.fields);
46 }
47};
48
59
60struct table_def {
61 table_def() = default;
65
66 table_name name; // the name of the table
67 type_name index_type; // the kind of index, i64, i128i128, etc
68 vector<field_name> key_names; // names for the keys defined by key_types
69 vector<type_name> key_types; // the type of key parameters
70 type_name type; // type of binary data stored in this table
71};
72
74 clause_pair() = default;
75 clause_pair( const string& id, const string& body )
76 : id(id), body(body)
77 {}
78
79 string id;
80 string body;
81};
82
84 error_message() = default;
85 error_message( uint64_t error_code, const string& error_msg )
86 : error_code(error_code), error_msg(error_msg)
87 {}
88
90 string error_msg;
91};
92
97
107
108template<typename T>
111};
112
135
136abi_def sysio_contract_abi(const abi_def& sysio_system_abi);
138
139extern unsigned char sysio_abi_bin[2132];
140
141} }
142
143namespace fc {
144
145template<typename ST, typename T>
146datastream<ST>& operator << (datastream<ST>& s, const sysio::chain::may_not_exist<T>& v) {
147 raw::pack(s, v.value);
148 return s;
149}
150
151template<typename ST, typename T>
153 if (s.remaining())
154 raw::unpack(s, v.value);
155 return s;
156}
157
158template<typename T>
162
163template<typename T>
167
168} // namespace fc
169
170FC_REFLECT( sysio::chain::type_def , (new_type_name)(type) )
172FC_REFLECT( sysio::chain::struct_def , (name)(base)(fields) )
173FC_REFLECT( sysio::chain::action_def , (name)(type)(ricardian_contract) )
174FC_REFLECT( sysio::chain::table_def , (name)(index_type)(key_names)(key_types)(type) )
176FC_REFLECT( sysio::chain::error_message , (error_code)(error_msg) )
179FC_REFLECT( sysio::chain::abi_def , (version)(types)(structs)(actions)(tables)
180 (ricardian_clauses)(error_messages)(abi_extensions)(variants)(action_results) )
std::string name
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
void unpack(Stream &s, std::deque< T > &value)
Definition raw.hpp:540
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
namespace sysio::chain
Definition authority.cpp:3
std::string string
Definition string.hpp:10
datastream< ST > & operator<<(datastream< ST > &s, const sysio::chain::may_not_exist< T > &v)
Definition abi_def.hpp:146
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
Definition authority.cpp:4
datastream< ST > & operator>>(datastream< ST > &s, sysio::chain::may_not_exist< T > &v)
Definition abi_def.hpp:152
string type_name
Definition abi_def.hpp:7
string field_name
Definition abi_def.hpp:8
sysio::chain::action_name action_name
abi_def sysio_contract_abi(const abi_def &sysio_system_abi)
unsigned char sysio_abi_bin[2132]
vector< type_def > common_type_defs()
#define T(meth, val, expected)
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
unsigned __int64 uint64_t
Definition stdint.h:136
vector< action_def > actions
Definition abi_def.hpp:127
may_not_exist< vector< action_result_def > > action_results
Definition abi_def.hpp:133
vector< error_message > error_messages
Definition abi_def.hpp:130
vector< clause_pair > ricardian_clauses
Definition abi_def.hpp:129
vector< type_def > types
Definition abi_def.hpp:125
vector< struct_def > structs
Definition abi_def.hpp:126
vector< table_def > tables
Definition abi_def.hpp:128
abi_def(const vector< type_def > &types, const vector< struct_def > &structs, const vector< action_def > &actions, const vector< table_def > &tables, const vector< clause_pair > &clauses, const vector< error_message > &error_msgs)
Definition abi_def.hpp:115
may_not_exist< vector< variant_def > > variants
Definition abi_def.hpp:132
extensions_type abi_extensions
Definition abi_def.hpp:131
action_def(const action_name &name, const type_name &type, const string &ricardian_contract)
Definition abi_def.hpp:51
action_result_def(const action_name &name, const type_name &result_type)
Definition abi_def.hpp:100
clause_pair(const string &id, const string &body)
Definition abi_def.hpp:75
error_message(uint64_t error_code, const string &error_msg)
Definition abi_def.hpp:85
bool operator==(const field_def &other) const
Definition abi_def.hpp:29
field_def(const field_name &name, const type_name &type)
Definition abi_def.hpp:22
Immutable except for fc::from_variant.
Definition name.hpp:43
vector< field_def > fields
Definition abi_def.hpp:42
struct_def(const type_name &name, const type_name &base, const vector< field_def > &fields)
Definition abi_def.hpp:36
bool operator==(const struct_def &other) const
Definition abi_def.hpp:44
vector< field_name > key_names
Definition abi_def.hpp:68
vector< type_name > key_types
Definition abi_def.hpp:69
table_def(const table_name &name, const type_name &index_type, const vector< field_name > &key_names, const vector< type_name > &key_types, const type_name &type)
Definition abi_def.hpp:62
type_def(const type_name &new_type_name, const type_name &type)
Definition abi_def.hpp:12
type_name new_type_name
Definition abi_def.hpp:16
vector< type_name > types
Definition abi_def.hpp:95
char * s