Added classes Process and Arguments.
This commit is contained in:
parent
0450c31449
commit
f4d2dec628
18 changed files with 373 additions and 82 deletions
|
@ -139,9 +139,9 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
|||
}
|
||||
|
||||
|
||||
xmrig::Config *xmrig::Config::load(int argc, char **argv, IConfigListener *listener)
|
||||
xmrig::Config *xmrig::Config::load(Process *process, IConfigListener *listener)
|
||||
{
|
||||
return static_cast<Config*>(ConfigLoader::load(argc, argv, new ConfigCreator(), listener));
|
||||
return static_cast<Config*>(ConfigLoader::load(process, new ConfigCreator(), listener));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,16 +35,13 @@
|
|||
#include "workers/CpuThread.h"
|
||||
|
||||
|
||||
class Addr;
|
||||
class Url;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class ConfigLoader;
|
||||
class IThread;
|
||||
class IConfigListener;
|
||||
class Process;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -85,7 +82,7 @@ public:
|
|||
inline int64_t affinity() const { return m_threads.mask; }
|
||||
inline ThreadsMode threadsMode() const { return m_threads.mode; }
|
||||
|
||||
static Config *load(int argc, char **argv, IConfigListener *listener);
|
||||
static Config *load(Process *process, IConfigListener *listener);
|
||||
|
||||
protected:
|
||||
bool finalize() override;
|
||||
|
|
|
@ -46,8 +46,9 @@
|
|||
class xmrig::ControllerPrivate
|
||||
{
|
||||
public:
|
||||
inline ControllerPrivate() :
|
||||
inline ControllerPrivate(Process *process) :
|
||||
network(nullptr),
|
||||
process(process),
|
||||
config(nullptr)
|
||||
{}
|
||||
|
||||
|
@ -60,13 +61,14 @@ public:
|
|||
|
||||
|
||||
Network *network;
|
||||
Process *process;
|
||||
std::vector<xmrig::IControllerListener *> listeners;
|
||||
xmrig::Config *config;
|
||||
};
|
||||
|
||||
|
||||
xmrig::Controller::Controller()
|
||||
: d_ptr(new ControllerPrivate())
|
||||
xmrig::Controller::Controller(Process *process)
|
||||
: d_ptr(new ControllerPrivate(process))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -99,11 +101,11 @@ xmrig::Config *xmrig::Controller::config() const
|
|||
}
|
||||
|
||||
|
||||
int xmrig::Controller::init(int argc, char **argv)
|
||||
int xmrig::Controller::init()
|
||||
{
|
||||
Cpu::init();
|
||||
|
||||
d_ptr->config = xmrig::Config::load(argc, argv, this);
|
||||
d_ptr->config = xmrig::Config::load(d_ptr->process, this);
|
||||
if (!d_ptr->config) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -39,18 +39,19 @@ namespace xmrig {
|
|||
class Config;
|
||||
class ControllerPrivate;
|
||||
class IControllerListener;
|
||||
class Process;
|
||||
|
||||
|
||||
class Controller : public IConfigListener
|
||||
{
|
||||
public:
|
||||
Controller();
|
||||
Controller(Process *process);
|
||||
~Controller() override;
|
||||
|
||||
bool isDone() const;
|
||||
bool isReady() const;
|
||||
Config *config() const;
|
||||
int init(int argc, char **argv);
|
||||
int init();
|
||||
Network *network() const;
|
||||
void addListener(IControllerListener *listener);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue