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>
23
/// ilist_half_node - Base class that provides prev services for sentinels.
25
template<typename NodeTy>
26
class ilist_half_node {
27
friend struct ilist_traits<NodeTy>;
30
NodeTy *getPrev() { return Prev; }
31
const NodeTy *getPrev() const { return Prev; }
32
void setPrev(NodeTy *P) { Prev = P; }
33
ilist_half_node() : Prev(0) {}
36
template<typename NodeTy>
37
struct ilist_nextprev_traits;
39
/// ilist_node - Base class that provides next/prev services for nodes
40
/// that use ilist_nextprev_traits or ilist_default_traits.
42
template<typename NodeTy>
43
class ilist_node : private ilist_half_node<NodeTy> {
44
friend struct ilist_nextprev_traits<NodeTy>;
45
friend struct ilist_traits<NodeTy>;
47
NodeTy *getNext() { return Next; }
48
const NodeTy *getNext() const { return Next; }
49
void setNext(NodeTy *N) { Next = N; }
51
ilist_node() : Next(0) {}
54
} // End llvm namespace