Logo ROOT  
Reference Guide
TArrayL64.h
Go to the documentation of this file.
1 // @(#)root/cont:$Id$
2 // Author: Fons Rademakers 20/11/06
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TArrayL64
13 #define ROOT_TArrayL64
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TArrayL64 //
19 // //
20 // Array of long64s (64 bits per element) . //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TArray.h"
25 
26 
27 class TArrayL64 : public TArray {
28 
29 public:
30  Long64_t *fArray; //[fN] Array of fN long64s
31 
32  TArrayL64();
33  TArrayL64(Int_t n);
34  TArrayL64(Int_t n, const Long64_t *array);
35  TArrayL64(const TArrayL64 &array);
36  TArrayL64 &operator=(const TArrayL64 &rhs);
37  virtual ~TArrayL64();
38 
39  void Adopt(Int_t n, Long64_t *array);
40  void AddAt(Long64_t c, Int_t i);
41  Long64_t At(Int_t i) const;
42  void Copy(TArrayL64 &array) const {array.Set(fN,fArray);}
43  const Long64_t *GetArray() const { return fArray; }
44  Long64_t *GetArray() { return fArray; }
45  Double_t GetAt(Int_t i) const { return At(i); }
46  Stat_t GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
47  void Reset() {memset(fArray, 0, fN*sizeof(Long64_t));}
48  void Reset(Long64_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
49  void Set(Int_t n);
50  void Set(Int_t n, const Long64_t *array);
51  void SetAt(Double_t v, Int_t i) { AddAt((Long64_t)v, i); }
53  Long64_t operator[](Int_t i) const;
54 
55  ClassDef(TArrayL64,1) //Array of long64s
56 };
57 
58 
59 
60 #if defined R__TEMPLATE_OVERLOAD_BUG
61 template <>
62 #endif
63 inline TBuffer &operator>>(TBuffer &buf, TArrayL64 *&obj)
64 {
65  // Read TArrayL64 object from buffer.
66 
68  return buf;
69 }
70 
71 #if defined R__TEMPLATE_OVERLOAD_BUG
72 template <>
73 #endif
74 inline TBuffer &operator<<(TBuffer &buf, const TArrayL64 *obj)
75 {
76  // Write a TArrayL64 object into buffer.
77 
78  return buf << (const TArray*)obj;
79 }
80 
81 inline Long64_t TArrayL64::At(Int_t i) const
82 {
83  if (!BoundsOk("TArrayL64::At", i)) return 0;
84  return fArray[i];
85 }
86 
88 {
89  if (!BoundsOk("TArrayL64::operator[]", i))
90  i = 0;
91  return fArray[i];
92 }
93 
95 {
96  if (!BoundsOk("TArrayL64::operator[]", i)) return 0;
97  return fArray[i];
98 }
99 
100 #endif
TArrayL64::Reset
void Reset(Long64_t val)
Definition: TArrayL64.h:48
c
#define c(i)
Definition: RSha256.hxx:101
n
const Int_t n
Definition: legend1.C:16
TArrayL64::At
Long64_t At(Int_t i) const
Definition: TArrayL64.h:81
sum
static uint64_t sum(uint64_t i)
Definition: Factory.cxx:2345
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TArrayL64::TArrayL64
TArrayL64()
Default TArrayL64 ctor.
Definition: TArrayL64.cxx:26
Int_t
int Int_t
Definition: RtypesCore.h:45
TArrayL64::Copy
void Copy(TArrayL64 &array) const
Definition: TArrayL64.h:42
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
TArray::fN
Int_t fN
Definition: TArray.h:38
TArrayL64::Adopt
void Adopt(Int_t n, Long64_t *array)
Adopt array arr into TArrayL64, i.e.
Definition: TArrayL64.cxx:81
TArrayL64::AddAt
void AddAt(Long64_t c, Int_t i)
Add long64 c at position i. Check for out of bounds.
Definition: TArrayL64.cxx:93
v
@ v
Definition: rootcling_impl.cxx:3664
TArrayL64::fArray
Long64_t * fArray
Definition: TArrayL64.h:30
TArrayL64::GetAt
Double_t GetAt(Int_t i) const
Definition: TArrayL64.h:45
TArrayL64::~TArrayL64
virtual ~TArrayL64()
Delete TArrayL64 object.
Definition: TArrayL64.cxx:71
TArrayL64::Reset
void Reset()
Definition: TArrayL64.h:47
TArrayL64::GetArray
Long64_t * GetArray()
Definition: TArrayL64.h:44
operator<<
TBuffer & operator<<(TBuffer &buf, const TArrayL64 *obj)
Definition: TArrayL64.h:74
TArray::ReadArray
static TArray * ReadArray(TBuffer &b, const TClass *clReq)
Read TArray object from buffer.
Definition: TArray.cxx:41
TArrayL64
Array of long64s (64 bits per element).
Definition: TArrayL64.h:27
Double_t
double Double_t
Definition: RtypesCore.h:59
TArray
Abstract array base class.
Definition: TArray.h:31
TArrayL64::operator[]
Long64_t & operator[](Int_t i)
Definition: TArrayL64.h:87
TArray::BoundsOk
Bool_t BoundsOk(const char *where, Int_t at) const
Definition: TArray.h:77
TArrayL64::GetSum
Stat_t GetSum() const
Definition: TArrayL64.h:46
operator>>
TBuffer & operator>>(TBuffer &buf, TArrayL64 *&obj)
Definition: TArrayL64.h:63
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TArrayL64::Set
void Set(Int_t n)
Set size of this array to n long64s.
Definition: TArrayL64.cxx:105
TArrayL64::GetArray
const Long64_t * GetArray() const
Definition: TArrayL64.h:43
TArray.h
Stat_t
double Stat_t
Definition: RtypesCore.h:86
Class
void Class()
Definition: Class.C:29
TArrayL64::SetAt
void SetAt(Double_t v, Int_t i)
Definition: TArrayL64.h:51
int
TArrayL64::operator=
TArrayL64 & operator=(const TArrayL64 &rhs)
TArrayL64 assignment operator.
Definition: TArrayL64.cxx:61