TMessage.h

Go to the documentation of this file.
00001 // @(#)root/net:$Id: TMessage.h 35752 2010-09-26 22:07:36Z rdm $
00002 // Author: Fons Rademakers   19/12/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TMessage
00013 #define ROOT_TMessage
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TMessage                                                             //
00019 //                                                                      //
00020 // Message buffer class used for serializing objects and sending them   //
00021 // over the network.                                                    //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TBufferFile
00026 #include "TBufferFile.h"
00027 #endif
00028 #ifndef ROOT_MessageTypes
00029 #include "MessageTypes.h"
00030 #endif
00031 #ifndef ROOT_TBits
00032 #include "TBits.h"
00033 #endif
00034 
00035 class TList;
00036 class TVirtualStreamerInfo;
00037 
00038 class TMessage : public TBufferFile {
00039 
00040 friend class TAuthenticate;
00041 friend class TSocket;
00042 friend class TPSocket;
00043 friend class TXSocket;
00044 
00045 private:
00046    TList   *fInfos;       //Array of TStreamerInfo used in WriteObject
00047    TBits    fBitsPIDs;    //Array of bits to mark the TProcessIDs uids written to the message
00048    UInt_t   fWhat;        //Message type
00049    TClass  *fClass;       //If message is kMESS_OBJECT pointer to object's class
00050    Int_t    fCompress;    //Compression level from 0 (not compressed) to 9 (max compression)
00051    char    *fBufComp;     //Compressed buffer
00052    char    *fBufCompCur;  //Current position in compressed buffer
00053    char    *fCompPos;     //Position of fBufCur when message was compressed
00054    Bool_t   fEvolution;   //True if support for schema evolution required
00055 
00056    static Bool_t fgEvolution;  //True if global support for schema evolution required
00057 
00058    // TMessage objects cannot be copied or assigned
00059    TMessage(const TMessage &);           // not implemented
00060    void operator=(const TMessage &);     // not implemented
00061 
00062    // used by friend TSocket
00063    Bool_t TestBitNumber(UInt_t bitnumber) const { return fBitsPIDs.TestBitNumber(bitnumber); }
00064 
00065 protected:
00066    TMessage(void *buf, Int_t bufsize);   // only called by T(P)Socket::Recv()
00067    void SetLength() const;               // only called by T(P)Socket::Send()
00068 
00069 public:
00070    TMessage(UInt_t what = kMESS_ANY, Int_t bufsiz = TBuffer::kInitialSize);
00071    virtual ~TMessage();
00072 
00073    void     ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force);
00074    void     Forward();
00075    TClass  *GetClass() const { return fClass;}
00076    void     TagStreamerInfo(TVirtualStreamerInfo* info);
00077    void     Reset();
00078    void     Reset(UInt_t what) { SetWhat(what); Reset(); }
00079    UInt_t   What() const { return fWhat; }
00080    void     SetWhat(UInt_t what);
00081 
00082    void     EnableSchemaEvolution(Bool_t enable = kTRUE) { fEvolution = enable; }
00083    Bool_t   UsesSchemaEvolution() const { return fEvolution; }
00084    void     SetCompressionLevel(Int_t level = 1);
00085    Int_t    GetCompressionLevel() const { return fCompress; }
00086    Int_t    Compress();
00087    Int_t    Uncompress();
00088    char    *CompBuffer() const { return fBufComp; }
00089    Int_t    CompLength() const { return (Int_t)(fBufCompCur - fBufComp); }
00090    void     WriteObject(const TObject *obj);
00091    UShort_t WriteProcessID(TProcessID *pid);
00092 
00093    static void   EnableSchemaEvolutionForAll(Bool_t enable = kTRUE);
00094    static Bool_t UsesSchemaEvolutionForAll();
00095 
00096    ClassDef(TMessage,0)  // Message buffer class
00097 };
00098 
00099 #endif

Generated on Tue Jul 5 14:27:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1