mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-23 06:30:04 +00:00
621cc7d5a2
* Unit test updates * Lambda syntax cleanup * Use new-style casts * Use std::none_of when saving the cache * Use to_integer instead of casts * Use accessors for getting CDB data * Made ctrl_t private * Improved encapsulation * Replaced pointers by references * Removed all remaining occurrences of DWORD and BYTE, making os.h obsolete
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
// Keeps track of and manages the controllers
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <memory>
|
|
|
|
using namespace std;
|
|
|
|
class BUS;
|
|
class AbstractController;
|
|
class PrimaryDevice;
|
|
|
|
class ControllerManager
|
|
{
|
|
shared_ptr<BUS> bus;
|
|
|
|
unordered_map<int, shared_ptr<AbstractController>> controllers;
|
|
|
|
public:
|
|
|
|
explicit ControllerManager(shared_ptr<BUS> bus) : bus(bus) {}
|
|
~ControllerManager() = default;
|
|
|
|
// Maximum number of controller devices
|
|
static const int DEVICE_MAX = 8;
|
|
|
|
bool AttachToScsiController(int, shared_ptr<PrimaryDevice>);
|
|
bool DeleteController(shared_ptr<AbstractController>);
|
|
shared_ptr<AbstractController> IdentifyController(int) const;
|
|
shared_ptr<AbstractController> FindController(int) const;
|
|
unordered_set<shared_ptr<PrimaryDevice>> GetAllDevices() const;
|
|
void DeleteAllControllers();
|
|
void ResetAllControllers() const;
|
|
shared_ptr<PrimaryDevice> GetDeviceByIdAndLun(int, int) const;
|
|
};
|