Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSortedList.h
Go to the documentation of this file.
1// @(#)root/cont:$Id$
2// Author: Fons Rademakers 14/09/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSortedList
13#define ROOT_TSortedList
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TSortedList //
19// //
20// A sorted doubly linked list. All sortable classes inheriting from //
21// TObject can be inserted in a TSortedList. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TList.h"
26
27
28class TSortedList : public TList {
29
30public:
32
33 void Add(TObject *obj);
34 void Add(TObject *obj, Option_t *opt);
35
36 Bool_t IsSorted() const { return kTRUE; }
37
38 //---- the following methods are overridden to preserve sorting order
39 void AddFirst(TObject *obj) { Add(obj); }
40 void AddFirst(TObject *obj, Option_t *opt) { Add(obj, opt); }
41 void AddLast(TObject *obj) { Add(obj); }
42 void AddLast(TObject *obj, Option_t *opt) { Add(obj, opt); }
43 void AddAt(TObject *obj, Int_t) { Add(obj); }
44 void AddAfter(const TObject *, TObject *obj) { Add(obj); }
45 void AddAfter(TObjLink *, TObject *obj) { Add(obj); }
46 void AddBefore(const TObject *, TObject *obj) { Add(obj); }
47 void AddBefore(TObjLink *, TObject *obj) { Add(obj); }
49
50 ClassDef(TSortedList,0) //A sorted list
51};
52
53#endif
54
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
const Bool_t kSortAscending
Definition TList.h:31
A doubly linked list.
Definition TList.h:38
Bool_t fAscending
cache to speedup sequential calling of Before() and After() functions
Definition TList.h:49
Mother of all ROOT objects.
Definition TObject.h:41
A sorted doubly linked list.
Definition TSortedList.h:28
void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition TSortedList.h:39
void AddFirst(TObject *obj, Option_t *opt)
Add object at the beginning of the list and also store option.
Definition TSortedList.h:40
Bool_t IsSorted() const
Definition TSortedList.h:36
void AddBefore(TObjLink *, TObject *obj)
Insert object before the specified ObjLink object.
Definition TSortedList.h:47
void Add(TObject *obj)
Add object in sorted list.
void AddLast(TObject *obj, Option_t *opt)
Add object at the end of the list and also store option.
Definition TSortedList.h:42
void AddAfter(const TObject *, TObject *obj)
Insert object after object after in the list.
Definition TSortedList.h:44
TSortedList(Bool_t order=kSortAscending)
Definition TSortedList.h:31
void AddAt(TObject *obj, Int_t)
Insert object at position idx in the list.
Definition TSortedList.h:43
void AddBefore(const TObject *, TObject *obj)
Insert object before object before in the list.
Definition TSortedList.h:46
void AddAfter(TObjLink *, TObject *obj)
Insert object after the specified ObjLink object.
Definition TSortedList.h:45
void AddLast(TObject *obj)
Add object at the end of the list.
Definition TSortedList.h:41
void Sort(Bool_t=kSortAscending)
Sort linked list.
Definition TSortedList.h:48