LCOV - code coverage report
Current view: top level - shared_model/interfaces/common_objects - asset.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 0 9 0.0 %
Date: 2019-03-07 14:46:43 Functions: 2 6 33.3 %

          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_ASSET_HPP
       7             : #define IROHA_SHARED_MODEL_ASSET_HPP
       8             : 
       9             : #include "interfaces/base/model_primitive.hpp"
      10             : #include "interfaces/common_objects/types.hpp"
      11             : #include "utils/string_builder.hpp"
      12             : 
      13             : namespace shared_model {
      14             :   namespace interface {
      15             : 
      16             :     /**
      17             :      * Representation of valuable goods in the system
      18             :      */
      19             :     class Asset : public ModelPrimitive<Asset> {
      20             :      public:
      21             :       /**
      22             :        * @return Identity of asset
      23             :        */
      24             :       virtual const types::AccountIdType &assetId() const = 0;
      25             : 
      26             :       /**
      27             :        * @return Identity of domain
      28             :        */
      29             :       virtual const types::DomainIdType &domainId() const = 0;
      30             : 
      31             :       /**
      32             :        * @return Asset's fixed precision
      33             :        */
      34             :       virtual types::PrecisionType precision() const = 0;
      35             : 
      36             :       /**
      37             :        * Stringify the data.
      38             :        * @return the content of asset.
      39             :        */
      40             :       std::string toString() const override {
      41           0 :         return detail::PrettyStringBuilder()
      42           0 :             .init("Asset")
      43           0 :             .append("assetId", assetId())
      44           0 :             .append("domainId", domainId())
      45           0 :             .append("precision", std::to_string(precision()))
      46           0 :             .finalize();
      47           0 :       }
      48             : 
      49             :       /**
      50             :        * Checks equality of objects inside
      51             :        * @param rhs - other wrapped value
      52             :        * @return true, if wrapped objects are same
      53             :        */
      54             :       bool operator==(const ModelType &rhs) const override {
      55           0 :         return assetId() == rhs.assetId() and domainId() == rhs.domainId()
      56           0 :             and precision() == rhs.precision();
      57             :       }
      58             :     };
      59             :   }  // namespace interface
      60             : }  // namespace shared_model
      61             : #endif  // IROHA_SHARED_MODEL_ASSET_HPP

Generated by: LCOV version 1.13