Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:25

0001 // @(#)root/cont:$Id$
0002 // Author: Fons Rademakers   14/09/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TSortedList
0013 #define ROOT_TSortedList
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TSortedList                                                          //
0019 //                                                                      //
0020 // A sorted doubly linked list. All sortable classes inheriting from    //
0021 // TObject can be inserted in a TSortedList.                            //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TList.h"
0026 
0027 
0028 class TSortedList : public TList {
0029 
0030 public:
0031    TSortedList(Bool_t order = kSortAscending) { fAscending = order; }
0032 
0033    void      Add(TObject *obj) override;
0034    void      Add(TObject *obj, Option_t *opt) override;
0035 
0036    Bool_t    IsSorted() const override { return kTRUE; }
0037 
0038    //---- the following methods are overridden to preserve sorting order
0039    void      AddFirst(TObject *obj) override { Add(obj); }
0040    void      AddFirst(TObject *obj, Option_t *opt) override { Add(obj, opt); }
0041    void      AddLast(TObject *obj) override { Add(obj); }
0042    void      AddLast(TObject *obj, Option_t *opt) override { Add(obj, opt); }
0043    void      AddAt(TObject *obj, Int_t) override { Add(obj); }
0044    void      AddAfter(const TObject *, TObject *obj) override { Add(obj); }
0045    void      AddAfter(TObjLink *, TObject *obj) override { Add(obj); }
0046    void      AddBefore(const TObject *, TObject *obj) override { Add(obj); }
0047    void      AddBefore(TObjLink *, TObject *obj) override { Add(obj); }
0048    void      Sort(Bool_t = kSortAscending) override { }
0049 
0050    ClassDefOverride(TSortedList,0)  //A sorted list
0051 };
0052 
0053 #endif
0054