CatapultServer  v0.5.0.1 (Elephant)
WeakCosignedTransactionInfo.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "Cosignature.h"
23 #include "Transaction.h"
24 #include <vector>
25 
26 namespace catapult { namespace model {
27 
30  public:
33  {}
34 
36  WeakCosignedTransactionInfo(const Transaction* pTransaction, const std::vector<Cosignature>* pCosignatures)
37  : m_pTransaction(pTransaction)
38  , m_pCosignatures(pCosignatures)
39  {}
40 
41  public:
43  const Transaction& transaction() const {
44  return *m_pTransaction;
45  }
46 
48  const std::vector<Cosignature>& cosignatures() const {
49  return *m_pCosignatures;
50  }
51 
53  bool hasCosigner(const Key& signer) const {
54  return std::any_of(m_pCosignatures->cbegin(), m_pCosignatures->cend(), [&signer](const auto& cosignature) {
55  return signer == cosignature.Signer;
56  });
57  }
58 
59  public:
61  explicit operator bool() const noexcept {
62  return !!m_pTransaction;
63  }
64 
65  private:
67  const std::vector<Cosignature>* m_pCosignatures;
68  };
69 }}
catapult::model::WeakCosignedTransactionInfo
Wrapper around a transaction and its cosignatures.
Definition: WeakCosignedTransactionInfo.h:29
Transaction.h
catapult::model::WeakCosignedTransactionInfo::transaction
const Transaction & transaction() const
Gets the transaction.
Definition: WeakCosignedTransactionInfo.h:43
catapult::model::WeakCosignedTransactionInfo::hasCosigner
bool hasCosigner(const Key &signer) const
Returns true if a cosignature from signer is present.
Definition: WeakCosignedTransactionInfo.h:53
catapult::model::WeakCosignedTransactionInfo::m_pTransaction
const Transaction * m_pTransaction
Definition: WeakCosignedTransactionInfo.h:66
catapult::model::WeakCosignedTransactionInfo::WeakCosignedTransactionInfo
WeakCosignedTransactionInfo()
Creates an empty weak transaction info.
Definition: WeakCosignedTransactionInfo.h:32
catapult::model::WeakCosignedTransactionInfo::m_pCosignatures
const std::vector< Cosignature > * m_pCosignatures
Definition: WeakCosignedTransactionInfo.h:67
catapult::model::WeakCosignedTransactionInfo::cosignatures
const std::vector< Cosignature > & cosignatures() const
Gets the cosignatures.
Definition: WeakCosignedTransactionInfo.h:48
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::WeakCosignedTransactionInfo::WeakCosignedTransactionInfo
WeakCosignedTransactionInfo(const Transaction *pTransaction, const std::vector< Cosignature > *pCosignatures)
Creates a weak transaction info around pTransaction and pCosignatures.
Definition: WeakCosignedTransactionInfo.h:36
catapult::model::Transaction
Binary layout for a transaction.
Definition: Transaction.h:32
Cosignature.h