ROOT  6.06/09
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 #ifndef ROOT_TArray
25 #include "TArray.h"
26 #endif
27 
28 
29 class TArrayL64 : public TArray {
30 
31 public:
32  Long64_t *fArray; //[fN] Array of fN long64s
33 
34  TArrayL64();
35  TArrayL64(Int_t n);
36  TArrayL64(Int_t n, const Long64_t *array);
37  TArrayL64(const TArrayL64 &array);
38  TArrayL64 &operator=(const TArrayL64 &rhs);
39  virtual ~TArrayL64();
40 
41  void Adopt(Int_t n, Long64_t *array);
42  void AddAt(Long64_t c, Int_t i);
43  Long64_t At(Int_t i) const;
44  void Copy(TArrayL64 &array) const {array.Set(fN,fArray);}
45  const Long64_t *GetArray() const { return fArray; }
46  Long64_t *GetArray() { return fArray; }
47  Double_t GetAt(Int_t i) const { return At(i); }
48  Stat_t GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
49  void Reset() {memset(fArray, 0, fN*sizeof(Long64_t));}
50  void Reset(Long64_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
51  void Set(Int_t n);
52  void Set(Int_t n, const Long64_t *array);
53  void SetAt(Double_t v, Int_t i) { AddAt((Long64_t)v, i); }
55  Long64_t operator[](Int_t i) const;
56 
57  ClassDef(TArrayL64,1) //Array of long64s
58 };
59 
60 
61 
62 #if defined R__TEMPLATE_OVERLOAD_BUG
63 template <>
64 #endif
66 {
67  // Read TArrayL64 object from buffer.
68 
70  return buf;
71 }
72 
73 #if defined R__TEMPLATE_OVERLOAD_BUG
74 template <>
75 #endif
76 inline TBuffer &operator<<(TBuffer &buf, const TArrayL64 *obj)
77 {
78  // Write a TArrayL64 object into buffer.
79 
80  return buf << (const TArray*)obj;
81 }
82 
83 inline Long64_t TArrayL64::At(Int_t i) const
84 {
85  if (!BoundsOk("TArrayL64::At", i)) return 0;
86  return fArray[i];
87 }
88 
90 {
91  if (!BoundsOk("TArrayL64::operator[]", i))
92  i = 0;
93  return fArray[i];
94 }
95 
97 {
98  if (!BoundsOk("TArrayL64::operator[]", i)) return 0;
99  return fArray[i];
100 }
101 
102 #endif
Abstract array base class.
Definition: TArray.h:33
long long Long64_t
Definition: RtypesCore.h:69
Long64_t & operator[](Int_t i)
Definition: TArrayL64.h:89
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
int Int_t
Definition: RtypesCore.h:41
Long64_t * fArray
Definition: TArrayL64.h:32
Stat_t GetSum() const
Definition: TArrayL64.h:48
void Copy(TArrayL64 &array) const
Definition: TArrayL64.h:44
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Class()
Definition: Class.C:29
Int_t fN
Definition: TArray.h:40
Bool_t BoundsOk(const char *where, Int_t at) const
Definition: TArray.h:79
SVector< double, 2 > v
Definition: Dict.h:5
static TArray * ReadArray(TBuffer &b, const TClass *clReq)
Read TArray object from buffer.
Definition: TArray.cxx:40
Long64_t At(Int_t i) const
Definition: TArrayL64.h:83
Long64_t * GetArray()
Definition: TArrayL64.h:46
void AddAt(Long64_t c, Int_t i)
Add long64 c at position i. Check for out of bounds.
Definition: TArrayL64.cxx:92
void SetAt(Double_t v, Int_t i)
Definition: TArrayL64.h:53
TArrayL64 & operator=(const TArrayL64 &rhs)
TArrayL64 assignment operator.
Definition: TArrayL64.cxx:60
void Reset(Long64_t val)
Definition: TArrayL64.h:50
Double_t GetAt(Int_t i) const
Definition: TArrayL64.h:47
double Double_t
Definition: RtypesCore.h:55
const Long64_t * GetArray() const
Definition: TArrayL64.h:45
TBuffer & operator<<(TBuffer &buf, const TArrayL64 *obj)
Definition: TArrayL64.h:76
void Set(Int_t n)
Set size of this array to n long64s.
Definition: TArrayL64.cxx:104
double Stat_t
Definition: RtypesCore.h:73
void Reset()
Definition: TArrayL64.h:49
Array of long64s (64 bits per element).
Definition: TArrayL64.h:29
virtual ~TArrayL64()
Delete TArrayL64 object.
Definition: TArrayL64.cxx:70
TBuffer & operator>>(TBuffer &buf, TArrayL64 *&obj)
Definition: TArrayL64.h:65
TObject * obj
void Adopt(Int_t n, Long64_t *array)
Adopt array arr into TArrayL64, i.e.
Definition: TArrayL64.cxx:80
const Int_t n
Definition: legend1.C:16