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  .appendNamed("address",
37  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
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
std::string finalize()
Definition: string_builder.cpp:44
virtual bool operator!=(const ModelType &rhs) const
Definition: model_primitive.hpp:43
Definition: string_builder.hpp:18
virtual bool operator==(const ModelType &rhs) const =0
Definition: model_primitive.hpp:22
Definition: add_asset_quantity.hpp:20
Definition: command_executor.hpp:12
virtual std::string toString() const
Definition: model_primitive.hpp:33
PrettyStringBuilder & appendNamed(const Name &name, const Value &value)
----—— Augmented appending functions. ----—— ///
Definition: string_builder.hpp:53