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_roles_response.hpp"
7 : #include <boost/range/numeric.hpp>
8 :
9 : namespace shared_model {
10 : namespace proto {
11 :
12 : template <typename QueryResponseType>
13 : RolesResponse::RolesResponse(QueryResponseType &&queryResponse)
14 14 : : CopyableProto(std::forward<QueryResponseType>(queryResponse)),
15 14 : rolesResponse_{proto_->roles_response()},
16 : roles_{[this] {
17 6 : return boost::accumulate(rolesResponse_.roles(),
18 6 : RolesIdType{},
19 : [](auto &&roles, const auto &role) {
20 16 : roles.emplace_back(role);
21 16 : return std::move(roles);
22 : });
23 14 : }} {}
24 :
25 : template RolesResponse::RolesResponse(RolesResponse::TransportType &);
26 : template RolesResponse::RolesResponse(const RolesResponse::TransportType &);
27 : template RolesResponse::RolesResponse(RolesResponse::TransportType &&);
28 :
29 : RolesResponse::RolesResponse(const RolesResponse &o)
30 0 : : RolesResponse(o.proto_) {}
31 :
32 : RolesResponse::RolesResponse(RolesResponse &&o)
33 14 : : RolesResponse(std::move(o.proto_)) {}
34 :
35 : const RolesResponse::RolesIdType &RolesResponse::roles() const {
36 8 : return *roles_;
37 : }
38 :
39 : } // namespace proto
40 : } // namespace shared_model
|