CMS 3D CMS Logo

Namespaces | Macros | Functions
PortableHostCollectionReadRules.h File Reference
#include <TGenericClassInfo.h>
#include <TVirtualObject.h>
#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "FWCore/Utilities/interface/concatenate.h"
#include "FWCore/Utilities/interface/stringize.h"

Go to the source code of this file.

Namespaces

 ROOT
 

Macros

#define SET_PORTABLEHOSTCOLLECTION_READ_RULES(COLLECTION)
 
#define SET_PORTABLEHOSTMULTICOLLECTION_READ_RULES(COLLECTION)
 

Functions

template<typename T >
static void readPortableHostCollection_v1 (char *target, TVirtualObject *from_buffer)
 
template<typename T >
static void readPortableHostMultiCollection_v1 (char *target, TVirtualObject *from_buffer)
 
template<typename T >
static bool ROOT::set_PortableHostCollection_read_rules (std::string const &type)
 
template<typename T >
static bool ROOT::set_PortableHostMultiCollection_read_rules (std::string const &type)
 

Macro Definition Documentation

◆ SET_PORTABLEHOSTCOLLECTION_READ_RULES

#define SET_PORTABLEHOSTCOLLECTION_READ_RULES (   COLLECTION)
Value:
static bool EDM_CONCATENATE(set_PortableHostCollection_read_rules_done_at_, __LINE__) [[maybe_unused]] = \
ROOT::set_PortableHostCollection_read_rules<COLLECTION>(EDM_STRINGIZE(COLLECTION))
#define EDM_CONCATENATE(a, b)
Definition: concatenate.h:6
#define EDM_STRINGIZE(token)
Definition: stringize.h:6

Definition at line 129 of file PortableHostCollectionReadRules.h.

◆ SET_PORTABLEHOSTMULTICOLLECTION_READ_RULES

#define SET_PORTABLEHOSTMULTICOLLECTION_READ_RULES (   COLLECTION)
Value:
static bool EDM_CONCATENATE(set_PortableHostMultiCollection_read_rules_done_at_, __LINE__) [[maybe_unused]] = \
ROOT::set_PortableHostMultiCollection_read_rules<COLLECTION>(EDM_STRINGIZE(COLLECTION))
#define EDM_CONCATENATE(a, b)
Definition: concatenate.h:6
#define EDM_STRINGIZE(token)
Definition: stringize.h:6

Definition at line 133 of file PortableHostCollectionReadRules.h.

Function Documentation

◆ readPortableHostCollection_v1()

template<typename T >
static void readPortableHostCollection_v1 ( char *  target,
TVirtualObject *  from_buffer 
)
static

Definition at line 13 of file PortableHostCollectionReadRules.h.

References filterCSVwithJSON::target.

13  {
14  // extract the actual types
15  using Collection = T;
16  using Layout = typename Collection::Layout;
17 
18  // valid only for PortableHostCollection<T>
19  static_assert(std::is_same_v<Collection, PortableHostCollection<Layout>>);
20 
21  // proxy for the object being read from file
22  struct OnFile {
23  Layout &layout_;
24  };
25 
26  // address in memory of the buffer containing the object being read from file
27  char *address = static_cast<char *>(from_buffer->GetObject());
28  // offset of the "layout_" data member
29  static ptrdiff_t layout_offset = from_buffer->GetClass()->GetDataMemberOffset("layout_");
30  // reference to the Layout object being read from file
31  OnFile onfile = {*(Layout *)(address + layout_offset)};
32 
33  // pointer to the Collection object being constructed in memory
34  Collection *newObj = (Collection *)target;
35 
36  // move the data from the on-file layout to the newly constructed object
37  Collection::ROOTReadStreamer(newObj, onfile.layout_);
38 }
long double T

◆ readPortableHostMultiCollection_v1()

template<typename T >
static void readPortableHostMultiCollection_v1 ( char *  target,
TVirtualObject *  from_buffer 
)
static

Definition at line 42 of file PortableHostCollectionReadRules.h.

References filterCSVwithJSON::target.

42  {
43  // extract the actual types
44  using Collection = T;
45  using Implementation = typename Collection::Implementation;
46 
47  // valid only for PortableHostCollection<T>
48  //static_assert(std::is_same_v<Collection, PortableHostCollection<Layout>>);
49 
50  // proxy for the object being read from file
51  struct OnFile {
52  Implementation &impl_;
53  };
54 
55  // address in memory of the buffer containing the object being read from file
56  char *address = static_cast<char *>(from_buffer->GetObject());
57  // offset of the "layout_" data member
58  static ptrdiff_t impl_offset = from_buffer->GetClass()->GetDataMemberOffset("impl_");
59  // reference to the Layout object being read from file
60  OnFile onfile = {*(Implementation *)(address + impl_offset)};
61 
62  // pointer to the Collection object being constructed in memory
63  Collection *newObj = (Collection *)target;
64 
65  // move the data from the on-file layout to the newly constructed object
66  Collection::ROOTReadStreamer(newObj, onfile.impl_);
67 }
long double T