hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
batch_meta.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_BATCH_META_HPP
7 #define IROHA_SHARED_MODEL_BATCH_META_HPP
8 
11 
12 namespace shared_model {
13  namespace interface {
14 
18  class BatchMeta : public ModelPrimitive<BatchMeta> {
19  public:
20  virtual types::BatchType type() const = 0;
21 
22  std::string toString() const override {
24  .init("BatchMeta")
25  .append("Type",
26  type() == types::BatchType::ATOMIC ? "ATOMIC" : "ORDERED")
28  [](auto &hash) { return hash.toString(); })
29  .finalize();
30  }
32  using ReducedHashesType = std::vector<interface::types::HashType>;
33 
37  virtual const ReducedHashesType &reducedHashes() const = 0;
43  bool operator==(const ModelType &rhs) const override {
44  return boost::equal(reducedHashes(), rhs.reducedHashes())
45  and type() == rhs.type();
46  }
47  };
48  } // namespace interface
49 } // namespace shared_model
50 #endif // IROHA_SHARED_MODEL_BATCH_META_HPP
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
std::string toString() const override
Definition: batch_meta.hpp:22
bool operator==(const ModelType &rhs) const override
Definition: batch_meta.hpp:43
virtual const ReducedHashesType & reducedHashes() const =0
PrettyStringBuilder & appendAll(Collection &&c, Transform &&t)
Definition: string_builder.hpp:56
Definition: string_builder.hpp:16
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
PrettyStringBuilder & append(const std::string &name, const std::string &value)
Definition: string_builder.cpp:36
std::vector< interface::types::HashType > ReducedHashesType
type of hashes collection
Definition: batch_meta.hpp:32
Definition: batch_meta.hpp:18
Definition: model_primitive.hpp:23
BatchType
Definition: types.hpp:84
virtual types::BatchType type() const =0
Definition: command_executor.hpp:12