Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2018 All Rights Reserved.
3 : * http://soramitsu.co.jp
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #ifndef IROHA_SHARED_MODEL_PROTO_DOMAIN_HPP
19 : #define IROHA_SHARED_MODEL_PROTO_DOMAIN_HPP
20 :
21 : #include "backend/protobuf/common_objects/trivial_proto.hpp"
22 : #include "interfaces/common_objects/domain.hpp"
23 : #include "qry_responses.pb.h"
24 : #include "utils/lazy_initializer.hpp"
25 :
26 : namespace shared_model {
27 : namespace proto {
28 : class Domain final : public CopyableProto<interface::Domain,
29 : iroha::protocol::Domain,
30 : Domain> {
31 : public:
32 : template <typename DomainType>
33 : explicit Domain(DomainType &&domain)
34 383 : : CopyableProto(std::forward<DomainType>(domain)) {}
35 :
36 : Domain(const Domain &o) : Domain(o.proto_) {}
37 :
38 : Domain(Domain &&o) noexcept : Domain(std::move(o.proto_)) {}
39 :
40 : const interface::types::DomainIdType &domainId() const override {
41 967 : return proto_->domain_id();
42 : }
43 :
44 : const interface::types::RoleIdType &defaultRole() const override {
45 29 : return proto_->default_role();
46 : }
47 : };
48 : } // namespace proto
49 : } // namespace shared_model
50 :
51 : #endif // IROHA_SHARED_MODEL_PROTO_DOMAIN_HPP
|