//--------------------------------------------------------------------------- // // 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 "shared/piscsi_util.h" #include #include #include #include "generated/piscsi_interface.pb.h" using namespace std; using namespace piscsi_interface; class PrimaryDevice; class DeviceFactory { public: DeviceFactory(); ~DeviceFactory() = default; shared_ptr CreateDevice(PbDeviceType, int, const string&) const; PbDeviceType GetTypeForFile(const string&) const; unordered_set GetSectorSizes(PbDeviceType type) const; const auto& GetExtensionMapping() const { return extension_mapping; } private: unordered_map> sector_sizes; unordered_map> extension_mapping; unordered_map> device_mapping; };