// @(#)root/io:$Id: 697641b2b52ed3d97bb5bde0fb5d2ff4a2f6c24f $
// Author: Rene Brun   17/01/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TBufferFile
#define ROOT_TBufferFile


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBufferFile                                                          //
//                                                                      //
// The concrete implementation of TBuffer for writing/reading to/from a //
// ROOT file or socket.                                                 //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TBuffer
#include "TBuffer.h"
#endif
#ifndef ROOT_Bytes
#include "Bytes.h"
#endif

#include <vector>

#ifdef R__OLDHPACC
namespace std {
   using ::string;
   using ::vector;
}
#endif

class TVirtualStreamerInfo;
class TStreamerInfo;
class TStreamerElement;
class TClass;
class TExMap;
class TVirtualArray;
namespace TStreamerInfoActions {
   class TActionSequence;
}

class TBufferFile : public TBuffer {

protected:
   typedef std::vector<TStreamerInfo*> InfoList_t;

   Int_t           fMapCount;      //Number of objects or classes in map
   Int_t           fMapSize;       //Default size of map
   Int_t           fDisplacement;  //Value to be added to the map offsets
   UShort_t        fPidOffset;     //Offset to be added to the pid index in this key/buffer.
   TExMap         *fMap;           //Map containing object,offset pairs for reading/writing
   TExMap         *fClassMap;      //Map containing object,class pairs for reading
   TStreamerInfo  *fInfo;          //Pointer to TStreamerInfo object writing/reading the buffer
   InfoList_t      fInfoStack;     //Stack of pointers to the TStreamerInfos

   static Int_t    fgMapSize;      //Default map size for all TBuffer objects

   // Default ctor
   TBufferFile() : TBuffer(), fMapCount(0), fMapSize(0),
               fDisplacement(0),fPidOffset(0), fMap(0), fClassMap(0),
     fInfo(0), fInfoStack() {}

   // TBuffer objects cannot be copied or assigned
   TBufferFile(const TBufferFile &);       // not implemented
   void operator=(const TBufferFile &);    // not implemented

   Int_t  CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss, const char* classname);
   void   CheckCount(UInt_t offset);
   UInt_t CheckObject(UInt_t offset, const TClass *cl, Bool_t readClass = kFALSE);

   virtual  void  WriteObjectClass(const void *actualObjStart, const TClass *actualClass);

