Scorum
objects.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/multi_index/composite_key.hpp>
4 
5 #include <fc/shared_containers.hpp>
6 
10 
11 //
12 // Plugins should #define their SPACE_ID's so plugins with
13 // conflicting SPACE_ID assignments can be compiled into the
14 // same binary (by simply re-assigning some of the conflicting #defined
15 // SPACE_ID's in a build script).
16 //
17 // Assignment of SPACE_ID's cannot be done at run-time because
18 // various template automagic depends on them being known at compile
19 // time.
20 //
21 #ifndef ACCOUNT_STATISTICS_SPACE_ID
22 #define ACCOUNT_STATISTICS_SPACE_ID 10
23 #endif
24 
25 namespace scorum {
26 namespace account_statistics {
27 
28 using namespace scorum::chain;
29 
31 {
34 };
35 
36 struct bucket_object : public common_statistics::base_bucket_object, public object<bucket_object_type, bucket_object>
37 {
38  CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(bucket_object, (account_statistic))
39 
40  id_type id;
41 
43 };
44 typedef bucket_object::id_type bucket_id_type;
45 
46 struct activity_bucket_object : public common_statistics::base_bucket_object,
48 {
49  CHAINBASE_DEFAULT_CONSTRUCTOR(activity_bucket_object)
50 
51  id_type id;
52 
53  uint32_t active_market_accounts = 0;
54  uint32_t active_forum_accounts = 0;
55  uint32_t active_market_and_forum_accounts = 0;
56 };
58 
59 struct by_id;
60 typedef shared_multi_index_container<bucket_object,
61  indexed_by<ordered_unique<tag<by_id>,
62  member<bucket_object,
64  &bucket_object::id>>,
65  ordered_unique<tag<common_statistics::by_bucket>,
66  composite_key<bucket_object,
67  member<common_statistics::
68  base_bucket_object,
69  uint32_t,
70  &common_statistics::
71  base_bucket_object::seconds>,
72  member<common_statistics::
73  base_bucket_object,
74  fc::time_point_sec,
75  &common_statistics::
76  base_bucket_object::open>>>>>
78 } // namespace account_statistics
79 } // namespace scorum
80 
81 FC_REFLECT_DERIVED(scorum::account_statistics::bucket_object,
82  (scorum::common_statistics::base_bucket_object)(scorum::account_statistics::account_metric),
83  (id))
84 
85 CHAINBASE_SET_INDEX_TYPE(scorum::account_statistics::bucket_object, scorum::account_statistics::bucket_index)
86 
87 // clang-format off
88 
89 FC_REFLECT_DERIVED(
90  scorum::account_statistics::activity_bucket_object, (scorum::common_statistics::base_bucket_object),
91  (id)
92  (active_market_accounts)
93  (active_forum_accounts)
94  (active_market_and_forum_accounts)
95 )
96 
97 // clang-format on
Definition: game.cpp:4
activity_bucket_object::id_type activity_bucket_id_type
Definition: objects.hpp:57
bucket_object::id_type bucket_id_type
Definition: objects.hpp:44
shared_multi_index_container< bucket_object, indexed_by< ordered_unique< tag< by_id >, member< bucket_object, bucket_id_type, &bucket_object::id > >, ordered_unique< tag< common_statistics::by_bucket >, composite_key< bucket_object, member< common_statistics::base_bucket_object, uint32_t, &common_statistics::base_bucket_object::seconds >, member< common_statistics::base_bucket_object, fc::time_point_sec, &common_statistics::base_bucket_object::open > > > > > bucket_index
Definition: objects.hpp:59
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
Definition: asset.cpp:15
#define ACCOUNT_STATISTICS_SPACE_ID
Definition: objects.hpp:22