hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
proposal.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_PROPOSAL_HPP
7 #define IROHA_SHARED_MODEL_PROPOSAL_HPP
8 
13 
14 namespace shared_model {
15  namespace interface {
16 
17  class Proposal : public ModelPrimitive<Proposal> {
18  public:
23 
27  virtual types::HeightType height() const = 0;
28 
32  virtual types::TimestampType createdTime() const = 0;
33 
34  bool operator==(const Proposal &rhs) const override {
35  return transactions() == rhs.transactions() and height() == rhs.height()
36  and createdTime() == rhs.createdTime();
37  }
38 
39  virtual const types::BlobType &blob() const = 0;
40 
41  virtual const types::HashType &hash() const = 0;
42 
43  std::string toString() const override {
45  .init("Proposal")
46  .append("height", std::to_string(height()))
47  .append("transactions")
49  [](auto &transaction) { return transaction.toString(); })
50  .finalize();
51  }
52  };
53 
54  } // namespace interface
55 } // namespace shared_model
56 
57 #endif // IROHA_SHARED_MODEL_PROPOSAL_HPP
std::string toString() const override
Definition: proposal.hpp:43
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:41
Definition: hash.hpp:18
std::string to_string(const Collection &collection, Lambda transform)
Definition: logger.hpp:132
Definition: blob.hpp:24
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
bool operator==(const Proposal &rhs) const override
Definition: proposal.hpp:34
Definition: proposal.hpp:17
virtual const types::BlobType & blob() const =0
PrettyStringBuilder & appendAll(Collection &&c, Transform &&t)
Definition: string_builder.hpp:56
virtual const types::HashType & hash() const =0
virtual types::HeightType height() const =0
Definition: string_builder.hpp:16
PrettyStringBuilder & append(const std::string &name, const std::string &value)
Definition: string_builder.cpp:36
virtual types::TransactionsCollectionType transactions() const =0
Definition: model_primitive.hpp:23
Definition: command_executor.hpp:12
virtual types::TimestampType createdTime() const =0
uint64_t TimestampType
Type of timestamp.
Definition: types.hpp:61
boost::any_range< Transaction, boost::random_access_traversal_tag, const Transaction & > TransactionsCollectionType
Type of transactions&#39; collection.
Definition: range_types.hpp:29