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
bd88fc2c
Commit
bd88fc2c
authored
7 years ago
by
Philippe Canal
Browse files
Options
Downloads
Patches
Plain Diff
Introduce TKey::ReadObject<typeName>. This is a user friendly wrapper around ReadObjectAny.
parent
1f36a37c
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
README/ReleaseNotes/v612/index.md
+8
-3
8 additions, 3 deletions
README/ReleaseNotes/v612/index.md
io/io/inc/TKey.h
+7
-1
7 additions, 1 deletion
io/io/inc/TKey.h
with
15 additions
and
4 deletions
README/ReleaseNotes/v612/index.md
+
8
−
3
View file @
bd88fc2c
...
...
@@ -65,6 +65,14 @@ In extremely rare cases, this change breaks a valid use where the temporary `TSt
object before the destruction of the temporary:
`TString str = objStr->GetString().ReplaceAll("a", "b");`
. In these rare cases,
please use the new function
`CopyString()`
which clearly indicates that it involves a temporary.
## I/O Libraries
-
Introduce TKey::ReadObject
<typeName>
. This is a user friendly wrapper around ReadObjectAny. For example
```
{.cpp}
auto h1 = key->ReadObject<TH1>
```
after which h1 will either be null if the key contains something that is not a TH1 (or derived class)
or will be set to the address of the histogram read from the file.
## Histogram Libraries
...
...
@@ -94,9 +102,6 @@ please use the new function `CopyString()` which clearly indicates that it invol
## Geometry Libraries
## I/O Libraries
## Database Libraries
...
...
This diff is collapsed.
Click to expand it.
io/io/inc/TKey.h
+
7
−
1
View file @
bd88fc2c
...
...
@@ -15,8 +15,8 @@
#include
"TNamed.h"
#include
"TDatime.h"
#include
"TBuffer.h"
#include
"TClass.h"
class
TClass
;
class
TBrowser
;
class
TDirectory
;
class
TFile
;
...
...
@@ -93,6 +93,12 @@ protected:
virtual
Int_t
Read
(
TObject
*
obj
);
virtual
TObject
*
ReadObj
();
virtual
TObject
*
ReadObjWithBuffer
(
char
*
bufferRead
);
/// To read an object (non deriving from TObject) from the file.
/// This is more user friendly version of TKey::ReadObjectAny.
/// See TKey::ReadObjectAny for more details.
template
<
typename
T
>
T
*
ReadObject
()
{
return
reinterpret_cast
<
T
*>
(
ReadObjectAny
(
TClass
::
GetClass
(
typeid
(
T
))));
}
virtual
void
*
ReadObjectAny
(
const
TClass
*
expectedClass
);
virtual
void
ReadBuffer
(
char
*&
buffer
);
void
ReadKeyBuffer
(
char
*&
buffer
);
...
...
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