mame/src/emu/devdelegate.cpp
Vas Crabb 55b8ca317a -Switch to building MAME as C++17.
* Updated sol2 to 3.2.2
* Updated pugixml to 1.10
* Increased minimum clang version to 6
* Cleaned up some stuff that can use new features
2020-11-15 03:53:47 +11:00

35 lines
813 B
C++

// license:BSD-3-Clause
// copyright-holders:Aaron Giles, Vas Crabb
/***************************************************************************
devdelegate.cpp
Delegates that are late-bound to MAME devices.
***************************************************************************/
#include "emu.h"
#include "devdelegate.h"
namespace emu::detail {
delegate_late_bind &device_delegate_helper::bound_object() const
{
if (!m_tag)
return m_base.get();
device_t *const device(m_base.get().subdevice(m_tag));
if (!device)
throw emu_fatalerror("Unable to locate device '%s' relative to '%s'\n", m_tag, m_base.get().tag());
return *device;
}
void device_delegate_helper::set_tag(char const *tag)
{
m_base = m_base.get().mconfig().current_device();
m_tag = tag;
}
} // namespace emu::detail