00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TSeqCollection
00013 #define ROOT_TSeqCollection
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef ROOT_TCollection
00026 #include "TCollection.h"
00027 #endif
00028
00029
00030 class TSeqCollection : public TCollection {
00031
00032 protected:
00033 Bool_t fSorted;
00034
00035 TSeqCollection() : fSorted(kFALSE) { }
00036 virtual void Changed() { fSorted = kFALSE; }
00037
00038 public:
00039 virtual ~TSeqCollection() { }
00040 virtual void Add(TObject *obj) { AddLast(obj); }
00041 virtual void AddFirst(TObject *obj) = 0;
00042 virtual void AddLast(TObject *obj) = 0;
00043 virtual void AddAt(TObject *obj, Int_t idx) = 0;
00044 virtual void AddAfter(const TObject *after, TObject *obj) = 0;
00045 virtual void AddBefore(const TObject *before, TObject *obj) = 0;
00046 virtual void RemoveFirst() { Remove(First()); }
00047 virtual void RemoveLast() { Remove(Last()); }
00048 virtual TObject *RemoveAt(Int_t idx) { return Remove(At(idx)); }
00049 virtual void RemoveAfter(TObject *after) { Remove(After(after)); }
00050 virtual void RemoveBefore(TObject *before) { Remove(Before(before)); }
00051
00052 virtual TObject *At(Int_t idx) const = 0;
00053 virtual TObject *Before(const TObject *obj) const = 0;
00054 virtual TObject *After(const TObject *obj) const = 0;
00055 virtual TObject *First() const = 0;
00056 virtual TObject *Last() const = 0;
00057 Int_t LastIndex() const { return GetSize() - 1; }
00058 virtual Int_t IndexOf(const TObject *obj) const;
00059 virtual Bool_t IsSorted() const { return fSorted; }
00060 void UnSort() { fSorted = kFALSE; }
00061 Long64_t Merge(TCollection *list);
00062
00063 static Int_t ObjCompare(TObject *a, TObject *b);
00064 static void QSort(TObject **a, Int_t first, Int_t last);
00065 static inline void QSort(TObject **a, TObject **b, Int_t first, Int_t last) { QSort(a, 1, &b, first, last); }
00066 static void QSort(TObject **a, Int_t nBs, TObject ***b, Int_t first, Int_t last);
00067
00068 ClassDef(TSeqCollection,0)
00069 };
00070
00071 #endif