1
//------------------------------------------------------------------------
3
//------------------------------------------------------------------------
5
// GL-Node Viewer (C) 2004-2007 Andrew Apted
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; either version 2
10
// of the License, or (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
//------------------------------------------------------------------------
19
#ifndef __NODEVIEW_LIST_H__
20
#define __NODEVIEW_LIST_H__
22
// (Yes, I'm probably nuts for not using std::list)
33
listnode_c() : nd_next(NULL), nd_prev(NULL) { }
34
listnode_c(const listnode_c& other) : nd_next(other.nd_next),
35
nd_prev(other.nd_prev) { }
38
inline listnode_c& operator= (const listnode_c& rhs)
42
nd_next = rhs.nd_next;
43
nd_prev = rhs.nd_prev;
48
inline listnode_c *NodeNext() const { return nd_next; }
49
inline listnode_c *NodePrev() const { return nd_prev; }
59
list_c() : head(NULL), tail(NULL) { }
60
list_c(const list_c& other) : head(other.head), tail(other.tail) { }
63
inline list_c& operator= (const list_c& rhs)
79
inline listnode_c *begin() const { return head; }
80
inline listnode_c *end() const { return tail; }
85
void remove(listnode_c *cur)
90
cur->nd_next->nd_prev = cur->nd_prev;
95
cur->nd_prev->nd_next = cur->nd_next;
100
void push_back(listnode_c *cur)
113
void push_front(listnode_c *cur)
126
inline listnode_c *pop_back()
128
listnode_c *cur = tail;
136
inline listnode_c *pop_front()
138
listnode_c *cur = head;
147
#endif /* __NODEVIEW_LIST_H__ */