Files
RASCSI/cpp/devices/device_factory.h
Daniel Markstedt b7e7c4e529 Remove bitrotted X68000 host bridge device
The X68000 host bridge and associated host file system module
has not been functional for many years, as reported by multiple users

Removing the code will reduce complexity for users -
the SCBR device has caused some misunderstandings in the past -
while eliminating code that has been flagged as insecure by SonarQube
2025-11-09 08:45:56 +01:00

60 lines
1.4 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2021-2023 Uwe Seimet
//
// The DeviceFactory creates devices based on their type and the image file extension
//
//---------------------------------------------------------------------------
#pragma once
#include <string>
#include <unordered_map>
#include "generated/piscsi_interface.pb.h"
using namespace std;
using namespace piscsi_interface;
class PrimaryDevice;
class DeviceFactory
{
public:
DeviceFactory() = default;
~DeviceFactory() = default;
shared_ptr<PrimaryDevice> CreateDevice(PbDeviceType, int, const string&) const;
PbDeviceType GetTypeForFile(const string&) const;
const auto& GetExtensionMapping() const { return EXTENSION_MAPPING; }
private:
const inline static unordered_map<string, PbDeviceType, piscsi_util::StringHash, equal_to<>> EXTENSION_MAPPING = {
{ "hd1", SCHD },
{ "hds", SCHD },
{ "hda", SCHD },
{ "hdn", SCHD },
{ "hdi", SCHD },
{ "nhd", SCHD },
{ "hdr", SCRM },
{ "mos", SCMO },
{ "is1", SCCD },
{ "iso", SCCD },
{ "cdr", SCCD },
{ "toast", SCCD },
{ "tar", SCTP },
{ "tap", SCTP },
};
const inline static unordered_map<string, PbDeviceType, piscsi_util::StringHash, equal_to<>> DEVICE_MAPPING = {
{ "daynaport", SCDP },
{ "printer", SCLP },
{ "services", SCHS }
};
};