public:
   enum { kMapSize = 503 };
   enum { kStreamedMemberWise = BIT(14) }; //added to version number to know if a collection has been stored member-wise
   enum { kNotDecompressed = BIT(15) };    //indicates a weird buffer, used by TBasket
   enum { kTextBasedStreaming = BIT(18) }; //indicates if buffer used for XML/SQL object streaming
   enum { kUser1 = BIT(21), kUser2 = BIT(22), kUser3 = BIT(23)}; //free for user

   TBufferFile(TBuffer::EMode mode);
   TBufferFile(TBuffer::EMode mode, Int_t bufsiz);
   TBufferFile(TBuffer::EMode mode, Int_t bufsiz, void *buf, Bool_t adopt = kTRUE, ReAllocCharFun_t reallocfunc = 0);
   virtual ~TBufferFile();

   Int_t    GetMapCount() const { return fMapCount; }
   void     GetMappedObject(UInt_t tag, void* &ptr, TClass* &ClassPtr) const;
   void     MapObject(const TObject *obj, UInt_t offset = 1);
   void     MapObject(const void *obj, const TClass *cl, UInt_t offset = 1);
   void     Reset() { SetBufferOffset(); ResetMap(); }
   void     InitMap();
   void     ResetMap();
   void     SetReadParam(Int_t mapsize);
   void     SetWriteParam(Int_t mapsize);

   Bool_t   CheckObject(const TObject *obj);
   Bool_t   CheckObject(const void *obj, const TClass *ptrClass);

   virtual Int_t      GetVersionOwner() const;
   virtual Int_t      CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss);
   virtual Int_t      CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname);
   virtual void       SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE);

   virtual void       SkipVersion(const TClass *cl = 0);
   virtual Version_t  ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, const TClass *cl = 0);
   virtual Version_t  ReadVersionNoCheckSum(UInt_t *start = 0, UInt_t *bcnt = 0);
   virtual Version_t  ReadVersionForMemberWise(const TClass *cl = 0);
   virtual UInt_t     WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE);
   virtual UInt_t     WriteVersionMemberWise(const TClass *cl, Bool_t useBcnt = kFALSE);

   virtual void      *ReadObjectAny(const TClass* cast);
   virtual void       SkipObjectAny();

   virtual void       TagStreamerInfo(TVirtualStreamerInfo* info);
   virtual void       IncrementLevel(TVirtualStreamerInfo* info);
   virtual void       SetStreamerElementNumber(TStreamerElement*,Int_t) {}
   virtual void       DecrementLevel(TVirtualStreamerInfo*);
   TVirtualStreamerInfo  *GetInfo() {return (TVirtualStreamerInfo*)fInfo;}
   virtual void       ClassBegin(const TClass*, Version_t = -1) {}
   virtual void       ClassEnd(const TClass*) {}
   virtual void       ClassMember(const char*, const char* = 0, Int_t = -1, Int_t = -1) {}

   virtual Int_t      ReadBuf(void *buf, Int_t max);
   virtual void       WriteBuf(const void *buf, Int_t max);

   virtual char      *ReadString(char *s, Int_t max);
   virtual void       WriteString(const char *s);

   virtual TClass    *ReadClass(const TClass *cl = 0, UInt_t *objTag = 0);
   virtual void       WriteClass(const TClass *cl);

   virtual TObject   *ReadObject(const TClass *cl);
   virtual void       WriteObject(const TObject *obj);

   virtual Int_t      WriteObjectAny(const void *obj, const TClass *ptrClass);

   UShort_t GetPidOffset() const {
      // See comment in TBuffer::SetPidOffset
      return fPidOffset;
   }
   void     SetPidOffset(UShort_t offset);
   Int_t    GetBufferDisplacement() const { return fDisplacement; }
   void     SetBufferDisplacement() { fDisplacement = 0; }
   void     SetBufferDisplacement(Int_t skipped)
            { fDisplacement =  (Int_t)(Length() - skipped); }

   // basic types and arrays of basic types
   virtual   void     ReadFloat16 (Float_t *f, TStreamerElement *ele=0);
   virtual   void     WriteFloat16(Float_t *f, TStreamerElement *ele=0);
   virtual   void     ReadDouble32 (Double_t *d, TStreamerElement *ele=0);
   virtual   void     WriteDouble32(Double_t *d, TStreamerElement *ele=0);
   virtual   void     ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue);
   virtual   void     ReadWithNbits(Float_t *ptr, Int_t nbits);
   virtual   void     ReadWithFactor(Double_t *ptr, Double_t factor, Double_t minvalue);
   virtual   void     ReadWithNbits(Double_t *ptr, Int_t nbits);

   virtual   Int_t    ReadArray(Bool_t    *&b);
   virtual   Int_t    ReadArray(Char_t    *&c);
   virtual   Int_t    ReadArray(UChar_t   *&c);
   virtual   Int_t    ReadArray(Short_t   *&h);
   virtual   Int_t    ReadArray(UShort_t  *&h);
   virtual   Int_t    ReadArray(Int_t     *&i);
   virtual   Int_t    ReadArray(UInt_t    *&i);
   virtual   Int_t    ReadArray(Long_t    *&l);
   virtual   Int_t    ReadArray(ULong_t   *&l);
   virtual   Int_t    ReadArray(Long64_t  *&l);
   virtual   Int_t    ReadArray(ULong64_t *&l);
   virtual   Int_t    ReadArray(Float_t   *&f);
   virtual   Int_t    ReadArray(Double_t  *&d);
   virtual   Int_t    ReadArrayFloat16(Float_t  *&f, TStreamerElement *ele=0);
   virtual   Int_t    ReadArrayDouble32(Double_t  *&d, TStreamerElement *ele=0);

   virtual   Int_t    ReadStaticArray(Bool_t    *b);
   virtual   Int_t    ReadStaticArray(Char_t    *c);
   virtual   Int_t    ReadStaticArray(UChar_t   *c);
   virtual   Int_t    ReadStaticArray(Short_t   *h);
   virtual   Int_t    ReadStaticArray(UShort_t  *h);
   virtual   Int_t    ReadStaticArray(Int_t     *i);
   virtual   Int_t    ReadStaticArray(UInt_t    *i);
   virtual   Int_t    ReadStaticArray(Long_t    *l);
   virtual   Int_t    ReadStaticArray(ULong_t   *l);
   virtual   Int_t    ReadStaticArray(Long64_t  *l);
   virtual   Int_t    ReadStaticArray(ULong64_t *l);
   virtual   Int_t    ReadStaticArray(Float_t   *f);
   virtual   Int_t    ReadStaticArray(Double_t  *d);
   virtual   Int_t    ReadStaticArrayFloat16(Float_t  *f, TStreamerElement *ele=0);
   virtual   Int_t    ReadStaticArrayDouble32(Double_t  *d, TStreamerElement *ele=0);

   virtual   void     ReadFastArray(Bool_t    *b, Int_t n);
   virtual   void     ReadFastArray(Char_t    *c, Int_t n);
   virtual   void     ReadFastArrayString(Char_t    *c, Int_t n);
   virtual   void     ReadFastArray(UChar_t   *c, Int_t n);
   virtual   void     ReadFastArray(Short_t   *h, Int_t n);
   virtual   void     ReadFastArray(UShort_t  *h, Int_t n);
   virtual   void     ReadFastArray(Int_t     *i, Int_t n);
   virtual   void     ReadFastArray(UInt_t    *i, Int_t n);
   virtual   void     ReadFastArray(Long_t    *l, Int_t n);
   virtual   void     ReadFastArray(ULong_t   *l, Int_t n);
   virtual   void     ReadFastArray(Long64_t  *l, Int_t n);
   virtual   void     ReadFastArray(ULong64_t *l, Int_t n);
   virtual   void     ReadFastArray(Float_t   *f, Int_t n);
   virtual   void     ReadFastArray(Double_t  *d, Int_t n);
   virtual   void     ReadFastArrayFloat16(Float_t  *f, Int_t n, TStreamerElement *ele=0);
   virtual   void     ReadFastArrayDouble32(Double_t  *d, Int_t n, TStreamerElement *ele=0);
   virtual   void     ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) ;
   virtual   void     ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits);
   virtual   void     ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue);
   virtual   void     ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) ;
   virtual   void     ReadFastArray(void  *start , const TClass *cl, Int_t n=1, TMemberStreamer *s=0, const TClass* onFileClass=0 );
   virtual   void     ReadFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0, const TClass* onFileClass=0);

   virtual   void     WriteArray(const Bool_t    *b, Int_t n);
   virtual   void     WriteArray(const Char_t    *c, Int_t n);
   virtual   void     WriteArray(const UChar_t   *c, Int_t n);
   virtual   void     WriteArray(const Short_t   *h, Int_t n);
   virtual   void     WriteArray(const UShort_t  *h, Int_t n);
   virtual   void     WriteArray(const Int_t     *i, Int_t n);
   virtual   void     WriteArray(const UInt_t    *i, Int_t n);
   virtual   void     WriteArray(const Long_t    *l, Int_t n);
   virtual   void     WriteArray(const ULong_t   *l, Int_t n);
   virtual   void     WriteArray(const Long64_t  *l, Int_t n);
   virtual   void     WriteArray(const ULong64_t *l, Int_t n);
   virtual   void     WriteArray(const Float_t   *f, Int_t n);
   virtual   void     WriteArray(const Double_t  *d, Int_t n);
   virtual   void     WriteArrayFloat16(const Float_t  *f, Int_t n, TStreamerElement *ele=0);
   virtual   void     WriteArrayDouble32(const Double_t  *d, Int_t n, TStreamerElement *ele=0);

   virtual   void     WriteFastArray(const Bool_t    *b, Int_t n);
   virtual   void     WriteFastArray(const Char_t    *c, Int_t n);
   virtual   void     WriteFastArrayString(const Char_t    *c, Int_t n);
   virtual   void     WriteFastArray(const UChar_t   *c, Int_t n);
   virtual   void     WriteFastArray(const Short_t   *h, Int_t n);
   virtual   void     WriteFastArray(const UShort_t  *h, Int_t n);
   virtual   void     WriteFastArray(const Int_t     *i, Int_t n);
   virtual   void     WriteFastArray(const UInt_t    *i, Int_t n);
   virtual   void     WriteFastArray(const Long_t    *l, Int_t n);
   virtual   void     WriteFastArray(const ULong_t   *l, Int_t n);
   virtual   void     WriteFastArray(const Long64_t  *l, Int_t n);
   virtual   void     WriteFastArray(const ULong64_t *l, Int_t n);
   virtual   void     WriteFastArray(const Float_t   *f, Int_t n);
   virtual   void     WriteFastArray(const Double_t  *d, Int_t n);
   virtual   void     WriteFastArrayFloat16(const Float_t  *f, Int_t n, TStreamerElement *ele=0);
   virtual   void     WriteFastArrayDouble32(const Double_t  *d, Int_t n, TStreamerElement *ele=0);
   virtual   void     WriteFastArray(void  *start,  const TClass *cl, Int_t n=1, TMemberStreamer *s=0);
   virtual   Int_t    WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);

   virtual   void     StreamObject(void *obj, const type_info &typeinfo, const TClass* onFileClass = 0 );
   virtual   void     StreamObject(void *obj, const char *className, const TClass* onFileClass = 0 );
   virtual   void     StreamObject(void *obj, const TClass *cl, const TClass* onFileClass = 0 );
   virtual   void     StreamObject(TObject *obj);

   virtual   void     ReadBool(Bool_t       &b);
   virtual   void     ReadChar(Char_t       &c);
   virtual   void     ReadUChar(UChar_t     &c);
   virtual   void     ReadShort(Short_t     &s);
   virtual   void     ReadUShort(UShort_t   &s);
   virtual   void     ReadInt(Int_t         &i);
   virtual   void     ReadUInt(UInt_t       &i);
   virtual   void     ReadLong(Long_t       &l);
   virtual   void     ReadULong(ULong_t     &l);
   virtual   void     ReadLong64(Long64_t   &l);
   virtual   void     ReadULong64(ULong64_t &l);
   virtual   void     ReadFloat(Float_t     &f);
   virtual   void     ReadDouble(Double_t   &d);
   virtual   void     ReadCharP(Char_t      *c);
   virtual   void     ReadTString(TString   &s);
   virtual   void     ReadStdString(std::string &s);

   virtual   void     WriteBool(Bool_t       b);
   virtual   void     WriteChar(Char_t       c);
   virtual   void     WriteUChar(UChar_t     c);
   virtual   void     WriteShort(Short_t     s);
   virtual   void     WriteUShort(UShort_t   s);
   virtual   void     WriteInt(Int_t         i);
   virtual   void     WriteUInt(UInt_t       i);
   virtual   void     WriteLong(Long_t       l);
   virtual   void     WriteULong(ULong_t     l);
   virtual   void     WriteLong64(Long64_t   l);
   virtual   void     WriteULong64(ULong64_t l);
   virtual   void     WriteFloat(Float_t     f);
   virtual   void     WriteDouble(Double_t   d);
   virtual   void     WriteCharP(const Char_t *c);
   virtual   void     WriteTString(const TString &s);
   virtual   void     WriteStdString(const std::string &s);

   // Special basic ROOT objects and collections
   virtual   TProcessID *GetLastProcessID(TRefTable *reftable) const;
   virtual   UInt_t      GetTRefExecId();
   virtual   TProcessID *ReadProcessID(UShort_t pidf);
   virtual   UShort_t    WriteProcessID(TProcessID *pid);

   // Utilities for TStreamerInfo
   virtual   void   ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force);
   virtual   void   ForceWriteInfoClones(TClonesArray *a);
   virtual   Int_t  ReadClones (TClonesArray *a, Int_t nobjects, Version_t objvers);
   virtual   Int_t  WriteClones(TClonesArray *a, Int_t nobjects);

   // Utilities for TClass
   virtual   Int_t  ReadClassEmulated(const TClass *cl, void *object, const TClass *onfile_class);
   virtual   Int_t  ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class);
   virtual   Int_t  ReadClassBuffer(const TClass *cl, void *pointer, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class);
   virtual   Int_t  WriteClassBuffer(const TClass *cl, void *pointer);

   // Utilites to streamer using sequences.
   Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object);
   Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
   Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);

   static void    SetGlobalReadParam(Int_t mapsize);
   static void    SetGlobalWriteParam(Int_t mapsize);
   static Int_t   GetGlobalReadParam();
   static Int_t   GetGlobalWriteParam();

   ClassDef(TBufferFile,0)  //concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
};


