netlist_t no longer descends from netlist::object_t.

This commit is contained in:
couriersud 2016-04-10 17:16:06 +02:00
parent 71d2cf2625
commit 19397471c1
6 changed files with 51 additions and 40 deletions

View File

@ -324,9 +324,9 @@ void netlist_mame_device_t::device_start()
m_setup->start_devices();
m_setup->resolve_inputs();
netlist().save(NAME(m_rem));
netlist().save(NAME(m_div));
netlist().save(NAME(m_old));
netlist().save_item(m_rem, this, "m_rem");
netlist().save_item(m_div, this, "m_div");
netlist().save_item(m_old, this, "m_old");
save_state();
@ -347,7 +347,7 @@ void netlist_mame_device_t::device_reset()
LOG_DEV_CALLS(("device_reset\n"));
m_old = netlist::netlist_time::zero;
m_rem = netlist::netlist_time::zero;
netlist().do_reset();
netlist().reset();
}
void netlist_mame_device_t::device_stop()

View File

@ -479,10 +479,10 @@ public:
const pstring &def_param)
: base_factory_t(name, classname, def_param), m_setup(setup) { }
class dummy : public device_t
class wrapper : public device_t
{
public:
dummy(const pstring &dev_name) : device_t(), m_dev_name(dev_name) { }
wrapper(const pstring &dev_name) : device_t(), m_dev_name(dev_name) { }
protected:
virtual void init(netlist_t &anetlist, const pstring &aname) override
{
@ -499,7 +499,7 @@ public:
ATTR_COLD device_t *Create() override
{
device_t *r = palloc(dummy(this->name()));
device_t *r = palloc(wrapper(this->name()));
return r;
}

View File

@ -127,17 +127,14 @@ void queue_t::on_post_load()
ATTR_COLD object_t::object_t(const type_t atype, const family_t afamily)
: m_objtype(atype)
, m_family(afamily)
, m_netlist(NULL)
, m_netlist(nullptr)
{}
ATTR_COLD object_t::object_t(const pstring &aname, const type_t atype, const family_t afamily)
: m_name(aname)
, m_objtype(atype)
ATTR_COLD object_t::object_t(netlist_t &nl, const type_t atype, const family_t afamily)
: m_objtype(atype)
, m_family(afamily)
{
// FIXME:
m_netlist = reinterpret_cast<netlist_t *>(this);
}
, m_netlist(&nl)
{}
ATTR_COLD object_t::object_t(netlist_t &nl, const pstring &aname, const type_t atype, const family_t afamily)
: m_name(aname)
@ -151,6 +148,12 @@ ATTR_COLD object_t::~object_t()
{
}
ATTR_COLD void object_t::init_object(const pstring &aname)
{
m_name = aname;
save_register();
}
ATTR_COLD void object_t::init_object(netlist_t &nl, const pstring &aname)
{
m_netlist = &nl;
@ -188,7 +191,7 @@ ATTR_COLD void device_object_t::init_object(core_device_t &dev,
// ----------------------------------------------------------------------------------------
netlist_t::netlist_t(const pstring &aname)
: object_t(aname, NETLIST, GENERIC), pstate_manager_t(),
: pstate_manager_t(),
m_stop(netlist_time::zero),
m_time(netlist_time::zero),
m_use_deactivate(0),
@ -197,9 +200,12 @@ netlist_t::netlist_t(const pstring &aname)
m_solver(NULL),
m_gnd(NULL),
m_params(NULL),
m_name(aname),
m_setup(NULL),
m_log(this)
{
save_item(static_cast<pstate_callback_t &>(m_queue), this, "m_queue");
save_item(m_time, this, "m_time");
}
netlist_t::~netlist_t()
@ -218,13 +224,6 @@ netlist_t::~netlist_t()
pstring::resetmem();
}
ATTR_COLD void netlist_t::save_register()
{
save(static_cast<pstate_callback_t &>(m_queue), "m_queue");
save(NLNAME(m_time));
object_t::save_register();
}
ATTR_HOT nl_double netlist_t::gmin() const
{
return solver()->gmin();
@ -941,6 +940,19 @@ ATTR_COLD analog_output_t::analog_output_t()
net().m_cur_Analog = NL_FCONST(0.99);
}
ATTR_COLD analog_output_t::analog_output_t(core_device_t &dev, const pstring &aname)
: analog_t(OUTPUT), m_proxied_net(NULL)
{
this->set_net(m_my_net);
set_state(STATE_OUT);
net().m_cur_Analog = NL_FCONST(0.99);
analog_t::init_object(dev, aname);
net().init_object(dev.netlist(), aname + ".net");
net().register_railterminal(*this);
}
ATTR_COLD void analog_output_t::init_object(core_device_t &dev, const pstring &aname)
{
analog_t::init_object(dev, aname);

View File

@ -378,8 +378,7 @@ namespace netlist
PARAM = 3,
NET = 4,
DEVICE = 5,
NETLIST = 6,
QUEUE = 7
QUEUE = 6
};
enum family_t {
// Terminal families
@ -405,11 +404,12 @@ namespace netlist
};
ATTR_COLD object_t(const type_t atype, const family_t afamily);
ATTR_COLD object_t(const pstring &aname, const type_t atype, const family_t afamily);
ATTR_COLD object_t(netlist_t &nl, const type_t atype, const family_t afamily);
ATTR_COLD object_t(netlist_t &nl, const pstring &aname, const type_t atype, const family_t afamily);
virtual ~object_t();
ATTR_COLD void init_object(const pstring &aname);
ATTR_COLD void init_object(netlist_t &nl, const pstring &aname);
ATTR_COLD bool isInitialized() { return (m_netlist != NULL); }
@ -906,6 +906,7 @@ namespace netlist
P_PREVENT_COPYING(analog_output_t)
public:
ATTR_COLD analog_output_t(core_device_t &dev, const pstring &aname);
ATTR_COLD analog_output_t();
ATTR_COLD void init_object(core_device_t &dev, const pstring &aname);
@ -1185,7 +1186,7 @@ namespace netlist
// -----------------------------------------------------------------------------
class netlist_t : public object_t, public pstate_manager_t, public plog_dispatch_intf
class netlist_t : public pstate_manager_t, public plog_dispatch_intf
{
P_PREVENT_COPYING(netlist_t)
public:
@ -1193,6 +1194,8 @@ namespace netlist
netlist_t(const pstring &aname);
virtual ~netlist_t();
pstring name() const { return m_name; }
ATTR_COLD void start();
ATTR_COLD void stop();
@ -1267,15 +1270,13 @@ namespace netlist
pnamedlist_t<core_device_t *> m_started_devices;
#endif
ATTR_COLD plog_base<NL_DEBUG> &log() { return m_log; }
ATTR_COLD const plog_base<NL_DEBUG> &log() const { return m_log; }
ATTR_COLD plog_base<NL_DEBUG> &log() { return m_log; }
ATTR_COLD const plog_base<NL_DEBUG> &log() const { return m_log; }
virtual void reset();
protected:
/* from object */
virtual void reset() override;
virtual void save_register() override;
#if (NL_KEEP_STATISTICS)
// performance
int m_perf_out_processed;
@ -1290,13 +1291,13 @@ namespace netlist
bool m_use_deactivate;
queue_t m_queue;
devices::NETLIB_NAME(mainclock) * m_mainclock;
devices::NETLIB_NAME(solver) * m_solver;
devices::NETLIB_NAME(gnd) * m_gnd;
devices::NETLIB_NAME(netlistparams) *m_params;
pstring m_name;
setup_t *m_setup;
plog_base<NL_DEBUG> m_log;
};

View File

@ -197,8 +197,6 @@ pstring setup_t::objtype_as_astr(object_t &in) const
return "PARAM";
case terminal_t::DEVICE:
return "DEVICE";
case terminal_t::NETLIST:
return "NETLIST";
case terminal_t::QUEUE:
return "QUEUE";
}
@ -283,9 +281,6 @@ void setup_t::register_object(device_t &dev, const pstring &name, object_t &obj)
case terminal_t::DEVICE:
log().fatal("Device registration not yet supported - {1}\n", name);
break;
case terminal_t::NETLIST:
log().fatal("Netlist registration not yet supported - {1}\n", name);
break;
case terminal_t::QUEUE:
log().fatal("QUEUE registration not yet supported - {1}\n", name);
break;

View File

@ -178,6 +178,9 @@ ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
if (net_proxy_output == NULL)
{
//net_proxy_output = palloc(analog_output_t(*this,
// this->name() + "." + pfmt("m{1}")(m_inps.size())));
net_proxy_output = palloc(analog_output_t);
net_proxy_output->init_object(*this, this->name() + "." + pfmt("m{1}")(m_inps.size()));
m_inps.push_back(net_proxy_output);