diff --git a/base/src/TBuffer.cxx b/base/src/TBuffer.cxx index b6539d855d2fc88f051b0d6db9e09e314ab48920..9dd5f883635745dafe56afd32ef0b707f035580f 100644 --- a/base/src/TBuffer.cxx +++ b/base/src/TBuffer.cxx @@ -1,4 +1,4 @@ -// @(#)root/base:$Name: $:$Id: TBuffer.cxx,v 1.52 2003/05/08 17:20:41 rdm Exp $ +// @(#)root/base:$Name: $:$Id: TBuffer.cxx,v 1.53 2003/06/11 16:57:45 brun Exp $ // Author: Fons Rademakers 04/05/96 /************************************************************************* @@ -1790,7 +1790,7 @@ void TBuffer::WriteObject(const void *actualObjectStart, TClass *actualClass) // A warning to let the user know it will need to change the class code // to be able to read this back. - if (actualClass->GetNew() == 0) { + if (actualClass->HasDefaultConstructor() == 0) { Warning("WriteObjectAny", "since %s had no public constructor\n" "\twhich can be called without argument, objects of this class\n" "\tcan not be read with the current library. You would need to\n" diff --git a/base/src/TKey.cxx b/base/src/TKey.cxx index 5f5c4a205704cbd6c676d46f8c86e32945f47072..f7b9404d74deb12481906eef6132ed5887fb4b78 100644 --- a/base/src/TKey.cxx +++ b/base/src/TKey.cxx @@ -1,4 +1,4 @@ -// @(#)root/base:$Name: $:$Id: TKey.cxx,v 1.31 2003/02/26 10:11:51 brun Exp $ +// @(#)root/base:$Name: $:$Id: TKey.cxx,v 1.32 2003/04/28 16:28:22 brun Exp $ // Author: Rene Brun 28/12/94 /************************************************************************* @@ -142,7 +142,7 @@ TKey::TKey(TObject *obj, const char *name, Int_t bufsize) //*-*-*-*-*-*-*-*-*-*Create a TKey object and fill output buffer*-*-*-*-*-*-* //*-* =========================================== - if (!obj->IsA()->GetNew()) { + if (!obj->IsA()->HasDefaultConstructor()) { Warning("TKey", "since %s had no public constructor\n" "\twhich can be called without argument, objects of this class\n" "\tcan not be read with the current library. You would need to\n" diff --git a/io/src/TKey.cxx b/io/src/TKey.cxx index 5f5c4a205704cbd6c676d46f8c86e32945f47072..f7b9404d74deb12481906eef6132ed5887fb4b78 100644 --- a/io/src/TKey.cxx +++ b/io/src/TKey.cxx @@ -1,4 +1,4 @@ -// @(#)root/base:$Name: $:$Id: TKey.cxx,v 1.31 2003/02/26 10:11:51 brun Exp $ +// @(#)root/base:$Name: $:$Id: TKey.cxx,v 1.32 2003/04/28 16:28:22 brun Exp $ // Author: Rene Brun 28/12/94 /************************************************************************* @@ -142,7 +142,7 @@ TKey::TKey(TObject *obj, const char *name, Int_t bufsize) //*-*-*-*-*-*-*-*-*-*Create a TKey object and fill output buffer*-*-*-*-*-*-* //*-* =========================================== - if (!obj->IsA()->GetNew()) { + if (!obj->IsA()->HasDefaultConstructor()) { Warning("TKey", "since %s had no public constructor\n" "\twhich can be called without argument, objects of this class\n" "\tcan not be read with the current library. You would need to\n" diff --git a/meta/inc/TClass.h b/meta/inc/TClass.h index 02a8f03d21a77743f77dec8223aee0eebf2072bd..d275cfc447a2b95f0b148dd645270f410e15c36f 100644 --- a/meta/inc/TClass.h +++ b/meta/inc/TClass.h @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TClass.h,v 1.31 2002/12/05 10:01:50 brun Exp $ +// @(#)root/meta:$Name: $:$Id: TClass.h,v 1.32 2003/02/28 20:26:51 brun Exp $ // Author: Rene Brun 07/01/95 /************************************************************************* @@ -120,6 +120,7 @@ public: void Destructor(void *obj, Bool_t dtorOnly = kFALSE); void *DynamicCast(const TClass *base, void *obj, Bool_t up = kTRUE); char *EscapeChars(char * text) const; + Bool_t HasDefaultConstructor() const; UInt_t GetCheckSum(UInt_t code=0) const; Version_t GetClassVersion() const { ((TClass*)this)->fVersionUsed = kTRUE; return fClassVersion; } TDataMember *GetDataMember(const char *datamember) const; diff --git a/meta/src/TClass.cxx b/meta/src/TClass.cxx index d29f1346d2075d7c643ca9e61685e99f1e310e50..cf6701516ffd2aceaacb1cc79ceaa6a0bbeb83db 100644 --- a/meta/src/TClass.cxx +++ b/meta/src/TClass.cxx @@ -1,4 +1,4 @@ -// @(#)root/meta:$Name: $:$Id: TClass.cxx,v 1.118 2003/06/21 06:07:46 brun Exp $ +// @(#)root/meta:$Name: $:$Id: TClass.cxx,v 1.119 2003/06/23 15:19:15 brun Exp $ // Author: Rene Brun 07/01/95 /************************************************************************* @@ -2213,9 +2213,28 @@ void TClass::SetDestructor(ROOT::DesFunc_t destructorFunc) fDestructor = destructorFunc; } +//______________________________________________________________________________ +Bool_t TClass::HasDefaultConstructor() const +{ + // Return true if we have access to a default construstor + + if (fNew) return true; + + if (!GetClassInfo()) return false; + + // Insure the existence of G__struct.rootspecial[GetClassInfo()->Tagnum()] + if (GetClassInfo()->Version()) {}; + Assert(G__struct.rootspecial[GetClassInfo()->Tagnum()]!=0); + + if (G__struct.rootspecial[GetClassInfo()->Tagnum()]->defaultconstructor!=0) + return true; + + return false; +} + //______________________________________________________________________________ ROOT::NewFunc_t TClass::GetNew() const -{ +{ return fNew; }