//---------------------- TBufferFile inlines ---------------------------------------

//______________________________________________________________________________
inline void TBufferFile::WriteBool(Bool_t b)
{
   if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t));
   tobuf(fBufCur, b);
}

//______________________________________________________________________________
inline void TBufferFile::WriteChar(Char_t c)
{
   if (fBufCur + sizeof(Char_t) > fBufMax) AutoExpand(fBufSize+sizeof(Char_t));
   tobuf(fBufCur, c);
}

//______________________________________________________________________________
inline void TBufferFile::WriteUChar(UChar_t c)
{
   if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t));
   tobuf(fBufCur, (Char_t)c);
}

//______________________________________________________________________________
inline void TBufferFile::WriteShort(Short_t h)
{
   if (fBufCur + sizeof(Short_t) > fBufMax) AutoExpand(fBufSize+sizeof(Short_t));
   tobuf(fBufCur, h);
}

//______________________________________________________________________________
inline void TBufferFile::WriteUShort(UShort_t h)
{
   if (fBufCur + sizeof(UShort_t) > fBufMax) AutoExpand(fBufSize+sizeof(UShort_t));
   tobuf(fBufCur, (Short_t)h);
}

//______________________________________________________________________________
inline void TBufferFile::WriteInt(Int_t i)
{
   if (fBufCur + sizeof(Int_t) > fBufMax) AutoExpand(fBufSize+sizeof(Int_t));
   tobuf(fBufCur, i);
}

