// license:BSD-3-Clause // copyright-holders:Olivier Galibert // handler_entry_read_passthrough/handler_entry_write_passthrough // parent class for handlers which want to tap the access and usually pass it on to another handler template class handler_entry_read_passthrough : public handler_entry_read { public: using uX = typename emu::detail::handler_entry_size::uX; handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_read(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {} ~handler_entry_read_passthrough(); virtual handler_entry_read_passthrough *instantiate(handler_entry_read *next) const = 0; handler_entry_read *get_subhandler() const { return m_next; } void detach(const std::unordered_set &handlers) override; protected: memory_passthrough_handler &m_mph; handler_entry_read *m_next; handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph, handler_entry_read *next) : handler_entry_read(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); } }; template class handler_entry_write_passthrough : public handler_entry_write { public: using uX = typename emu::detail::handler_entry_size::uX; handler_entry_write_passthrough(address_space *space, memory_passthrough_handler &mph) : handler_entry_write(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(nullptr) {} ~handler_entry_write_passthrough(); virtual handler_entry_write_passthrough *instantiate(handler_entry_write *next) const = 0; handler_entry_write *get_subhandler() const { return m_next; } void detach(const std::unordered_set &handlers) override; protected: memory_passthrough_handler &m_mph; handler_entry_write *m_next; handler_entry_write_passthrough(address_space *space, memory_passthrough_handler &mph, handler_entry_write *next) : handler_entry_write(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); } };