Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
rpc
command.h
Go to the documentation of this file.
1
// Copyright (c) 2018-2019 The Bitcoin 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
#ifndef BITCOIN_RPC_COMMAND_H
6
#define BITCOIN_RPC_COMMAND_H
7
8
#include <
univalue.h
>
9
10
#include <string>
11
12
class
JSONRPCRequest
;
13
20
class
RPCCommand
{
21
private
:
22
const
std::string
name
;
23
24
/*
25
* Child classes should define dependencies as private members.
26
* These dependencies must not be changed, or successive calls to the same
27
* command will give unexpected behavior.
28
*/
29
30
// TODO: Parameter definitions (these will be used to generate help
31
// messages as well)
32
33
public
:
34
RPCCommand
(
const
std::string &
nameIn
) :
name
(
nameIn
) {}
35
virtual
~RPCCommand
() {}
36
37
RPCCommand
(
const
RPCCommand
&) =
delete
;
38
RPCCommand
&
operator=
(
const
RPCCommand
&) =
delete
;
39
45
virtual
UniValue
Execute
(
const
JSONRPCRequest
&request)
const
= 0;
46
47
const
std::string &
GetName
()
const
{
return
name
; };
48
};
49
54
class
RPCCommandWithArgsContext
:
public
RPCCommand
{
55
public
:
56
RPCCommandWithArgsContext
(
const
std::string &
nameIn
) :
RPCCommand
(
nameIn
) {}
57
58
virtual
UniValue
Execute
(
const
UniValue
&args)
const
= 0;
59
60
UniValue
Execute
(
const
JSONRPCRequest
&request)
const
final
;
61
};
62
63
#endif
// BITCOIN_RPC_COMMAND_H
JSONRPCRequest
Definition
request.h:30
RPCCommand
Base class for all RPC commands.
Definition
command.h:20
RPCCommand::RPCCommand
RPCCommand(const std::string &nameIn)
Definition
command.h:34
RPCCommand::GetName
const std::string & GetName() const
Definition
command.h:47
RPCCommand::name
const std::string name
Definition
command.h:22
RPCCommand::RPCCommand
RPCCommand(const RPCCommand &)=delete
RPCCommand::Execute
virtual UniValue Execute(const JSONRPCRequest &request) const =0
It is recommended to override Execute(JSONRPCRequest) only if the entire request context is required.
RPCCommand::~RPCCommand
virtual ~RPCCommand()
Definition
command.h:35
RPCCommand::operator=
RPCCommand & operator=(const RPCCommand &)=delete
RPCCommandWithArgsContext
By default, use RPCCommandWithArgsContext as the parent class for new RPC command classes that only d...
Definition
command.h:54
RPCCommandWithArgsContext::RPCCommandWithArgsContext
RPCCommandWithArgsContext(const std::string &nameIn)
Definition
command.h:56
RPCCommandWithArgsContext::Execute
virtual UniValue Execute(const UniValue &args) const =0
UniValue
Definition
univalue.h:25
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
univalue.h
Generated on Sat Nov 23 2024 02:38:00 for Bitcoin ABC by
1.9.8