CatapultServer  v0.5.0.1 (Elephant)
AccountRestrictionSharedTransaction.h
Go to the documentation of this file.
1 
21 #pragma once
25 
26 namespace catapult { namespace model {
27 
28 #pragma pack(push, 1)
29 
31  template<typename THeader, typename TAccountRestrictionModification>
32  struct BasicAccountRestrictionTransactionBody : public THeader {
33  private:
35 
36  public:
39 
42 
43  // followed by account restriction modifications if ModificationsCount != 0
44  DEFINE_TRANSACTION_VARIABLE_DATA_ACCESSORS(Modifications, TAccountRestrictionModification)
45 
46  private:
47  template<typename T>
48  static auto* ModificationsPtrT(T& transaction) {
49  return transaction.ModificationsCount ? THeader::PayloadStart(transaction) : nullptr;
50  }
51 
52  public:
53  // Calculates the real size of account restriction \a transaction.
54  static constexpr uint64_t CalculateRealSize(const TransactionType& transaction) noexcept {
55  return sizeof(TransactionType) + transaction.ModificationsCount * sizeof(TAccountRestrictionModification);
56  }
57  };
58 
59 #define DEFINE_ACCOUNT_RESTRICTION_TRANSACTION(VALUE_NAME, ENTITY_TYPE_NAME, VALUE_TYPE) \
60  template<typename THeader> \
61  struct Account##VALUE_NAME##RestrictionTransactionBody \
62  : public BasicAccountRestrictionTransactionBody<THeader, AccountRestrictionModification<VALUE_TYPE>> { \
63  public: \
64  DEFINE_TRANSACTION_CONSTANTS(Entity_Type_Account_##ENTITY_TYPE_NAME##_Restriction, 1) \
65  }; \
66  \
67  DEFINE_EMBEDDABLE_TRANSACTION(Account##VALUE_NAME##Restriction)
68 
69 #pragma pack(pop)
70 }}
catapult::model::BasicAccountRestrictionTransactionBody::RestrictionType
AccountRestrictionType RestrictionType
Account restriction type.
Definition: AccountRestrictionSharedTransaction.h:38
Transaction.h
catapult::model::AccountRestrictionType
AccountRestrictionType
Account restriction types.
Definition: AccountRestrictionTypes.h:31
AccountRestrictionTypes.h
catapult::model::BasicAccountRestrictionTransactionBody::ModificationsPtrT
static auto * ModificationsPtrT(T &transaction)
Definition: AccountRestrictionSharedTransaction.h:48
catapult::model::BasicAccountRestrictionTransactionBody::TransactionType
BasicAccountRestrictionTransactionBody< THeader, TAccountRestrictionModification > TransactionType
Definition: AccountRestrictionSharedTransaction.h:34
catapult::model::BasicAccountRestrictionTransactionBody
Binary layout for a basic account restriction transaction body.
Definition: AccountRestrictionSharedTransaction.h:32
AccountRestrictionEntityType.h
catapult
Definition: AddressExtractionExtension.cpp:28
DEFINE_TRANSACTION_VARIABLE_DATA_ACCESSORS
#define DEFINE_TRANSACTION_VARIABLE_DATA_ACCESSORS(NAME, TYPE)
Defines NAME (TYPE typed) variable data accessors around a similarly named templated untyped data acc...
Definition: Transaction.h:57
catapult::model::BasicAccountRestrictionTransactionBody::ModificationsCount
uint8_t ModificationsCount
Number of modifications.
Definition: AccountRestrictionSharedTransaction.h:41
catapult::model::BasicAccountRestrictionTransactionBody::CalculateRealSize
static constexpr uint64_t CalculateRealSize(const TransactionType &transaction) noexcept
Definition: AccountRestrictionSharedTransaction.h:54