1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-22 08:16:42 +00:00

Introduces a multimachine to handle multi-target static analyser outputs.

Non-functional as of yet.
This commit is contained in:
Thomas Harte
2018-01-28 22:22:21 -05:00
parent e025674eb2
commit d493ea4bca
11 changed files with 154 additions and 21 deletions
@@ -0,0 +1,38 @@
//
// MultiMachine.cpp
// Clock Signal
//
// Created by Thomas Harte on 28/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#include "MultiMachine.hpp"
using namespace Analyser::Dynamic;
MultiMachine::MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines) :
machines_(std::move(machines)) {}
ConfigurationTarget::Machine *MultiMachine::configuration_target() {
return nullptr;
}
CRTMachine::Machine *MultiMachine::crt_machine() {
return nullptr;
}
JoystickMachine::Machine *MultiMachine::joystick_machine() {
return nullptr;
}
KeyboardMachine::Machine *MultiMachine::keyboard_machine() {
return nullptr;
}
Configurable::Device *MultiMachine::configurable_device() {
return nullptr;
}
Utility::TypeRecipient *MultiMachine::type_recipient() {
return nullptr;
}
@@ -0,0 +1,50 @@
//
// MultiMachine.hpp
// Clock Signal
//
// Created by Thomas Harte on 28/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#ifndef MultiMachine_hpp
#define MultiMachine_hpp
#include "../../../Machines/Utility/MachineForTarget.hpp"
#include <memory>
#include <vector>
namespace Analyser {
namespace Dynamic {
/*!
Provides the same interface as to a single machine, while multiplexing all
underlying calls to an array of real dynamic machines.
Calls to crt_machine->get_crt will return that for the first machine.
Following each crt_machine->run_for, reorders the supplied machines by
confidence.
If confidence for any machine becomes disproportionately low compared to
the others in the set, that machine is removed from the array.
*/
class MultiMachine: public ::Machine::DynamicMachine {
public:
MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines);
ConfigurationTarget::Machine *configuration_target() override;
CRTMachine::Machine *crt_machine() override;
JoystickMachine::Machine *joystick_machine() override;
KeyboardMachine::Machine *keyboard_machine() override;
Configurable::Device *configurable_device() override;
Utility::TypeRecipient *type_recipient() override;
private:
std::vector<std::unique_ptr<DynamicMachine>> machines_;
};
}
}
#endif /* MultiMachine_hpp */