TOrdCollection


class description - source file - inheritance tree

class TOrdCollection : public TSeqCollection

    private:
Bool_t IllegalIndex(char* method, Int_t idx) void Init(Int_t capacity) Int_t LogIndex(Int_t idx) Bool_t LowWaterMark() void MoveGapTo(Int_t newGapStart) Int_t PhysIndex(Int_t idx) void SetCapacity(Int_t newCapacity) public:
TOrdCollection TOrdCollection(Int_t capacity = kDefaultCapacity) virtual void ~TOrdCollection() virtual void AddAfter(TObject* after, TObject* obj) virtual void AddAt(TObject* obj, Int_t idx) virtual void AddBefore(TObject* before, TObject* obj) virtual void AddFirst(TObject* obj) virtual void AddLast(TObject* obj) virtual TObject* After(TObject* obj) virtual TObject* At(Int_t idx) virtual TObject* Before(TObject* obj) Int_t BinarySearch(TObject* obj) TClass* Class() virtual void Clear(Option_t* option) virtual void Delete(Option_t* option) virtual TObject* First() virtual Int_t IndexOf(TObject* obj) virtual TClass* IsA() virtual TObject* Last() virtual TIterator* MakeIterator(Bool_t dir = kIterForward) void PutAt(TObject* obj, Int_t idx) virtual TObject* Remove(TObject* obj) virtual void RemoveAt(Int_t idx) virtual void ShowMembers(TMemberInspector& insp, char* parent) void Sort() virtual void Streamer(TBuffer& b)

Data Members

private:
TObject** fCont Int_t fCapacity Int_t fGapStart Int_t fGapSize public:
static const enum TObject:: kDefaultCapacity static const enum TObject:: kMinExpand static const enum TObject:: kShrinkFactor

Class Description

                                                                      
 TOrdCollection                                                       
                                                                      
 Ordered collection. An ordered collection has TList insertion        
 semantics but is implemented using an array of TObject*'s. It uses   
 less space than a TList (since there is no need for the prev and     
 next pointers), but it is more costly to insert objects (since it    
 has to create a gap by copying object pointers). TOrdCollection      
 is better than TList when objects are only added at the end of the   
 collection since no copying needs to be done.                        

/*

*/

                                                                      


TOrdCollection(Int_t capacity)
 Create an ordered collection.

~TOrdCollection()
 Delete the collection. Objects are not deleted.

void AddAt(TObject *obj, Int_t idx)
 Insert object at position idx in the collection.

void AddFirst(TObject *obj)
 Insert object at beginning of collection.

void AddLast(TObject *obj)
 Add object at the end of the collection.

void AddBefore(TObject *before, TObject *obj)
 Insert object before object before in the collection.

void AddAfter(TObject *after, TObject *obj)
 Insert object after object after in the collection.

TObject* After(TObject *obj) const
 Return the object after object obj. Returns 0 if obj is last
 in collection.

TObject* At(Int_t idx) const
 Returns the object at position idx. Returns 0 if idx is out of range.

TObject* Before(TObject *obj) const
 Returns the object before object obj. Returns 0 if obj is first
 in collection.

void Clear(Option_t *)
 Remove all objects from the collection. Does not delete the objects.

void Delete(Option_t *)
 Remove all objects from the collection AND delete all heap based objects.

TObject* First() const
 Return the first object in the collection. Returns 0 when collection
 is empty.

TObject* Last() const
 Return the last object in the collection. Returns 0 when collection
 is empty.

Bool_t IllegalIndex(const char *method, Int_t idx) const
 Return true when index out of bounds and print error.

Int_t IndexOf(TObject *obj) const
 Return index of object in collection. Returns -1 when object not found.
 Uses member IsEqual() to find object.

void Init(Int_t capacity)
 Initialize ordered collection.

TIterator* MakeIterator(Bool_t dir) const
 Return an ordered collection iterator.

void MoveGapTo(Int_t start)
 Move gap to new position. Gap needs to be moved when objects are
 inserted not at the end.

void PutAt(TObject *obj, Int_t idx)
 Put object at index idx. Overwrites what was at idx before.

void RemoveAt(Int_t idx)
 Remove object at index idx.

TObject* Remove(TObject *obj)
 Remove object from collection.

void SetCapacity(Int_t newCapacity)
 Set/change ordered collection capacity.

void Sort()
 If objects in collection are sortable (i.e. IsSortable() returns true
 for all objects) then sort collection.

Int_t BinarySearch(TObject *obj)
 Find object using a binary search. Collection must first have been
 sorted.



Inline Functions


              Int_t PhysIndex(Int_t idx)
              Int_t LogIndex(Int_t idx)
             Bool_t LowWaterMark()
            TClass* Class()
            TClass* IsA()
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)


Author: Fons Rademakers 13/09/95
Last update: 2.22/07 05/07/99 18.55.52 by Fons Rademakers
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.