Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2017 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_ACCOUNT_HPP
19 : #define IROHA_SHARED_MODEL_PROTO_ACCOUNT_HPP
20 :
21 : #include "backend/protobuf/common_objects/trivial_proto.hpp"
22 : #include "backend/protobuf/util.hpp"
23 : #include "interfaces/common_objects/account.hpp"
24 : #include "qry_responses.pb.h"
25 : #include "utils/lazy_initializer.hpp"
26 :
27 : namespace shared_model {
28 : namespace proto {
29 : class Account final : public CopyableProto<interface::Account,
30 : iroha::protocol::Account,
31 : Account> {
32 : public:
33 : template <typename AccountType>
34 : explicit Account(AccountType &&account)
35 524 : : CopyableProto(std::forward<AccountType>(account)) {}
36 :
37 : Account(const Account &o) : Account(o.proto_) {}
38 :
39 : Account(Account &&o) noexcept : Account(std::move(o.proto_)) {}
40 :
41 : const interface::types::AccountIdType &accountId() const override {
42 561 : return proto_->account_id();
43 : }
44 :
45 : const interface::types::DomainIdType &domainId() const override {
46 68 : return proto_->domain_id();
47 : }
48 :
49 : interface::types::QuorumType quorum() const override {
50 58 : return proto_->quorum();
51 : }
52 :
53 : const interface::types::JsonType &jsonData() const override {
54 43 : return proto_->json_data();
55 : }
56 :
57 : private:
58 : template <typename T>
59 : using Lazy = detail::LazyInitializer<T>;
60 : };
61 : } // namespace proto
62 : } // namespace shared_model
63 :
64 : #endif // IROHA_SHARED_MODEL_PROTO_ACCOUNT_HPP
|