hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
account_asset.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_ACCOUNT_ASSET_HPP
7 #define IROHA_SHARED_MODEL_ACCOUNT_ASSET_HPP
8 
12 #include "utils/string_builder.hpp"
13 
14 namespace shared_model {
15  namespace interface {
16 
20  class AccountAsset : public ModelPrimitive<AccountAsset> {
21  public:
25  virtual const types::AccountIdType &accountId() const = 0;
26 
30  virtual const types::AssetIdType &assetId() const = 0;
31 
35  virtual const Amount &balance() const = 0;
36 
41  std::string toString() const override {
43  .init("AccountAsset")
44  .append("accountId", accountId())
45  .append("assetId", assetId())
46  .append("balance", balance().toString())
47  .finalize();
48  }
49 
55  bool operator==(const ModelType &rhs) const override {
56  return accountId() == rhs.accountId() and assetId() == rhs.assetId()
57  and balance() == rhs.balance();
58  }
59  };
60  } // namespace interface
61 } // namespace shared_model
62 #endif // IROHA_SHARED_MODEL_ACCOUNT_ASSET_HPP
virtual const Amount & balance() const =0
std::string toString() const override
Definition: account_asset.hpp:41
PrettyStringBuilder & init(const std::string &name)
Definition: string_builder.cpp:18
bool operator==(const ModelType &rhs) const override
Definition: account_asset.hpp:55
virtual const types::AssetIdType & assetId() const =0
Definition: amount.hpp:19
std::string finalize()
Definition: string_builder.cpp:61
virtual const types::AccountIdType & accountId() 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
Definition: model_primitive.hpp:22
Definition: command_executor.hpp:12
Definition: account_asset.hpp:20
std::string AssetIdType
Type of asset id.
Definition: types.hpp:55