Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ai/src/external/bullet/LinearMath/btList.h @ 8465

Last change on this file since 8465 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/*
2Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/
3
4This software is provided 'as-is', without any express or implied warranty.
5In no event will the authors be held liable for any damages arising from the use of this software.
6Permission is granted to anyone to use this software for any purpose,
7including commercial applications, and to alter it and redistribute it freely,
8subject to the following restrictions:
9
101. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
112. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
123. This notice may not be removed or altered from any source distribution.
13*/
14
15
16
17#ifndef GEN_LIST_H
18#define GEN_LIST_H
19
20class btGEN_Link {
21public:
22    btGEN_Link() : m_next(0), m_prev(0) {}
23    btGEN_Link(btGEN_Link *next, btGEN_Link *prev) : m_next(next), m_prev(prev) {}
24   
25    btGEN_Link *getNext() const { return m_next; } 
26    btGEN_Link *getPrev() const { return m_prev; } 
27
28    bool isHead() const { return m_prev == 0; }
29    bool isTail() const { return m_next == 0; }
30
31    void insertBefore(btGEN_Link *link) {
32        m_next         = link;
33        m_prev         = link->m_prev;
34        m_next->m_prev = this;
35        m_prev->m_next = this;
36    } 
37
38    void insertAfter(btGEN_Link *link) {
39        m_next         = link->m_next;
40        m_prev         = link;
41        m_next->m_prev = this;
42        m_prev->m_next = this;
43    } 
44
45    void remove() { 
46        m_next->m_prev = m_prev; 
47        m_prev->m_next = m_next;
48    }
49
50private: 
51    btGEN_Link  *m_next;
52    btGEN_Link  *m_prev;
53};
54
55class btGEN_List {
56public:
57    btGEN_List() : m_head(&m_tail, 0), m_tail(0, &m_head) {}
58
59    btGEN_Link *getHead() const { return m_head.getNext(); } 
60    btGEN_Link *getTail() const { return m_tail.getPrev(); } 
61
62    void addHead(btGEN_Link *link) { link->insertAfter(&m_head); }
63    void addTail(btGEN_Link *link) { link->insertBefore(&m_tail); }
64   
65private:
66    btGEN_Link m_head;
67    btGEN_Link m_tail;
68};
69
70#endif
71
72
73
Note: See TracBrowser for help on using the repository browser.