Skip to content
Snippets Groups Projects
Commit 4a397337 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

add local fEvolution flag in TMessage. It will be initialized by the value

of fgEvolution at the time of message creation. This to:
1) allow some message to have schema evolution while others not
2) to avoid that the changing of the global fgEvolution during the life-time
   of a message to cause problems


git-svn-id: http://root.cern.ch/svn/root/trunk@24432 27541ba8-7e3a-0410-8455-c3a389f83636
parent e86b4241
No related branches found
No related tags found
No related merge requests found
...@@ -44,16 +44,17 @@ friend class TXSocket; ...@@ -44,16 +44,17 @@ friend class TXSocket;
private: private:
TList *fInfos; //Array of TStreamerInfo used in WriteObject TList *fInfos; //Array of TStreamerInfo used in WriteObject
TBits fBitsPIDs; //Array of bits to mark the TProcessIDs uids written to the mesasge TBits fBitsPIDs; //Array of bits to mark the TProcessIDs uids written to the message
UInt_t fWhat; //Message type UInt_t fWhat; //Message type
TClass *fClass; //If message is kMESS_OBJECT pointer to object's class TClass *fClass; //If message is kMESS_OBJECT pointer to object's class
Int_t fCompress; //Compression level from 0 (not compressed) to 9 (max compression) Int_t fCompress; //Compression level from 0 (not compressed) to 9 (max compression)
char *fBufComp; //Compressed buffer char *fBufComp; //Compressed buffer
char *fBufCompCur; //Current position in compressed buffer char *fBufCompCur; //Current position in compressed buffer
char *fCompPos; //Position of fBufCur when message was compressed char *fCompPos; //Position of fBufCur when message was compressed
Bool_t fEvolution; //True if support for schema evolution required
static Bool_t fgEvolution; //True if support for schema evolution required
static Bool_t fgEvolution; //True if global support for schema evolution required
// TMessage objects cannot be copied or assigned // TMessage objects cannot be copied or assigned
TMessage(const TMessage &); // not implemented TMessage(const TMessage &); // not implemented
void operator=(const TMessage &); // not implemented void operator=(const TMessage &); // not implemented
...@@ -66,17 +67,17 @@ public: ...@@ -66,17 +67,17 @@ public:
TMessage(UInt_t what = kMESS_ANY); TMessage(UInt_t what = kMESS_ANY);
virtual ~TMessage(); virtual ~TMessage();
static void EnableSchemaEvolution(Bool_t enable=kTRUE);
void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force); void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force);
void Forward(); void Forward();
TClass *GetClass() const { return fClass;} TClass *GetClass() const { return fClass;}
void IncrementLevel(TVirtualStreamerInfo* info); void IncrementLevel(TVirtualStreamerInfo* info);
void Reset(); void Reset();
void Reset(UInt_t what) { SetWhat(what); Reset(); } void Reset(UInt_t what) { SetWhat(what); Reset(); }
UInt_t What() const { return fWhat; } UInt_t What() const { return fWhat; }
void SetWhat(UInt_t what); void SetWhat(UInt_t what);
void EnableSchemaEvolution(Bool_t enable = kTRUE) { fEvolution = enable; }
Bool_t UsesSchemaEvolution() const { return fEvolution; }
void SetCompressionLevel(Int_t level = 1); void SetCompressionLevel(Int_t level = 1);
Int_t GetCompressionLevel() const { return fCompress; } Int_t GetCompressionLevel() const { return fCompress; }
Int_t Compress(); Int_t Compress();
...@@ -87,6 +88,9 @@ public: ...@@ -87,6 +88,9 @@ public:
void WriteObject(const TObject *obj); void WriteObject(const TObject *obj);
UShort_t WriteProcessID(TProcessID *pid); UShort_t WriteProcessID(TProcessID *pid);
static void EnableSchemaEvolutionForAll(Bool_t enable = kTRUE);
static Bool_t UsesSchemaEvolutionForAll();
ClassDef(TMessage,0) // Message buffer class ClassDef(TMessage,0) // Message buffer class
}; };
......
...@@ -60,7 +60,7 @@ TMessage::TMessage(UInt_t what) : TBufferFile(TBuffer::kWrite) ...@@ -60,7 +60,7 @@ TMessage::TMessage(UInt_t what) : TBufferFile(TBuffer::kWrite)
fBufCompCur = 0; fBufCompCur = 0;
fCompPos = 0; fCompPos = 0;
fInfos = 0; fInfos = 0;
fEvolution = kFALSE;
} }
//______________________________________________________________________________ //______________________________________________________________________________
...@@ -79,6 +79,7 @@ TMessage::TMessage(void *buf, Int_t bufsize) : TBufferFile(TBuffer::kRead, bufsi ...@@ -79,6 +79,7 @@ TMessage::TMessage(void *buf, Int_t bufsize) : TBufferFile(TBuffer::kRead, bufsi
fBufCompCur = 0; fBufCompCur = 0;
fCompPos = 0; fCompPos = 0;
fInfos = 0; fInfos = 0;
fEvolution = kFALSE;
if (fWhat & kMESS_ZIP) { if (fWhat & kMESS_ZIP) {
// if buffer has kMESS_ZIP set, move it to fBufComp and uncompress // if buffer has kMESS_ZIP set, move it to fBufComp and uncompress
...@@ -108,19 +109,27 @@ TMessage::~TMessage() ...@@ -108,19 +109,27 @@ TMessage::~TMessage()
} }
//______________________________________________________________________________ //______________________________________________________________________________
void TMessage::EnableSchemaEvolution(Bool_t enable) void TMessage::EnableSchemaEvolutionForAll(Bool_t enable)
{ {
//static function enabling or disabling the automatic schema evolution // Static function enabling or disabling the automatic schema evolution.
//by default schema evolution support is off // By default schema evolution support is off.
fgEvolution = enable; fgEvolution = enable;
} }
//______________________________________________________________________________
Bool_t TMessage::UsesSchemaEvolutionForAll()
{
// Static function returning status of global schema evolution.
return fgEvolution;
}
//______________________________________________________________________________ //______________________________________________________________________________
void TMessage::ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t /* force */) void TMessage::ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t /* force */)
{ {
// force writing the TStreamerInfo to the message // force writing the TStreamerInfo to the message
if (fgEvolution) fInfos->Add(info); if (fgEvolution) fInfos->Add(info);
} }
...@@ -146,7 +155,7 @@ void TMessage::IncrementLevel(TVirtualStreamerInfo* info) ...@@ -146,7 +155,7 @@ void TMessage::IncrementLevel(TVirtualStreamerInfo* info)
// Increment level. // Increment level.
TBufferFile::IncrementLevel(info); TBufferFile::IncrementLevel(info);
if (fgEvolution) fInfos->Add(info); if (fgEvolution) fInfos->Add(info);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment