Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TArray Class Referenceabstract

Abstract array base class.

Used by TArrayC, TArrayS, TArrayI, TArrayL, TArrayF and TArrayD. Data member is public for historical reasons.

PyROOT

When used from Python, the subclasses of TArray (TArrayC, TArrayS, TArrayI, TArrayL, TArrayF and TArrayD) benefit from the following extra features:

  • Their size can be obtained with len, which is equivalent to TArray::GetSize():
    import ROOT
    a = ROOT.TArrayD(2)
    print(len(a)) # prints '2'
    Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
  • Their elements can be read and written with the getitem and setitem operators, respectively:
    a[0] = 0.2
    a[1] = 1.7
    print(a[0]) # prints '0.2'
  • They are iterable:
    for elem in a:
    print(elem)

Definition at line 31 of file TArray.h.

Public Member Functions

 TArray ()
 
 TArray (const TArray &a)
 
 TArray (Int_t n)
 
virtual ~TArray ()
 
virtual Double_t GetAt (Int_t i) const =0
 
Int_t GetSize () const
 
virtual TClassIsA () const
 
TArrayoperator= (const TArray &rhs)
 
virtual void Set (Int_t n)=0
 
virtual void SetAt (Double_t v, Int_t i)=0
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static TArrayReadArray (TBuffer &b, const TClass *clReq)
 Read TArray object from buffer.
 
static void WriteArray (TBuffer &b, const TArray *a)
 Write TArray object to buffer.
 

Public Attributes

Int_t fN
 

Protected Member Functions

Bool_t BoundsOk (const char *where, Int_t at) const
 
Bool_t OutOfBoundsError (const char *where, Int_t i) const
 Generate an out-of-bounds error. Always returns false.
 

Friends

TBufferoperator<< (TBuffer &b, const TArray *obj)
 Write TArray or derived object to buffer.
 

#include <TArray.h>

Inheritance diagram for TArray:
[legend]

Constructor & Destructor Documentation

◆ TArray() [1/3]

TArray::TArray ( )
inline

Definition at line 40 of file TArray.h.

◆ TArray() [2/3]

TArray::TArray ( Int_t  n)
inline

Definition at line 41 of file TArray.h.

◆ TArray() [3/3]

TArray::TArray ( const TArray a)
inline

Definition at line 42 of file TArray.h.

◆ ~TArray()

virtual TArray::~TArray ( )
inlinevirtual

Definition at line 45 of file TArray.h.

Member Function Documentation

◆ BoundsOk()

Bool_t TArray::BoundsOk ( const char *  where,
Int_t  at 
) const
inlineprotected

Definition at line 77 of file TArray.h.

◆ Class()

static TClass * TArray::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TArray::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TArray::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 58 of file TArray.h.

◆ DeclFileName()

static const char * TArray::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 58 of file TArray.h.

◆ GetAt()

virtual Double_t TArray::GetAt ( Int_t  i) const
pure virtual

Implemented in TArrayC, TArrayD, TArrayF, TArrayI, TArrayL, TArrayL64, and TArrayS.

◆ GetSize()

Int_t TArray::GetSize ( ) const
inline

Definition at line 47 of file TArray.h.

◆ IsA()

virtual TClass * TArray::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Reimplemented in TArrayC, TArrayD, TArrayF, TArrayI, TArrayL, TArrayL64, TArrayS, TGLTH3Composition, TH1C, TH1S, TH1I, TH1L, TH1F, TH1D, TH1K, TH2C, TH2S, TH2I, TH2L, TH2F, TH2D, TH3C, TH3S, TH3I, TH3L, TH3F, TH3D, TProfile, TProfile2D, and TProfile3D.

Definition at line 58 of file TArray.h.

◆ operator=()

TArray & TArray::operator= ( const TArray rhs)
inline

Definition at line 43 of file TArray.h.

◆ OutOfBoundsError()

Bool_t TArray::OutOfBoundsError ( const char *  where,
Int_t  i 
) const
protected

Generate an out-of-bounds error. Always returns false.

Definition at line 30 of file TArray.cxx.

◆ ReadArray()

TArray * TArray::ReadArray ( TBuffer b,
const TClass clReq 
)
static

Read TArray object from buffer.

Simplified version of TBuffer::ReadObject (does not keep track of multiple references to same array).

Definition at line 41 of file TArray.cxx.

◆ Set()

virtual void TArray::Set ( Int_t  n)
pure virtual

Implemented in TArrayC, TArrayD, TArrayF, TArrayI, TArrayL, TArrayL64, and TArrayS.

◆ SetAt()

virtual void TArray::SetAt ( Double_t  v,
Int_t  i 
)
pure virtual

Implemented in TArrayC, TArrayD, TArrayF, TArrayI, TArrayL, TArrayL64, and TArrayS.

◆ Streamer()

virtual void TArray::Streamer ( TBuffer )
virtual

◆ StreamerNVirtual()

void TArray::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 58 of file TArray.h.

◆ WriteArray()

void TArray::WriteArray ( TBuffer b,
const TArray a 
)
static

Write TArray object to buffer.

Simplified version of TBuffer::WriteObject (does not keep track of multiple references to the same array).

Definition at line 82 of file TArray.cxx.

Friends And Related Symbol Documentation

◆ operator<<

TBuffer & operator<< ( TBuffer b,
const TArray obj 
)
friend

Write TArray or derived object to buffer.

Definition at line 112 of file TArray.cxx.

Member Data Documentation

◆ fN

Int_t TArray::fN

Definition at line 38 of file TArray.h.

  • core/cont/inc/TArray.h
  • core/cont/src/TArray.cxx