Intrusive Containers
Classes

Intrusive Double Linked List. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DListInNode< R, N, n >
 
class  DListInRoot< R, N, n >
 
class  DListInRoot< R, N, n >
 
class  DListInNode< R, N, n >
 

Detailed Description

Intrusive Double Linked List.

This file defines a pair of templates (DListInRoot and DListInNode) that implement an intrusive double linked list.

Overview

DListInRoot and DListInNode provide a simple API to allow classes to provide a basic List <-> Node relationship (1 List holding many Nodes) with a doubly linked list. (c.f. ListIn.h, ListInRoot, and ListInNode for singly linked list)

To create this relationship, the class to act as the list derives from the template DListInRoot, and the class to act as the Node from DListInNode, both with a first parameter of the class name of the List clase, and a second parameter of the Node clasee. There is an optional integral 3rd parameter to allow the classes to inherent from these multiple times if you need to represent multiple simultaneous relationships. This inheretance should be public, or you need to add the DListInRoot and DListInNode templates as friends.

At the point of decleration, both classes need to be declared, so you will typically have a forward of the other class before the definition of the class. At the point of usage of members, generally the full definition of both classes is needed to instance the code for the template.

Inside this file, the following types have the following meanings:

R: The "user" type that will be derived from DListInRoot

N: The "user" type that will be derived from DListInNode

n: The integer parameter for the template to allow multiple useage

Root: The particular instance of DListInRoot<R, N, n> being used

Node: The particular instance of DListInNode<R, N, n> being used

node: will have type N*, to be used when walking the list.

Invarients
  • root->first_ and root->last_ will either both be NULL, or neither will be NULL
  • if root->first_ != NULL,
    • root->first_->root_ == root
    • root->last_->root_ == root
    • root->first_->prev_ == NULL
    • root->last_->next_ == NULL
  • if node->root_ == NULL:
    • node->next_ == NULL
    • node->prev_ == NULL
  • if node->next_ != NULL:
    • node->next_->prev_ == node
    • node->next_->root_ == node->root_
    • if node->root_ != NULL AND node->prev_ == NULL:
    • node->root_->first_ == node
  • if node->root_ != NULL abd node->next_ == NULL:
    • node->root_->last_ == node

See also
DListIn.hpp
ListIn.h