summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pstate.cpp')
-rw-r--r--src/lib/netlist/plib/pstate.cpp47
1 files changed, 15 insertions, 32 deletions
diff --git a/src/lib/netlist/plib/pstate.cpp b/src/lib/netlist/plib/pstate.cpp
index c8c4c5725c6..ee44eede27a 100644
--- a/src/lib/netlist/plib/pstate.cpp
+++ b/src/lib/netlist/plib/pstate.cpp
@@ -9,70 +9,53 @@
namespace plib {
-pstate_manager_t::pstate_manager_t()
+state_manager_t::state_manager_t()
{
}
-pstate_manager_t::~pstate_manager_t()
+state_manager_t::~state_manager_t()
{
m_save.clear();
}
-void pstate_manager_t::save_state_ptr(const void *owner, const pstring &stname, const pstate_data_type_e dt, const int size, const int count, void *ptr, bool is_ptr)
+void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, const datatype_t dt, const int count, void *ptr)
{
- pstring fullname = stname;
- ATTR_UNUSED pstring ts[] = {
- "NOT_SUPPORTED",
- "DT_CUSTOM",
- "DT_DOUBLE",
-#if (PHAS_INT128)
- "DT_INT128",
-#endif
- "DT_INT64",
- "DT_INT16",
- "DT_INT8",
- "DT_INT",
- "DT_BOOLEAN",
- "DT_FLOAT"
- };
-
- auto p = plib::make_unique<pstate_entry_t>(stname, dt, owner, size, count, ptr, is_ptr);
+ auto p = plib::make_unique<entry_t>(stname, dt, owner, count, ptr);
m_save.push_back(std::move(p));
}
-void pstate_manager_t::remove_save_items(const void *owner)
+void state_manager_t::remove_save_items(const void *owner)
{
- unsigned i = 0;
- while (i < m_save.size())
+ for (auto i = m_save.begin(); i != m_save.end(); )
{
- if (m_save[i]->m_owner == owner)
- m_save.remove_at(i);
+ if (i->get()->m_owner == owner)
+ i = m_save.erase(i);
else
i++;
}
}
-void pstate_manager_t::pre_save()
+void state_manager_t::pre_save()
{
for (auto & s : m_save)
- if (s->m_dt == DT_CUSTOM)
+ if (s->m_dt.is_custom)
s->m_callback->on_pre_save();
}
-void pstate_manager_t::post_load()
+void state_manager_t::post_load()
{
for (auto & s : m_save)
- if (s->m_dt == DT_CUSTOM)
+ if (s->m_dt.is_custom)
s->m_callback->on_post_load();
}
-template<> void pstate_manager_t::save_item(const void *owner, pstate_callback_t &state, const pstring &stname)
+template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname)
{
//save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
- pstate_callback_t *state_p = &state;
- auto p = plib::make_unique<pstate_entry_t>(stname, owner, state_p);
+ callback_t *state_p = &state;
+ auto p = plib::make_unique<entry_t>(stname, owner, state_p);
m_save.push_back(std::move(p));
state.register_state(*this, stname);
}