LCOV - code coverage report
Current view: top level - shared_model/backend/protobuf/common_objects - asset.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 4 4 100.0 %
Date: 2018-12-05 17:11:35 Functions: 13 13 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
       3             :  * http://soramitsu.co.jp
       4             :  *
       5             :  * Licensed under the Apache License, Version 2.0 (the "License");
       6             :  * you may not use this file except in compliance with the License.
       7             :  * You may obtain a copy of the License at
       8             :  *
       9             :  *        http://www.apache.org/licenses/LICENSE-2.0
      10             :  *
      11             :  * Unless required by applicable law or agreed to in writing, software
      12             :  * distributed under the License is distributed on an "AS IS" BASIS,
      13             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14             :  * See the License for the specific language governing permissions and
      15             :  * limitations under the License.
      16             :  */
      17             : 
      18             : #ifndef IROHA_SHARED_MODEL_PROTO_ASSET_HPP
      19             : #define IROHA_SHARED_MODEL_PROTO_ASSET_HPP
      20             : 
      21             : #include "backend/protobuf/common_objects/trivial_proto.hpp"
      22             : #include "backend/protobuf/util.hpp"
      23             : #include "interfaces/common_objects/asset.hpp"
      24             : #include "qry_responses.pb.h"
      25             : #include "utils/lazy_initializer.hpp"
      26             : 
      27             : namespace shared_model {
      28             :   namespace proto {
      29             :     class Asset final : public CopyableProto<interface::Asset,
      30             :                                              iroha::protocol::Asset,
      31             :                                              Asset> {
      32             :      public:
      33             :       template <typename AssetType>
      34             :       explicit Asset(AssetType &&account)
      35          50 :           : CopyableProto(std::forward<AssetType>(account)) {}
      36             : 
      37             :       Asset(const Asset &o) : Asset(o.proto_) {}
      38             : 
      39             :       Asset(Asset &&o) noexcept : Asset(std::move(o.proto_)) {}
      40             : 
      41             :       const interface::types::AssetIdType &assetId() const override {
      42          19 :         return proto_->asset_id();
      43             :       }
      44             : 
      45             :       const interface::types::DomainIdType &domainId() const override {
      46          17 :         return proto_->domain_id();
      47             :       }
      48             : 
      49             :       interface::types::PrecisionType precision() const override {
      50          14 :         return proto_->precision();
      51             :       }
      52             : 
      53             :      private:
      54             :       template <typename T>
      55             :       using Lazy = detail::LazyInitializer<T>;
      56             :     };
      57             :   }  // namespace proto
      58             : }  // namespace shared_model
      59             : 
      60             : #endif  // IROHA_SHARED_MODEL_PROTO_ASSET_HPP

Generated by: LCOV version 1.13