-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test a user-defined implementation of the ROOT read rules
- Loading branch information
Showing
2 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// required by <RtypesImp.h> | ||
#define G__DICTIONARY | ||
|
||
#include <Rtypes.h> | ||
#include <RtypesImp.h> | ||
#include <TGenericClassInfo.h> | ||
#include <TVirtualObject.h> | ||
|
||
#include "classes.h" | ||
|
||
namespace ROOT { | ||
|
||
// forward declaration | ||
TGenericClassInfo *GenerateInitInstance(portabletest::TestHostCollection const *); | ||
|
||
} // namespace ROOT | ||
|
||
// read function for portabletest::TestHostCollection | ||
// called for every event | ||
static void setROOTReadStreamerFor_portabletest_TestHostCollection(char *target, TVirtualObject *oldObj) { | ||
// address in memory of the buffer containing the object being read from file | ||
char *onfile_address = (char *)oldObj->GetObject(); | ||
// offset of the "layout_" data member | ||
static ptrdiff_t onfile_offset = oldObj->GetClass()->GetDataMemberOffset("layout_"); | ||
// reference to the Layout object being read from file | ||
portabletest::TestHostCollection::Layout &onfile( | ||
*(portabletest::TestHostCollection::Layout *)(onfile_address + onfile_offset)); | ||
// pointer to the portabletest::TestHostCollection object being constructed in memory | ||
portabletest::TestHostCollection *newObj = (portabletest::TestHostCollection *)target; | ||
|
||
portabletest::TestHostCollection::ROOTReadStreamer(newObj, onfile); | ||
} | ||
|
||
// set the read function for portabletest::TestHostCollection | ||
// called when the dictionary is loaded | ||
static bool set_portabletest_TestHostCollection_ReadRules() { | ||
// build the read rules | ||
std::vector<::ROOT::Internal::TSchemaHelper> readrules(1); | ||
::ROOT::Internal::TSchemaHelper *rule = &readrules[0]; | ||
rule->fSourceClass = "portabletest::TestHostCollection"; | ||
rule->fSource = "portabletest::TestHostCollection::Layout layout_;"; | ||
rule->fFunctionPtr = (void *)TFunc2void(setROOTReadStreamerFor_portabletest_TestHostCollection); | ||
rule->fTarget = "buffer_,layout_,view_"; | ||
rule->fCode = ""; | ||
rule->fVersion = "[1-]"; | ||
rule->fEmbed = false; | ||
|
||
// set the read rules | ||
::ROOT::GenerateInitInstance((portabletest::TestHostCollection const *)nullptr)->SetReadRules(readrules); | ||
|
||
return true; | ||
} | ||
|
||
static const bool has_the_portabletest_TestHostCollection_ReadRules_been_set = | ||
set_portabletest_TestHostCollection_ReadRules(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters