CatapultServer  v0.5.0.1 (Elephant)
AggregateNotifications.h
Go to the documentation of this file.
1 
21 #pragma once
25 
26 namespace catapult { namespace model {
27 
28  // region aggregate notification types
29 
31 #define DEFINE_AGGREGATE_NOTIFICATION(DESCRIPTION, CODE, CHANNEL) DEFINE_NOTIFICATION_TYPE(CHANNEL, Aggregate, DESCRIPTION, CODE)
32 
34  DEFINE_AGGREGATE_NOTIFICATION(Cosignatures, 0x001, Validator);
35 
37  DEFINE_AGGREGATE_NOTIFICATION(EmbeddedTransaction, 0x002, Validator);
38 
39 #undef DEFINE_AGGREGATE_NOTIFICATION
40 
41  // endregion
42 
43  // region BasicAggregateNotification
44 
46  template<typename TDerivedNotification>
48  protected:
50  BasicAggregateNotification(const Key& signer, size_t cosignaturesCount, const Cosignature* pCosignatures)
51  : Notification(TDerivedNotification::Notification_Type, sizeof(TDerivedNotification))
52  , Signer(signer)
53  , CosignaturesCount(cosignaturesCount)
54  , CosignaturesPtr(pCosignatures)
55  {}
56 
57  public:
59  const Key& Signer;
60 
63 
66  };
67 
68  // endregion
69 
70  // region AggregateEmbeddedTransactionNotification
71 
73  struct AggregateEmbeddedTransactionNotification : public BasicAggregateNotification<AggregateEmbeddedTransactionNotification> {
74  public:
76  static constexpr auto Notification_Type = Aggregate_EmbeddedTransaction_Notification;
77 
78  public:
81  const Key& signer,
82  const EmbeddedTransaction& transaction,
83  size_t cosignaturesCount,
84  const Cosignature* pCosignatures)
85  : BasicAggregateNotification<AggregateEmbeddedTransactionNotification>(signer, cosignaturesCount, pCosignatures)
86  , Transaction(transaction)
87  {}
88 
89  public:
92  };
93 
94  // endregion
95 
96  // region AggregateCosignaturesNotification
97 
100  struct AggregateCosignaturesNotification : public BasicAggregateNotification<AggregateCosignaturesNotification> {
101  public:
103  static constexpr auto Notification_Type = Aggregate_Cosignatures_Notification;
104 
105  public:
108  const Key& signer,
109  size_t transactionsCount,
110  const EmbeddedTransaction* pTransactions,
111  size_t cosignaturesCount,
112  const Cosignature* pCosignatures)
113  : BasicAggregateNotification<AggregateCosignaturesNotification>(signer, cosignaturesCount, pCosignatures)
114  , TransactionsCount(transactionsCount)
115  , TransactionsPtr(pTransactions)
116  {}
117 
118  public:
121 
124  };
125 
126  // endregion
127 }}
catapult::model::AggregateEmbeddedTransactionNotification::AggregateEmbeddedTransactionNotification
AggregateEmbeddedTransactionNotification(const Key &signer, const EmbeddedTransaction &transaction, size_t cosignaturesCount, const Cosignature *pCosignatures)
Creates a notification around signer, transaction, cosignaturesCount and pCosignatures.
Definition: AggregateNotifications.h:80
catapult::model::AggregateCosignaturesNotification
Definition: AggregateNotifications.h:100
catapult::model::Cosignature
A cosignature.
Definition: Cosignature.h:29
EmbeddedTransaction.h
catapult::model::BasicAggregateNotification::CosignaturesCount
size_t CosignaturesCount
Number of cosignatures.
Definition: AggregateNotifications.h:62
catapult::model::AggregateCosignaturesNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: AggregateNotifications.h:103
catapult::model::DEFINE_AGGREGATE_NOTIFICATION
DEFINE_AGGREGATE_NOTIFICATION(Cosignatures, 0x001, Validator)
Aggregate was received with cosignatures.
catapult::model::AggregateCosignaturesNotification::TransactionsPtr
const EmbeddedTransaction * TransactionsPtr
Const pointer to the first transaction.
Definition: AggregateNotifications.h:123
catapult::model::BasicAggregateNotification::CosignaturesPtr
const Cosignature * CosignaturesPtr
Const pointer to the first cosignature.
Definition: AggregateNotifications.h:65
catapult::model::BasicAggregateNotification
A basic aggregate notification.
Definition: AggregateNotifications.h:47
catapult::model::BasicAggregateNotification::BasicAggregateNotification
BasicAggregateNotification(const Key &signer, size_t cosignaturesCount, const Cosignature *pCosignatures)
Creates a notification around signer, cosignaturesCount and pCosignatures.
Definition: AggregateNotifications.h:50
catapult::model::BasicAggregateNotification::Signer
const Key & Signer
Aggregate signer.
Definition: AggregateNotifications.h:59
catapult::model::AggregateEmbeddedTransactionNotification
Notification of an embedded aggregate transaction with cosignatures.
Definition: AggregateNotifications.h:73
catapult::model::AggregateEmbeddedTransactionNotification::Transaction
const EmbeddedTransaction & Transaction
Embedded transaction.
Definition: AggregateNotifications.h:91
catapult::model::AggregateCosignaturesNotification::TransactionsCount
size_t TransactionsCount
Number of transactions.
Definition: AggregateNotifications.h:120
Notifications.h
catapult::model::AggregateEmbeddedTransactionNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: AggregateNotifications.h:76
catapult::model::EmbeddedTransaction
Binary layout for an embedded transaction (non-verifiable).
Definition: EmbeddedTransaction.h:38
catapult::model::Notification
A basic notification.
Definition: Notifications.h:36
catapult::model::AggregateCosignaturesNotification::AggregateCosignaturesNotification
AggregateCosignaturesNotification(const Key &signer, size_t transactionsCount, const EmbeddedTransaction *pTransactions, size_t cosignaturesCount, const Cosignature *pCosignatures)
Creates a notification around signer, transactionsCount, pTransactions, cosignaturesCount and pCosign...
Definition: AggregateNotifications.h:107
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::Transaction
Binary layout for a transaction.
Definition: Transaction.h:32
Cosignature.h