//______________________________________________________________________________
inline void TBufferFile::WriteUInt(UInt_t i)
{
   if (fBufCur + sizeof(UInt_t) > fBufMax) AutoExpand(fBufSize+sizeof(UInt_t));
   tobuf(fBufCur, (Int_t)i);
}

//______________________________________________________________________________
inline void TBufferFile::WriteLong(Long_t l)
{
   if (fBufCur + sizeof(Long_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long_t));
   tobuf(fBufCur, l);
}

//______________________________________________________________________________
inline void TBufferFile::WriteULong(ULong_t l)
{
   if (fBufCur + sizeof(ULong_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong_t));
   tobuf(fBufCur, (Long_t)l);
}

//______________________________________________________________________________
inline void TBufferFile::WriteLong64(Long64_t ll)
{
   if (fBufCur + sizeof(Long64_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long64_t));
   tobuf(fBufCur, ll);
}

//______________________________________________________________________________
inline void TBufferFile::WriteULong64(ULong64_t ll)
{
   if (fBufCur + sizeof(ULong64_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong64_t));
   tobuf(fBufCur, (Long64_t)ll);
}

//______________________________________________________________________________
inline void TBufferFile::WriteFloat(Float_t f)
{
   if (fBufCur + sizeof(Float_t) > fBufMax) AutoExpand(fBufSize+sizeof(Float_t));
   tobuf(fBufCur, f);
}

//______________________________________________________________________________
inline void TBufferFile::WriteDouble(Double_t d)
{
   if (fBufCur + sizeof(Double_t) > fBufMax) AutoExpand(fBufSize+sizeof(Double_t));
   tobuf(fBufCur, d);
}

//______________________________________________________________________________
inline void TBufferFile::WriteCharP(const Char_t *c)
{
   WriteString(c);
}

//______________________________________________________________________________
inline void TBufferFile::ReadBool(Bool_t &b)
{
   frombuf(fBufCur, &b);
}

//______________________________________________________________________________
inline void TBufferFile::ReadChar(Char_t &c)
{
   frombuf(fBufCur, &c);
}

//______________________________________________________________________________
inline void TBufferFile::ReadUChar(UChar_t &c)
{
   TBufferFile::ReadChar((Char_t &)c);
}

//______________________________________________________________________________
inline void TBufferFile::ReadShort(Short_t &h)
{
   frombuf(fBufCur, &h);
}

//______________________________________________________________________________
inline void TBufferFile::ReadUShort(UShort_t &h)
{
   TBufferFile::ReadShort((Short_t &)h);
}

//______________________________________________________________________________
inline void TBufferFile::ReadInt(Int_t &i)
{
   frombuf(fBufCur, &i);
}

//______________________________________________________________________________
inline void TBufferFile::ReadUInt(UInt_t &i)
{
   TBufferFile::ReadInt((Int_t &)i);
}


// in implementation file because special case with old version
//______________________________________________________________________________
//inline void TBufferFile::ReadLong(Long_t &ll)
//{
//   frombuf(fBufCur, &ll);
//}

//______________________________________________________________________________
inline void TBufferFile::ReadULong(ULong_t &ll)
{
   TBufferFile::ReadLong((Long_t&)ll);
}


