openMSX
ide
IDEDeviceFactory.cc
Go to the documentation of this file.
1
#include "
IDEDeviceFactory.hh
"
2
#include "
DummyIDEDevice.hh
"
3
#include "
IDEHD.hh
"
4
#include "
IDECDROM.hh
"
5
#include "
DeviceConfig.hh
"
6
#include "
MSXException.hh
"
7
#include <memory>
8
9
namespace
openmsx::IDEDeviceFactory
{
10
11
std::unique_ptr<IDEDevice>
create
(
const
DeviceConfig
& config)
12
{
13
if
(!config.
getXML
()) {
14
return
std::make_unique<DummyIDEDevice>();
15
}
16
const
auto
& type = config.
getChildData
(
"type"
);
17
if
(type ==
"IDEHD"
) {
18
return
std::make_unique<IDEHD>(config);
19
}
else
if
(type ==
"IDECDROM"
) {
20
return
std::make_unique<IDECDROM>(config);
21
}
22
throw
MSXException
(
"Unknown IDE device: "
, type);
23
}
24
25
}
// namespace openmsx::IDEDeviceFactory
DeviceConfig.hh
DummyIDEDevice.hh
IDECDROM.hh
IDEDeviceFactory.hh
IDEHD.hh
MSXException.hh
openmsx::DeviceConfig
Definition
DeviceConfig.hh:21
openmsx::DeviceConfig::getChildData
std::string_view getChildData(std::string_view name) const
Definition
DeviceConfig.cc:48
openmsx::DeviceConfig::getXML
const XMLElement * getXML() const
Definition
DeviceConfig.hh:48
openmsx::MSXException
Definition
MSXException.hh:12
openmsx::IDEDeviceFactory
Definition
IDEDeviceFactory.cc:9
openmsx::IDEDeviceFactory::create
std::unique_ptr< IDEDevice > create(const DeviceConfig &config)
Definition
IDEDeviceFactory.cc:11
Generated on Sat Dec 21 2024 14:13:52 for openMSX by
1.9.8