library: libCore #include "TOrdCollection.h" |
TOrdCollection
class description - source file - inheritance tree (.pdf)
private:
Bool_t IllegalIndex(const char* method, Int_t idx) const
void Init(Int_t capacity)
Int_t LogIndex(Int_t idx) const
Bool_t LowWaterMark() const
void MoveGapTo(Int_t newGapStart)
Int_t PhysIndex(Int_t idx) const
void SetCapacity(Int_t newCapacity)
public:
TOrdCollection(Int_t capacity = kDefaultCapacity)
~TOrdCollection()
virtual void AddAfter(const TObject* after, TObject* obj)
virtual void AddAt(TObject* obj, Int_t idx)
virtual void AddBefore(const TObject* before, TObject* obj)
virtual void AddFirst(TObject* obj)
virtual void AddLast(TObject* obj)
virtual TObject* After(const TObject* obj) const
virtual TObject* At(Int_t idx) const
virtual TObject* Before(const TObject* obj) const
Int_t BinarySearch(TObject* obj)
static TClass* Class()
virtual void Clear(Option_t* option)
virtual void Delete(Option_t* option)
virtual TObject* First() const
virtual TObject** GetObjectRef(const TObject* obj) const
virtual Int_t IndexOf(const TObject* obj) const
virtual TClass* IsA() const
virtual TObject* Last() const
virtual TIterator* MakeIterator(Bool_t dir = kIterForward) const
void PutAt(TObject* obj, Int_t idx)
virtual TObject* Remove(TObject* obj)
virtual TObject* RemoveAt(Int_t idx)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
void Sort()
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
private:
TObject** fCont
Int_t fCapacity
Int_t fGapStart
Int_t fGapSize
public:
static const enum TOrdCollection:: kDefaultCapacity
static const enum TOrdCollection:: kMinExpand
static const enum TOrdCollection:: kShrinkFactor
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 unless the TOrdCollection
is the owner (set via SetOwner()).
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(const TObject *before, TObject *obj)
Insert object before object before in the collection.
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the collection.
TObject* After(const 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(const 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
unless the TOrdCollection is the owner (set via SetOwner()).
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** GetObjectRef(const TObject *obj) const
return address of pointer obj
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(const 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.
TObject* 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) const
Int_t LogIndex(Int_t idx) const
Bool_t LowWaterMark() const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Author: Fons Rademakers 13/09/95
Last update: root/cont:$Name: $:$Id: TOrdCollection.cxx,v 1.12 2004/11/12 21:51:18 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - 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.