summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2016-12-30 20:29:07 +0100
committer couriersud <couriersud@arcor.de>2016-12-30 23:42:23 +0100
commitf1a6e2b47ebfb03989743d72484e3e30dcdb7c8b (patch)
treef24b8e938bb49af8795cb23d208aa9e4ec08ce5b
parentb1516cc7a3f756750261260bb3fc79f507da9762 (diff)
Align noexcept usage. Rename register_con to add_terminal for clearity.
Fix bug introduced with last commit. (nw)
-rw-r--r--src/lib/netlist/devices/nld_truthtable.h4
-rw-r--r--src/lib/netlist/nl_base.cpp4
-rw-r--r--src/lib/netlist/nl_base.h84
-rw-r--r--src/lib/netlist/nl_setup.cpp32
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp2
5 files changed, 64 insertions, 62 deletions
diff --git a/src/lib/netlist/devices/nld_truthtable.h b/src/lib/netlist/devices/nld_truthtable.h
index 6fcd746578f..d1dd6da76a9 100644
--- a/src/lib/netlist/devices/nld_truthtable.h
+++ b/src/lib/netlist/devices/nld_truthtable.h
@@ -261,7 +261,7 @@ namespace netlist
}
public:
- void inc_active() noexcept override
+ void inc_active() NL_NOEXCEPT override
{
if (m_NI > 1)
if (++m_active == 1)
@@ -270,7 +270,7 @@ namespace netlist
}
}
- void dec_active() noexcept override
+ void dec_active() NL_NOEXCEPT override
{
/* FIXME:
* Based on current measurements there is no point to disable
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 44f63a4a403..7d8f1b4cb4f 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -730,7 +730,7 @@ void detail::net_t::reset()
m_active++;
}
-void detail::net_t::register_con(detail::core_terminal_t &terminal)
+void detail::net_t::add_terminal(detail::core_terminal_t &terminal)
{
for (auto t : m_core_terms)
if (t == &terminal)
@@ -747,7 +747,7 @@ void detail::net_t::register_con(detail::core_terminal_t &terminal)
void detail::net_t::move_connections(detail::net_t &dest_net)
{
for (auto &ct : m_core_terms)
- dest_net.register_con(*ct);
+ dest_net.add_terminal(*ct);
m_core_terms.clear();
m_active = 0;
}
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index def52d3ff69..6b515a20c1c 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -302,9 +302,9 @@ namespace netlist
const T &value //!< Initial value after construction
);
//! Copy Constructor.
- state_var(const state_var &rhs) noexcept = default;
+ state_var(const state_var &rhs) NL_NOEXCEPT = default;
//! Move Constructor.
- state_var(state_var &&rhs) noexcept = default;
+ state_var(state_var &&rhs) NL_NOEXCEPT = default;
//! Assignment operator to assign value of a state var.
state_var &operator=(state_var rhs) { std::swap(rhs.m_value, this->m_value); return *this; }
//! Assignment operator to assign value of type T.
@@ -332,8 +332,8 @@ namespace netlist
{
public:
state_var(device_t &dev, const pstring name, const T & value);
- state_var(const state_var &rhs) noexcept = default;
- state_var(state_var &&rhs) noexcept = default;
+ state_var(const state_var &rhs) NL_NOEXCEPT = default;
+ state_var(state_var &&rhs) NL_NOEXCEPT = default;
state_var &operator=(const state_var rhs) { m_value = rhs.m_value; return *this; }
state_var &operator=(const T rhs) { m_value = rhs; return *this; }
T & operator[](const std::size_t i) { return m_value[i]; }
@@ -496,8 +496,8 @@ namespace netlist
const net_t & net() const { return *m_net;}
net_t & net() { return *m_net;}
- bool is_logic() const noexcept;
- bool is_analog() const noexcept;
+ bool is_logic() const NL_NOEXCEPT;
+ bool is_analog() const NL_NOEXCEPT;
bool is_state(const state_e astate) const { return (m_state == astate); }
state_e state() const { return m_state; }
@@ -524,8 +524,8 @@ namespace netlist
{
}
- const analog_net_t & net() const noexcept;
- analog_net_t & net() noexcept;
+ const analog_net_t & net() const NL_NOEXCEPT;
+ analog_net_t & net() NL_NOEXCEPT;
};
// -----------------------------------------------------------------------------
@@ -609,8 +609,8 @@ namespace netlist
devices::nld_base_proxy *get_proxy() const { return m_proxy; }
void set_proxy(devices::nld_base_proxy *proxy) { m_proxy = proxy; }
- logic_net_t & net() noexcept;
- const logic_net_t & net() const noexcept;
+ logic_net_t & net() NL_NOEXCEPT;
+ const logic_net_t & net() const NL_NOEXCEPT;
protected:
@@ -627,7 +627,7 @@ namespace netlist
public:
logic_input_t(core_device_t &dev, const pstring &aname);
- netlist_sig_t Q() const noexcept;
+ netlist_sig_t Q() const NL_NOEXCEPT;
netlist_sig_t operator()() const NL_NOEXCEPT
{
@@ -667,7 +667,7 @@ namespace netlist
/*! returns voltage at terminal.
* \returns voltage at terminal.
*/
- nl_double Q_Analog() const noexcept;
+ nl_double Q_Analog() const NL_NOEXCEPT;
};
@@ -687,16 +687,16 @@ namespace netlist
void reset();
- void register_con(core_terminal_t &terminal);
+ void add_terminal(core_terminal_t &terminal);
- bool is_logic() const noexcept;
- bool is_analog() const noexcept;
+ bool is_logic() const NL_NOEXCEPT;
+ bool is_analog() const NL_NOEXCEPT;
void toggle_new_Q() { m_new_Q ^= 1; }
void force_queue_execution() { m_new_Q = (m_cur_Q ^ 1); }
- void push_to_queue(const netlist_time delay) noexcept;
- void reschedule_in_queue(const netlist_time delay) noexcept;
+ void push_to_queue(const netlist_time delay) NL_NOEXCEPT;
+ void reschedule_in_queue(const netlist_time delay) NL_NOEXCEPT;
bool is_queued() const { return m_in_queue == 1; }
void update_devs() NL_NOEXCEPT;
@@ -707,7 +707,7 @@ namespace netlist
bool isRailNet() const { return !(m_railterminal == nullptr); }
core_terminal_t & railterminal() const { return *m_railterminal; }
- std::size_t num_cons() const noexcept { return m_core_terms.size(); }
+ std::size_t num_cons() const NL_NOEXCEPT { return m_core_terms.size(); }
void inc_active(core_terminal_t &term) NL_NOEXCEPT;
void dec_active(core_terminal_t &term) NL_NOEXCEPT;
@@ -747,7 +747,7 @@ namespace netlist
netlist_sig_t new_Q() const { return m_new_Q; }
void initial(const netlist_sig_t val) { m_cur_Q = m_new_Q = val; }
- void set_Q(const netlist_sig_t newQ, const netlist_time delay) noexcept
+ void set_Q(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
{
if (newQ != m_new_Q)
{
@@ -756,7 +756,7 @@ namespace netlist
}
}
- void set_Q_time(const netlist_sig_t newQ, const netlist_time at) noexcept
+ void set_Q_time(const netlist_sig_t newQ, const netlist_time at) NL_NOEXCEPT
{
if (newQ != m_new_Q)
{
@@ -811,7 +811,7 @@ namespace netlist
void initial(const netlist_sig_t val);
- void push(const netlist_sig_t newQ, const netlist_time delay) noexcept
+ void push(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
{
m_my_net.set_Q(newQ, delay); // take the shortcut
}
@@ -826,11 +826,11 @@ namespace netlist
public:
analog_output_t(core_device_t &dev, const pstring &aname);
- void push(const nl_double val) noexcept { set_Q(val); }
+ void push(const nl_double val) NL_NOEXCEPT { set_Q(val); }
void initial(const nl_double val);
private:
- void set_Q(const nl_double newQ) noexcept;
+ void set_Q(const nl_double newQ) NL_NOEXCEPT;
analog_net_t m_my_net;
};
@@ -1019,7 +1019,7 @@ namespace netlist
void set_delegate_pointer();
void stop_dev();
- void do_inc_active() noexcept
+ void do_inc_active() NL_NOEXCEPT
{
if (m_hint_deactivate)
{
@@ -1028,7 +1028,7 @@ namespace netlist
}
}
- void do_dec_active() noexcept
+ void do_dec_active() NL_NOEXCEPT
{
if (m_hint_deactivate)
dec_active();
@@ -1044,8 +1044,8 @@ namespace netlist
protected:
virtual void update() NL_NOEXCEPT { }
- virtual void inc_active() noexcept { }
- virtual void dec_active() noexcept { }
+ virtual void inc_active() NL_NOEXCEPT { }
+ virtual void dec_active() NL_NOEXCEPT { }
virtual void stop() { }
virtual void reset() { }
@@ -1182,7 +1182,7 @@ namespace netlist
devices::NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
nl_double gmin() const;
- void push_to_queue(detail::net_t &out, const netlist_time attime) noexcept;
+ void push_to_queue(detail::net_t &out, const netlist_time attime) NL_NOEXCEPT;
void remove_from_queue(detail::net_t &out) NL_NOEXCEPT;
void process_queue(const netlist_time &delta);
@@ -1302,22 +1302,22 @@ namespace netlist
// inline implementations
// -----------------------------------------------------------------------------
- inline bool detail::core_terminal_t::is_logic() const noexcept
+ inline bool detail::core_terminal_t::is_logic() const NL_NOEXCEPT
{
return dynamic_cast<const logic_t *>(this) != nullptr;
}
- inline bool detail::core_terminal_t::is_analog() const noexcept
+ inline bool detail::core_terminal_t::is_analog() const NL_NOEXCEPT
{
return dynamic_cast<const analog_t *>(this) != nullptr;
}
- inline bool detail::net_t::is_logic() const noexcept
+ inline bool detail::net_t::is_logic() const NL_NOEXCEPT
{
return dynamic_cast<const logic_net_t *>(this) != nullptr;
}
- inline bool detail::net_t::is_analog() const noexcept
+ inline bool detail::net_t::is_analog() const NL_NOEXCEPT
{
return dynamic_cast<const analog_net_t *>(this) != nullptr;
}
@@ -1358,7 +1358,7 @@ namespace netlist
}
}
- inline void detail::net_t::push_to_queue(const netlist_time delay) noexcept
+ inline void detail::net_t::push_to_queue(const netlist_time delay) NL_NOEXCEPT
{
if (!is_queued() && (num_cons() != 0))
{
@@ -1371,7 +1371,7 @@ namespace netlist
}
}
- inline void detail::net_t::reschedule_in_queue(const netlist_time delay) noexcept
+ inline void detail::net_t::reschedule_in_queue(const netlist_time delay) NL_NOEXCEPT
{
if (is_queued())
netlist().remove_from_queue(*this);
@@ -1384,39 +1384,39 @@ namespace netlist
}
}
- inline const analog_net_t & analog_t::net() const noexcept
+ inline const analog_net_t & analog_t::net() const NL_NOEXCEPT
{
return static_cast<const analog_net_t &>(core_terminal_t::net());
}
- inline analog_net_t & analog_t::net() noexcept
+ inline analog_net_t & analog_t::net() NL_NOEXCEPT
{
return static_cast<analog_net_t &>(core_terminal_t::net());
}
inline nl_double terminal_t::operator ()() const { return net().Q_Analog(); }
- inline logic_net_t & logic_t::net() noexcept
+ inline logic_net_t & logic_t::net() NL_NOEXCEPT
{
return *static_cast<logic_net_t *>(&core_terminal_t::net());
}
- inline const logic_net_t & logic_t::net() const noexcept
+ inline const logic_net_t & logic_t::net() const NL_NOEXCEPT
{
return static_cast<const logic_net_t &>(core_terminal_t::net());
}
- inline netlist_sig_t logic_input_t::Q() const noexcept
+ inline netlist_sig_t logic_input_t::Q() const NL_NOEXCEPT
{
return net().Q();
}
- inline nl_double analog_input_t::Q_Analog() const noexcept
+ inline nl_double analog_input_t::Q_Analog() const NL_NOEXCEPT
{
return net().Q_Analog();
}
- inline void analog_output_t::set_Q(const nl_double newQ) noexcept
+ inline void analog_output_t::set_Q(const nl_double newQ) NL_NOEXCEPT
{
if (newQ != net().Q_Analog())
{
@@ -1426,7 +1426,7 @@ namespace netlist
}
}
- inline void netlist_t::push_to_queue(detail::net_t &out, const netlist_time attime) noexcept
+ inline void netlist_t::push_to_queue(detail::net_t &out, const netlist_time attime) NL_NOEXCEPT
{
m_queue.push(attime, &out);
}
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 62c06176a2d..6e9d57ec567 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -445,7 +445,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out)
}
out.net().m_core_terms.clear(); // clear the list
- out.net().register_con(new_proxy->in());
+ out.net().add_terminal(new_proxy->in());
out_cast.set_proxy(proxy);
proxy = new_proxy.get();
@@ -479,20 +479,22 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp)
/* connect all existing terminals to new net */
if (inp.has_net())
- for (auto & p : inp.net().m_core_terms)
{
- p->clear_net(); // de-link from all nets ...
- if (!connect(ret->proxy_term(), *p))
- log().fatal("Error connecting {1} to {2}\n", ret->proxy_term().name(), (*p).name());
+ for (auto & p : inp.net().m_core_terms)
+ {
+ p->clear_net(); // de-link from all nets ...
+ if (!connect(ret->proxy_term(), *p))
+ log().fatal("Error connecting {1} to {2}\n", ret->proxy_term().name(), (*p).name());
+ }
+ inp.net().m_core_terms.clear(); // clear the list
}
- inp.net().m_core_terms.clear(); // clear the list
- ret->out().net().register_con(inp);
+ ret->out().net().add_terminal(inp);
#else
if (inp.has_net())
//fatalerror("logic inputs can only belong to one net!\n");
merge_nets(ret->out().net(), inp.net());
else
- ret->out().net().register_con(inp);
+ ret->out().net().add_terminal(inp);
#endif
netlist().register_dev(std::move(new_proxy));
return ret;
@@ -537,7 +539,7 @@ void setup_t::connect_input_output(detail::core_terminal_t &in, detail::core_ter
#endif
auto proxy = get_a_d_proxy(in);
- out.net().register_con(proxy->proxy_term());
+ out.net().add_terminal(proxy->proxy_term());
}
else if (out.is_logic() && in.is_analog())
{
@@ -551,7 +553,7 @@ void setup_t::connect_input_output(detail::core_terminal_t &in, detail::core_ter
if (in.has_net())
merge_nets(out.net(), in.net());
else
- out.net().register_con(in);
+ out.net().add_terminal(in);
}
}
@@ -594,7 +596,7 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o
if (in.has_net())
merge_nets(out.net(), in.net());
else
- out.net().register_con(in);
+ out.net().add_terminal(in);
}
else if (out.is_logic())
{
@@ -619,12 +621,12 @@ void setup_t::connect_terminals(detail::core_terminal_t &t1, detail::core_termin
else if (t2.has_net())
{
log().debug("T2 has net\n");
- t2.net().register_con(t1);
+ t2.net().add_terminal(t1);
}
else if (t1.has_net())
{
log().debug("T1 has net\n");
- t1.net().register_con(t2);
+ t1.net().add_terminal(t2);
}
else
{
@@ -632,8 +634,8 @@ void setup_t::connect_terminals(detail::core_terminal_t &t1, detail::core_termin
// FIXME: Nets should have a unique name
auto anet = plib::palloc<analog_net_t>(netlist(),"net." + t1.name());
t1.set_net(anet);
- anet->register_con(t2);
- anet->register_con(t1);
+ anet->add_terminal(t2);
+ anet->add_terminal(t1);
}
}
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index b9c69884382..3f4deb0340f 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -163,7 +163,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
nl_assert(p->net().is_analog());
net_proxy_output->m_proxied_net = static_cast<analog_net_t *>(&p->net());
}
- net_proxy_output->net().register_con(*p);
+ net_proxy_output->net().add_terminal(*p);
// FIXME: repeated
net_proxy_output->net().rebuild_list();
log().debug("Added input\n");