dlist.h File Reference

doubly linked list. More...

#include <iostream>
#include "abacus/abacusroot.h"
#include "abacus/global.h"
#include "abacus/dlistitem.h"
#include "abacus/dlist.inc"

Go to the source code of this file.

Classes

class  ABA_DLIST< Type >
 class ABA_DLIST implements a doubly linked linear list. The list is implemented by a doubly linked list of ABA_DLISTITEMs. More...

Defines

#define forAllDListElem(L, item, e)
 ABA_DLIST: iterators.


Detailed Description

doubly linked list.

Author:
Matthias Elf
The following sections implement a template for a doubly linked linear list. The implementation is very similar to the class ABA_LIST. However, we do not derive these classes from the respective classes of ABA_LIST since this causes type conflicts. (e.g. {item->pred_->succ_ = dListItem} would require explicit cast).

Two classes are required for the representation of this data structure. The first one ABA_DLISTITEM forms the basic building block of the list storing an element and pointers to the predecessor and successor in the list, the second one is the ABA_LIST itself.
License:
This file is part of ABACUS - A Branch And CUt System Copyright (C) 1995 - 2003 University of Cologne, Germany
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See also:
http://www.gnu.org/copyleft/gpl.html

Definition in file dlist.h.


Define Documentation

#define forAllDListElem ( L,
item,
 ) 

Value:

for((item = (L).first()) ? (e = (item)->elem()) : 0; item !=0; \
    (item = (item)->succ()) ? (e = (item)->elem()) : 0)
ABA_DLIST: iterators.

The iterator forAllDListElem assigns to {Type e} all elements in the list beginning with the first element. The additional parameter item has to be of type ABA_DLISTITEM<Type>*. Deletions of elements in the list during the application of this iterator can cause an error. The operator ?: is used that item is only dereferenced if item != 0. The expression 0 on the right side of : is only a dummy that this expression is compilable.

Parameters:
L The list that should be iterated (ABA_DLIST<Type>).
item An auxilliary pointer to a list item (ABA_DLISTITEM<Type> *).
e The elements in the list are assigned to this variable (Type).

Definition at line 192 of file dlist.h.


Generated on Tue Aug 14 18:09:54 2007 for ABACUS by  doxygen 1.5.1