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

Abstract array base class.

Python interface

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'
  • 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)

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

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
std::size_t size () const
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:
TArrayC TArrayD TArrayF TArrayI TArrayL TArrayL64 TArrayS TH1C TH2C TH3C TH1D TH2D TH3D TH1F TH2F TH3F TH1I TH2I TH3I TH1L TH2L TH3L TH1S TH2S TH3S

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 79 of file TArray.h.

◆ Class()

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

◆ Class_Name()

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

◆ Class_Version()

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

Definition at line 60 of file TArray.h.

◆ DeclFileName()

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

Definition at line 60 of file TArray.h.

◆ GetAt()

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

Implemented in TArrayC, TArrayD, TArrayF, TArrayI, TArrayL64, TArrayL, 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, TArrayL64, TArrayL, TArrayS, TGLTH3Composition, TH1C, TH1D, TH1F, TH1I, TH1L, TH1S, TH2C, TH2D, TH2F, TH2I, TH2L, TH2S, TH3C, TH3D, TH3F, TH3I, TH3L, TH3S, TProfile2D, TProfile3D, and TProfile.

Definition at line 60 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 29 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 40 of file TArray.cxx.

◆ Set()

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

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

◆ SetAt()

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

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

◆ size()

std::size_t TArray::size ( ) const
inline

Definition at line 50 of file TArray.h.

◆ Streamer()

virtual void TArray::Streamer ( TBuffer & )
virtual

◆ StreamerNVirtual()

void TArray::StreamerNVirtual ( TBuffer & ClassDef_StreamerNVirtual_b)
inline

Definition at line 60 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 81 of file TArray.cxx.

◆ operator<<

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

Write TArray or derived object to buffer.

Definition at line 111 of file TArray.cxx.

Member Data Documentation

◆ fN

Int_t TArray::fN

Definition at line 38 of file TArray.h.


The documentation for this class was generated from the following files: