Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
d8a9d7ac
Commit
d8a9d7ac
authored
10 years ago
by
Axel Naumann
Browse files
Options
Downloads
Patches
Plain Diff
Cache the TypeName as index/length into fTrueName; use fTrueName for kOther_t.
parent
28231d3d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/meta/inc/TDataType.h
+6
-5
6 additions, 5 deletions
core/meta/inc/TDataType.h
core/meta/src/TDataType.cxx
+27
-9
27 additions, 9 deletions
core/meta/src/TDataType.cxx
with
33 additions
and
14 deletions
core/meta/inc/TDataType.h
+
6
−
5
View file @
d8a9d7ac
...
...
@@ -45,11 +45,13 @@ enum EDataType {
class
TDataType
:
public
TDictionary
{
private:
TypedefInfo_t
*
fInfo
;
//pointer to CINT typedef info
TypedefInfo_t
*
fInfo
;
//
!
pointer to CINT typedef info
Int_t
fSize
;
//size of type
EDataType
fType
;
//type id
Long_t
fProperty
;
//The property information for the (potential) underlying class
TString
fTrueName
;
//True name of the (potential) underlying class
TString
fTrueName
;
//Qualified name of the (potential) underlying class, e.g. "MyClass*const*"
Int_t
fTypeNameIdx
;
//Start of class name part of the (potential) underlying class in fTrueName
Int_t
fTypeNameLen
;
//Strlen of class name part of the (potential) underlying class in fTrueName
static
TDataType
*
fgBuiltins
[
kNumDataTypes
];
//Array of builtins
void
CheckInfo
();
...
...
@@ -65,7 +67,7 @@ public:
virtual
~
TDataType
();
Int_t
Size
()
const
;
Int_t
GetType
()
const
{
return
(
Int_t
)
fType
;
}
const
char
*
GetTypeName
()
const
;
TString
GetTypeName
();
const
char
*
GetFullTypeName
()
const
;
const
char
*
AsString
(
void
*
buf
)
const
;
Long_t
Property
()
const
;
...
...
@@ -75,8 +77,7 @@ public:
static
EDataType
GetType
(
const
type_info
&
typeinfo
);
static
void
AddBuiltins
(
TCollection
*
types
);
ClassDef
(
TDataType
,
0
)
//Basic data type descriptor
ClassDef
(
TDataType
,
2
)
//Basic data type descriptor
};
#endif
This diff is collapsed.
Click to expand it.
core/meta/src/TDataType.cxx
+
27
−
9
View file @
d8a9d7ac
...
...
@@ -30,7 +30,8 @@ ClassImp(TDataType)
TDataType
*
TDataType
::
fgBuiltins
[
kNumDataTypes
]
=
{
0
};
//______________________________________________________________________________
TDataType
::
TDataType
(
TypedefInfo_t
*
info
)
:
TDictionary
()
TDataType
::
TDataType
(
TypedefInfo_t
*
info
)
:
TDictionary
(),
fTypeNameIdx
(
-
1
),
fTypeNameLen
(
0
)
{
// Default TDataType ctor. TDataTypes are constructed in TROOT via
// a call to TCling::UpdateListOfTypes().
...
...
@@ -52,7 +53,8 @@ TDataType::TDataType(TypedefInfo_t *info) : TDictionary()
}
//______________________________________________________________________________
TDataType
::
TDataType
(
const
char
*
typenam
)
:
fInfo
(
0
),
fProperty
(
kIsFundamental
)
TDataType
::
TDataType
(
const
char
*
typenam
)
:
fInfo
(
0
),
fProperty
(
kIsFundamental
),
fTypeNameIdx
(
-
1
),
fTypeNameLen
(
0
)
{
// Constructor for basic data types, like "char", "unsigned char", etc.
...
...
@@ -70,8 +72,9 @@ TDataType::TDataType(const TDataType& dt) :
fSize
(
dt
.
fSize
),
fType
(
dt
.
fType
),
fProperty
(
dt
.
fProperty
),
fTrueName
(
dt
.
fTrueName
)
{
fTrueName
(
dt
.
fTrueName
),
fTypeNameIdx
(
dt
.
fTypeNameIdx
),
fTypeNameLen
(
dt
.
fTypeNameLen
)
{
//copy constructor
}
...
...
@@ -87,7 +90,9 @@ TDataType& TDataType::operator=(const TDataType& dt)
fType
=
dt
.
fType
;
fProperty
=
dt
.
fProperty
;
fTrueName
=
dt
.
fTrueName
;
}
fTypeNameIdx
=
dt
.
fTypeNameIdx
;
fTypeNameLen
=
dt
.
fTypeNameLen
;
}
return
*
this
;
}
...
...
@@ -134,16 +139,28 @@ const char *TDataType::GetTypeName(EDataType type)
}
//______________________________________________________________________________
const
char
*
TDataType
::
GetTypeName
()
const
TString
TDataType
::
GetTypeName
()
{
// Get basic type of typedef, e,g.: "class TDirectory*" -> "TDirectory".
// Result needs to be used or copied immediately.
if
(
fTypeNameLen
)
{
return
fTrueName
(
fTypeNameIdx
,
fTypeNameLen
);
}
if
(
fInfo
)
{
(
const_cast
<
TDataType
*>
(
this
))
->
CheckInfo
();
return
gInterpreter
->
TypeName
(
fTrueName
.
Data
());
TString
typeName
=
gInterpreter
->
TypeName
(
fTrueName
.
Data
());
fTypeNameIdx
=
fTrueName
.
Index
(
typeName
);
if
(
fTypeNameIdx
==
-
1
)
{
Error
(
"GetTypeName"
,
"Cannot find type name %s in true name %s!"
,
typeName
.
Data
(),
fTrueName
.
Data
());
return
fName
;
}
fTypeNameLen
=
typeName
.
Length
();
return
fTrueName
(
fTypeNameIdx
,
fTypeNameLen
);
}
else
{
return
fName
.
Data
();
if
(
fType
!=
kOther_t
)
return
fName
.
Data
();
return
fTrueName
;
}
}
...
...
@@ -156,7 +173,8 @@ const char *TDataType::GetFullTypeName() const
(
const_cast
<
TDataType
*>
(
this
))
->
CheckInfo
();
return
fTrueName
;
}
else
{
return
fName
.
Data
();
if
(
fType
!=
kOther_t
)
return
fName
;
return
fTrueName
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment