Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TArrayL64.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/cont:$Id$
0002 // Author: Fons Rademakers   20/11/06
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TArrayL64
0013 #define ROOT_TArrayL64
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TArrayL64                                                            //
0019 //                                                                      //
0020 // Array of long64s (64 bits per element)    .                          //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TArray.h"
0025 
0026 
0027 class TArrayL64 : public TArray {
0028 
0029 public:
0030    Long64_t   *fArray;       //[fN] Array of fN long64s
0031 
0032    TArrayL64();
0033    TArrayL64(Int_t n);
0034    TArrayL64(Int_t n, const Long64_t *array);
0035    TArrayL64(const TArrayL64 &array);
0036    TArrayL64  &operator=(const TArrayL64 &rhs);
0037    virtual    ~TArrayL64();
0038 
0039    void            Adopt(Int_t n, Long64_t *array);
0040    void            AddAt(Long64_t c, Int_t i);
0041    Long64_t        At(Int_t i) const;
0042    void            Copy(TArrayL64 &array) const {array.Set(fN,fArray);}
0043    const Long64_t *GetArray() const { return fArray; }
0044    Long64_t       *GetArray() { return fArray; }
0045    Double_t        GetAt(Int_t i) const override { return At(i); }
0046    Stat_t          GetSum() const {Stat_t sum=0; for (Int_t i=0;i<fN;i++) sum+=fArray[i]; return sum;}
0047    void            Reset()           {memset(fArray,  0, fN*sizeof(Long64_t));}
0048    void            Reset(Long64_t val) {for (Int_t i=0;i<fN;i++) fArray[i] = val;}
0049    void            Set(Int_t n) override;
0050    void            Set(Int_t n, const Long64_t *array);
0051    void            SetAt(Double_t v, Int_t i) override { AddAt((Long64_t)v, i); }
0052    Long64_t       &operator[](Int_t i);
0053    Long64_t        operator[](Int_t i) const;
0054 
0055    ClassDefOverride(TArrayL64,1)  //Array of long64s
0056 };
0057 
0058 
0059 
0060 #if defined R__TEMPLATE_OVERLOAD_BUG
0061 template <>
0062 #endif
0063 inline TBuffer &operator>>(TBuffer &buf, TArrayL64 *&obj)
0064 {
0065    // Read TArrayL64 object from buffer.
0066 
0067    obj = (TArrayL64 *) TArray::ReadArray(buf, TArrayL64::Class());
0068    return buf;
0069 }
0070 
0071 #if defined R__TEMPLATE_OVERLOAD_BUG
0072 template <>
0073 #endif
0074 inline TBuffer &operator<<(TBuffer &buf, const TArrayL64 *obj)
0075 {
0076    // Write a TArrayL64 object into buffer.
0077 
0078    return buf << (const TArray*)obj;
0079 }
0080 
0081 inline Long64_t TArrayL64::At(Int_t i) const
0082 {
0083    if (!BoundsOk("TArrayL64::At", i)) return 0;
0084    return fArray[i];
0085 }
0086 
0087 inline Long64_t &TArrayL64::operator[](Int_t i)
0088 {
0089    if (!BoundsOk("TArrayL64::operator[]", i))
0090       i = 0;
0091    return fArray[i];
0092 }
0093 
0094 inline Long64_t TArrayL64::operator[](Int_t i) const
0095 {
0096    if (!BoundsOk("TArrayL64::operator[]", i)) return 0;
0097    return fArray[i];
0098 }
0099 
0100 #endif