LCOV - code coverage report
Current view: top level - shared_model/interfaces/common_objects - account.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 2 10 20.0 %
Date: 2019-03-07 14:46:43 Functions: 3 6 50.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_SHARED_MODEL_ACCOUNT_HPP
       7             : #define IROHA_SHARED_MODEL_ACCOUNT_HPP
       8             : 
       9             : #include "cryptography/hash.hpp"
      10             : #include "interfaces/base/model_primitive.hpp"
      11             : #include "interfaces/common_objects/types.hpp"
      12             : #include "utils/string_builder.hpp"
      13             : 
      14             : namespace shared_model {
      15             :   namespace interface {
      16             : 
      17             :     /**
      18             :      * User identity information in the system
      19             :      */
      20             :     class Account : public ModelPrimitive<Account> {
      21             :      public:
      22             :       /**
      23             :        * @return Identity of user, for fetching data
      24             :        */
      25             :       virtual const types::AccountIdType &accountId() const = 0;
      26             : 
      27             :       /**
      28             :        * @return Identity of domain, for fetching data
      29             :        */
      30             :       virtual const types::DomainIdType &domainId() const = 0;
      31             : 
      32             :       /**
      33             :        * @return Minimum quorum of signatures needed for transactions
      34             :        */
      35             :       virtual types::QuorumType quorum() const = 0;
      36             : 
      37             :       /**
      38             :        * @return JSON data stored in account
      39             :        */
      40             :       virtual const types::JsonType &jsonData() const = 0;
      41             : 
      42             :       /**
      43             :        * Stringify the data.
      44             :        * @return the content of account asset.
      45             :        */
      46             :       std::string toString() const override {
      47           0 :         return detail::PrettyStringBuilder()
      48           0 :             .init("Account")
      49           0 :             .append("accountId", accountId())
      50           0 :             .append("domainId", domainId())
      51           0 :             .append("quorum", std::to_string(quorum()))
      52           0 :             .append("json", jsonData())
      53           0 :             .finalize();
      54           0 :       }
      55             : 
      56             :       /**
      57             :        * Checks equality of objects inside
      58             :        * @param rhs - other wrapped value
      59             :        * @return true, if wrapped objects are same
      60             :        */
      61             :       bool operator==(const Account &rhs) const override {
      62           1 :         return accountId() == rhs.accountId() and domainId() == rhs.domainId()
      63           1 :             and quorum() == rhs.quorum() and jsonData() == rhs.jsonData();
      64             :       }
      65             :     };
      66             :   }  // namespace interface
      67             : }  // namespace shared_model
      68             : #endif  // IROHA_SHARED_MODEL_ACCOUNT_HPP

Generated by: LCOV version 1.13