summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/nl_base.h
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2017-02-25 10:43:49 +0100
committer couriersud <couriersud@gmx.org>2017-02-25 10:44:04 +0100
commit1a2f928403c37f3cdf870ac340d0f1f71a7a0761 (patch)
tree92e1115632ef6573c4a344e8f106063f008b4c33 /src/lib/netlist/nl_base.h
parent418a0ee67de77959ca7adeee7768949d5731de6e (diff)
Netlist refactoring
- align timed_queue closer to std::priority_queue - use uint8_t in extended clock for better memory usage. - minor changes to nl_breakout.cpp (nw)
Diffstat (limited to 'src/lib/netlist/nl_base.h')
-rw-r--r--src/lib/netlist/nl_base.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index f8f6189f5b9..002d02869ed 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -320,11 +320,15 @@ namespace netlist
//! Copy Constructor.
state_var(const state_var &rhs) NL_NOEXCEPT = default;
//! Move Constructor.
- state_var(state_var &&rhs) NL_NOEXCEPT = default;
+ state_var(state_var &&rhs) NL_NOEXCEPT { std::swap(m_value, rhs.m_value); }
//! Assignment operator to assign value of a state var.
- state_var &operator=(const state_var &rhs) NL_NOEXCEPT { m_value = rhs; return *this; }
+ state_var &operator=(const state_var &rhs) NL_NOEXCEPT { m_value = rhs.m_value; return *this; }
+ //! Assignment move operator to assign value of a state var.
+ state_var &operator=(state_var &&rhs) NL_NOEXCEPT { std::swap(m_value, rhs.m_value); return *this; }
//! Assignment operator to assign value of type T.
state_var &operator=(const T &rhs) NL_NOEXCEPT { m_value = rhs; return *this; }
+ //! Assignment move operator to assign value of type T.
+ state_var &operator=(T &&rhs) NL_NOEXCEPT { std::swap(m_value, rhs); return *this; }
//! Return value of state variable.
operator T & () NL_NOEXCEPT { return m_value; }
//! Return const value of state variable.
@@ -716,8 +720,8 @@ namespace netlist
void update_devs() NL_NOEXCEPT;
- netlist_time time() const NL_NOEXCEPT { return m_time; }
- void set_time(const netlist_time ntime) NL_NOEXCEPT { m_time = ntime; }
+ const netlist_time &time() const NL_NOEXCEPT { return m_time; }
+ void set_time(const netlist_time &ntime) NL_NOEXCEPT { m_time = ntime; }
bool isRailNet() const { return !(m_railterminal == nullptr); }
core_terminal_t & railterminal() const { return *m_railterminal; }
@@ -743,10 +747,10 @@ namespace netlist
protected:
state_var<netlist_sig_t> m_new_Q;
state_var<netlist_sig_t> m_cur_Q;
+ state_var<queue_status> m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
state_var<netlist_time> m_time;
state_var_s32 m_active;
- state_var<queue_status> m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
state_var<nl_double> m_cur_Analog;
@@ -1174,11 +1178,12 @@ namespace netlist
// -----------------------------------------------------------------------------
class detail::queue_t :
- public timed_queue<net_t *, netlist_time>,
+ public timed_queue<pqentry_t<net_t *, netlist_time>>,
public detail::netlist_ref,
public plib::state_manager_t::callback_t
{
public:
+ typedef pqentry_t<net_t *, netlist_time> entry_t;
explicit queue_t(netlist_t &nl);
protected:
@@ -1214,7 +1219,7 @@ namespace netlist
nl_double gmin() const;
void process_queue(const netlist_time &delta) NL_NOEXCEPT;
- void abort_current_queue_slice() { m_queue.retime(nullptr, m_time); }
+ void abort_current_queue_slice() { m_queue.retime(detail::queue_t::entry_t(m_time, nullptr)); }
/* Control functions */