Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include "backend/protobuf/query_responses/proto_signatories_response.hpp"
7 :
8 : #include <boost/range/numeric.hpp>
9 : #include "cryptography/hash.hpp"
10 :
11 : namespace shared_model {
12 : namespace proto {
13 :
14 : template <typename QueryResponseType>
15 : SignatoriesResponse::SignatoriesResponse(QueryResponseType &&queryResponse)
16 25 : : CopyableProto(std::forward<QueryResponseType>(queryResponse)),
17 25 : signatories_response_{proto_->signatories_response()},
18 : keys_{[this] {
19 25 : return boost::accumulate(
20 25 : signatories_response_.keys(),
21 25 : interface::types::PublicKeyCollectionType{},
22 : [](auto acc, auto key) {
23 88 : acc.emplace_back(crypto::Hash::fromHexString(key));
24 88 : return acc;
25 0 : });
26 25 : }()} {}
27 :
28 : template SignatoriesResponse::SignatoriesResponse(
29 : SignatoriesResponse::TransportType &);
30 : template SignatoriesResponse::SignatoriesResponse(
31 : const SignatoriesResponse::TransportType &);
32 : template SignatoriesResponse::SignatoriesResponse(
33 : SignatoriesResponse::TransportType &&);
34 :
35 : SignatoriesResponse::SignatoriesResponse(const SignatoriesResponse &o)
36 0 : : SignatoriesResponse(o.proto_) {}
37 :
38 : SignatoriesResponse::SignatoriesResponse(SignatoriesResponse &&o)
39 25 : : SignatoriesResponse(std::move(o.proto_)) {}
40 :
41 : const interface::types::PublicKeyCollectionType &SignatoriesResponse::keys()
42 : const {
43 16 : return keys_;
44 : }
45 :
46 : } // namespace proto
47 : } // namespace shared_model
|