CatapultServer  v0.5.0.1 (Elephant)
src/catapult/types.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "utils/ByteArray.h"
23 #include "utils/ClampedBaseValue.h"
24 #include "utils/RawBuffer.h"
25 #include <array>
26 
27 namespace catapult {
28 
29  // region byte arrays (ex address)
30 
31  constexpr size_t Signature_Size = 64;
32  constexpr size_t Key_Size = 32;
33  constexpr size_t Hash512_Size = 64;
34  constexpr size_t Hash256_Size = 32;
35  constexpr size_t Hash160_Size = 20;
36 
37  struct Signature_tag {};
39 
40  struct Key_tag {};
42 
43  struct Hash512_tag { static constexpr auto Byte_Size = 64; };
45 
46  struct Hash256_tag { static constexpr auto Byte_Size = 32; };
48 
49  struct Hash160_tag {};
51 
52  struct GenerationHash_tag { static constexpr auto Byte_Size = 32; };
54 
55  // endregion
56 
57  // region byte arrays (address)
58 
59  constexpr size_t Address_Decoded_Size = 25;
60  constexpr size_t Address_Encoded_Size = 40;
61 
62  struct Address_tag {};
64 
67 
68  // endregion
69 
70  // region base values
71 
72  struct Timestamp_tag {};
74 
75  struct Amount_tag {};
77 
78  struct MosaicId_tag {};
80 
83 
84  struct Height_tag {};
86 
87  struct BlockDuration_tag {};
89 
92 
93  struct Difficulty_tag {
94  public:
95  static constexpr uint64_t Default_Value = 100'000'000'000'000;
96  static constexpr uint64_t Min_Value = Default_Value / 10;
97  static constexpr uint64_t Max_Value = Default_Value * 10;
98  };
100 
101  struct Importance_tag {};
103 
104  // endregion
105 
106  using utils::RawBuffer;
108  using utils::RawString;
110 
112  template<typename T, size_t N>
113  constexpr size_t CountOf(T const (&)[N]) noexcept {
114  return N;
115  }
116 }
catapult::Hash160_tag
Definition: src/catapult/types.h:49
catapult::Key_tag
Definition: src/catapult/types.h:40
catapult::Hash256_tag
Definition: src/catapult/types.h:46
catapult::CountOf
constexpr size_t CountOf(T const (&)[N]) noexcept
Returns the size of the specified array.
Definition: src/catapult/types.h:113
RawBuffer.h
catapult::Difficulty_tag::Max_Value
static constexpr uint64_t Max_Value
Definition: src/catapult/types.h:97
catapult::Difficulty_tag::Min_Value
static constexpr uint64_t Min_Value
Definition: src/catapult/types.h:96
catapult::UnresolvedMosaicId_tag
Definition: src/catapult/types.h:81
catapult::Height_tag
Definition: src/catapult/types.h:84
catapult::Importance_tag
Definition: src/catapult/types.h:101
catapult::Hash512_Size
constexpr size_t Hash512_Size
Definition: src/catapult/types.h:33
catapult::Signature_Size
constexpr size_t Signature_Size
Definition: src/catapult/types.h:31
catapult::BlockDuration_tag
Definition: src/catapult/types.h:87
ClampedBaseValue.h
catapult::Hash512_tag::Byte_Size
static constexpr auto Byte_Size
Definition: src/catapult/types.h:43
catapult::Address_tag
Definition: src/catapult/types.h:62
catapult::utils::BaseValue< uint64_t, Timestamp_tag >
catapult::utils::MutableRawBuffer
BasicRawBuffer< uint8_t > MutableRawBuffer
A mutable binary buffer.
Definition: RawBuffer.h:65
catapult::Hash160_Size
constexpr size_t Hash160_Size
Definition: src/catapult/types.h:35
catapult::GenerationHash_tag::Byte_Size
static constexpr auto Byte_Size
Definition: src/catapult/types.h:52
catapult::Address_Encoded_Size
constexpr size_t Address_Encoded_Size
Definition: src/catapult/types.h:60
catapult::Difficulty_tag::Default_Value
static constexpr uint64_t Default_Value
Definition: src/catapult/types.h:95
catapult::MosaicId_tag
Definition: src/catapult/types.h:78
catapult::Key_Size
constexpr size_t Key_Size
Definition: src/catapult/types.h:32
catapult::Timestamp_tag
Definition: src/catapult/types.h:72
catapult::BlockFeeMultiplier_tag
Definition: src/catapult/types.h:90
catapult::utils::MutableRawString
A mutable string buffer.
Definition: RawBuffer.h:82
catapult::utils::RawString
A const string buffer.
Definition: RawBuffer.h:68
catapult::UnresolvedAddress_tag
Definition: src/catapult/types.h:65
catapult::Signature_tag
Definition: src/catapult/types.h:37
ByteArray.h
catapult::Address_Decoded_Size
constexpr size_t Address_Decoded_Size
Definition: src/catapult/types.h:59
catapult::Hash512_tag
Definition: src/catapult/types.h:43
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ClampedBaseValue< uint64_t, Difficulty_tag >
catapult::Amount_tag
Definition: src/catapult/types.h:75
catapult::Difficulty_tag
Definition: src/catapult/types.h:93
catapult::Hash256_Size
constexpr size_t Hash256_Size
Definition: src/catapult/types.h:34
catapult::Hash256_tag::Byte_Size
static constexpr auto Byte_Size
Definition: src/catapult/types.h:46
catapult::GenerationHash_tag
Definition: src/catapult/types.h:52
catapult::utils::ByteArray< Signature_Size, Signature_tag >
catapult::utils::RawBuffer
BasicRawBuffer< const uint8_t > RawBuffer
A const binary buffer.
Definition: RawBuffer.h:62