Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop and test enum #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
90c9156
TEnum and TEnumConstant linked
CristinaCristescu Jul 12, 2013
d5a27ee
TEnum and TEnumConstant linked
CristinaCristescu Jul 12, 2013
9d2dab8
Integrate TEnum and TEnumConstant with TCling.
CristinaCristescu Jul 12, 2013
fbe1e7c
Fix enums and test TCling with enums.
CristinaCristescu Jul 16, 2013
2270680
New interface to TEnum and update in TClass and TCling
CristinaCristescu Aug 5, 2013
faae06a
Fix enum decls by pushing manually the transation.
CristinaCristescu Aug 8, 2013
091bb94
Finally: enable the asserts that assure very conservative integrity c…
vgvassilev Aug 8, 2013
ae65cac
Add another expected to pass construct for null deref.
vgvassilev Aug 8, 2013
cd0762c
Loosen the asserts due to not well-enough-understood behavior in clan…
vgvassilev Aug 8, 2013
659caed
Allow to change text of context menu items even when they are of type…
bellenot Aug 8, 2013
9d31735
Fix a problem on Windows with TContextMenu::Execute() parameters
bellenot Aug 8, 2013
b44a177
Only if I could spell C++ :)
vgvassilev Aug 8, 2013
baa7b98
Instead of check each load and store instruction, we check the usage …
sploving Aug 8, 2013
24a1203
In CLINGCXXFLAGS, put the source include dir first.
pcanal Aug 8, 2013
4326f21
Not using real SourceLocation is bad, especially in -verify mode.
vgvassilev Aug 8, 2013
956b885
Add support for per-packet max proc time
gganis Aug 7, 2013
641a1fa
Fine-tune previous patch
gganis Aug 8, 2013
cc511bf
Remove unused variable.
vgvassilev Aug 9, 2013
e653ef6
Replaced tabs with spaces in testcode
strykejern Aug 8, 2013
448e120
Replaced tabs with spaces in custom classes for tests
strykejern Aug 8, 2013
6c5b206
Added comment for one array reader interface
strykejern Aug 8, 2013
132b855
Remove a couple of gotos
bellenot Aug 9, 2013
504c91e
Remove forgotten label
bellenot Aug 9, 2013
f0473ba
Remove one more goto
bellenot Aug 9, 2013
ce8dee2
Reverting wrong changes to TTreePlayer
strykejern Aug 9, 2013
3a59f4d
Refactoring interface for incrementing the entry pointer
strykejern Aug 9, 2013
1ec1a2e
Fix unchecked NULL return in HandleEnumDecl.
CristinaCristescu Aug 12, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build/unix/gminimalHeaders.list
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ include/TEntryList.h
include/TEntryListArray.h
include/TEntryListBlock.h
include/TEntryListFromFile.h
include/TEnum.h
include/TEnumConstant.h
include/TEnv.h
include/TError.h
include/TEventIter.h
Expand Down
2 changes: 2 additions & 0 deletions core/base/inc/TROOT.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ friend TROOT *ROOT::GetROOT2();
TSeqCollection *fProofs; //List of proof sessions
TSeqCollection *fClipboard; //List of clipbard objects
TSeqCollection *fDataSets; //List of data sets (TDSet or TChain)
TCollection *fEnums; //List of enum types
TProcessUUID *fUUIDs; //Pointer to TProcessID managing TUUIDs
TFolder *fRootFolder; //top level folder //root
TList *fBrowsables; //List of browsables
Expand Down Expand Up @@ -212,6 +213,7 @@ friend TROOT *ROOT::GetROOT2();
TSeqCollection *GetListOfProofs() const { return fProofs; }
TSeqCollection *GetClipboard() const { return fClipboard; }
TSeqCollection *GetListOfDataSets() const { return fDataSets; }
TCollection *GetListOfEnums() const { return fEnums; }
TList *GetListOfBrowsables() const { return fBrowsables; }
TDataType *GetType(const char *name, Bool_t load = kFALSE) const;
TFile *GetFile() const { if (gDirectory != this) return gDirectory->GetFile(); else return 0;}
Expand Down
7 changes: 4 additions & 3 deletions core/base/src/TContextMenu.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void TContextMenu::Action(TClassMenuItem *menuitem)
#else
// It is a workaround of the "Dead lock under Windows
char *cmd = Form("((TContextMenu *)0x%lx)->Execute((TObject *)0x%lx,"
"(TMethod *)0x%lx,(TObjArray *)0);",
"(TMethod *)0x%lx,\"\");",
(Long_t)this,(Long_t)object,(Long_t)method);
//Printf("%s", cmd);
gROOT->ProcessLine(cmd);
Expand All @@ -171,8 +171,9 @@ void TContextMenu::Action(TClassMenuItem *menuitem)
#else
// It is a workaround of the "Dead lock under Windows
char *cmd = Form("((TContextMenu *)0x%lx)->Execute((TObject *)0x%lx,"
"(TMethod *)0x%lx,(TObjArray *)0);",
(Long_t)this,(Long_t)object,(Long_t)method);
"(TMethod *)0x%lx,(TObject*)0x%lx);",
(Long_t)this,(Long_t)object,(Long_t)method,
(Long_t)fSelectedObject);
//Printf("%s", cmd);
gROOT->ProcessLine(cmd);
//Execute( object, method, (TObjArray *)NULL );
Expand Down
3 changes: 3 additions & 0 deletions core/base/src/TROOT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
// Initialize interface to CINT C++ interpreter
fVersionInt = 0; // check in TROOT dtor in case TCling fails
fClasses = 0; // might be checked via TCling ctor
fEnums = 0;

