00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TArrayL
00013 #define ROOT_TArrayL
00014
00015
00017
00018
00019
00020
00021
00023
00024 #ifndef ROOT_TArray
00025 #include "TArray.h"
00026 #endif
00027
00028
00029 class TArrayL : public TArray {
00030
00031 public:
00032 Long_t *fArray;
00033
00034 TArrayL();
00035 TArrayL(Int_t n);
00036 TArrayL(Int_t n, const Long_t *array);
00037 TArrayL(const TArrayL &array);
00038 TArrayL &operator=(const TArrayL &rhs);
00039 virtual ~TArrayL();
00040
00041 void Adopt(Int_t n, Long_t *array);
00042 void AddAt(Long_t c, Int_t i);
00043 Long_t At(Int_t i) const;
00044 void Copy(TArrayL &array) const {array.Set(fN); for (Int_t i=0;i<fN;i++) array.fArray[i] = fArray[i];}
00045 const Long_t *GetArray() const { return fArray; }
00046 Long_t *GetArray() { return fArray; }
00047 Stat_t GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
00048 void Reset() {memset(fArray, 0, fN*sizeof(Long_t));}
00049 void Reset(Long_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
00050 void Set(Int_t n);
00051 void Set(Int_t n, const Long_t *array);
00052 Long_t &operator[](Int_t i);
00053 Long_t operator[](Int_t i) const;
00054
00055 ClassDef(TArrayL,1)
00056 };
00057
00058
00059
00060 #if defined R__TEMPLATE_OVERLOAD_BUG
00061 template <>
00062 #endif
00063 inline TBuffer &operator>>(TBuffer &buf, TArrayL *&obj)
00064 {
00065
00066
00067 obj = (TArrayL *) TArray::ReadArray(buf, TArrayL::Class());
00068 return buf;
00069 }
00070
00071 #if defined R__TEMPLATE_OVERLOAD_BUG
00072 template <>
00073 #endif
00074 inline TBuffer &operator<<(TBuffer &buf, const TArrayL *obj)
00075 {
00076
00077 return buf << (TArray*)obj;
00078 }
00079
00080 inline Long_t TArrayL::At(Int_t i) const
00081 {
00082 if (!BoundsOk("TArrayL::At", i)) return 0;
00083 return fArray[i];
00084 }
00085
00086 inline Long_t &TArrayL::operator[](Int_t i)
00087 {
00088 if (!BoundsOk("TArrayL::operator[]", i))
00089 i = 0;
00090 return fArray[i];
00091 }
00092
00093 inline Long_t TArrayL::operator[](Int_t i) const
00094 {
00095 if (!BoundsOk("TArrayL::operator[]", i)) return 0;
00096 return fArray[i];
00097 }
00098
00099 #endif