Panda3D
linkedListNode.h
1 // Filename: linkedListNode.h
2 // Created by: drose (16Mar06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LINKEDLISTNODE_H
16 #define LINKEDLISTNODE_H
17 
18 #include "pandabase.h"
19 #include "pnotify.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : LinkedListNode
23 // Description : This just stores the pointers to implement a
24 // doubly-linked list of some kind of object. There are
25 // occasions when a hand-rolled linked list is more
26 // appropriate than an STL container.
27 //
28 // Typically, each node of the linked list, as well as
29 // the root of the list, will inherit from this class.
30 //
31 // Note that this class is not inherently thread-safe;
32 // derived classes are responsible for protecting any
33 // calls into it within mutexes, if necessary.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_PUTIL LinkedListNode {
36 protected:
37  INLINE LinkedListNode();
38  INLINE LinkedListNode(bool);
39  INLINE ~LinkedListNode();
40 
41  INLINE bool is_on_list() const;
42  INLINE void remove_from_list();
43  INLINE void insert_before(LinkedListNode *node);
44  INLINE void insert_after(LinkedListNode *node);
45 
46  INLINE void take_list_from(LinkedListNode *other_root);
47 
48  LinkedListNode *_prev, *_next;
49 };
50 
51 #include "linkedListNode.I"
52 
53 #endif
This just stores the pointers to implement a doubly-linked list of some kind of object.