Logo ROOT   6.08/07
Reference Guide
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 #ifndef ROOT_TList
26 #include "TList.h"
27 #endif
28 
29 
30 class TSortedList : public TList {
31 
32 public:
34 
35  void Add(TObject *obj);
36  void Add(TObject *obj, Option_t *opt);
37 
38  Bool_t IsSorted() const { return kTRUE; }
39 
40  //---- the following methods are overridden to preserve sorting order
41  void AddFirst(TObject *obj) { Add(obj); }
42  void AddFirst(TObject *obj, Option_t *opt) { Add(obj, opt); }
43  void AddLast(TObject *obj) { Add(obj); }
44  void AddLast(TObject *obj, Option_t *opt) { Add(obj, opt); }
45  void AddAt(TObject *obj, Int_t) { Add(obj); }
46  void AddAfter(const TObject *, TObject *obj) { Add(obj); }
47  void AddAfter(TObjLink *, TObject *obj) { Add(obj); }
48  void AddBefore(const TObject *, TObject *obj) { Add(obj); }
49  void AddBefore(TObjLink *, TObject *obj) { Add(obj); }
51 
52  ClassDef(TSortedList,0) //A sorted list
53 };
54 
55 #endif
56 
void AddLast(TObject *obj, Option_t *opt)
Add object at the end of the list and also store option.
Definition: TSortedList.h:44
void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TSortedList.h:41
const char Option_t
Definition: RtypesCore.h:62
Bool_t IsSorted() const
Definition: TSortedList.h:38
void AddFirst(TObject *obj, Option_t *opt)
Add object at the beginning of the list and also store option.
Definition: TSortedList.h:42
void AddAfter(TObjLink *, TObject *obj)
Insert object after the specified ObjLink object.
Definition: TSortedList.h:47
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void Sort(Bool_t=kSortAscending)
Sort linked list.
Definition: TSortedList.h:50
#define ClassDef(name, id)
Definition: Rtypes.h:254
A sorted doubly linked list.
Definition: TSortedList.h:30
void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TSortedList.h:43
void AddBefore(TObjLink *, TObject *obj)
Insert object before the specified ObjLink object.
Definition: TSortedList.h:49
A doubly linked list.
Definition: TList.h:47
void AddAt(TObject *obj, Int_t)
Insert object at position idx in the list.
Definition: TSortedList.h:45
void AddBefore(const TObject *, TObject *obj)
Insert object before object before in the list.
Definition: TSortedList.h:48
TSortedList(Bool_t order=kSortAscending)
Definition: TSortedList.h:33
void AddAfter(const TObject *, TObject *obj)
Insert object after object after in the list.
Definition: TSortedList.h:46
Bool_t fAscending
cache to speedup sequential calling of Before() and After() functions
Definition: TList.h:55
const Bool_t kSortAscending
Definition: TList.h:40
Mother of all ROOT objects.
Definition: TObject.h:37
void Add(TObject *obj)
Add object in sorted list.
Definition: TSortedList.cxx:27
const Bool_t kTRUE
Definition: Rtypes.h:91