00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TArray
00013 #define ROOT_TArray
00014
00015
00017
00018
00019
00020
00021
00022
00023
00025
00026 #ifndef ROOT_Htypes
00027 #include "Htypes.h"
00028 #endif
00029 #include <string.h>
00030
00031 class TBuffer;
00032
00033
00034 class TArray {
00035
00036 protected:
00037 Bool_t BoundsOk(const char *where, Int_t at) const;
00038 Bool_t OutOfBoundsError(const char *where, Int_t i) const;
00039
00040 public:
00041 Int_t fN;
00042
00043 TArray() { fN = 0; }
00044 TArray(Int_t n) { fN = n; }
00045 TArray(const TArray &a) { fN = a.fN; }
00046 TArray &operator=(const TArray &rhs) { fN = rhs.fN; return *this; }
00047 virtual ~TArray() { fN = 0; }
00048
00049 Int_t GetSize() const { return fN; }
00050 virtual void Set(Int_t n) = 0;
00051
00052 static TArray *ReadArray(TBuffer &b, const TClass *clReq);
00053 static void WriteArray(TBuffer &b, const TArray *a);
00054
00055 friend TBuffer &operator<<(TBuffer &b, const TArray *obj);
00056
00057 ClassDef(TArray,1)
00058 };
00059
00060 #if defined R__TEMPLATE_OVERLOAD_BUG
00061 template <>
00062 #endif
00063 inline TBuffer &operator>>(TBuffer &buf, TArray *&obj)
00064 {
00065
00066
00067 obj = (TArray *) TArray::ReadArray(buf, TArray::Class());
00068 return buf;
00069 }
00070
00071 #if defined R__TEMPLATE_OVERLOAD_BUG
00072 template <>
00073 #endif
00074 TBuffer &operator<<(TBuffer &b, const TArray *obj);
00075
00076 inline Bool_t TArray::BoundsOk(const char *where, Int_t at) const
00077 {
00078 return (at < 0 || at >= fN)
00079 ? OutOfBoundsError(where, at)
00080 : kTRUE;
00081 }
00082
00083 #endif