LCOV - code coverage report
Current view: top level - irohad/consensus/yac - vote_message.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 2 2 100.0 %
Date: 2019-03-07 14:46:43 Functions: 11 11 100.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_VOTE_MESSAGE_HPP
       7             : #define IROHA_VOTE_MESSAGE_HPP
       8             : 
       9             : #include <memory>
      10             : 
      11             : #include "consensus/yac/yac_hash_provider.hpp"  // for YacHash
      12             : #include "interfaces/common_objects/signature.hpp"
      13             : #include "utils/string_builder.hpp"
      14             : 
      15             : namespace iroha {
      16             :   namespace consensus {
      17             :     namespace yac {
      18             : 
      19             :       /**
      20             :        * VoteMessage represents voting for some block;
      21             :        */
      22             :       struct VoteMessage {
      23             :         YacHash hash;
      24             :         std::shared_ptr<shared_model::interface::Signature> signature;
      25             : 
      26             :         bool operator==(const VoteMessage &rhs) const {
      27        5605 :           return hash == rhs.hash and *signature == *rhs.signature;
      28             :         }
      29             : 
      30             :         bool operator!=(const VoteMessage &rhs) const {
      31         569 :           return not(*this == rhs);
      32             :         }
      33             : 
      34             :         std::string toString() const {
      35             :           return shared_model::detail::PrettyStringBuilder()
      36             :               .init("VoteMessage")
      37             :               .append("yac hash", hash.toString())
      38             :               .append("signature",
      39             :                       signature ? signature->toString() : "not set")
      40             :               .finalize();
      41             :         }
      42             :       };
      43             : 
      44             :     }  // namespace yac
      45             :   }    // namespace consensus
      46             : }  // namespace iroha
      47             : 
      48             : #endif  // IROHA_VOTE_MESSAGE_HPP

Generated by: LCOV version 1.13