diff options
author | 2017-01-27 18:36:45 +0100 | |
---|---|---|
committer | 2017-01-27 18:38:01 +0100 | |
commit | cb16de91c61c387b3215d77c16fbef0376a23677 (patch) | |
tree | 86435e9cced881b4053ccafbf92211d2458e5208 /src | |
parent | 5b0d4772a392461ebb7b6d450517bd0fe5ceca7d (diff) |
Minor refactoring. (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/netlist/nl_lists.h | 1 | ||||
-rw-r--r-- | src/lib/netlist/plib/pconfig.h | 24 | ||||
-rw-r--r-- | src/lib/netlist/plib/pfmtlog.h | 22 | ||||
-rw-r--r-- | src/lib/netlist/plib/ptypes.h | 31 | ||||
-rw-r--r-- | src/lib/netlist/plib/putil.cpp | 4 |
5 files changed, 37 insertions, 45 deletions
diff --git a/src/lib/netlist/nl_lists.h b/src/lib/netlist/nl_lists.h index 728bba6f440..f643af2020e 100644 --- a/src/lib/netlist/nl_lists.h +++ b/src/lib/netlist/nl_lists.h @@ -17,6 +17,7 @@ #include "nl_config.h" #include "plib/plists.h" #include "plib/pchrono.h" +#include "plib/ptypes.h" // ---------------------------------------------------------------------------------------- // timed queue diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index 71b4b4d955b..105463fe489 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -51,30 +51,6 @@ typedef __int128_t INT128; // Standard defines //============================================================ -// prevent implicit copying -#if 0 -#define P_PREVENT_COPYING(name) \ - private: \ - name(const name &); \ - name(const name &&); \ - name &operator=(const name &); -#else - -namespace plib -{ - struct nocopyassignmove - { - protected: - nocopyassignmove() = default; - ~nocopyassignmove() = default; - private: - nocopyassignmove(const nocopyassignmove &) = delete; - nocopyassignmove(nocopyassignmove &&) = delete; - nocopyassignmove &operator=(const nocopyassignmove &) = delete; - }; -} -#endif - //============================================================ // Pointer to Member Function //============================================================ diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index 8ee3c75c5f8..1a212e601b8 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -14,6 +14,14 @@ namespace plib { +P_ENUM(plog_level, + DEBUG, + INFO, + VERBOSE, + WARNING, + ERROR, + FATAL) + template <typename T> struct ptype_traits_base { @@ -175,14 +183,6 @@ private: unsigned m_arg; }; -P_ENUM(plog_level, - DEBUG, - INFO, - VERBOSE, - WARNING, - ERROR, - FATAL) - class plog_dispatch_intf; template <bool build_enabled = true> @@ -242,7 +242,7 @@ private: }; -template <plog_level::e L, bool build_enabled = true> +template <plog_level::E L, bool build_enabled = true> class plog_channel : public pfmt_writer_t<build_enabled> { public: @@ -258,7 +258,7 @@ private: class plog_dispatch_intf { - template<plog_level::e, bool> friend class plog_channel; + template<plog_level::E, bool> friend class plog_channel; public: virtual ~plog_dispatch_intf(); @@ -290,7 +290,7 @@ public: }; -template <plog_level::e L, bool build_enabled> +template <plog_level::E L, bool build_enabled> void plog_channel<L, build_enabled>::vdowrite(const pstring &ls) const { m_base->vlog(L, ls); diff --git a/src/lib/netlist/plib/ptypes.h b/src/lib/netlist/plib/ptypes.h index 6aabed738e9..182333875d0 100644 --- a/src/lib/netlist/plib/ptypes.h +++ b/src/lib/netlist/plib/ptypes.h @@ -40,10 +40,25 @@ namespace plib #endif //============================================================ + // prevent implicit copying + //============================================================ + + struct nocopyassignmove + { + protected: + nocopyassignmove() = default; + ~nocopyassignmove() = default; + private: + nocopyassignmove(const nocopyassignmove &) = delete; + nocopyassignmove(nocopyassignmove &&) = delete; + nocopyassignmove &operator=(const nocopyassignmove &) = delete; + }; + + //============================================================ // penum - strongly typed enumeration //============================================================ - struct enum_base + struct penum_base { protected: static int from_string_int(const char *str, const char *x); @@ -53,22 +68,22 @@ namespace plib } #define P_ENUM(ename, ...) \ - struct ename : public plib::enum_base { \ - enum e { __VA_ARGS__ }; \ - ename (e v) : m_v(v) { } \ + struct ename : public plib::penum_base { \ + enum E { __VA_ARGS__ }; \ + ename (E v) : m_v(v) { } \ bool set_from_string (const pstring &s) { \ static const char *strings = # __VA_ARGS__; \ int f = from_string_int(strings, s.c_str()); \ - if (f>=0) { m_v = static_cast<e>(f); return true; } else { return false; } \ + if (f>=0) { m_v = static_cast<E>(f); return true; } else { return false; } \ } \ - operator e() const {return m_v;} \ + operator E() const {return m_v;} \ bool operator==(const ename &rhs) const {return m_v == rhs.m_v;} \ - bool operator==(const e &rhs) const {return m_v == rhs;} \ + bool operator==(const E &rhs) const {return m_v == rhs;} \ const pstring name() const { \ static const char *strings = # __VA_ARGS__; \ return nthstr(static_cast<int>(m_v), strings); \ } \ - private: e m_v; }; + private: E m_v; }; #endif /* PTYPES_H_ */ diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp index 87ac06b3f75..6a24e8c4012 100644 --- a/src/lib/netlist/plib/putil.cpp +++ b/src/lib/netlist/plib/putil.cpp @@ -104,7 +104,7 @@ namespace plib } - int enum_base::from_string_int(const char *str, const char *x) + int penum_base::from_string_int(const char *str, const char *x) { int cnt = 0; const char *cur = str; @@ -131,7 +131,7 @@ namespace plib return cnt; return -1; } - pstring enum_base::nthstr(int n, const char *str) + pstring penum_base::nthstr(int n, const char *str) { char buf[64]; char *bufp = buf; |