hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
asset.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_ASSET_HPP
7 #define IROHA_SHARED_MODEL_ASSET_HPP
8 
11 #include "utils/string_builder.hpp"
12 
13 namespace shared_model {
14  namespace interface {
15 
19  class Asset : public ModelPrimitive<Asset> {
20  public:
24  virtual const types::AccountIdType &assetId() const = 0;
25 
29  virtual const types::DomainIdType &domainId() const = 0;
30 
34  virtual types::PrecisionType precision() const = 0;
35 
40  std::string toString() const override {
42  .init("Asset")
43  .append("assetId", assetId())
44  .append("domainId", domainId())
45  .append("precision", std::to_string(precision()))
46  .finalize();
47  }
48 
54  bool operator==(const ModelType &rhs) const override {
55  return assetId() == rhs.assetId() and domainId() == rhs.domainId()
56  and precision() == rhs.precision();
57  }
58  };
59  } // namespace interface
60 } // namespace shared_model
61 #endif // IROHA_SHARED_MODEL_ASSET_HPP
bool operator==(const ModelType &rhs) const override
Definition: asset.hpp:54
std::string to_string(const Collection &collection, Lambda transform)
Definition: logger.hpp:132
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
std::string DomainIdType
Iroha domain id type.
Definition: types.hpp:53
std::string finalize()
Definition: string_builder.cpp:52
virtual const types::AccountIdType & assetId() const =0
Definition: string_builder.hpp:16
std::string AccountIdType
Type of account id.
Definition: types.hpp:39
PrettyStringBuilder & append(const std::string &name, const std::string &value)
Definition: string_builder.cpp:36
virtual const types::DomainIdType & domainId() const =0
Definition: asset.hpp:19
uint8_t PrecisionType
Type of precision.
Definition: types.hpp:41
virtual types::PrecisionType precision() const =0
Definition: model_primitive.hpp:22
Definition: command_executor.hpp:12
std::string toString() const override
Definition: asset.hpp:40