TArrayL64.h

Go to the documentation of this file.
00001 // @(#)root/cont:$Id: TArrayL64.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Fons Rademakers   20/11/06
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TArrayL64
00013 #define ROOT_TArrayL64
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TArrayL64                                                            //
00019 //                                                                      //
00020 // Array of long64s (64 bits per element)    .                          //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TArray
00025 #include "TArray.h"
00026 #endif
00027 
00028 
00029 class TArrayL64 : public TArray {
00030 
00031 public:
00032    Long64_t   *fArray;       //[fN] Array of fN long64s
00033 
00034    TArrayL64();
00035    TArrayL64(Int_t n);
00036    TArrayL64(Int_t n, const Long64_t *array);
00037    TArrayL64(const TArrayL64 &array);
00038    TArrayL64  &operator=(const TArrayL64 &rhs);
00039    virtual    ~TArrayL64();
00040 
00041    void            Adopt(Int_t n, Long64_t *array);
00042    void            AddAt(Long64_t c, Int_t i);
00043    Long64_t        At(Int_t i) const;
00044    void            Copy(TArrayL64 &array) const {array.Set(fN,fArray);}
00045    const Long64_t *GetArray() const { return fArray; }
00046    Long64_t       *GetArray() { return fArray; }
00047    Double_t        GetAt(Int_t i) const { return At(i); }
00048    Stat_t          GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
00049    void            Reset()           {memset(fArray,  0, fN*sizeof(Long64_t));}
00050    void            Reset(Long64_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
00051    void            Set(Int_t n);
00052    void            Set(Int_t n, const Long64_t *array);
00053    void            SetAt(Double_t v, Int_t i) { AddAt((Long64_t)v, i); }
00054    Long64_t       &operator[](Int_t i);
00055    Long64_t        operator[](Int_t i) const;
00056 
00057    ClassDef(TArrayL64,1)  //Array of long64s
00058 };
00059 
00060 
00061 
00062 #if defined R__TEMPLATE_OVERLOAD_BUG
00063 template <>
00064 #endif
00065 inline TBuffer &operator>>(TBuffer &buf, TArrayL64 *&obj)
00066 {
00067    // Read TArrayL64 object from buffer.
00068 
00069    obj = (TArrayL64 *) TArray::ReadArray(buf, TArrayL64::Class());
00070    return buf;
00071 }
00072 
00073 #if defined R__TEMPLATE_OVERLOAD_BUG
00074 template <>
00075 #endif
00076 inline TBuffer &operator<<(TBuffer &buf, const TArrayL64 *obj)
00077 {
00078    // Write a TArrayL64 object into buffer.
00079 
00080    return buf << (TArray*)obj;
00081 }
00082 
00083 inline Long64_t TArrayL64::At(Int_t i) const
00084 {
00085    if (!BoundsOk("TArrayL64::At", i)) return 0;
00086    return fArray[i];
00087 }
00088 
00089 inline Long64_t &TArrayL64::operator[](Int_t i)
00090 {
00091    if (!BoundsOk("TArrayL64::operator[]", i))
00092       i = 0;
00093    return fArray[i];
00094 }
00095 
00096 inline Long64_t TArrayL64::operator[](Int_t i) const
00097 {
00098    if (!BoundsOk("TArrayL64::operator[]", i)) return 0;
00099    return fArray[i];
00100 }
00101 
00102 #endif

Generated on Tue Jul 5 14:11:25 2011 for ROOT_528-00b_version by  doxygen 1.5.1