diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 936352cc370..b405e96e5fd 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -314,7 +314,7 @@ private: // ======================> cheat_manager // private machine-global data -class cheat_manager : public bindable_object +class cheat_manager { public: // construction/destruction diff --git a/src/emu/cpu/drcbeut.h b/src/emu/cpu/drcbeut.h index 291772e9958..fabd86100a7 100644 --- a/src/emu/cpu/drcbeut.h +++ b/src/emu/cpu/drcbeut.h @@ -147,7 +147,7 @@ private: typedef delegate drc_label_fixup_delegate; // structure holding a live list of labels -class drc_label_list : public bindable_object +class drc_label_list { public: // construction/destruction diff --git a/src/emu/cpu/drcuml.h b/src/emu/cpu/drcuml.h index 3058c06d1df..a67b6170046 100644 --- a/src/emu/cpu/drcuml.h +++ b/src/emu/cpu/drcuml.h @@ -166,7 +166,7 @@ private: // interface structure for a back-end -class drcbe_interface : public bindable_object +class drcbe_interface { public: // construction/destruction diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h index a447c224485..b218087db3d 100644 --- a/src/emu/cpu/m68000/m68kcpu.h +++ b/src/emu/cpu/m68000/m68kcpu.h @@ -554,7 +554,7 @@ typedef delegate m68k_write8_delegate; typedef delegate m68k_write16_delegate; typedef delegate m68k_write32_delegate; -class m68k_memory_interface : public bindable_object +class m68k_memory_interface { public: void init8(address_space &space); diff --git a/src/emu/delegate.c b/src/emu/delegate.c index d6922243029..0aaee215d61 100644 --- a/src/emu/delegate.c +++ b/src/emu/delegate.c @@ -41,29 +41,6 @@ #include "delegate.h" -//************************************************************************** -// BINDABLE OBJECT -//************************************************************************** - -//------------------------------------------------- -// bindable_object - constructor -//------------------------------------------------- - -bindable_object::bindable_object() -{ -} - - -//------------------------------------------------- -// ~bindable_object - destructor -//------------------------------------------------- - -bindable_object::~bindable_object() -{ -} - - - //************************************************************************** // INTERNAL DELEGATE HELPERS //************************************************************************** diff --git a/src/emu/delegate.h b/src/emu/delegate.h index 8175673541b..4557f44235b 100644 --- a/src/emu/delegate.h +++ b/src/emu/delegate.h @@ -140,30 +140,6 @@ class delegate_generic_class; #endif -// ======================> bindable_object - -// define a bindable_object base class that must be at the root of any object -// hierarchy which intends to do late binding -class bindable_object -{ -public: - // virtual destructor to ensure this is a polymorphic class - bindable_object(); - virtual ~bindable_object(); -}; - -// define a deferred cast helper function that does a proper dynamic_cast -// from a bindable_object to the target class, and returns a delegate_generic_class -template -static delegate_generic_class *deferred_cast(bindable_object &object) -{ - return reinterpret_cast(dynamic_cast<_TargetClass *>(&object)); -} - -// we store pointers to these deferred casting helpers, so make a friendly type for it -typedef delegate_generic_class *(*deferred_cast_func)(bindable_object &object); - - // ======================> delegate_traits // delegate_traits is a meta-template that is used to provide a static function pointer @@ -283,16 +259,14 @@ class delegate_base public: // generic constructor delegate_base() - : m_caster(NULL), - m_name(NULL), + : m_name(NULL), m_function(NULL), m_object(NULL), m_callobject(NULL) { } // copy constructor delegate_base(const delegate_base &src) - : m_caster(src.m_caster), - m_name(src.m_name), + : m_name(src.m_name), m_object(src.m_object), m_callobject(src.is_mfp() ? reinterpret_cast(this) : src.m_object), m_function(src.m_function), @@ -301,47 +275,42 @@ public: // copy constructor with re-bind template delegate_base(const delegate_base &src, _FunctionClass *object) - : m_caster(src.m_caster), - m_name(src.m_name), + : m_name(src.m_name), m_object(src.m_object), m_callobject(src.is_mfp() ? reinterpret_cast(this) : src.m_object), m_function(src.m_function), - m_rawfunction(src.m_rawfunction) { bind(object); } + m_rawfunction(src.m_rawfunction) { bind(reinterpret_cast(object)); } // construct from member function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_function(&delegate_base::method_stub<_FunctionClass>), m_object(NULL), m_callobject(reinterpret_cast(this)), - m_rawfunction(funcptr) { bind(object); } + m_rawfunction(funcptr) { bind(reinterpret_cast(object)); } // construct from static function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_object(NULL), m_callobject(NULL), - m_function(reinterpret_cast(funcptr)) { bind(object); } + m_function(reinterpret_cast(funcptr)) { bind(reinterpret_cast(object)); } // construct from static reference function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_object(NULL), m_callobject(NULL), - m_function(reinterpret_cast(funcptr)) { bind(object); } + m_function(reinterpret_cast(funcptr)) { bind(reinterpret_cast(object)); } // copy operator delegate_base &operator=(const delegate_base &src) { if (this != &src) { - m_caster = src.m_caster; m_name = src.m_name; m_object = src.m_object; m_callobject = src.is_mfp() ? reinterpret_cast(this) : src.m_object; @@ -354,13 +323,11 @@ public: // comparison operator bool operator==(const delegate_base &rhs) const { - return (m_caster == rhs.m_caster && m_object == rhs.m_object && - m_function == m_function && m_rawfunction == m_rawfunction); + return (m_object == rhs.m_object && m_function == m_function && m_rawfunction == m_rawfunction); } // getters - bool isnull() const { return (m_caster == NULL); } - bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); } + bool isnull() const { return (m_function == NULL); } bool has_object() const { return (m_object != NULL); } const char *name() const { return m_name; } @@ -373,9 +340,9 @@ public: protected: // bind the actual object - void bind(bindable_object *object) + void bind(delegate_generic_class *object) { - m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL; + m_object = object; if (!is_mfp()) m_callobject = m_object; } @@ -429,7 +396,6 @@ protected: } // internal state - deferred_cast_func m_caster; // pointer to helper function that does the cast const char * m_name; // name string generic_static_func m_function; // generic static function pointer delegate_raw_mfp m_rawfunction; // copy of raw MFP @@ -508,15 +474,13 @@ class delegate_base public: // generic constructor delegate_base() - : m_caster(NULL), - m_name(NULL), + : m_name(NULL), m_object(NULL), m_function(NULL) { } // copy constructor delegate_base(const delegate_base &src) - : m_caster(src.m_caster), - m_name(src.m_name), + : m_name(src.m_name), m_object(src.m_object), m_function(src.m_function), m_rawfunction(src.m_rawfunction) { } @@ -524,43 +488,38 @@ public: // copy constructor with re-bind template delegate_base(const delegate_base &src, _FunctionClass *object) - : m_caster(src.m_caster), - m_name(src.m_name), + : m_name(src.m_name), m_object(src.m_object), m_function(src.m_function), - m_rawfunction(src.m_rawfunction) { bind(object); } + m_rawfunction(src.m_rawfunction) { bind(reinterpret_cast(object)); } // construct from member function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_object(NULL), m_function(NULL), - m_rawfunction(funcptr) { bind(object); } + m_rawfunction(funcptr) { bind(reinterpret_cast(object)); } // construct from static function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_object(NULL), - m_function(reinterpret_cast(funcptr)) { bind(object); } + m_function(reinterpret_cast(funcptr)) { bind(reinterpret_cast(object)); } // construct from static reference function with object pointer template delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) - : m_caster(&deferred_cast<_FunctionClass>), - m_name(name), + : m_name(name), m_object(NULL), - m_function(reinterpret_cast(funcptr)) { bind(object); } + m_function(reinterpret_cast(funcptr)) { bind(reinterpret_cast(object)); } // copy operator delegate_base &operator=(const delegate_base &src) { if (this != &src) { - m_caster = src.m_caster; m_name = src.m_name; m_object = src.m_object; m_function = src.m_function; @@ -572,13 +531,11 @@ public: // comparison operator bool operator==(const delegate_base &rhs) const { - return (m_caster == rhs.m_caster && m_object == rhs.m_object && - m_function == m_function && m_rawfunction == m_rawfunction); + return (m_object == rhs.m_object && m_function == m_function && m_rawfunction == m_rawfunction); } // getters - bool isnull() const { return (m_caster == NULL); } - bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); } + bool isnull() const { return (m_function == NULL && m_rawfunction.m_function == 0); } bool has_object() const { return (m_object != NULL); } const char *name() const { return m_name; } @@ -591,15 +548,14 @@ public: protected: // bind the actual object - void bind(bindable_object *object) + void bind(delegate_generic_class *object) { - m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL; + m_object = object; if (m_object != NULL && m_rawfunction.m_function != 0) m_function = reinterpret_cast(m_rawfunction.convert_to_generic(m_object)); } // internal state - deferred_cast_func m_caster; // pointer to helper function that does the cast const char * m_name; // name string delegate_generic_class * m_object; // pointer to the post-cast object generic_static_func m_function; // generic static function pointer diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index 3260afb9ea6..5d7d2c050f2 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -126,7 +126,7 @@ typedef void (*write_line_device_func)(device_t *device, int state); // ======================> tagged_device_list // tagged_device_list is a tagged_list with additional searching based on type -class device_list : public tagged_list, public bindable_object +class device_list : public tagged_list { typedef tagged_list super; @@ -176,7 +176,7 @@ private: // ======================> device_t // device_t represents a device -class device_t : public virtual bindable_object +class device_t { DISABLE_COPYING(device_t); @@ -459,7 +459,7 @@ private: // ======================> device_interface // device_interface represents runtime information for a particular device interface -class device_interface : public virtual bindable_object +class device_interface { DISABLE_COPYING(device_interface); diff --git a/src/emu/machine.h b/src/emu/machine.h index 7e99283db2b..1efdf2ced3c 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -309,7 +309,7 @@ public: typedef delegate machine_notify_delegate; // description of the currently-running machine -class running_machine : public bindable_object +class running_machine { DISABLE_COPYING(running_machine); diff --git a/src/emu/memory.c b/src/emu/memory.c index 868b7ede6e3..42426aa8044 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -417,7 +417,7 @@ private: // ======================> handler_entry // a handler entry contains information about a memory handler -class handler_entry : public bindable_object +class handler_entry { DISABLE_COPYING(handler_entry); @@ -669,7 +669,7 @@ private: // ======================> address_table // address_table contains information about read/write accesses within an address space -class address_table : public bindable_object +class address_table { // address map lookup table definitions static const int LEVEL1_BITS = 18; // number of address bits in the level 1 table @@ -2039,7 +2039,7 @@ void address_space::populate_from_map() void address_space::populate_map_entry(const address_map_entry &entry, read_or_write readorwrite) { const map_handler_data &data = (readorwrite == ROW_READ) ? entry.m_read : entry.m_write; - bindable_object *object; + void *object; device_t *device; // based on the handler type, alter the bits, name, funcptr, and object diff --git a/src/emu/memory.h b/src/emu/memory.h index 81f6b50fd65..d5651e44216 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -291,7 +291,7 @@ public: // ======================> address_space // address_space holds live information about an address space -class address_space : public bindable_object +class address_space { friend class address_table; friend class address_table_read; diff --git a/src/emu/render.h b/src/emu/render.h index 783c939d690..5ed2919fd2c 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -714,7 +714,7 @@ private: // ======================> render_manager // contains machine-global information and operations -class render_manager : public bindable_object +class render_manager { friend class render_target; diff --git a/src/emu/schedule.h b/src/emu/schedule.h index eac0b494829..7815ac2513e 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -150,7 +150,7 @@ private: // ======================> device_scheduler -class device_scheduler : public bindable_object +class device_scheduler { friend class device_execute_interface; friend class emu_timer; diff --git a/src/emu/sound.h b/src/emu/sound.h index f655121e0d4..03f6b8ec98c 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -199,7 +199,7 @@ private: // ======================> sound_manager -class sound_manager : public bindable_object +class sound_manager { friend class sound_stream; diff --git a/src/emu/video.h b/src/emu/video.h index 63439ab65b7..aafff46b644 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -70,7 +70,7 @@ typedef struct _avi_file avi_file; // ======================> video_manager -class video_manager : public bindable_object +class video_manager { friend class screen_device;