Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
28 class TSortedList : public TList {
29 
30 public:
31  TSortedList(Bool_t order = kSortAscending) { fAscending = order; }
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); }
48  void Sort(Bool_t = kSortAscending) { }
49 
50  ClassDef(TSortedList,0) //A sorted list
51 };
52 
53 #endif
54