fConfigOptions = R__CONFIGUREOPTIONS;
fConfigFeatures = R__CONFIGUREFEATURES;
Expand All @@ -416,6 +417,7 @@ TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
//fIdMap = new IdMap_t;
fStreamerInfo = new TObjArray(100);
fClassGenerators = new TList;
fEnums = new THashTable(200, 3); // FIXME: should be 1.2 * number of ROOT global enums at startup

// initialize plugin manager early
fPluginManager->LoadHandlersFromEnv(gEnv);
Expand Down Expand Up @@ -630,6 +632,7 @@ TROOT::~TROOT()
SafeDelete(fGlobals);
if (fGlobalFunctions) fGlobalFunctions->Delete();
SafeDelete(fGlobalFunctions);
fEnums->Delete();
fClasses->Delete(); SafeDelete(fClasses); // TClass'es must be deleted last
#endif

Expand Down
2 changes: 2 additions & 0 deletions core/meta/inc/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#pragma link C++ class TDataMember;
#pragma link C++ class TDataType;
#pragma link C++ class TDictionary;
#pragma link C++ class TEnumConstant+;
#pragma link C++ class TEnum+;
#pragma link C++ class TFunction;
#pragma link C++ class ROOT::TSchemaMatch+;
#pragma link C++ class ROOT::TSchemaRule+;
Expand Down
2 changes: 2 additions & 0 deletions core/meta/inc/TClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ friend class ROOT::TGenericClassInfo;
TList *fRealData; //linked list for persistent members including base classes
TList *fBase; //linked list for base classes
TList *fData; //linked list for data members
TList *fEnums; //linked list for the enums
TList *fMethod; //linked list for methods
TList *fAllPubData; //all public data members (including from base classes)
TList *fAllPubMethod; //all public methods (including from base classes)
Expand Down Expand Up @@ -267,6 +268,7 @@ friend class ROOT::TGenericClassInfo;
else return (fCurrentInfo=(TVirtualStreamerInfo*)(fStreamerInfo->At(fClassVersion)));
}
TList *GetListOfDataMembers();
TList *GetListOfEnums();
TList *GetListOfBases();
TList *GetListOfMethods();
TList *GetListOfRealData() const { return fRealData; }
Expand Down
56 changes: 56 additions & 0 deletions core/meta/inc/TEnum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// @(#)root/meta:$Id$
// Author: Bianca-Cristina Cristescu 09/07/13

/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT_TEnum
#define ROOT_TEnum

//////////////////////////////////////////////////////////////////////////
// //
// TEnum //
// //
// TEnum class defines enum type. //
// //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_THashList
#include "THashList.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

class TEnumConstant;

class TEnum : public TNamed {

private:
THashList fConstantList; //list of constants the enum type
void* fInfo; //interpreter implementation provided declaration

public:

TEnum(): fInfo(0) {}
TEnum(const char* name, bool isGlobal, void* info);
virtual ~TEnum();

void AddConstant(TEnumConstant* constant);
const TSeqCollection* GetConstants() const { return &fConstantList; }
const TEnumConstant* GetConstant(const char* name) const {
return (TEnumConstant*) fConstantList.FindObject(name);
}

ClassDef(TEnum,1) //Enum type class
};

#endif
46 changes: 46 additions & 0 deletions core/meta/inc/TEnumConstant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// @(#)root/meta:$Id$
// Author: Bianca-Cristina Cristescu 09/07/13

/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT_TEnumConstant
#define ROOT_TEnumConstant


//////////////////////////////////////////////////////////////////////////
// //
// TEnumConstant //
// //
// TEnumConstant class defines a constant in the TEnum type. //
// //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGlobal
#include "TGlobal.h"
#endif

class TEnum;

