* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: pList.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program 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
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* The file pList.h contains "private" code for methods relating to the
* This file is considered private to the class implementation and not
* part of its interface. This code is in a header file just to
* allow the template class to be packaged up into a library.
template<class T
> List
<T
>::List()
template<class T
> List
<T
>::~List()
while (removeHead() != NULL
)
template<class T
> inline Link
<T
> *List
<T
>::addHead(T
*newItem
)
Link
<T
> *link
= new Link
<T
>(newItem
, head
, NULL
);
template<class T
> inline Link
<T
> *List
<T
>::addTail(T
*newItem
)
Link
<T
> *link
= new Link
<T
>(newItem
, NULL
, tail
);
template<class T
> inline Link
<T
> *List
<T
>::addBefore (Link
<T
> *link
,
Link
<T
> *newLink
= new Link
<T
>(newItem
, link
, link
->prev
);
newLink
->prev
->next
= newLink
;
template<class T
> inline Link
<T
> *List
<T
>::addAfter (Link
<T
> *link
,
Link
<T
> *newLink
= new Link
<T
>(newItem
, link
->next
, link
);
newLink
->next
->prev
= newLink
;
template<class T
> inline T
*List
<T
>::removeHead()
template<class T
> inline T
*List
<T
>::removeTail()
template<class T
> inline T
*List
<T
>::removeItem (Link
<T
> *link
)
link
->prev
->next
= link
->next
;
link
->next
->prev
= link
->prev
;
template<class T
> void List
<T
>::printThis (ostream
&os
)
os
<< "List has length " << length
<< "\n";
// ListIterator<T> iter(this);
// for (Link<T> *link = iter.getHeadLink();
// link = iter.getNextLink()) {
// link->printThis(cout);
template<class T
> inline T
*ListIterator
<T
>::getNextItem ()
if (link
&& link
->next
) {
template<class T
> inline T
*ListIterator
<T
>::getPrevItem ()
if (link
&& link
->prev
) {
template<class T
> inline Link
<T
> *ListIterator
<T
>::getNextLink ()
if (link
&& link
->next
) {
template<class T
> inline Link
<T
> *ListIterator
<T
>::getPrevLink ()
if (link
&& link
->prev
) {