hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
pb_common.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_PB_COMMON_HPP
7 #define IROHA_PB_COMMON_HPP
8 
9 #include "commands.pb.h"
11 #include "model/account.hpp"
12 #include "model/account_asset.hpp"
13 #include "model/asset.hpp"
14 #include "model/domain.hpp"
15 #include "model/peer.hpp"
16 #include "model/signature.hpp"
17 #include "qry_responses.pb.h"
18 
19 namespace iroha {
20  namespace model {
21  namespace converters {
22  // peer
23  protocol::Peer serializePeer(iroha::model::Peer iroha_peer);
24  iroha::model::Peer deserializePeer(protocol::Peer pb_peer);
25 
26  iroha::protocol::Account serializeAccount(
27  const iroha::model::Account &account);
28  iroha::protocol::Asset serializeAsset(const iroha::model::Asset &asset);
29  iroha::protocol::AccountAsset serializeAccountAsset(
30  const iroha::model::AccountAsset &account_asset);
31  iroha::protocol::Domain serializeDomain(
32  const iroha::model::Domain &domain);
33  } // namespace converters
34  } // namespace model
35 
42  template <typename T>
43  hash256_t hash(const T &pb) {
44  return sha3_256(pb.payload().SerializeAsString());
45  }
46 } // namespace iroha
47 
48 #endif // IROHA_PB_COMMON_HPP
Definition: account_asset.hpp:16
iroha::protocol::Domain serializeDomain(const iroha::model::Domain &domain)
Definition: pb_common.cpp:65
iroha::model::Peer deserializePeer(protocol::Peer pb_peer)
Definition: pb_common.cpp:25
Definition: asset.hpp:17
iroha::protocol::AccountAsset serializeAccountAsset(const iroha::model::AccountAsset &account_asset)
Definition: pb_common.cpp:56
Definition: block_query.hpp:16
Definition: peer.hpp:17
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
void sha3_256(uint8_t *output, const uint8_t *input, size_t in_size)
Definition: sha3_hash.cpp:13
Definition: account.hpp:17
Definition: blob.hpp:49
Definition: domain.hpp:16
iroha::protocol::Account serializeAccount(const iroha::model::Account &account)
Definition: pb_common.cpp:38
protocol::Peer serializePeer(iroha::model::Peer iroha_peer)
Definition: pb_common.cpp:18
iroha::protocol::Asset serializeAsset(const iroha::model::Asset &asset)
Definition: pb_common.cpp:48