2 * $Id: GEN_List.h 228 2002-12-26 18:25:17Z mein $
3 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. The Blender
9 * Foundation also sells licenses for use in proprietary software under
10 * the Blender License. See http://www.blender.org/BL/ for information
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL/BL DUAL LICENSE BLOCK *****
33 * $Id: GEN_List.h 228 2002-12-26 18:25:17Z mein $
34 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
36 * This program is free software; you can redistribute it and/or
37 * modify it under the terms of the GNU General Public License
38 * as published by the Free Software Foundation; either version 2
39 * of the License, or (at your option) any later version. The Blender
40 * Foundation also sells licenses for use in proprietary software under
41 * the Blender License. See http://www.blender.org/BL/ for information
44 * This program is distributed in the hope that it will be useful,
45 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 * GNU General Public License for more details.
49 * You should have received a copy of the GNU General Public License
50 * along with this program; if not, write to the Free Software Foundation,
51 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
53 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
54 * All rights reserved.
56 * The Original Code is: all of this file.
58 * Contributor(s): none yet.
60 * ***** END GPL/BL DUAL LICENSE BLOCK *****
68 GEN_Link() : m_next(0), m_prev(0) {}
69 GEN_Link(GEN_Link
*next
, GEN_Link
*prev
) : m_next(next
), m_prev(prev
) {}
71 GEN_Link
*getNext() const { return m_next
; }
72 GEN_Link
*getPrev() const { return m_prev
; }
74 bool isHead() const { return m_prev
== 0; }
75 bool isTail() const { return m_next
== 0; }
77 void insertBefore(GEN_Link
*link
) {
79 m_prev
= link
->m_prev
;
80 m_next
->m_prev
= this;
81 m_prev
->m_next
= this;
84 void insertAfter(GEN_Link
*link
) {
85 m_next
= link
->m_next
;
87 m_next
->m_prev
= this;
88 m_prev
->m_next
= this;
92 m_next
->m_prev
= m_prev
;
93 m_prev
->m_next
= m_next
;
103 GEN_List() : m_head(&m_tail
, 0), m_tail(0, &m_head
) {}
105 GEN_Link
*getHead() const { return m_head
.getNext(); }
106 GEN_Link
*getTail() const { return m_tail
.getPrev(); }
108 void addHead(GEN_Link
*link
) { link
->insertAfter(&m_head
); }
109 void addTail(GEN_Link
*link
) { link
->insertBefore(&m_tail
); }