summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/nl_base.h
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2017-01-14 20:11:51 +0100
committer couriersud <couriersud@gmx.org>2017-01-15 17:56:45 +0100
commit3cfe098bb24646ba446157e1e27ecfe9d428665e (patch)
treef0882f52da91a26083b582844f19035663f20fb8 /src/lib/netlist/nl_base.h
parentfa6442a5e64bf2dee0e082c25ed10c342b7f1fd0 (diff)
Introduce a more structured approach to models. (nw)
Diffstat (limited to 'src/lib/netlist/nl_base.h')
-rw-r--r--src/lib/netlist/nl_base.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index da8cb14401b..d1ad788b17b 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -951,22 +951,41 @@ namespace netlist
pstring m_param;
};
- class param_model_t final : public param_str_t
+ class param_model_t : public param_str_t
{
public:
+
+ class value_t
+ {
+ public:
+ value_t(param_model_t &param, const pstring name)
+ {
+ printf("Looking for %s %s\n", param.name().c_str(), name.c_str());
+ m_value = param.model_value(name);
+ }
+ const double operator()() const { return m_value; }
+ operator double() const { return m_value; }
+ private:
+ double m_value;
+ };
+
+ friend class value_t;
+
param_model_t(device_t &device, const pstring name, const pstring val)
: param_str_t(device, name, val) { }
- /* these should be cached! */
- nl_double model_value(const pstring &entity);
- const pstring model_value_str(const pstring &entity);
- const pstring model_type();
+ const pstring model_value_str(const pstring &entity) /*const*/;
+ const pstring model_type() /*const*/;
protected:
virtual void changed() override;
+ nl_double model_value(const pstring &entity) /*const*/;
private:
+ /* hide this */
+ void setTo(const pstring &param) = delete;
model_map_t m_map;
};
+
class param_data_t : public param_str_t
{
public:
@@ -1082,10 +1101,10 @@ namespace netlist
setup_t &setup();
- template<class C>
- void register_sub(const pstring &name, std::unique_ptr<C> &dev)
+ template<class C, typename... Args>
+ void register_sub(const pstring &name, std::unique_ptr<C> &dev, const Args&... args)
{
- dev.reset(new C(*this, name));
+ dev.reset(new C(*this, name, args...));
}
void register_subalias(const pstring &name, detail::core_terminal_t &term);