class TEnumConstant : public TGlobal {
private:
const TEnum *fEnum; //the enum type
Long64_t fValue; //the value for the constant

public:
TEnumConstant(): fEnum(0), fValue(-1) {}
TEnumConstant(DataMemberInfo_t *info, const char* name, Long64_t value, TEnum* type);
virtual ~TEnumConstant();

Long64_t GetValue() const { return fValue; }
const TEnum *GetType() const { return fEnum; }

ClassDef(TEnumConstant,1) //Enum type constant
};

#endif
1 change: 1 addition & 0 deletions core/meta/inc/TInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class TInterpreter : public TNamed {
virtual Bool_t CheckClassTemplate(const char *name) = 0;
virtual Long_t Calc(const char *line, EErrorCode* error = 0) = 0;
virtual void CreateListOfBaseClasses(TClass *cl) const = 0;
virtual void CreateListOfEnums(TClass *cl) const = 0;
virtual void CreateListOfDataMembers(TClass *cl) const = 0;
virtual void CreateListOfMethods(TClass *cl) const = 0;
virtual void CreateListOfMethodArgs(TFunction *m) const = 0;
Expand Down
37 changes: 33 additions & 4 deletions core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ ClassImp(TClass)
TClass::TClass() :
TDictionary(),
fStreamerInfo(0), fConversionStreamerInfo(0), fRealData(0),
fBase(0), fData(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fBase(0), fData(0), fEnums(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fClassMenuList(0),
fDeclFileName(""), fImplFileName(""), fDeclFileLine(0), fImplFileLine(0),
fInstanceCount(0), fOnHeap(0),
Expand All @@ -797,7 +797,7 @@ TClass::TClass() :
TClass::TClass(const char *name, Bool_t silent) :
TDictionary(name),
fStreamerInfo(0), fConversionStreamerInfo(0), fRealData(0),
fBase(0), fData(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fBase(0), fData(0), fEnums(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fClassMenuList(0),
fDeclFileName(""), fImplFileName(""), fDeclFileLine(0), fImplFileLine(0),
fInstanceCount(0), fOnHeap(0),
Expand Down Expand Up @@ -846,7 +846,7 @@ TClass::TClass(const char *name, Version_t cversion,
const char *dfil, const char *ifil, Int_t dl, Int_t il, Bool_t silent) :
TDictionary(name),
fStreamerInfo(0), fConversionStreamerInfo(0), fRealData(0),
fBase(0), fData(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fBase(0), fData(0), fEnums(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fClassMenuList(0),
fDeclFileName(""), fImplFileName(""), fDeclFileLine(0), fImplFileLine(0),
fInstanceCount(0), fOnHeap(0),
Expand Down Expand Up @@ -875,7 +875,7 @@ TClass::TClass(const char *name, Version_t cversion,
Bool_t silent) :
TDictionary(name),
fStreamerInfo(0), fConversionStreamerInfo(0), fRealData(0),
fBase(0), fData(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fBase(0), fData(0), fEnums(0), fMethod(0), fAllPubData(0), fAllPubMethod(0),
fClassMenuList(0),
fDeclFileName(""), fImplFileName(""), fDeclFileLine(0), fImplFileLine(0),
fInstanceCount(0), fOnHeap(0),
Expand Down Expand Up @@ -1129,6 +1129,7 @@ TClass::TClass(const TClass& cl) :
fRealData(cl.fRealData),
fBase(cl.fBase),
fData(cl.fData),
fEnums(cl.fEnums),
fMethod(cl.fMethod),
fAllPubData(cl.fAllPubData),
fAllPubMethod(cl.fAllPubMethod),
Expand Down Expand Up @@ -1231,6 +1232,10 @@ TClass::~TClass()
fData->Delete();
delete fData; fData = 0;

if (fEnums)
fEnums->Delete();
delete fEnums; fEnums = 0;

if (fMethod)
fMethod->Delete();
delete fMethod; fMethod=0;
Expand Down Expand Up @@ -2983,6 +2988,26 @@ TList *TClass::GetListOfBases()
return fBase;
}

//______________________________________________________________________________
TList *TClass::GetListOfEnums()
{
// Return list containing the TEnums of a class.

R__LOCKGUARD(gClingMutex);
if (!fClassInfo) {
if (!fEnums) fEnums = new TList;
return fEnums;
}

if (!fEnums) {
if (!gInterpreter)
Fatal("GetListOfEnums", "gInterpreter not initialized");

gInterpreter->CreateListOfEnums(this);
}
return fEnums;
}

//______________________________________________________________________________
TList *TClass::GetListOfDataMembers()
{
Expand Down Expand Up @@ -3241,6 +3266,10 @@ void TClass::ResetCaches()
fData->Delete();
delete fData; fData = 0;

if (fEnums)
fEnums->Delete();
delete fEnums; fEnums = 0;

if (fMethod)
fMethod->Delete();
delete fMethod; fMethod=0;
Expand Down
Loading