hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
account.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_ACCOUNT_HPP
7 #define IROHA_SHARED_MODEL_ACCOUNT_HPP
8 
9 #include "cryptography/hash.hpp"
12 #include "utils/string_builder.hpp"
13 
14 namespace shared_model {
15  namespace interface {
16 
20  class Account : public ModelPrimitive<Account> {
21  public:
25  virtual const types::AccountIdType &accountId() const = 0;
26 
30  virtual const types::DomainIdType &domainId() const = 0;
31 
35  virtual types::QuorumType quorum() const = 0;
36 
40  virtual const types::JsonType &jsonData() const = 0;
41 
46  std::string toString() const override {
48  .init("Account")
49  .append("accountId", accountId())
50  .append("domainId", domainId())
51  .append("quorum", std::to_string(quorum()))
52  .append("json", jsonData())
53  .finalize();
54  }
55 
61  bool operator==(const Account &rhs) const override {
62  return accountId() == rhs.accountId() and domainId() == rhs.domainId()
63  and quorum() == rhs.quorum() and jsonData() == rhs.jsonData();
64  }
65  };
66  } // namespace interface
67 } // namespace shared_model
68 #endif // IROHA_SHARED_MODEL_ACCOUNT_HPP
Definition: account.hpp:20
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 const types::DomainIdType & domainId() const =0
std::string DomainIdType
Iroha domain id type.
Definition: types.hpp:53
virtual const types::AccountIdType & accountId() const =0
std::string finalize()
Definition: string_builder.cpp:52
virtual const types::JsonType & jsonData() const =0
Definition: string_builder.hpp:16
std::string AccountIdType
Type of account id.
Definition: types.hpp:39
std::string toString() const override
Definition: account.hpp:46
PrettyStringBuilder & append(const std::string &name, const std::string &value)
Definition: string_builder.cpp:36
virtual types::QuorumType quorum() const =0
bool operator==(const Account &rhs) const override
Definition: account.hpp:61
Definition: model_primitive.hpp:23
Definition: command_executor.hpp:12
uint16_t QuorumType
Type of Quorum used in transaction and set quorum.
Definition: types.hpp:62
std::string JsonType
Type of JSON data.
Definition: types.hpp:74