openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
Pluggable.cc
Go to the documentation of this file.
1
#include "
Pluggable.hh
"
2
#include "
PlugException.hh
"
3
#include "
Connector.hh
"
4
#include "
unreachable.hh
"
5
#include <cassert>
6
7
using
std::string;
8
9
namespace
openmsx {
10
11
Pluggable::Pluggable
()
12
{
13
setConnector
(
nullptr
);
14
}
15
16
Pluggable::~Pluggable
()
17
{
18
}
19
20
const
string
&
Pluggable::getName
()
const
21
{
22
static
const
string
name(
"--empty--"
);
23
return
name;
24
}
25
26
void
Pluggable::plug
(
Connector
& newConnector,
EmuTime::param
time)
27
{
28
assert(
getClass
() == newConnector.
getClass
());
29
30
if
(connector) {
31
throw
PlugException
(
getName
() +
" already plugged in "
+
32
connector->
getName
() +
'.'
);
33
}
34
plugHelper
(newConnector, time);
35
setConnector
(&newConnector);
36
}
37
38
void
Pluggable::unplug
(
EmuTime::param
time)
39
{
40
try
{
41
unplugHelper
(time);
42
}
catch
(
MSXException
&) {
43
UNREACHABLE
;
44
}
45
setConnector
(
nullptr
);
46
}
47
48
Connector
*
Pluggable::getConnector
()
const
49
{
50
return
connector;
51
}
52
53
void
Pluggable::setConnector
(
Connector
* conn)
54
{
55
connector = conn;
56
}
57
58
}
// namespace openmsx
Generated on Mon May 20 2013 12:16:59 for openMSX by
1.8.1.2