Panda3D

linkedListNode.h

00001 // Filename: linkedListNode.h
00002 // Created by:  drose (16Mar06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef LINKEDLISTNODE_H
00016 #define LINKEDLISTNODE_H
00017 
00018 #include "pandabase.h"
00019 #include "pnotify.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //       Class : LinkedListNode
00023 // Description : This just stores the pointers to implement a
00024 //               doubly-linked list of some kind of object.  There are
00025 //               occasions when a hand-rolled linked list is more
00026 //               appropriate than an STL container.
00027 //
00028 //               Typically, each node of the linked list, as well as
00029 //               the root of the list, will inherit from this class.
00030 //
00031 //               Note that this class is not inherently thread-safe;
00032 //               derived classes are responsible for protecting any
00033 //               calls into it within mutexes, if necessary.
00034 ////////////////////////////////////////////////////////////////////
00035 class EXPCL_PANDA_PUTIL LinkedListNode {
00036 protected:
00037   INLINE LinkedListNode();
00038   INLINE LinkedListNode(bool);
00039   INLINE ~LinkedListNode();
00040 
00041   INLINE bool is_on_list() const;
00042   INLINE void remove_from_list();
00043   INLINE void insert_before(LinkedListNode *node);
00044   INLINE void insert_after(LinkedListNode *node);
00045 
00046   INLINE void take_list_from(LinkedListNode *other_root);
00047 
00048   LinkedListNode *_prev, *_next;
00049 };
00050 
00051 #include "linkedListNode.I"
00052 
00053 #endif
 All Classes Functions Variables Enumerations