1 //==-- llvm/ADT/ilist_node.h - Intrusive Linked List Helper ------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ilist_node class template, which is a convenient
11 // base class for creating classes that can be used with ilists.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ADT_ILIST_NODE_H
16 #define LLVM_ADT_ILIST_NODE_H
20 template<typename NodeTy>
21 struct ilist_nextprev_traits;
23 /// ilist_node - Base class that provides next/prev services for nodes
24 /// that use ilist_nextprev_traits or ilist_default_traits.
26 template<typename NodeTy>
29 friend struct ilist_nextprev_traits<NodeTy>;
31 NodeTy *getPrev() { return Prev; }
32 NodeTy *getNext() { return Next; }
33 const NodeTy *getPrev() const { return Prev; }
34 const NodeTy *getNext() const { return Next; }
35 void setPrev(NodeTy *N) { Prev = N; }
36 void setNext(NodeTy *N) { Next = N; }
38 ilist_node() : Prev(0), Next(0) {}
41 } // End llvm namespace