LCOV - code coverage report
Current view: top level - shared_model/interfaces/base - model_primitive.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 1 6 16.7 %
Date: 2018-12-05 17:11:35 Functions: 185 497 37.2 %

          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_MODEL_PRIMITIVE_HPP
      19             : #define IROHA_MODEL_PRIMITIVE_HPP
      20             : 
      21             : #include <ciso646>
      22             : 
      23             : #include "utils/string_builder.hpp"
      24             : #include "common/cloneable.hpp"
      25             : 
      26             : namespace shared_model {
      27             :   namespace interface {
      28             :     /**
      29             :      * ModelPrimitive is a base class of whole domain objects in system.
      30             :      * This class required for guarantee consistent interface on all shared
      31             :      * model objects.
      32             :      * @tparam Model - your new style model
      33             :      */
      34             :     template <typename Model>
      35             :     class ModelPrimitive : public Cloneable<ModelPrimitive<Model>> {
      36             :      public:
      37             :       /**
      38             :        * Reference for model type.
      39             :        */
      40             :       using ModelType = Model;
      41             : 
      42             :       /**
      43             :        * Make string developer representation of object
      44             :        * @return string with internal state of object
      45             :        */
      46             :       virtual std::string toString() const {
      47           0 :         return detail::PrettyStringBuilder()
      48           0 :             .init("Primitive")
      49           0 :             .append("address", std::to_string(reinterpret_cast<uint64_t>(this)))
      50           0 :             .finalize();
      51           0 :       }
      52             : 
      53             :       virtual bool operator==(const ModelType &rhs) const = 0;
      54             : 
      55             :       virtual bool operator!=(const ModelType &rhs) const {
      56          22 :         return not(*this == rhs);
      57             :       }
      58             : 
      59             :       virtual ~ModelPrimitive() = default;
      60             :     };
      61             :   }  // namespace interface
      62             : }  // namespace shared_model
      63             : #endif  // IROHA_MODEL_PRIMITIVE_HPP

Generated by: LCOV version 1.13