LLVM API Documentation

ilist_node.h

Go to the documentation of this file.
00001 //==-- llvm/ADT/ilist_node.h - Intrusive Linked List Helper ------*- C++ -*-==//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines the ilist_node class template, which is a convenient
00011 // base class for creating classes that can be used with ilists.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_ADT_ILIST_NODE_H
00016 #define LLVM_ADT_ILIST_NODE_H
00017 
00018 namespace llvm {
00019 
00020 template<typename NodeTy>
00021 struct ilist_nextprev_traits;
00022 
00023 template<typename NodeTy>
00024 struct ilist_traits;
00025 
00026 /// ilist_node - Base class that provides next/prev services for nodes
00027 /// that use ilist_nextprev_traits or ilist_default_traits.
00028 ///
00029 template<typename NodeTy>
00030 class ilist_node {
00031 private:
00032   friend struct ilist_nextprev_traits<NodeTy>;
00033   friend struct ilist_traits<NodeTy>;
00034   NodeTy *Prev, *Next;
00035   NodeTy *getPrev() { return Prev; }
00036   NodeTy *getNext() { return Next; }
00037   const NodeTy *getPrev() const { return Prev; }
00038   const NodeTy *getNext() const { return Next; }
00039   void setPrev(NodeTy *N) { Prev = N; }
00040   void setNext(NodeTy *N) { Next = N; }
00041 protected:
00042   ilist_node() : Prev(0), Next(0) {}
00043 };
00044 
00045 } // End llvm namespace
00046 
00047 #endif