LCOV - code coverage report
Current view: top level - shared_model/backend/protobuf - util.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 5 5 100.0 %
Date: 2019-03-07 14:46:43 Functions: 12 12 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_SHARED_MODEL_PROTO_UTIL_HPP
       7             : #define IROHA_SHARED_MODEL_PROTO_UTIL_HPP
       8             : 
       9             : #include <google/protobuf/message.h>
      10             : #include <vector>
      11             : #include "cryptography/blob.hpp"
      12             : 
      13             : namespace shared_model {
      14             :   namespace proto {
      15             : 
      16             :     template <typename T>
      17             :     crypto::Blob makeBlob(T &&message) {
      18       33417 :       crypto::Blob::Bytes data;
      19       33417 :       data.resize(message.ByteSizeLong());
      20       33533 :       message.SerializeToArray(data.data(), data.size());
      21       33665 :       return crypto::Blob(std::move(data));
      22       33665 :     }
      23             : 
      24             :   }  // namespace proto
      25             : }  // namespace shared_model
      26             : 
      27             : #endif  // IROHA_SHARED_MODEL_PROTO_UTIL_HPP

Generated by: LCOV version 1.13