openMSX
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
openmsx::CartridgeSlotManager Class Reference

#include <CartridgeSlotManager.hh>

Public Member Functions

 CartridgeSlotManager (MSXMotherBoard &motherBoard)
 
 ~CartridgeSlotManager ()
 
void createExternalSlot (int ps)
 
void createExternalSlot (int ps, int ss)
 
void removeExternalSlot (int ps)
 
void removeExternalSlot (int ps, int ss)
 
void testRemoveExternalSlot (int ps, const HardwareConfig &allowed) const
 
void testRemoveExternalSlot (int ps, int ss, const HardwareConfig &allowed) const
 
void getSpecificSlot (unsigned slot, int &ps, int &ss) const
 
void getAnyFreeSlot (int &ps, int &ss) const
 
void allocateSlot (int ps, int ss, const HardwareConfig &hwConfig)
 
void freeSlot (int ps, int ss, const HardwareConfig &hwConfig)
 
int allocateAnyPrimarySlot (const HardwareConfig &hwConfig)
 
int allocateSpecificPrimarySlot (unsigned slot, const HardwareConfig &hwConfig)
 
void freePrimarySlot (int ps, const HardwareConfig &hwConfig)
 
bool isExternalSlot (int ps, int ss, bool convert) const
 
bool slotExists (unsigned slot) const
 
int getNumberOfSlots () const
 
const HardwareConfiggetConfigForSlot (unsigned slot) const
 
std::pair< int, int > getPsSs (unsigned slot) const
 
std::string getPsSsString (unsigned slot) const
 
std::optional< unsigned > findSlotWith (const HardwareConfig &config) const
 

Static Public Member Functions

static int getSlotNum (std::string_view slot)
 

Static Public Attributes

static constexpr unsigned MAX_SLOTS = 16 + 4
 

Detailed Description

Definition at line 22 of file CartridgeSlotManager.hh.

Constructor & Destructor Documentation

◆ CartridgeSlotManager()

openmsx::CartridgeSlotManager::CartridgeSlotManager ( MSXMotherBoard motherBoard)
explicit

Definition at line 76 of file CartridgeSlotManager.cc.

◆ ~CartridgeSlotManager()

openmsx::CartridgeSlotManager::~CartridgeSlotManager ( )

Definition at line 83 of file CartridgeSlotManager.cc.

References MAX_SLOTS, and xrange().

Member Function Documentation

◆ allocateAnyPrimarySlot()

int openmsx::CartridgeSlotManager::allocateAnyPrimarySlot ( const HardwareConfig hwConfig)

Definition at line 242 of file CartridgeSlotManager.cc.

References MAX_SLOTS, and xrange().

◆ allocateSlot()

void openmsx::CartridgeSlotManager::allocateSlot ( int  ps,
int  ss,
const HardwareConfig hwConfig 
)

Definition at line 266 of file CartridgeSlotManager.cc.

References MAX_SLOTS, and xrange().

◆ allocateSpecificPrimarySlot()

int openmsx::CartridgeSlotManager::allocateSpecificPrimarySlot ( unsigned  slot,
const HardwareConfig hwConfig 
)

Definition at line 205 of file CartridgeSlotManager.cc.

References MAX_SLOTS.

◆ createExternalSlot() [1/2]

void openmsx::CartridgeSlotManager::createExternalSlot ( int  ps)

Definition at line 112 of file CartridgeSlotManager.cc.

References createExternalSlot().

Referenced by createExternalSlot().

◆ createExternalSlot() [2/2]

void openmsx::CartridgeSlotManager::createExternalSlot ( int  ps,
int  ss 
)

◆ findSlotWith()

std::optional< unsigned > openmsx::CartridgeSlotManager::findSlotWith ( const HardwareConfig config) const
inline

Definition at line 75 of file CartridgeSlotManager.hh.

References MAX_SLOTS, and xrange().

Referenced by openmsx::ImGuiMedia::slotAndNameForHardwareConfig().

◆ freePrimarySlot()

void openmsx::CartridgeSlotManager::freePrimarySlot ( int  ps,
const HardwareConfig hwConfig 
)

Definition at line 256 of file CartridgeSlotManager.cc.

◆ freeSlot()

void openmsx::CartridgeSlotManager::freeSlot ( int  ps,
int  ss,
const HardwareConfig hwConfig 
)

Definition at line 288 of file CartridgeSlotManager.cc.

References MAX_SLOTS, and xrange().

◆ getAnyFreeSlot()

void openmsx::CartridgeSlotManager::getAnyFreeSlot ( int &  ps,
int &  ss 
) const

Definition at line 223 of file CartridgeSlotManager.cc.

References MAX_SLOTS, and xrange().

◆ getConfigForSlot()

const HardwareConfig * openmsx::CartridgeSlotManager::getConfigForSlot ( unsigned  slot) const
inline

Definition at line 61 of file CartridgeSlotManager.hh.

References MAX_SLOTS.

Referenced by openmsx::ImGuiMedia::displayNameForSlotContent().

◆ getNumberOfSlots()

int openmsx::CartridgeSlotManager::getNumberOfSlots ( ) const
inline

Definition at line 58 of file CartridgeSlotManager.hh.

References ranges::count_if().

◆ getPsSs()

std::pair< int, int > openmsx::CartridgeSlotManager::getPsSs ( unsigned  slot) const
inline

Definition at line 65 of file CartridgeSlotManager.hh.

References MAX_SLOTS.

Referenced by getPsSsString(), and openmsx::ImGuiMedia::showMenu().

◆ getPsSsString()

std::string openmsx::CartridgeSlotManager::getPsSsString ( unsigned  slot) const
inline

◆ getSlotNum()

int openmsx::CartridgeSlotManager::getSlotNum ( std::string_view  slot)
static

Definition at line 92 of file CartridgeSlotManager.cc.

Referenced by openmsx::HardwareConfig::parseSlots().

◆ getSpecificSlot()

void openmsx::CartridgeSlotManager::getSpecificSlot ( unsigned  slot,
int &  ps,
int &  ss 
) const

Definition at line 192 of file CartridgeSlotManager.cc.

References MAX_SLOTS.

◆ isExternalSlot()

bool openmsx::CartridgeSlotManager::isExternalSlot ( int  ps,
int  ss,
bool  convert 
) const

Definition at line 306 of file CartridgeSlotManager.cc.

References ranges::any_of(), MAX_SLOTS, and xrange().

Referenced by createExternalSlot().

◆ removeExternalSlot() [1/2]

void openmsx::CartridgeSlotManager::removeExternalSlot ( int  ps)

◆ removeExternalSlot() [2/2]

void openmsx::CartridgeSlotManager::removeExternalSlot ( int  ps,
int  ss 
)

◆ slotExists()

bool openmsx::CartridgeSlotManager::slotExists ( unsigned  slot) const
inline

Definition at line 54 of file CartridgeSlotManager.hh.

References MAX_SLOTS.

◆ testRemoveExternalSlot() [1/2]

void openmsx::CartridgeSlotManager::testRemoveExternalSlot ( int  ps,
const HardwareConfig allowed 
) const

◆ testRemoveExternalSlot() [2/2]

void openmsx::CartridgeSlotManager::testRemoveExternalSlot ( int  ps,
int  ss,
const HardwareConfig allowed 
) const

Definition at line 166 of file CartridgeSlotManager.cc.

Member Data Documentation

◆ MAX_SLOTS

constexpr unsigned openmsx::CartridgeSlotManager::MAX_SLOTS = 16 + 4
staticconstexpr

The documentation for this class was generated from the following files: