LCOV - code coverage report
Current view: top level - shared_model/interfaces/common_objects - domain.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 0 8 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_DOMAIN_HPP
       7             : #define IROHA_SHARED_MODEL_DOMAIN_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             :      * Domain object represents administrative unit within the system
      18             :      */
      19             :     class Domain : public ModelPrimitive<Domain> {
      20             :      public:
      21             :       /**
      22             :        * @return Identity of domain
      23             :        */
      24             :       virtual const types::DomainIdType &domainId() const = 0;
      25             : 
      26             :       /**
      27             :        * @return Default role of domain
      28             :        */
      29             :       virtual const types::RoleIdType &defaultRole() const = 0;
      30             :       /**
      31             :        * Stringify the data.
      32             :        * @return the content of asset.
      33             :        */
      34             :       std::string toString() const override {
      35           0 :         return detail::PrettyStringBuilder()
      36           0 :             .init("Domain")
      37           0 :             .append("domainId", domainId())
      38           0 :             .append("defaultRole", defaultRole())
      39           0 :             .finalize();
      40           0 :       }
      41             : 
      42             :       /**
      43             :        * Checks equality of objects inside
      44             :        * @param rhs - other wrapped value
      45             :        * @return true, if wrapped objects are same
      46             :        */
      47             :       bool operator==(const ModelType &rhs) const override {
      48           0 :         return domainId() == rhs.domainId()
      49           0 :             and defaultRole() == rhs.defaultRole();
      50             :       }
      51             :     };
      52             :   }  // namespace interface
      53             : }  // namespace shared_model
      54             : 
      55             : #endif  // IROHA_SHARED_MODEL_DOMAIN_HPP

Generated by: LCOV version 1.13