hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
model_primitive.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_MODEL_PRIMITIVE_HPP
7 #define IROHA_MODEL_PRIMITIVE_HPP
8 
9 #include <ciso646>
10 
11 #include "utils/string_builder.hpp"
12 #include "common/cloneable.hpp"
13 
14 namespace shared_model {
15  namespace interface {
22  template <typename Model>
23  class ModelPrimitive : public Cloneable<ModelPrimitive<Model>> {
24  public:
28  using ModelType = Model;
29 
34  virtual std::string toString() const {
36  .init("Primitive")
37  .append("address", std::to_string(reinterpret_cast<uint64_t>(this)))
38  .finalize();
39  }
40 
41  virtual bool operator==(const ModelType &rhs) const = 0;
42 
43  virtual bool operator!=(const ModelType &rhs) const {
44  return not(*this == rhs);
45  }
46 
47  virtual ~ModelPrimitive() = default;
48  };
49  } // namespace interface
50 } // namespace shared_model
51 #endif // IROHA_MODEL_PRIMITIVE_HPP
std::string to_string(const Collection &collection, Lambda transform)
Definition: logger.hpp:132
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
virtual std::string toString() const
Definition: model_primitive.hpp:34
Definition: cloneable.hpp:63
std::string finalize()
Definition: string_builder.cpp:52
Definition: string_builder.hpp:16
PrettyStringBuilder & append(const std::string &name, const std::string &value)
Definition: string_builder.cpp:36
virtual bool operator==(const ModelType &rhs) const =0
virtual bool operator!=(const ModelType &rhs) const
Definition: model_primitive.hpp:43
Definition: model_primitive.hpp:23
Definition: stateless_valid_tx_response.hpp:16
Definition: command_executor.hpp:12