CatapultServer  v0.5.0.1 (Elephant)
TransactionContainer.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "SizePrefixedEntity.h"
24 
25 namespace catapult { namespace model {
26 
27 #pragma pack(push, 1)
28 
33  template<typename TEntityHeader, typename TComponentEntity>
34  struct TransactionContainer : public TEntityHeader {
39  }
40 
45  }
46 
48  TComponentEntity* TransactionsPtr() {
49  return TEntityHeader::Size <= sizeof(TEntityHeader)
50  ? nullptr
51  : reinterpret_cast<TComponentEntity*>(reinterpret_cast<uint8_t*>(this) + sizeof(TEntityHeader));
52  }
53 
55  const TComponentEntity* TransactionsPtr() const {
56  return TEntityHeader::Size <= sizeof(TEntityHeader)
57  ? nullptr
58  : reinterpret_cast<const TComponentEntity*>(reinterpret_cast<const uint8_t*>(this) + sizeof(TEntityHeader));
59  }
60 
61  // followed by "transactions"
62  };
63 
64 #pragma pack(pop)
65 }}
catapult::model::TransactionContainer::Transactions
auto Transactions(EntityContainerErrorPolicy errorPolicy=EntityContainerErrorPolicy::Throw)
Definition: TransactionContainer.h:37
catapult::model::MakeContiguousEntityContainer
constexpr BasicContiguousEntityContainer< TEntity > MakeContiguousEntityContainer(TEntity *pEntity, size_t size, EntityContainerErrorPolicy errorPolicy=EntityContainerErrorPolicy::Throw)
Definition: ContiguousEntityContainer.h:214
catapult::model::EntityContainerErrorPolicy
EntityContainerErrorPolicy
Polcies for handling iteration errors.
Definition: ContiguousEntityContainer.h:28
catapult::model::TransactionContainer::Transactions
auto Transactions(EntityContainerErrorPolicy errorPolicy=EntityContainerErrorPolicy::Throw) const
Definition: TransactionContainer.h:43
ContiguousEntityContainer.h
catapult::model::EntityContainerErrorPolicy::Throw
Immediately throw when an iteration error is encounted.
catapult::model::GetTransactionPayloadSize
size_t GetTransactionPayloadSize(const AggregateTransactionHeader &header)
Gets the number of bytes containing transaction data according to header.
Definition: AggregateTransaction.cpp:25
catapult::model::TransactionContainer::TransactionsPtr
const TComponentEntity * TransactionsPtr() const
Returns a const pointer to transactions contained in this container.
Definition: TransactionContainer.h:55
SizePrefixedEntity.h
catapult::model::TransactionContainer
Definition: TransactionContainer.h:34
catapult::model::TransactionContainer::TransactionsPtr
TComponentEntity * TransactionsPtr()
Returns a pointer to transactions contained in this container.
Definition: TransactionContainer.h:48
catapult
Definition: AddressExtractionExtension.cpp:28