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