//______________________________________________________________________________
inline void TBufferFile::ReadLong64(Long64_t &ll)
{
   frombuf(fBufCur, &ll);
}

//______________________________________________________________________________
inline void TBufferFile::ReadULong64(ULong64_t &ll)
{
   TBufferFile::ReadLong64((Long64_t &)ll);
}

//______________________________________________________________________________
inline void TBufferFile::ReadFloat(Float_t &f)
{
   frombuf(fBufCur, &f);
}

//______________________________________________________________________________
inline void TBufferFile::ReadDouble(Double_t &d)
{
   frombuf(fBufCur, &d);
}

//______________________________________________________________________________
inline void TBufferFile::ReadCharP(Char_t *c)
{
   ReadString(c, -1);
}

//______________________________________________________________________________
inline Int_t TBufferFile::ReadArray(UChar_t *&c)
   {  return TBufferFile::ReadArray((Char_t *&)c); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadArray(UShort_t *&h)
   {  return TBufferFile::ReadArray((Short_t *&)h); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadArray(UInt_t *&i)
   {  return TBufferFile::ReadArray((Int_t *&)i); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadArray(ULong_t *&l)
   {  return TBufferFile::ReadArray((Long_t *&)l); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadArray(ULong64_t *&ll)
   {  return TBufferFile::ReadArray((Long64_t *&)ll); }

//______________________________________________________________________________
inline Int_t TBufferFile::ReadStaticArray(UChar_t *c)
   {  return TBufferFile::ReadStaticArray((Char_t *)c); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadStaticArray(UShort_t *h)
   {  return TBufferFile::ReadStaticArray((Short_t *)h); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadStaticArray(UInt_t *i)
   {  return TBufferFile::ReadStaticArray((Int_t *)i); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadStaticArray(ULong_t *l)
   {  return TBufferFile::ReadStaticArray((Long_t *)l); }
//______________________________________________________________________________
inline Int_t TBufferFile::ReadStaticArray(ULong64_t *ll)
   {  return TBufferFile::ReadStaticArray((Long64_t *)ll); }

//______________________________________________________________________________
inline void TBufferFile::ReadFastArray(UChar_t *c, Int_t n)
   {        TBufferFile::ReadFastArray((Char_t *)c, n); }
//______________________________________________________________________________
inline void TBufferFile::ReadFastArray(UShort_t *h, Int_t n)
   {        TBufferFile::ReadFastArray((Short_t *)h, n); }
//______________________________________________________________________________
inline void TBufferFile::ReadFastArray(UInt_t *i, Int_t n)
   {        TBufferFile::ReadFastArray((Int_t *)i, n); }
//______________________________________________________________________________
inline void TBufferFile::ReadFastArray(ULong_t *l, Int_t n)
   {        TBufferFile::ReadFastArray((Long_t *)l, n); }
//______________________________________________________________________________
inline void TBufferFile::ReadFastArray(ULong64_t *ll, Int_t n)
   {        TBufferFile::ReadFastArray((Long64_t *)ll, n); }

//______________________________________________________________________________
inline void TBufferFile::WriteArray(const UChar_t *c, Int_t n)
   {        TBufferFile::WriteArray((const Char_t *)c, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteArray(const UShort_t *h, Int_t n)
   {        TBufferFile::WriteArray((const Short_t *)h, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteArray(const UInt_t *i, Int_t n)
   {        TBufferFile::WriteArray((const Int_t *)i, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteArray(const ULong64_t *ll, Int_t n)
   {        TBufferFile::WriteArray((const Long64_t *)ll, n); }

//______________________________________________________________________________
inline void TBufferFile::WriteFastArray(const UChar_t *c, Int_t n)
   {        TBufferFile::WriteFastArray((const Char_t *)c, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteFastArray(const UShort_t *h, Int_t n)
   {        TBufferFile::WriteFastArray((const Short_t *)h, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteFastArray(const UInt_t *i, Int_t n)
   {        TBufferFile::WriteFastArray((const Int_t *)i, n); }
//______________________________________________________________________________
inline void TBufferFile::WriteFastArray(const ULong64_t *ll, Int_t n)
   {        TBufferFile::WriteFastArray((const Long64_t *)ll, n); }

#endif
 TBufferFile.h:1
 TBufferFile.h:2
 TBufferFile.h:3
 TBufferFile.h:4
 TBufferFile.h:5
 TBufferFile.h:6
 TBufferFile.h:7
 TBufferFile.h:8
 TBufferFile.h:9
 TBufferFile.h:10
 TBufferFile.h:11
 TBufferFile.h:12
 TBufferFile.h:13
 TBufferFile.h:14
 TBufferFile.h:15
 TBufferFile.h:16
 TBufferFile.h:17
 TBufferFile.h:18
 TBufferFile.h:19
 TBufferFile.h:20
 TBufferFile.h:21
 TBufferFile.h:22
 TBufferFile.h:23
 TBufferFile.h:24
 TBufferFile.h:25
 TBufferFile.h:26
 TBufferFile.h:27
 TBufferFile.h:28
 TBufferFile.h:29
 TBufferFile.h:30
 TBufferFile.h:31
 TBufferFile.h:32
 TBufferFile.h:33
 TBufferFile.h:34
 TBufferFile.h:35
 TBufferFile.h:36
 TBufferFile.h:37
 TBufferFile.h:38
 TBufferFile.h:39
 TBufferFile.h:40
 TBufferFile.h:41
 TBufferFile.h:42
 TBufferFile.h:43
 TBufferFile.h:44
 TBufferFile.h:45
 TBufferFile.h:46
 TBufferFile.h:47
 TBufferFile.h:48
 TBufferFile.h:49
 TBufferFile.h:50
 TBufferFile.h:51
 TBufferFile.h:52
 TBufferFile.h:53
 TBufferFile.h:54
 TBufferFile.h:55
 TBufferFile.h:56
 TBufferFile.h:57
 TBufferFile.h:58
 TBufferFile.h:59
 TBufferFile.h:60
 TBufferFile.h:61
 TBufferFile.h:62
 TBufferFile.h:63
 TBufferFile.h:64
 TBufferFile.h:65
 TBufferFile.h:66
 TBufferFile.h:67
 TBufferFile.h:68
 TBufferFile.h:69
 TBufferFile.h:70
 TBufferFile.h:71
 TBufferFile.h:72
 TBufferFile.h:73
 TBufferFile.h:74
 TBufferFile.h:75
 TBufferFile.h:76
 TBufferFile.h:77
 TBufferFile.h:78
 TBufferFile.h:79
 TBufferFile.h:80
 TBufferFile.h:81
 TBufferFile.h:82
 TBufferFile.h:83
 TBufferFile.h:84
 TBufferFile.h:85
 TBufferFile.h:86
 TBufferFile.h:87
 TBufferFile.h:88
 TBufferFile.h:89
 TBufferFile.h:90
 TBufferFile.h:91
 TBufferFile.h:92
 TBufferFile.h:93
 TBufferFile.h:94
 TBufferFile.h:95
 TBufferFile.h:96
 TBufferFile.h:97
 TBufferFile.h:98
 TBufferFile.h:99
 TBufferFile.h:100
 TBufferFile.h:101
 TBufferFile.h:102
 TBufferFile.h:103
 TBufferFile.h:104
 TBufferFile.h:105
 TBufferFile.h:106
 TBufferFile.h:107
 TBufferFile.h:108
 TBufferFile.h:109
 TBufferFile.h:110
 TBufferFile.h:111
 TBufferFile.h:112
 TBufferFile.h:113
 TBufferFile.h:114
 TBufferFile.h:115
 TBufferFile.h:116
 TBufferFile.h:117
 TBufferFile.h:118
 TBufferFile.h:119
 TBufferFile.h:120
 TBufferFile.h:121
 TBufferFile.h:122
 TBufferFile.h:123
 TBufferFile.h:124
 TBufferFile.h:125
 TBufferFile.h:126
 TBufferFile.h:127
 TBufferFile.h:128
 TBufferFile.h:129
 TBufferFile.h:130
 TBufferFile.h:131
 TBufferFile.h:132
 TBufferFile.h:133
 TBufferFile.h:134
 TBufferFile.h:135
 TBufferFile.h:136
 TBufferFile.h:137
 TBufferFile.h:138
 TBufferFile.h:139
 TBufferFile.h:140
 TBufferFile.h:141
 TBufferFile.h:142
 TBufferFile.h:143
 TBufferFile.h:144
 TBufferFile.h:145
 TBufferFile.h:146
 TBufferFile.h:147
 TBufferFile.h:148
 TBufferFile.h:149
 TBufferFile.h:150
 TBufferFile.h:151
 TBufferFile.h:152
 TBufferFile.h:153
 TBufferFile.h:154
 TBufferFile.h:155
 TBufferFile.h:156
 TBufferFile.h:157
 TBufferFile.h:158
 TBufferFile.h:159
 TBufferFile.h:160
 TBufferFile.h:161
 TBufferFile.h:162
 TBufferFile.h:163
 TBufferFile.h:164
 TBufferFile.h:165
 TBufferFile.h:166
 TBufferFile.h:167
 TBufferFile.h:168
 TBufferFile.h:169
 TBufferFile.h:170
 TBufferFile.h:171
 TBufferFile.h:172
 TBufferFile.h:173
 TBufferFile.h:174
 TBufferFile.h:175
 TBufferFile.h:176
 TBufferFile.h:177
 TBufferFile.h:178
 TBufferFile.h:179
 TBufferFile.h:180
 TBufferFile.h:181
 TBufferFile.h:182
 TBufferFile.h:183
 TBufferFile.h:184
 TBufferFile.h:185
 TBufferFile.h:186
 TBufferFile.h:187
 TBufferFile.h:188
 TBufferFile.h:189
 TBufferFile.h:190
 TBufferFile.h:191
 TBufferFile.h:192
 TBufferFile.h:193
 TBufferFile.h:194
 TBufferFile.h:195
 TBufferFile.h:196
 TBufferFile.h:197
 TBufferFile.h:198
 TBufferFile.h:199
 TBufferFile.h:200
 TBufferFile.h:201
 TBufferFile.h:202
 TBufferFile.h:203
 TBufferFile.h:204
 TBufferFile.h:205
 TBufferFile.h:206
 TBufferFile.h:207
 TBufferFile.h:208
 TBufferFile.h:209
 TBufferFile.h:210
 TBufferFile.h:211
 TBufferFile.h:212
 TBufferFile.h:213
 TBufferFile.h:214
 TBufferFile.h:215
 TBufferFile.h:216
 TBufferFile.h:217
 TBufferFile.h:218
 TBufferFile.h:219
 TBufferFile.h:220
 TBufferFile.h:221
 TBufferFile.h:222
 TBufferFile.h:223
 TBufferFile.h:224
 TBufferFile.h:225
 TBufferFile.h:226
 TBufferFile.h:227
 TBufferFile.h:228
 TBufferFile.h:229
 TBufferFile.h:230
 TBufferFile.h:231
 TBufferFile.h:232
 TBufferFile.h:233
 TBufferFile.h:234
 TBufferFile.h:235
 TBufferFile.h:236
 TBufferFile.h:237
 TBufferFile.h:238
 TBufferFile.h:239
 TBufferFile.h:240
 TBufferFile.h:241
 TBufferFile.h:242
 TBufferFile.h:243
 TBufferFile.h:244
 TBufferFile.h:245
 TBufferFile.h:246
 TBufferFile.h:247
 TBufferFile.h:248
 TBufferFile.h:249
 TBufferFile.h:250
 TBufferFile.h:251
 TBufferFile.h:252
 TBufferFile.h:253
 TBufferFile.h:254
 TBufferFile.h:255
 TBufferFile.h:256
 TBufferFile.h:257
 TBufferFile.h:258
 TBufferFile.h:259
 TBufferFile.h:260
 TBufferFile.h:261
 TBufferFile.h:262
 TBufferFile.h:263
 TBufferFile.h:264
 TBufferFile.h:265
 TBufferFile.h:266
 TBufferFile.h:267
 TBufferFile.h:268
 TBufferFile.h:269
 TBufferFile.h:270
 TBufferFile.h:271
 TBufferFile.h:272
 TBufferFile.h:273
 TBufferFile.h:274
 TBufferFile.h:275
 TBufferFile.h:276
 TBufferFile.h:277
 TBufferFile.h:278
 TBufferFile.h:279
 TBufferFile.h:280
 TBufferFile.h:281
 TBufferFile.h:282
 TBufferFile.h:283
 TBufferFile.h:284
 TBufferFile.h:285
 TBufferFile.h:286
 TBufferFile.h:287
 TBufferFile.h:288
 TBufferFile.h:289
 TBufferFile.h:290
 TBufferFile.h:291
 TBufferFile.h:292
 TBufferFile.h:293
 TBufferFile.h:294
 TBufferFile.h:295
 TBufferFile.h:296
 TBufferFile.h:297
 TBufferFile.h:298
 TBufferFile.h:299
 TBufferFile.h:300
 TBufferFile.h:301
 TBufferFile.h:302
 TBufferFile.h:303
 TBufferFile.h:304
 TBufferFile.h:305
 TBufferFile.h:306
 TBufferFile.h:307
 TBufferFile.h:308
 TBufferFile.h:309
 TBufferFile.h:310
 TBufferFile.h:311
 TBufferFile.h:312
 TBufferFile.h:313
 TBufferFile.h:314
 TBufferFile.h:315
 TBufferFile.h:316
 TBufferFile.h:317
 TBufferFile.h:318
 TBufferFile.h:319
 TBufferFile.h:320
 TBufferFile.h:321
 TBufferFile.h:322
 TBufferFile.h:323
 TBufferFile.h:324
 TBufferFile.h:325
 TBufferFile.h:326
 TBufferFile.h:327
 TBufferFile.h:328
 TBufferFile.h:329
 TBufferFile.h:330
 TBufferFile.h:331
 TBufferFile.h:332
 TBufferFile.h:333
 TBufferFile.h:334
 TBufferFile.h:335
 TBufferFile.h:336
 TBufferFile.h:337
 TBufferFile.h:338
 TBufferFile.h:339
 TBufferFile.h:340
 TBufferFile.h:341
 TBufferFile.h:342
 TBufferFile.h:343
 TBufferFile.h:344
 TBufferFile.h:345
 TBufferFile.h:346
 TBufferFile.h:347
 TBufferFile.h:348
 TBufferFile.h:349
 TBufferFile.h:350
 TBufferFile.h:351
 TBufferFile.h:352
 TBufferFile.h:353
 TBufferFile.h:354
 TBufferFile.h:355
 TBufferFile.h:356
 TBufferFile.h:357
 TBufferFile.h:358
 TBufferFile.h:359
 TBufferFile.h:360
 TBufferFile.h:361
 TBufferFile.h:362
 TBufferFile.h:363
 TBufferFile.h:364
 TBufferFile.h:365
 TBufferFile.h:366
 TBufferFile.h:367
 TBufferFile.h:368
 TBufferFile.h:369
 TBufferFile.h:370
 TBufferFile.h:371
 TBufferFile.h:372
 TBufferFile.h:373
 TBufferFile.h:374
 TBufferFile.h:375
 TBufferFile.h:376
 TBufferFile.h:377
 TBufferFile.h:378
 TBufferFile.h:379
 TBufferFile.h:380
 TBufferFile.h:381
 TBufferFile.h:382
 TBufferFile.h:383
 TBufferFile.h:384
 TBufferFile.h:385
 TBufferFile.h:386
 TBufferFile.h:387
 TBufferFile.h:388
 TBufferFile.h:389
 TBufferFile.h:390
 TBufferFile.h:391
 TBufferFile.h:392
 TBufferFile.h:393
 TBufferFile.h:394
 TBufferFile.h:395
 TBufferFile.h:396
 TBufferFile.h:397
 TBufferFile.h:398
 TBufferFile.h:399
 TBufferFile.h:400
 TBufferFile.h:401
 TBufferFile.h:402
 TBufferFile.h:403
 TBufferFile.h:404
 TBufferFile.h:405
 TBufferFile.h:406
 TBufferFile.h:407
 TBufferFile.h:408
 TBufferFile.h:409
 TBufferFile.h:410
 TBufferFile.h:411
 TBufferFile.h:412
 TBufferFile.h:413
 TBufferFile.h:414
 TBufferFile.h:415
 TBufferFile.h:416
 TBufferFile.h:417
 TBufferFile.h:418
 TBufferFile.h:419
 TBufferFile.h:420
 TBufferFile.h:421
 TBufferFile.h:422
 TBufferFile.h:423
 TBufferFile.h:424
 TBufferFile.h:425
 TBufferFile.h:426
 TBufferFile.h:427
 TBufferFile.h:428
 TBufferFile.h:429
 TBufferFile.h:430
 TBufferFile.h:431
 TBufferFile.h:432
 TBufferFile.h:433
 TBufferFile.h:434
 TBufferFile.h:435
 TBufferFile.h:436
 TBufferFile.h:437
 TBufferFile.h:438
 TBufferFile.h:439
 TBufferFile.h:440
 TBufferFile.h:441
 TBufferFile.h:442
 TBufferFile.h:443
 TBufferFile.h:444
 TBufferFile.h:445
 TBufferFile.h:446
 TBufferFile.h:447
 TBufferFile.h:448
 TBufferFile.h:449
 TBufferFile.h:450
 TBufferFile.h:451
 TBufferFile.h:452
 TBufferFile.h:453
 TBufferFile.h:454
 TBufferFile.h:455
 TBufferFile.h:456
 TBufferFile.h:457
 TBufferFile.h:458
 TBufferFile.h:459
 TBufferFile.h:460
 TBufferFile.h:461
 TBufferFile.h:462
 TBufferFile.h:463
 TBufferFile.h:464
 TBufferFile.h:465
 TBufferFile.h:466
 TBufferFile.h:467
 TBufferFile.h:468
 TBufferFile.h:469
 TBufferFile.h:470
 TBufferFile.h:471
 TBufferFile.h:472
 TBufferFile.h:473
 TBufferFile.h:474
 TBufferFile.h:475
 TBufferFile.h:476
 TBufferFile.h:477
 TBufferFile.h:478
 TBufferFile.h:479
 TBufferFile.h:480
 TBufferFile.h:481
 TBufferFile.h:482
 TBufferFile.h:483
 TBufferFile.h:484
 TBufferFile.h:485
 TBufferFile.h:486
 TBufferFile.h:487
 TBufferFile.h:488
 TBufferFile.h:489
 TBufferFile.h:490
 TBufferFile.h:491
 TBufferFile.h:492
 TBufferFile.h:493
 TBufferFile.h:494
 TBufferFile.h:495
 TBufferFile.h:496
 TBufferFile.h:497
 TBufferFile.h:498
 TBufferFile.h:499
 TBufferFile.h:500
 TBufferFile.h:501
 TBufferFile.h:502
 TBufferFile.h:503
 TBufferFile.h:504
 TBufferFile.h:505
 TBufferFile.h:506
 TBufferFile.h:507
 TBufferFile.h:508
 TBufferFile.h:509
 TBufferFile.h:510
 TBufferFile.h:511
 TBufferFile.h:512
 TBufferFile.h:513
 TBufferFile.h:514
 TBufferFile.h:515
 TBufferFile.h:516
 TBufferFile.h:517
 TBufferFile.h:518
 TBufferFile.h:519
 TBufferFile.h:520
 TBufferFile.h:521
 TBufferFile.h:522
 TBufferFile.h:523
 TBufferFile.h:524
 TBufferFile.h:525
 TBufferFile.h:526
 TBufferFile.h:527
 TBufferFile.h:528
 TBufferFile.h:529
 TBufferFile.h:530
 TBufferFile.h:531
 TBufferFile.h:532
 TBufferFile.h:533
 TBufferFile.h:534
 TBufferFile.h:535
 TBufferFile.h:536
 TBufferFile.h:537
 TBufferFile.h:538
 TBufferFile.h:539
 TBufferFile.h:540
 TBufferFile.h:541
 TBufferFile.h:542
 TBufferFile.h:543
 TBufferFile.h:544
 TBufferFile.h:545
 TBufferFile.h:546
 TBufferFile.h:547
 TBufferFile.h:548
 TBufferFile.h:549
 TBufferFile.h:550
 TBufferFile.h:551
 TBufferFile.h:552
 TBufferFile.h:553
 TBufferFile.h:554
 TBufferFile.h:555
 TBufferFile.h:556
 TBufferFile.h:557
 TBufferFile.h:558
 TBufferFile.h:559
 TBufferFile.h:560
 TBufferFile.h:561
 TBufferFile.h:562
 TBufferFile.h:563
 TBufferFile.h:564
 TBufferFile.h:565
 TBufferFile.h:566
 TBufferFile.h:567
 TBufferFile.h:568
 TBufferFile.h:569
 TBufferFile.h:570
 TBufferFile.h:571
 TBufferFile.h:572
 TBufferFile.h:573
 TBufferFile.h:574
 TBufferFile.h:575
 TBufferFile.h:576
 TBufferFile.h:577
 TBufferFile.h:578
 TBufferFile.h:579
 TBufferFile.h:580
 TBufferFile.h:581
 TBufferFile.h:582
 TBufferFile.h:583
 TBufferFile.h:584
 TBufferFile.h:585
 TBufferFile.h:586