ledger-core
WalletPoolBuilder.hpp
1 /*
2  *
3  * WalletPoolBuilder
4  * ledger-core
5  *
6  * Created by Pierre Pollastri on 15/11/2016.
7  *
8  * The MIT License (MIT)
9  *
10  * Copyright (c) 2016 Ledger
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a copy
13  * of this software and associated documentation files (the "Software"), to deal
14  * in the Software without restriction, including without limitation the rights
15  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16  * copies of the Software, and to permit persons to whom the Software is
17  * furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included in all
20  * copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28  * SOFTWARE.
29  *
30  */
31 #ifndef LEDGER_CORE_WALLETPOOLBUILDER_HPP
32 #define LEDGER_CORE_WALLETPOOLBUILDER_HPP
33 
34 #include <unordered_map>
35 
36 #include <api/WalletPoolBuilder.hpp>
37 #include <api/WalletPool.hpp>
38 #include <utils/optional.hpp>
39 
40 namespace ledger {
41 
42  namespace core {
43  class WalletPoolBuilder : public api::WalletPoolBuilder, public std::enable_shared_from_this<WalletPoolBuilder> {
44 
45  public:
46  virtual std::shared_ptr<api::WalletPoolBuilder> setPassword(const std::string &password) override;
47 
49 
50  virtual std::shared_ptr<api::WalletPoolBuilder>
51  setHttpClient(const std::shared_ptr<api::HttpClient> &client) override;
52 
53  virtual std::shared_ptr<api::WalletPoolBuilder>
54  setWebsocketClient(const std::shared_ptr<api::WebSocketClient> &client) override;
55 
56  virtual std::shared_ptr<api::WalletPoolBuilder>
57  setPathResolver(const std::shared_ptr<api::PathResolver> &pathResolver) override;
58 
59  virtual std::shared_ptr<api::WalletPoolBuilder>
60  setLogPrinter(const std::shared_ptr<api::LogPrinter> &printer) override;
61 
62  virtual std::shared_ptr<api::WalletPoolBuilder>
63  setThreadDispatcher(const std::shared_ptr<api::ThreadDispatcher> &dispatcher) override;
64 
65  virtual std::shared_ptr<api::WalletPoolBuilder> setName(const std::string &name) override;
66 
67  virtual std::shared_ptr<api::WalletPoolBuilder>
68  setRandomNumberGenerator(const std::shared_ptr<api::RandomNumberGenerator> &rng) override;
69 
70  virtual std::shared_ptr<api::WalletPoolBuilder>
71  setDatabaseBackend(const std::shared_ptr<api::DatabaseBackend> &backend) override;
72 
73  virtual std::shared_ptr <api::WalletPoolBuilder>
74  setConfiguration(const std::shared_ptr<api::DynamicObject> &configuration) override;
75 
76  virtual void build(const std::shared_ptr<api::WalletPoolCallback> &listener) override;
77 
78  private:
79  std::shared_ptr<api::HttpClient> _httpClient;
80  std::shared_ptr<api::WebSocketClient> _webSocketClient;
81  std::shared_ptr<api::PathResolver> _pathResolver;
82  std::shared_ptr<api::LogPrinter> _logPrinter;
83  std::shared_ptr<api::ThreadDispatcher> _dispatcher;
84  std::string _name;
85  std::string _password;
86  std::shared_ptr<api::RandomNumberGenerator> _rng;
87  std::shared_ptr<api::DatabaseBackend> _backend;
88  std::shared_ptr<api::DynamicObject> _configuration;
89  };
90  }
91 }
92 
93 
94 #endif //LEDGER_CORE_WALLETPOOLBUILDER_HPP
virtual std::shared_ptr< api::WalletPoolBuilder > setPassword(const std::string &password) override
Definition: WalletPoolBuilder.cpp:76
Definition: WalletPoolBuilder.hpp:43
Definition: WalletPoolBuilder.hpp:30
Definition: Account.cpp:8
virtual std::shared_ptr< api::WalletPoolBuilder > setName(const std::string &name) override
Definition: WalletPoolBuilder.cpp:71