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 
13 namespace shared_model {
14  namespace interface {
21  template <typename Model>
23  public:
27  using ModelType = Model;
28 
33  virtual std::string toString() const {
35  .init("Primitive")
36  .append("address", std::to_string(reinterpret_cast<uint64_t>(this)))
37  .finalize();
38  }
39 
40  virtual bool operator==(const ModelType &rhs) const = 0;
41 
42  virtual bool operator!=(const ModelType &rhs) const {
43  return not(*this == rhs);
44  }
45 
46  virtual ~ModelPrimitive() = default;
47  };
48  } // namespace interface
49 } // namespace shared_model
50 #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:33
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:42
Definition: model_primitive.hpp:22
Definition: add_asset_quantity.hpp:20
Definition: command_executor.hpp:12