#ifndef ROOT_TBuffer
#define ROOT_TBuffer
#ifndef ROOT_TObject
#include "TObject.h"
#endif
class TVirtualStreamerInfo;
class TStreamerElement;
class TClass;
class TString;
class TProcessID;
class TClonesArray;
class TRefTable;
class TBuffer : public TObject {
protected:
Bool_t fMode;
Int_t fVersion;
Int_t fBufSize;
char *fBuffer;
char *fBufCur;
char *fBufMax;
TObject *fParent;
TBuffer() : TObject(), fMode(0), fVersion(0), fBufSize(0), fBuffer(0),
fBufCur(0), fBufMax(0), fParent(0) {}
TBuffer(const TBuffer &);
void operator=(const TBuffer &);
void Expand(Int_t newsize);
Int_t Read(const char *name) { return TObject::Read(name); }
Int_t Write(const char *name, Int_t opt, Int_t bufs)
{ return TObject::Write(name, opt, bufs); }
Int_t Write(const char *name, Int_t opt, Int_t bufs) const
{ return TObject::Write(name, opt, bufs); }
public:
enum EMode { kRead = 0, kWrite = 1 };
enum { kIsOwner = BIT(16) };
enum { kCannotHandleMemberWiseStreaming = BIT(17)};
enum { kInitialSize = 1024, kMinimalSize = 128 };
TBuffer(EMode mode);
TBuffer(EMode mode, Int_t bufsiz);
TBuffer(EMode mode, Int_t bufsiz, void *buf, Bool_t adopt = kTRUE);
virtual ~TBuffer();
Int_t GetBufferVersion() const { return fVersion; }
Bool_t IsReading() const { return (fMode & kWrite) == 0; }
Bool_t IsWriting() const { return (fMode & kWrite) != 0; }
void SetReadMode();
void SetWriteMode();
void SetBuffer(void *buf, UInt_t bufsiz = 0, Bool_t adopt = kTRUE);
void SetBufferOffset(Int_t offset = 0) { fBufCur = fBuffer+offset; }
void SetParent(TObject *parent);
TObject *GetParent() const;
char *Buffer() const { return fBuffer; }
Int_t BufferSize() const { return fBufSize; }
void DetachBuffer() { fBuffer = 0; }
Int_t Length() const { return (Int_t)(fBufCur - fBuffer); }
virtual Bool_t CheckObject(const TObject *obj) = 0;
virtual Bool_t CheckObject(const void *obj, const TClass *ptrClass) = 0;
virtual Int_t ReadBuf(void *buf, Int_t max) = 0;
virtual void WriteBuf(const void *buf, Int_t max) = 0;
virtual char *ReadString(char *s, Int_t max) = 0;
virtual void WriteString(const char *s) = 0;
virtual Int_t GetVersionOwner() const = 0;
virtual Int_t GetMapCount() const = 0;
virtual void GetMappedObject(UInt_t tag, void* &ptr, TClass* &ClassPtr) const = 0;
virtual void MapObject(const TObject *obj, UInt_t offset = 1) = 0;
virtual void MapObject(const void *obj, const TClass *cl, UInt_t offset = 1) = 0;
virtual void Reset() = 0;
virtual void InitMap() = 0;
virtual void ResetMap() = 0;
virtual void SetReadParam(Int_t mapsize) = 0;
virtual void SetWriteParam(Int_t mapsize) = 0;
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss) = 0;
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname) = 0;
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE)= 0;
virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, const TClass *cl = 0) = 0;
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE) = 0;
virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBcnt = kFALSE) = 0;
virtual void *ReadObjectAny(const TClass* cast) = 0;
virtual void SkipObjectAny() = 0;
virtual void IncrementLevel(TVirtualStreamerInfo* info) = 0;
virtual void SetStreamerElementNumber(Int_t) = 0;
virtual void DecrementLevel(TVirtualStreamerInfo*) = 0;
virtual void ClassBegin(const TClass*, Version_t = -1) = 0;
virtual void ClassEnd(const TClass*) = 0;
virtual void ClassMember(const char*, const char* = 0, Int_t = -1, Int_t = -1) = 0;
virtual TVirtualStreamerInfo *GetInfo() = 0;
virtual TClass *ReadClass(const TClass *cl = 0, UInt_t *objTag = 0) = 0;
virtual void WriteClass(const TClass *cl) = 0;
virtual TObject *ReadObject(const TClass *cl) = 0;
virtual void WriteObject(const TObject *obj) = 0;
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass) = 0;
virtual UShort_t GetPidOffset() const = 0;
virtual void SetPidOffset(UShort_t offset) = 0;
virtual Int_t GetBufferDisplacement() const = 0;
virtual void SetBufferDisplacement() = 0;
virtual void SetBufferDisplacement(Int_t skipped) = 0;
virtual void ReadFloat16 (Float_t *f, TStreamerElement *ele=0) = 0;
virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0) = 0;
virtual void ReadDouble32 (Double_t *d, TStreamerElement *ele=0) = 0;
virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0) = 0;
virtual Int_t ReadArray(Bool_t *&b) = 0;
virtual Int_t ReadArray(Char_t *&c) = 0;
virtual Int_t ReadArray(UChar_t *&c) = 0;
virtual Int_t ReadArray(Short_t *&h) = 0;
virtual Int_t ReadArray(UShort_t *&h) = 0;
virtual Int_t ReadArray(Int_t *&i) = 0;
virtual Int_t ReadArray(UInt_t *&i) = 0;
virtual Int_t ReadArray(Long_t *&l) = 0;
virtual Int_t ReadArray(ULong_t *&l) = 0;
virtual Int_t ReadArray(Long64_t *&l) = 0;
virtual Int_t ReadArray(ULong64_t *&l) = 0;
virtual Int_t ReadArray(Float_t *&f) = 0;
virtual Int_t ReadArray(Double_t *&d) = 0;
virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0) = 0;
virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0) = 0;
virtual Int_t ReadStaticArray(Bool_t *b) = 0;
virtual Int_t ReadStaticArray(Char_t *c) = 0;
virtual Int_t ReadStaticArray(UChar_t *c) = 0;
virtual Int_t ReadStaticArray(Short_t *h) = 0;
virtual Int_t ReadStaticArray(UShort_t *h) = 0;
virtual Int_t ReadStaticArray(Int_t *i) = 0;
virtual Int_t ReadStaticArray(UInt_t *i) = 0;
virtual Int_t ReadStaticArray(Long_t *l) = 0;
virtual Int_t ReadStaticArray(ULong_t *l) = 0;
virtual Int_t ReadStaticArray(Long64_t *l) = 0;
virtual Int_t ReadStaticArray(ULong64_t *l) = 0;
virtual Int_t ReadStaticArray(Float_t *f) = 0;
virtual Int_t ReadStaticArray(Double_t *d) = 0;
virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0) = 0;
virtual Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele=0) = 0;
virtual void ReadFastArray(Bool_t *b, Int_t n) = 0;
virtual void ReadFastArray(Char_t *c, Int_t n) = 0;
virtual void ReadFastArrayString(Char_t *c, Int_t n) = 0;
virtual void ReadFastArray(UChar_t *c, Int_t n) = 0;
virtual void ReadFastArray(Short_t *h, Int_t n) = 0;
virtual void ReadFastArray(UShort_t *h, Int_t n) = 0;
virtual void ReadFastArray(Int_t *i, Int_t n) = 0;
virtual void ReadFastArray(UInt_t *i, Int_t n) = 0;
virtual void ReadFastArray(Long_t *l, Int_t n) = 0;
virtual void ReadFastArray(ULong_t *l, Int_t n) = 0;
virtual void ReadFastArray(Long64_t *l, Int_t n) = 0;
virtual void ReadFastArray(ULong64_t *l, Int_t n) = 0;
virtual void ReadFastArray(Float_t *f, Int_t n) = 0;
virtual void ReadFastArray(Double_t *d, Int_t n) = 0;
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0) = 0;
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0) = 0;
virtual void ReadFastArray(void *start , const TClass *cl, Int_t n=1, TMemberStreamer *s=0) = 0;
virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0) = 0;
virtual void WriteArray(const Bool_t *b, Int_t n) = 0;
virtual void WriteArray(const Char_t *c, Int_t n) = 0;
virtual void WriteArray(const UChar_t *c, Int_t n) = 0;
virtual void WriteArray(const Short_t *h, Int_t n) = 0;
virtual void WriteArray(const UShort_t *h, Int_t n) = 0;
virtual void WriteArray(const Int_t *i, Int_t n) = 0;
virtual void WriteArray(const UInt_t *i, Int_t n) = 0;
virtual void WriteArray(const Long_t *l, Int_t n) = 0;
virtual void WriteArray(const ULong_t *l, Int_t n) = 0;
virtual void WriteArray(const Long64_t *l, Int_t n) = 0;
virtual void WriteArray(const ULong64_t *l, Int_t n) = 0;
virtual void WriteArray(const Float_t *f, Int_t n) = 0;
virtual void WriteArray(const Double_t *d, Int_t n) = 0;
virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0) = 0;
virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0) = 0;
virtual void WriteFastArray(const Bool_t *b, Int_t n) = 0;
virtual void WriteFastArray(const Char_t *c, Int_t n) = 0;
virtual void WriteFastArrayString(const Char_t *c, Int_t n) = 0;
virtual void WriteFastArray(const UChar_t *c, Int_t n) = 0;
virtual void WriteFastArray(const Short_t *h, Int_t n) = 0;
virtual void WriteFastArray(const UShort_t *h, Int_t n) = 0;
virtual void WriteFastArray(const Int_t *i, Int_t n) = 0;
virtual void WriteFastArray(const UInt_t *i, Int_t n) = 0;
virtual void WriteFastArray(const Long_t *l, Int_t n) = 0;
virtual void WriteFastArray(const ULong_t *l, Int_t n) = 0;
virtual void WriteFastArray(const Long64_t *l, Int_t n) = 0;
virtual void WriteFastArray(const ULong64_t *l, Int_t n) = 0;
virtual void WriteFastArray(const Float_t *f, Int_t n) = 0;
virtual void WriteFastArray(const Double_t *d, Int_t n) = 0;
virtual void WriteFastArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0) = 0;
virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0) = 0;
virtual void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=0) = 0;
virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0) = 0;
virtual void StreamObject(void *obj, const type_info &typeinfo) = 0;
virtual void StreamObject(void *obj, const char *className) = 0;
virtual void StreamObject(void *obj, const TClass *cl) = 0;
virtual void StreamObject(TObject *obj) = 0;
virtual void ReadBool(Bool_t &b) = 0;
virtual void ReadChar(Char_t &c) = 0;
virtual void ReadUChar(UChar_t &c) = 0;
virtual void ReadShort(Short_t &s) = 0;
virtual void ReadUShort(UShort_t &s) = 0;
virtual void ReadInt(Int_t &i) = 0;
virtual void ReadUInt(UInt_t &i) = 0;
virtual void ReadLong(Long_t &l) = 0;
virtual void ReadULong(ULong_t &l) = 0;
virtual void ReadLong64(Long64_t &l) = 0;
virtual void ReadULong64(ULong64_t &l) = 0;
virtual void ReadFloat(Float_t &f) = 0;
virtual void ReadDouble(Double_t &d) = 0;
virtual void ReadCharP(Char_t *c) = 0;
virtual void ReadTString(TString &s) = 0;
virtual void WriteBool(Bool_t b) = 0;
virtual void WriteChar(Char_t c) = 0;
virtual void WriteUChar(UChar_t c) = 0;
virtual void WriteShort(Short_t s) = 0;
virtual void WriteUShort(UShort_t s) = 0;
virtual void WriteInt(Int_t i) = 0;
virtual void WriteUInt(UInt_t i) = 0;
virtual void WriteLong(Long_t l) = 0;
virtual void WriteULong(ULong_t l) = 0;
virtual void WriteLong64(Long64_t l) = 0;
virtual void WriteULong64(ULong64_t l) = 0;
virtual void WriteFloat(Float_t f) = 0;
virtual void WriteDouble(Double_t d) = 0;
virtual void WriteCharP(const Char_t *c) = 0;
virtual void WriteTString(const TString &s) = 0;
virtual TProcessID *GetLastProcessID(TRefTable *reftable) const = 0;
virtual UInt_t GetTRefExecId() = 0;
virtual TProcessID *ReadProcessID(UShort_t pidf) = 0;
virtual UShort_t WriteProcessID(TProcessID *pid) = 0;
virtual void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force) = 0;
virtual void ForceWriteInfoClones(TClonesArray *a) = 0;
virtual Int_t ReadClones (TClonesArray *a, Int_t nobjects, Version_t objvers) = 0;
virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects) = 0;
virtual Int_t ReadClassEmulated(TClass *cl, void *object) = 0;
virtual Int_t ReadClassBuffer(TClass *cl, void *pointer) = 0;
virtual Int_t ReadClassBuffer(TClass *cl, void *pointer, Int_t version, UInt_t start, UInt_t count) = 0;
virtual Int_t WriteClassBuffer(TClass *cl, void *pointer) = 0;
static TClass *GetClass(const type_info &typeinfo);
static TClass *GetClass(const char *className);
ClassDef(TBuffer,0)
};
inline TBuffer &operator>>(TBuffer &buf, Bool_t &b) { buf.ReadBool(b); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Char_t &c) { buf.ReadChar(c); return buf; }
inline TBuffer &operator>>(TBuffer &buf, UChar_t &c) { buf.ReadUChar(c); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Short_t &s) { buf.ReadShort(s); return buf; }
inline TBuffer &operator>>(TBuffer &buf, UShort_t &s) { buf.ReadUShort(s); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Int_t &i) { buf.ReadInt(i); return buf; }
inline TBuffer &operator>>(TBuffer &buf, UInt_t &i) { buf.ReadUInt(i); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Long_t &l) { buf.ReadLong(l); return buf; }
inline TBuffer &operator>>(TBuffer &buf, ULong_t &l) { buf.ReadULong(l); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Long64_t &l) { buf.ReadLong64(l); return buf; }
inline TBuffer &operator>>(TBuffer &buf, ULong64_t &l){ buf.ReadULong64(l);return buf; }
inline TBuffer &operator>>(TBuffer &buf, Float_t &f) { buf.ReadFloat(f); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Double_t &d) { buf.ReadDouble(d); return buf; }
inline TBuffer &operator>>(TBuffer &buf, Char_t *c) { buf.ReadCharP(c); return buf; }
inline TBuffer &operator>>(TBuffer &buf, TString &s) { buf.ReadTString(s);return buf; }
inline TBuffer &operator<<(TBuffer &buf, Bool_t b) { buf.WriteBool(b); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Char_t c) { buf.WriteChar(c); return buf; }
inline TBuffer &operator<<(TBuffer &buf, UChar_t c) { buf.WriteUChar(c); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Short_t s) { buf.WriteShort(s); return buf; }
inline TBuffer &operator<<(TBuffer &buf, UShort_t s) { buf.WriteUShort(s); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Int_t i) { buf.WriteInt(i); return buf; }
inline TBuffer &operator<<(TBuffer &buf, UInt_t i) { buf.WriteUInt(i); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Long_t l) { buf.WriteLong(l); return buf; }
inline TBuffer &operator<<(TBuffer &buf, ULong_t l) { buf.WriteULong(l); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Long64_t l) { buf.WriteLong64(l); return buf; }
inline TBuffer &operator<<(TBuffer &buf, ULong64_t l){ buf.WriteULong64(l);return buf; }
inline TBuffer &operator<<(TBuffer &buf, Float_t f) { buf.WriteFloat(f); return buf; }
inline TBuffer &operator<<(TBuffer &buf, Double_t d) { buf.WriteDouble(d); return buf; }
inline TBuffer &operator<<(TBuffer &buf, const Char_t *c) { buf.WriteCharP(c); return buf; }
inline TBuffer &operator<<(TBuffer &buf, const TString &s) { buf.WriteTString(s);return buf; }
#if !defined(R__CONCRETE_INPUT_OPERATOR)
#ifndef __CINT__
#if defined(R__SOLARIS) && defined(R__GNU)
#include <typeinfo>
#endif
template <class Tmpl> TBuffer &operator>>(TBuffer &buf, Tmpl *&obj)
{
TClass *cl = TBuffer::GetClass(typeid(Tmpl));
obj = (Tmpl *) ( (void*) buf.ReadObjectAny(cl) );
return buf;
}
template <class Tmpl> TBuffer &operator<<(TBuffer &buf, const Tmpl *obj)
{
TClass *cl = (obj) ? TBuffer::GetClass(typeid(*obj)) : 0;
buf.WriteObjectAny(obj, cl);
return buf;
}
#else
template <class Tmpl> TBuffer &operator>>(TBuffer &buf, Tmpl *&obj);
template <class Tmpl> TBuffer &operator<<(TBuffer &buf, Tmpl *&obj);
#endif
#endif
#if defined(R__TEMPLATE_OVERLOAD_BUG)
template <>
#endif
inline TBuffer &operator<<(TBuffer &buf, const TObject *obj)
{ buf.WriteObjectAny(obj, TObject::Class()); return buf; }
#endif
Last change: Wed Jun 25 08:35:17 2008
Last generated: 2008-06-25 08:35
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.