A Doubly-Linked List for ParmParse
The PP_List<T> class is a template class that implements a doubly-linked list of objects. A PP_List<T> is a useful container class when the number of objects in the collection is not known ahead of time. A PP_List<T> can contain an arbitrary number of elements; operations such as insertion, deletion, and catenation are easily implemented and inexpensive.The only difficulty when defining a list class is devising a mechanism to access the elements. In an array, an element is accessed using an integer index. Since the elements in a PP_List<T> are ordered by position, we could define an integer indexing operation that walks along the PP_List<T> links from the beginning until the numbered element is found. Unfortunately, this would be very inefficient when accessing elements near the end of a long list. Another solution is to allow user access to the individual link objects that contain the element as well as the forward and backward pointers. This is not a satisfactory solution since it allows user access to the internal representation of the class. The solution chosen is to define a PP_ListIterator<T> template class.
Think of a PP_ListIterator<T> as a pointer to an object in the PP_List<T>. You can access the element currently pointed to by the iterator, move the iterator forward and backward through the PP_List<T>, and use it as a mechanism to define where elements should be inserted and deleted. If the iterator is moved off the end of the list it behaves as a null pointer.
This is a concrete class, not a polymorphic one.
This is a convenience class for ParmParse and will not be in any way supported by anyone at ANAG.
This software is copyright (C) by the Lawrence Berkeley National Laboratory. Permission is granted to reproduce this software for non-commercial purposes provided that this notice is left intact.
It is acknowledged that the U.S. Government has rights to this software under Contract DE-AC03-765F00098 between the U.S. Department of Energy and the University of California.
This software is provided as a professional and academic contribution for joint exchange. Thus it is experimental, is provided ``as is'', with no warranties of any kind whatsoever, no support, no promise of updates, or printed documentation. By using this software, you acknowledge that the Lawrence Berkeley National Laboratory and Regents of the University of California shall have no liability with respect to the infringement of other copyrights by any part of this software.