BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
custom_objects.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 oxarbitrage 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
25 
26 #include <boost/multi_index/composite_key.hpp>
28 
29 namespace graphene { namespace custom_operations {
30 
31 using namespace chain;
32 
33 #ifndef CUSTOM_OPERATIONS_SPACE_ID
34 #define CUSTOM_OPERATIONS_SPACE_ID 7
35 #endif
36 
37 #define CUSTOM_OPERATIONS_MAX_KEY_SIZE (200)
38 
39 enum types {
41 };
42 
43 struct account_storage_object : public abstract_object<account_storage_object>
44 {
45  static const uint8_t space_id = CUSTOM_OPERATIONS_SPACE_ID;
46  static const uint8_t type_id = account_map;
47 
48  account_id_type account;
49  string catalog;
50  string key;
51  optional<variant> value;
52 };
53 
54 struct by_account_catalog_key;
55 
56 typedef multi_index_container<
58  indexed_by<
59  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
60  ordered_unique< tag<by_account_catalog_key>,
61  composite_key< account_storage_object,
62  member< account_storage_object, account_id_type, &account_storage_object::account >,
63  member< account_storage_object, string, &account_storage_object::catalog >,
64  member< account_storage_object, string, &account_storage_object::key >
65  >
66  >
67  >
69 
71 
73 
74 } } //graphene::custom_operations
75 
77  (account)(catalog)(key)(value))
78 FC_REFLECT_ENUM( graphene::custom_operations::types, (account_map))
#define CUSTOM_OPERATIONS_SPACE_ID
Definition: api.cpp:56
generic_index< account_storage_object, account_storage_multi_index_type > account_storage_index
FC_REFLECT_DERIVED(graphene::app::extended_asset_object,(graphene::chain::asset_object),(total_in_collateral)(total_backing_collateral))
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
multi_index_container< account_storage_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type,&object::id > >, ordered_unique< tag< by_account_catalog_key >, composite_key< account_storage_object, member< account_storage_object, account_id_type,&account_storage_object::account >, member< account_storage_object, string,&account_storage_object::catalog >, member< account_storage_object, string,&account_storage_object::key > > > >> account_storage_multi_index_type
Use the Curiously Recurring Template Pattern to automatically add the ability to clone, serialize, and move objects polymorphically.
Definition: object.hpp:90
base for all database objects
Definition: object.hpp:62