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