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.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/lib/netlist/plib/pstate.cpp b/src/lib/netlist/plib/pstate.cpp
index 3bd93ed4f8e..043033ed1ea 100644
--- a/src/lib/netlist/plib/pstate.cpp
+++ b/src/lib/netlist/plib/pstate.cpp
@@ -9,6 +9,17 @@
#include "palloc.h"
namespace plib {
+state_manager_t::state_manager_t()
+{
+}
+
+state_manager_t::~state_manager_t()
+{
+ m_save.clear();
+ m_custom.clear();
+}
+
+
void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, const datatype_t &dt, const std::size_t count, void *ptr)
{
@@ -18,40 +29,46 @@ void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, c
void state_manager_t::remove_save_items(const void *owner)
{
- auto i = m_save.end();
- while (i != m_save.begin())
+ for (auto i = m_save.begin(); i != m_save.end(); )
{
- i--;
if (i->get()->m_owner == owner)
i = m_save.erase(i);
+ else
+ i++;
}
- i = m_custom.end();
- while (i > m_custom.begin())
+ for (auto i = m_custom.begin(); i != m_custom.end(); )
{
- i--;
if (i->get()->m_owner == owner)
i = m_custom.erase(i);
+ else
+ i++;
}
}
void state_manager_t::pre_save()
{
for (auto & s : m_custom)
- s->m_callback->on_pre_save(*this);
+ s->m_callback->on_pre_save();
}
void state_manager_t::post_load()
{
for (auto & s : m_custom)
- s->m_callback->on_post_load(*this);
+ s->m_callback->on_post_load();
}
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);
callback_t *state_p = &state;
auto p = plib::make_unique<entry_t>(stname, owner, state_p);
m_custom.push_back(std::move(p));
state.register_state(*this, stname);
}
-} // namespace plib
+state_manager_t::callback_t::~callback_t()
+{
+}
+
+
+}