//--------------------------------------------------------------------------- // // SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // // Keeps track of and manages the controllers // //--------------------------------------------------------------------------- #pragma once #include #include #include #include "hal/bus.h" using namespace std; class AbstractController; class PrimaryDevice; class ControllerManager : public enable_shared_from_this { BUS& bus; unordered_map> controllers; public: explicit ControllerManager(BUS& bus) : bus(bus) {} ~ControllerManager() = default; // Maximum number of controller devices static const int DEVICE_MAX = 8; inline BUS& GetBus() const { return bus; } bool AttachToScsiController(int, shared_ptr); bool DeleteController(shared_ptr); shared_ptr IdentifyController(int) const; shared_ptr FindController(int) const; unordered_set> GetAllDevices() const; void DeleteAllControllers(); shared_ptr GetDeviceByIdAndLun(int, int) const; };