2017-11-05 17:49:28 +00:00
|
|
|
//
|
|
|
|
// MachineForTarget.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/11/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-11-05 17:49:28 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef MachineForTarget_hpp
|
|
|
|
#define MachineForTarget_hpp
|
|
|
|
|
2018-01-25 02:48:44 +00:00
|
|
|
#include "../../Analyser/Static/StaticAnalyser.hpp"
|
2020-03-20 03:24:06 +00:00
|
|
|
#include "../../Reflection/Struct.hpp"
|
2017-11-05 17:49:28 +00:00
|
|
|
|
2018-01-30 02:49:49 +00:00
|
|
|
#include "../DynamicMachine.hpp"
|
2020-04-02 03:19:34 +00:00
|
|
|
#include "../ROMMachine.hpp"
|
2017-11-05 17:49:28 +00:00
|
|
|
|
2017-11-21 02:55:32 +00:00
|
|
|
#include <map>
|
2020-03-13 00:56:02 +00:00
|
|
|
#include <memory>
|
2017-11-06 01:12:01 +00:00
|
|
|
#include <string>
|
2018-01-24 03:18:16 +00:00
|
|
|
#include <vector>
|
2017-11-06 01:12:01 +00:00
|
|
|
|
2020-03-15 16:54:55 +00:00
|
|
|
/*!
|
2020-03-16 01:50:43 +00:00
|
|
|
This namespace acts as a grab-bag of functions that allow a client to:
|
|
|
|
|
|
|
|
(i) discover the total list of implemented machines;
|
|
|
|
(ii) discover the construction and runtime options available for controlling them; and
|
|
|
|
(iii) create any implemented machine via its construction options.
|
|
|
|
|
|
|
|
See Reflection::Struct and Reflection::Enum for getting dynamic information from the
|
|
|
|
Targets that this namespace deals in.
|
2020-03-15 16:54:55 +00:00
|
|
|
*/
|
2017-11-05 17:49:28 +00:00
|
|
|
namespace Machine {
|
|
|
|
|
2018-01-25 23:28:19 +00:00
|
|
|
enum class Error {
|
|
|
|
None,
|
2018-07-11 00:00:46 +00:00
|
|
|
UnknownError,
|
2018-01-25 23:28:19 +00:00
|
|
|
UnknownMachine,
|
2018-01-29 03:22:21 +00:00
|
|
|
MissingROM,
|
|
|
|
NoTargets
|
2018-01-25 23:28:19 +00:00
|
|
|
};
|
|
|
|
|
2017-11-05 17:49:28 +00:00
|
|
|
/*!
|
|
|
|
Allocates an instance of DynamicMachine holding a machine that can
|
2018-01-24 03:18:16 +00:00
|
|
|
receive the supplied static analyser result. The machine has been allocated
|
|
|
|
on the heap. It is the caller's responsibility to delete the class when finished.
|
2017-11-05 17:49:28 +00:00
|
|
|
*/
|
2018-04-14 23:46:38 +00:00
|
|
|
DynamicMachine *MachineForTargets(const Analyser::Static::TargetList &targets, const ::ROMMachine::ROMFetcher &rom_fetcher, Error &error);
|
2017-11-05 17:49:28 +00:00
|
|
|
|
2020-03-15 16:54:55 +00:00
|
|
|
/*!
|
|
|
|
Allocates an instance of DynamicMaachine holding the machine described
|
|
|
|
by @c target. It is the caller's responsibility to delete the class when finished.
|
|
|
|
*/
|
|
|
|
DynamicMachine *MachineForTarget(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher, Machine::Error &error);
|
|
|
|
|
2017-11-06 01:12:01 +00:00
|
|
|
/*!
|
|
|
|
Returns a short string name for the machine identified by the target,
|
|
|
|
which is guaranteed not to have any spaces or other potentially
|
|
|
|
filesystem-bothering contents.
|
|
|
|
*/
|
2018-01-25 02:48:44 +00:00
|
|
|
std::string ShortNameForTargetMachine(const Analyser::Machine target);
|
2017-11-21 02:55:32 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns a long string name for the machine identified by the target,
|
|
|
|
usable for presentation to a human.
|
|
|
|
*/
|
2018-01-25 02:48:44 +00:00
|
|
|
std::string LongNameForTargetMachine(const Analyser::Machine target);
|
2017-11-21 02:55:32 +00:00
|
|
|
|
2020-03-19 03:11:25 +00:00
|
|
|
enum class Type {
|
|
|
|
RequiresMedia,
|
|
|
|
DoesntRequireMedia,
|
|
|
|
Any
|
|
|
|
};
|
|
|
|
|
2020-03-15 04:15:19 +00:00
|
|
|
/*!
|
2020-03-19 03:11:25 +00:00
|
|
|
@param type the type of machines to include.
|
2020-03-16 01:50:43 +00:00
|
|
|
@param long_names If this is @c true then long names will be returned; otherwise short names will be returned.
|
|
|
|
|
|
|
|
@returns A list of all available machines. Names are always guaranteed to be in the same order.
|
2020-03-15 04:15:19 +00:00
|
|
|
*/
|
2020-03-19 03:11:25 +00:00
|
|
|
std::vector<std::string> AllMachines(Type type, bool long_names);
|
2020-03-15 04:15:19 +00:00
|
|
|
|
2017-11-21 02:55:32 +00:00
|
|
|
/*!
|
2020-03-16 01:50:43 +00:00
|
|
|
Returns a map from long machine name to the list of options that machine exposes, for all machines.
|
2017-11-21 02:55:32 +00:00
|
|
|
*/
|
2020-03-16 03:48:53 +00:00
|
|
|
std::map<std::string, std::unique_ptr<Reflection::Struct>> AllOptionsByMachineName();
|
2017-11-06 01:12:01 +00:00
|
|
|
|
2020-03-15 16:54:55 +00:00
|
|
|
/*!
|
|
|
|
Returns a map from long machine name to appropriate instances of Target for the machine.
|
|
|
|
|
|
|
|
NB: Usually the instances of Target can be dynamic_casted to Reflection::Struct in order to determine available properties.
|
|
|
|
*/
|
|
|
|
std::map<std::string, std::unique_ptr<Analyser::Static::Target>> TargetsByMachineName(bool meaningful_without_media_only);
|
2020-03-13 00:56:02 +00:00
|
|
|
|
2017-11-05 17:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* MachineForTarget_hpp */
|