Warning, file /include/root/TArrayS.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TArrayS
0013 #define ROOT_TArrayS
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TArray.h"
0025
0026
0027 class TArrayS : public TArray {
0028
0029 public:
0030 Short_t *fArray;
0031
0032 TArrayS();
0033 TArrayS(Int_t n);
0034 TArrayS(Int_t n, const Short_t *array);
0035 TArrayS(const TArrayS &array);
0036 TArrayS &operator=(const TArrayS &rhs);
0037 virtual ~TArrayS();
0038
0039 void Adopt(Int_t n, Short_t *array);
0040 void AddAt(Short_t c, Int_t i);
0041 Short_t At(Int_t i) const ;
0042 void Copy(TArrayS &array) const {array.Set(fN,fArray);}
0043 const Short_t *GetArray() const { return fArray; }
0044 Short_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(Short_t));}
0048 void Reset(Short_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 Short_t *array);
0051 void SetAt(Double_t v, Int_t i) override { AddAt((Short_t)v, i); }
0052 Short_t &operator[](Int_t i);
0053 Short_t operator[](Int_t i) const;
0054
0055 ClassDefOverride(TArrayS,1)
0056 };
0057
0058 #if defined R__TEMPLATE_OVERLOAD_BUG
0059 template <>
0060 #endif
0061 inline TBuffer &operator>>(TBuffer &buf, TArrayS *&obj)
0062 {
0063
0064
0065 obj = (TArrayS *) TArray::ReadArray(buf, TArrayS::Class());
0066 return buf;
0067 }
0068
0069 #if defined R__TEMPLATE_OVERLOAD_BUG
0070 template <>
0071 #endif
0072 inline TBuffer &operator<<(TBuffer &buf, const TArrayS *obj)
0073 {
0074
0075 return buf << (const TArray*)obj;
0076 }
0077
0078 inline Short_t TArrayS::At(Int_t i) const
0079 {
0080 if (!BoundsOk("TArrayS::At", i)) return 0;
0081 return fArray[i];
0082 }
0083
0084 inline Short_t &TArrayS::operator[](Int_t i)
0085 {
0086 if (!BoundsOk("TArrayS::operator[]", i))
0087 i = 0;
0088 return fArray[i];
0089 }
0090
0091 inline Short_t TArrayS::operator[](Int_t i) const
0092 {
0093 if (!BoundsOk("TArrayS::operator[]", i)) return 0;
0094 return fArray[i];
0095 }
0096
0097 #endif