summaryrefslogtreecommitdiffstats
path: root/src/emu/devdelegate.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-11-08 12:56:12 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-11-08 12:56:12 +0100
commit7c19aac60e12d6f5ea301bdb34d7826a01e0b06f (patch)
treef310d86aa2c6bfc19d115307dedde4eb0cd52dad /src/emu/devdelegate.cpp
parenta57b46ae933badd7441ce1644711dbb851e2b504 (diff)
Rename *.c -> *.cpp in our source (nw)
Diffstat (limited to 'src/emu/devdelegate.cpp')
-rw-r--r--src/emu/devdelegate.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/emu/devdelegate.cpp b/src/emu/devdelegate.cpp
new file mode 100644
index 00000000000..53a03763e4a
--- /dev/null
+++ b/src/emu/devdelegate.cpp
@@ -0,0 +1,37 @@
+// license:BSD-3-Clause
+// copyright-holders:Aaron Giles
+/***************************************************************************
+
+ devdelegate.c
+
+ Delegates that are late-bound to MAME devices.
+
+***************************************************************************/
+
+#include "emu.h"
+
+
+//-------------------------------------------------
+// bound_object - use the device name to locate
+// a device relative to the given search root;
+// fatal error if not found
+//-------------------------------------------------
+
+delegate_late_bind &device_delegate_helper::bound_object(device_t &search_root)
+{
+ device_t *device = search_root.subdevice(m_device_name);
+ if (device == NULL)
+ throw emu_fatalerror("Unable to locate device '%s' relative to '%s'\n", m_device_name, search_root.tag());
+ return *device;
+}
+
+
+//-------------------------------------------------
+// safe_tag - return a tag string or (unknown) if
+// the object is not valid
+//-------------------------------------------------
+
+const char *device_delegate_helper::safe_tag(device_t *object)
+{
+ return (object != NULL) ? object->tag() : "(unknown)";
+}