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) override;
34 void Add(TObject *obj, Option_t *opt) override;
35
36 Bool_t IsSorted() const override { return kTRUE; }
37
38 //---- the following methods are overridden to preserve sorting order
39 void AddFirst(TObject *obj) override { Add(obj); }
40 void AddFirst(TObject *obj, Option_t *opt) override { Add(obj, opt); }
41 void AddLast(TObject *obj) override { Add(obj); }
42 void AddLast(TObject *obj, Option_t *opt) override { Add(obj, opt); }
43 void AddAt(TObject *obj, Int_t) override { Add(obj); }
44 void AddAfter(const TObject *, TObject *obj) override { Add(obj); }
45 void AddAfter(TObjLink *, TObject *obj) override { Add(obj); }
46 void AddBefore(const TObject *, TObject *obj) override { Add(obj); }
47 void AddBefore(TObjLink *, TObject *obj) override { Add(obj); }
48 void Sort(Bool_t = kSortAscending) override { }
49
50 ClassDefOverride(TSortedList,0) //A sorted list
51};
52
53#endif
54
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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) override
Add object at the beginning of the list.
Definition TSortedList.h:39
void AddBefore(TObjLink *, TObject *obj) override
Insert object before the specified ObjLink object.
Definition TSortedList.h:47
void AddBefore(const TObject *, TObject *obj) override
Insert object before object before in the list.
Definition TSortedList.h:46
void AddAfter(TObjLink *, TObject *obj) override
Insert object after the specified ObjLink object.
Definition TSortedList.h:45
void Add(TObject *obj) override
Add object in sorted list.
void AddFirst(TObject *obj, Option_t *opt) override
Add object at the beginning of the list and also store option.
Definition TSortedList.h:40
void AddLast(TObject *obj, Option_t *opt) override
Add object at the end of the list and also store option.
Definition TSortedList.h:42
TSortedList(Bool_t order=kSortAscending)
Definition TSortedList.h:31
void AddLast(TObject *obj) override
Add object at the end of the list.
Definition TSortedList.h:41
void AddAt(TObject *obj, Int_t) override
Insert object at position idx in the list.
Definition TSortedList.h:43
void AddAfter(const TObject *, TObject *obj) override
Insert object after object after in the list.
Definition TSortedList.h:44
Bool_t IsSorted() const override
Definition TSortedList.h:36
void Sort(Bool_t=kSortAscending) override
Sort linked list.
Definition TSortedList.h:48