Panda3D
Protected Member Functions | Protected Attributes

LinkedListNode Class Reference

This just stores the pointers to implement a doubly-linked list of some kind of object. More...

#include "linkedListNode.h"

Inheritance diagram for LinkedListNode:
AdaptiveLruPageDynamicList AdaptiveLruPageStaticList BamCacheIndex BamCacheRecord BufferContext BufferContextChain PandaNode PandaNodeChain SimpleAllocator SimpleAllocatorBlock SimpleLru SimpleLruPage

List of all members.

Protected Member Functions

 LinkedListNode (bool)
 This constructor should be invoked for any LinkedListNodes that will be used to serve as the root of a list.
void insert_after (LinkedListNode *node)
 Adds a LinkedListNode record after the indicated node in the doubly-linked list.
void insert_before (LinkedListNode *node)
 Adds a LinkedListNode record before the indicated node in the doubly-linked list.
bool is_on_list () const
 Returns true if the node is member of any list, false if it has been removed or never added.
void remove_from_list ()
 Removes a LinkedListNode record from the doubly-linked list.
void take_list_from (LinkedListNode *other_root)
 Given that this LinkedListNode represents the root of a list, and the other pointer represents the root of a different list, move all of the nodes (except the root itself) from other_root onto this list.

Protected Attributes

LinkedListNode_next
LinkedListNode_prev

Detailed Description

This just stores the pointers to implement a doubly-linked list of some kind of object.

There are occasions when a hand-rolled linked list is more appropriate than an STL container.

Typically, each node of the linked list, as well as the root of the list, will inherit from this class.

Note that this class is not inherently thread-safe; derived classes are responsible for protecting any calls into it within mutexes, if necessary.

Definition at line 35 of file linkedListNode.h.


Constructor & Destructor Documentation

LinkedListNode::LinkedListNode ( bool  ) [inline, protected]

This constructor should be invoked for any LinkedListNodes that will be used to serve as the root of a list.

It sets up the pointers as an empty list.

Definition at line 38 of file linkedListNode.I.


Member Function Documentation

void LinkedListNode::insert_after ( LinkedListNode node) [inline, protected]

Adds a LinkedListNode record after the indicated node in the doubly-linked list.

Definition at line 108 of file linkedListNode.I.

void LinkedListNode::insert_before ( LinkedListNode node) [inline, protected]

Adds a LinkedListNode record before the indicated node in the doubly-linked list.

Definition at line 91 of file linkedListNode.I.

Referenced by SimpleAllocator::do_alloc(), AdaptiveLru::do_partial_lru_update(), and SimpleLruPage::enqueue_lru().

bool LinkedListNode::is_on_list ( ) const [inline, protected]

Returns true if the node is member of any list, false if it has been removed or never added.

The head of a list generally appears to to always be a member of itself.

Definition at line 62 of file linkedListNode.I.

void LinkedListNode::remove_from_list ( ) [inline, protected]

Removes a LinkedListNode record from the doubly-linked list.

Definition at line 73 of file linkedListNode.I.

Referenced by SimpleLruPage::dequeue_lru(), SimpleAllocatorBlock::do_free(), AdaptiveLru::do_partial_lru_update(), and SimpleLruPage::enqueue_lru().

void LinkedListNode::take_list_from ( LinkedListNode other_root) [inline, protected]

Given that this LinkedListNode represents the root of a list, and the other pointer represents the root of a different list, move all of the nodes (except the root itself) from other_root onto this list.

Definition at line 127 of file linkedListNode.I.

Referenced by BufferContextChain::take_from().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations