Bitcoin Core
23.99.0
P2P Digital Currency
src
init
bitcoin-gui.cpp
Go to the documentation of this file.
1
// Copyright (c) 2021 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <
interfaces/chain.h
>
6
#include <
interfaces/echo.h
>
7
#include <
interfaces/init.h
>
8
#include <
interfaces/ipc.h
>
9
#include <
interfaces/node.h
>
10
#include <
interfaces/wallet.h
>
11
#include <
node/context.h
>
12
#include <
util/check.h
>
13
#include <
util/system.h
>
14
15
#include <memory>
16
17
namespace
init
{
18
namespace
{
19
const
char
* EXE_NAME =
"bitcoin-gui"
;
20
21
class
BitcoinGuiInit :
public
interfaces::Init
22
{
23
public
:
24
BitcoinGuiInit(
const
char
* arg0) :
m_ipc
(
interfaces::MakeIpc
(EXE_NAME, arg0, *
this
))
25
{
26
m_node
.
args
= &
gArgs
;
27
m_node
.
init
=
this
;
28
}
29
std::unique_ptr<interfaces::Node> makeNode()
override
{
return
interfaces::MakeNode
(
m_node
); }
30
std::unique_ptr<interfaces::Chain> makeChain()
override
{
return
interfaces::MakeChain
(
m_node
); }
31
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(
interfaces::Chain
& chain)
override
32
{
33
return
MakeWalletLoader
(chain, *
Assert
(
m_node
.
args
));
34
}
35
std::unique_ptr<interfaces::Echo> makeEcho()
override
{
return
interfaces::MakeEcho
(); }
36
interfaces::Ipc
*
ipc
()
override
{
return
m_ipc
.get(); }
37
node::NodeContext
m_node
;
38
std::unique_ptr<interfaces::Ipc>
m_ipc
;
39
};
40
}
// namespace
41
}
// namespace init
42
43
namespace
interfaces
{
44
std::unique_ptr<Init>
MakeGuiInit
(
int
argc,
char
* argv[])
45
{
46
return
std::make_unique<init::BitcoinGuiInit>(argc > 0 ? argv[0] :
""
);
47
}
48
}
// namespace interfaces
interfaces::MakeChain
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
Definition:
interfaces.cpp:777
interfaces
Definition:
dummywallet.cpp:10
check.h
interfaces::MakeIpc
std::unique_ptr< Ipc > MakeIpc(const char *exe_name, const char *process_argv0, Init &init)
Return implementation of Ipc interface.
Definition:
interfaces.cpp:74
ipc
Definition:
ipc.h:12
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition:
context.h:43
m_node
node::NodeContext m_node
Definition:
bitcoin-gui.cpp:37
interfaces::Init
Initial interface created when a process is first started, and used to give and get access to other i...
Definition:
init.h:28
chain.h
context.h
interfaces::MakeGuiInit
std::unique_ptr< Init > MakeGuiInit(int argc, char *argv[])
Return implementation of Init interface for the gui process.
Definition:
bitcoin-gui.cpp:44
Assert
#define Assert(val)
Identity function.
Definition:
check.h:74
m_ipc
std::unique_ptr< interfaces::Ipc > m_ipc
Definition:
bitcoin-gui.cpp:38
interfaces::Chain
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition:
chain.h:94
echo.h
node.h
interfaces::MakeNode
std::unique_ptr< Node > MakeNode(node::NodeContext &context)
Return implementation of Node interface.
Definition:
interfaces.cpp:776
init.h
node::NodeContext::init
interfaces::Init * init
Init interface for initializing current process and connecting to other processes.
Definition:
context.h:47
interfaces::MakeEcho
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
Definition:
echo.cpp:17
gArgs
ArgsManager gArgs
Definition:
system.cpp:93
ipc.h
node::NodeContext::args
ArgsManager * args
Definition:
context.h:56
system.h
init
Definition:
bitcoin-gui.cpp:17
wallet.h
interfaces::MakeWalletLoader
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet loader.
Definition:
dummywallet.cpp:62
interfaces::Ipc
Interface providing access to interprocess-communication (IPC) functionality.
Definition:
ipc.h:44
Generated on Sun Jun 26 2022 02:45:24 for Bitcoin Core by
1.8.17