From 709f219c2e4ad6c8fdca6b22d7542086f1b02a56 Mon Sep 17 00:00:00 2001 From: Rene Brun <Rene.Brun@cern.ch> Date: Tue, 12 Sep 2000 15:18:55 +0000 Subject: [PATCH] TClass::New has now an optional argument (kTRUE by default). The value of the argument is stored in fgCallingNew and can be tested by the static function TClass::IsCallingNew git-svn-id: http://root.cern.ch/svn/root/trunk@633 27541ba8-7e3a-0410-8455-c3a389f83636 --- meta/inc/TClass.h | 6 +++--- meta/src/TClass.cxx | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/meta/inc/TClass.h b/meta/inc/TClass.h index df276d906c2..fff8fc9cd5c 100644 --- a/meta/inc/TClass.h +++ b/meta/inc/TClass.h @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TClass.h,v 1.3 2000/09/05 09:21:23 brun Exp $ +// @(#)root/meta:$Name: $:$Id: TClass.h,v 1.4 2000/09/12 06:42:06 brun Exp $ // Author: Rene Brun 07/01/95 /************************************************************************* @@ -115,14 +115,14 @@ public: Bool_t InheritsFrom(const char *cl) const; Bool_t InheritsFrom(const TClass *cl) const; Bool_t IsFolder() const {return kTRUE;} - void *New(); + void *New(Bool_t defConstructor = kTRUE); void Destructor(void *obj, Bool_t dtorOnly = kFALSE); void ResetInstanceCount() { fInstanceCount = fOnHeap = 0; } Int_t Size() const; void SetStreamerInfo(const char *info=""); Long_t Property() const; - static Bool_t IsCallingNew() {return fgCallingNew;} + static Bool_t IsCallingNew(); static TClass *Load(TBuffer &b); void Store(TBuffer &b) const; diff --git a/meta/src/TClass.cxx b/meta/src/TClass.cxx index 216fde14d17..e6f5af2327c 100644 --- a/meta/src/TClass.cxx +++ b/meta/src/TClass.cxx @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TClass.cxx,v 1.5 2000/09/08 16:05:22 rdm Exp $ +// @(#)root/meta:$Name: $:$Id: TClass.cxx,v 1.6 2000/09/12 06:42:07 brun Exp $ // Author: Rene Brun 07/01/95 /************************************************************************* @@ -784,14 +784,14 @@ void *TClass::DynamicCast(const TClass *cl, void *obj) } //______________________________________________________________________________ -void *TClass::New() +void *TClass::New(Bool_t defConstructor) { // Return a pointer to a newly allocated object of this class. // The class must have a default constructor. if (!fClassInfo) return 0; - fgCallingNew = kTRUE; + fgCallingNew = defConstructor; void *p = GetClassInfo()->New(); fgCallingNew = kFALSE; if (!p) Error("New", "no default ctor for class %s", GetName()); @@ -1122,3 +1122,13 @@ void TClass::PrintStreamerInfoList(TList *list) } } } + +//______________________________________________________________________________ +Bool_t TClass::IsCallingNew() +{ + //static function returning the CallingNew flag passed to TClass::New + //as argument. + //This function cannot be inline (problems with NT linker) + + return fgCallingNew; +} -- GitLab