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)
 

Functions

template<typename T >
static void readPortableHostCollection_v1 (char *target, TVirtualObject *from_buffer)
 
template<typename T >
static bool ROOT::set_PortableHostCollection_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 72 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