2016-08-23 21:35:59 -04:00
|
|
|
//
|
|
|
|
// StaticAnalyser.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 23/08/2016.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-08-23 21:35:59 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef StaticAnalyser_hpp
|
|
|
|
#define StaticAnalyser_hpp
|
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
#include "../Machines.hpp"
|
|
|
|
|
|
|
|
#include "../../Storage/Cartridge/Cartridge.hpp"
|
2019-08-25 15:10:09 -04:00
|
|
|
#include "../../Storage/Disk/Disk.hpp"
|
|
|
|
#include "../../Storage/MassStorage/MassStorageDevice.hpp"
|
|
|
|
#include "../../Storage/Tape/Tape.hpp"
|
2016-08-27 18:26:51 -04:00
|
|
|
|
2018-04-14 12:12:12 -04:00
|
|
|
#include <memory>
|
2016-08-23 21:35:59 -04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
namespace Analyser {
|
|
|
|
namespace Static {
|
2016-08-23 21:35:59 -04:00
|
|
|
|
2017-08-17 10:48:29 -04:00
|
|
|
/*!
|
|
|
|
A list of disks, tapes and cartridges.
|
|
|
|
*/
|
|
|
|
struct Media {
|
2018-01-23 22:18:16 -05:00
|
|
|
std::vector<std::shared_ptr<Storage::Disk::Disk>> disks;
|
|
|
|
std::vector<std::shared_ptr<Storage::Tape::Tape>> tapes;
|
|
|
|
std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>> cartridges;
|
2019-08-25 15:10:09 -04:00
|
|
|
std::vector<std::shared_ptr<Storage::MassStorage::MassStorageDevice>> mass_storage_devices;
|
2017-12-02 16:01:30 -05:00
|
|
|
|
|
|
|
bool empty() const {
|
2019-08-25 15:10:09 -04:00
|
|
|
return disks.empty() && tapes.empty() && cartridges.empty() && mass_storage_devices.empty();
|
2017-12-02 16:01:30 -05:00
|
|
|
}
|
2020-03-19 20:40:43 -04:00
|
|
|
|
|
|
|
Media &operator +=(const Media &rhs) {
|
|
|
|
#define append(name) name.insert(name.end(), rhs.name.begin(), rhs.name.end());
|
|
|
|
append(disks);
|
|
|
|
append(tapes);
|
|
|
|
append(cartridges);
|
|
|
|
append(mass_storage_devices);
|
|
|
|
#undef append
|
|
|
|
return *this;
|
|
|
|
}
|
2017-08-17 10:48:29 -04:00
|
|
|
};
|
|
|
|
|
2016-08-28 12:20:40 -04:00
|
|
|
/*!
|
|
|
|
A list of disks, tapes and cartridges plus information about the machine to which to attach them and its configuration,
|
|
|
|
and instructions on how to launch the software attached, plus a measure of confidence in this target's correctness.
|
|
|
|
*/
|
2016-08-23 21:35:59 -04:00
|
|
|
struct Target {
|
2020-03-15 00:13:38 -04:00
|
|
|
Target(Machine machine) : machine(machine) {}
|
2018-03-09 15:36:11 -05:00
|
|
|
virtual ~Target() {}
|
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
Machine machine;
|
2018-01-24 22:35:54 -05:00
|
|
|
Media media;
|
2020-03-15 00:13:38 -04:00
|
|
|
float confidence = 0.0f;
|
2016-08-23 21:35:59 -04:00
|
|
|
};
|
2018-04-14 12:12:12 -04:00
|
|
|
typedef std::vector<std::unique_ptr<Target>> TargetList;
|
2016-08-23 21:35:59 -04:00
|
|
|
|
2016-08-28 12:20:40 -04:00
|
|
|
/*!
|
|
|
|
Attempts, through any available means, to return a list of potential targets for the file with the given name.
|
2017-11-07 22:51:06 -05:00
|
|
|
|
2016-08-28 12:20:40 -04:00
|
|
|
@returns The list of potential targets, sorted from most to least probable.
|
|
|
|
*/
|
2018-04-14 12:12:12 -04:00
|
|
|
TargetList GetTargets(const std::string &file_name);
|
2016-08-23 21:35:59 -04:00
|
|
|
|
2017-08-17 10:48:29 -04:00
|
|
|
/*!
|
|
|
|
Inspects the supplied file and determines the media included.
|
|
|
|
*/
|
2018-04-06 17:42:24 -04:00
|
|
|
Media GetMedia(const std::string &file_name);
|
2017-08-17 10:48:29 -04:00
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
}
|
2016-08-23 21:35:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* StaticAnalyser_hpp */
|