+
class TRefArrayIter
-
library: libCore
#include "TRefArray.h"
Display options:
Show inherited
Show non-public

class TRefArrayIter: public TIterator


TRefArray

An array of references to TObjects. The array expands automatically
 when  objects are added (shrinking can be done by hand using Expand()

The TRefArray can be filled with:
array.Add(obj)
array.AddAt(obj,i)
but not array[i] = obj  !!!

The array elements can be retrieved with:
TObject *obj = array.At(i);

When a TRefArray is Streamed, only the pointer unique id is written,
not the referenced object. TRefArray may be assigned to different
branches of one Tree or several Trees.
The branch containing the TRefArray can be read before or after the
array (eg TClonesArray, STL vector,..) of the referenced objects.

See an example in $ROOTSYS/test/Event.h

RESTRICTIONS when using TRefArray

- Elements in a TRefArray cannot point to a TFile or TDirectory.
- All elements of a TRefArray must be set in the same process,
In particular, one cannot modify some elements of the array in
a different process.
Use an array of TRef when one of the above restrictions is met.


Function Members (Methods)

public:
TRefArrayIter(const TRefArrayIter& iter)
TRefArrayIter(const TRefArray* arr, Bool_t dir = kIterForward)
~TRefArrayIter()
static TClass*Class()
virtual const TCollection*GetCollection() const
virtual Option_t*TIterator::GetOption() const
virtual TClass*IsA() const
virtual TObject*Next()
TObject*TIterator::operator()()
virtual TIterator&operator=(const TIterator& rhs)
TRefArrayIter&operator=(const TRefArrayIter& rhs)
virtual voidReset()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
private:
TRefArrayIter()

Data Members

private:
const TRefArray*fArrayarray being iterated
Int_tfCursorcurrent position in array
Bool_tfDirectioniteration direction

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TRefArrayIter(const TRefArray* arr, Bool_t dir = kIterForward)
 Create array iterator. By default the iteration direction
 is kIterForward. To go backward use kIterBackward.
TRefArrayIter(const TRefArrayIter& iter)
 Copy ctor.
TIterator & operator=(const TIterator &rhs)
 Overridden assignment operator.
TRefArrayIter & operator=(const TRefArrayIter &rhs)
 Overloaded assignment operator.
TObject * Next()
 Return next object in array. Returns 0 when no more objects in array.
void Reset()
 Reset array iterator.
TRefArrayIter(const TRefArrayIter& iter)
{ }
~TRefArrayIter()
{ }
const TCollection * GetCollection()
{ return fArray; }

Author: Rene Brun 02/10/2001
Last update: root/cont:$Name: $:$Id: TRefArray.cxx,v 1.29 2007/02/03 18:52:34 brun Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *

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.