summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/netlist/nl_lists.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/netlist/nl_lists.h')
-rw-r--r--src/emu/netlist/nl_lists.h143
1 files changed, 71 insertions, 72 deletions
diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h
index 3d4d70c0231..ef32fb03c1f 100644
--- a/src/emu/netlist/nl_lists.h
+++ b/src/emu/netlist/nl_lists.h
@@ -20,13 +20,12 @@ struct netlist_list_t
{
public:
- struct entry_t {
+ struct entry_t {
+ // keep compatibility with tagmap
+ _ListClass object() { return m_obj; }
- // keep compatibility with tagmap
- _ListClass object() { return m_obj; }
-
- _ListClass m_obj;
- };
+ _ListClass m_obj;
+ };
ATTR_COLD netlist_list_t(int numElements = _NumElem)
{
@@ -36,25 +35,25 @@ public:
m_ptr--;
}
- ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
- {
- m_list = new entry_t[m_num_elements];
- m_ptr = m_list;
- m_ptr--;
- for (int i=0; i<rhs.count(); i++)
- {
- this->add(rhs[i]);
- }
- }
-
- ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
- {
- for (int i=0; i<rhs.count(); i++)
- {
- this->add(rhs[i]);
- }
- return *this;
- }
+ ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
+ {
+ m_list = new entry_t[m_num_elements];
+ m_ptr = m_list;
+ m_ptr--;
+ for (int i=0; i<rhs.count(); i++)
+ {
+ this->add(rhs[i]);
+ }
+ }
+
+ ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
+ {
+ for (int i=0; i<rhs.count(); i++)
+ {
+ this->add(rhs[i]);
+ }
+ return *this;
+ }
ATTR_COLD ~netlist_list_t()
@@ -64,50 +63,50 @@ public:
ATTR_HOT inline void add(const _ListClass elem)
{
if (m_ptr-m_list >= m_num_elements - 1)
- resize(m_num_elements * 2);
+ resize(m_num_elements * 2);
(++m_ptr)->m_obj = elem;
}
ATTR_HOT inline void resize(const int new_size)
{
- int cnt = count();
- entry_t *m_new = new entry_t[new_size];
- entry_t *pd = m_new;
-
- for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
- *pd = *ps;
- delete[] m_list;
- m_list = m_new;
- m_ptr = m_list + cnt - 1;
- m_num_elements = new_size;
+ int cnt = count();
+ entry_t *m_new = new entry_t[new_size];
+ entry_t *pd = m_new;
+
+ for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
+ *pd = *ps;
+ delete[] m_list;
+ m_list = m_new;
+ m_ptr = m_list + cnt - 1;
+ m_num_elements = new_size;
+ }
+ ATTR_HOT inline void remove(const _ListClass elem)
+ {
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ if (i->object() == elem)
+ {
+ while (i < m_ptr)
+ {
+ *i = *(i+1);
+ i++;
+ }
+ m_ptr--;
+ return;
+ }
+ }
+ }
+ ATTR_HOT inline bool contains(const _ListClass elem) const
+ {
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ if (i->object() == elem)
+ return true;
+ }
+ return false;
}
- ATTR_HOT inline void remove(const _ListClass elem)
- {
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- if (i->object() == elem)
- {
- while (i < m_ptr)
- {
- *i = *(i+1);
- i++;
- }
- m_ptr--;
- return;
- }
- }
- }
- ATTR_HOT inline bool contains(const _ListClass elem) const
- {
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- if (i->object() == elem)
- return true;
- }
- return false;
- }
ATTR_HOT inline entry_t *first() const { return (m_ptr >= m_list ? &m_list[0] : NULL ); }
- ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
+ ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
ATTR_HOT inline entry_t *last() const { return m_ptr; }
ATTR_HOT inline int count() const { return m_ptr - m_list + 1; }
ATTR_HOT inline bool empty() const { return (m_ptr < m_list); }
@@ -115,16 +114,16 @@ public:
ATTR_COLD void reset_and_free()
{
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- delete i->object();
- }
- reset();
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ delete i->object();
+ }
+ reset();
}
- //ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
+ //ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
ATTR_HOT inline _ListClass& operator[](const int & index) { return m_list[index].m_obj; }
- ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
+ ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
private:
entry_t * m_ptr;
@@ -140,7 +139,7 @@ private:
template <class _Element, class _Time, int _Size>
class netlist_timed_queue
{
- NETLIST_PREVENT_COPYING(netlist_timed_queue)
+ NETLIST_PREVENT_COPYING(netlist_timed_queue)
public:
struct entry_t
@@ -153,7 +152,7 @@ public:
ATTR_HOT inline _Element & object() const { return *m_object; }
ATTR_HOT inline const _Time *time_ptr() const { return &m_time; }
- ATTR_HOT inline _Element *object_ptr() const { return m_object; }
+ ATTR_HOT inline _Element *object_ptr() const { return m_object; }
private:
_Time m_time;
_Element *m_object;
@@ -165,7 +164,7 @@ public:
clear();
}
- ATTR_HOT inline int capacity() const { return _Size; }
+ ATTR_HOT inline int capacity() const { return _Size; }
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }