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_block_query_response.hpp"
7 :
8 : #include "utils/variant_deserializer.hpp"
9 :
10 : namespace shared_model {
11 : namespace proto {
12 :
13 : template <typename QueryResponseType>
14 : BlockQueryResponse::BlockQueryResponse(QueryResponseType &&queryResponse)
15 731 : : CopyableProto(std::forward<QueryResponseType>(queryResponse)),
16 : variant_{[this] {
17 731 : auto &&ar = *proto_;
18 731 : int which = ar.GetDescriptor()
19 731 : ->FindFieldByNumber(ar.response_case())
20 731 : ->index();
21 731 : return shared_model::detail::variant_impl<
22 : ProtoQueryResponseVariantType::types>::
23 : template load<ProtoQueryResponseVariantType>(
24 731 : std::forward<decltype(ar)>(ar), which);
25 : }()},
26 731 : ivariant_{variant_} {}
27 :
28 : template BlockQueryResponse::BlockQueryResponse(
29 : BlockQueryResponse::TransportType &);
30 : template BlockQueryResponse::BlockQueryResponse(
31 : const BlockQueryResponse::TransportType &);
32 : template BlockQueryResponse::BlockQueryResponse(
33 : BlockQueryResponse::TransportType &&);
34 :
35 : BlockQueryResponse::BlockQueryResponse(const BlockQueryResponse &o)
36 0 : : BlockQueryResponse(o.proto_) {}
37 :
38 : BlockQueryResponse::BlockQueryResponse(BlockQueryResponse &&o) noexcept
39 0 : : BlockQueryResponse(std::move(o.proto_)) {}
40 :
41 : const BlockQueryResponse::QueryResponseVariantType &
42 : BlockQueryResponse::get() const {
43 9 : return ivariant_;
44 : }
45 :
46 : } // namespace proto
47 : } // namespace shared_model
|