CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Member Functions
cond::serialization::SerializationHelper< T, INIT > Class Template Reference

#include <SerializationHelper.h>

Inheritance diagram for cond::serialization::SerializationHelper< T, INIT >:
cond::serialization::SerializationHelperBase

Public Member Functions

unique_void_ptr deserialize (std::streambuf &iBuff, const std::string_view iClassName) const final
 
const SerializationHelperoperator= (const SerializationHelper &)=delete
 
 SerializationHelper ()=default
 
 SerializationHelper (const SerializationHelper &)=delete
 
std::string_view serialize (std::streambuf &oBuff, void const *iObj) const final
 
const std::type_info & type () const final
 
- Public Member Functions inherited from cond::serialization::SerializationHelperBase
const SerializationHelperBaseoperator= (const SerializationHelperBase &)=delete
 
 SerializationHelperBase ()=default
 
 SerializationHelperBase (const SerializationHelperBase &)=delete
 
virtual ~SerializationHelperBase ()=default
 

Static Private Member Functions

template<typename TYPELIST >
static unique_void_ptr deserialize_impl (std::streambuf &iBuff, const std::string_view iClassName)
 
template<typename TYPELIST >
static std::string_view serialize_impl (std::streambuf &oBuff, T const *iObj)
 

Detailed Description

template<typename T, typename INIT = NoInitializer>
class cond::serialization::SerializationHelper< T, INIT >

Definition at line 55 of file SerializationHelper.h.

Constructor & Destructor Documentation

◆ SerializationHelper() [1/2]

template<typename T , typename INIT = NoInitializer>
cond::serialization::SerializationHelper< T, INIT >::SerializationHelper ( )
default

◆ SerializationHelper() [2/2]

template<typename T , typename INIT = NoInitializer>
cond::serialization::SerializationHelper< T, INIT >::SerializationHelper ( const SerializationHelper< T, INIT > &  )
delete

Member Function Documentation

◆ deserialize()

template<typename T , typename INIT = NoInitializer>
unique_void_ptr cond::serialization::SerializationHelper< T, INIT >::deserialize ( std::streambuf &  iBuff,
const std::string_view  iClassName 
) const
inlinefinalvirtual

Implements cond::serialization::SerializationHelperBase.

Definition at line 64 of file SerializationHelper.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr().

64  {
66  using BaseClassAndInheriting =
68  return deserialize_impl<BaseClassAndInheriting>(iBuff, iClassName);
69  } else {
70  return deserialize_impl<typename BaseClassInfo<T>::inheriting_classes_t>(iBuff, iClassName);
71  }
72  }

◆ deserialize_impl()

template<typename T , typename INIT = NoInitializer>
template<typename TYPELIST >
static unique_void_ptr cond::serialization::SerializationHelper< T, INIT >::deserialize_impl ( std::streambuf &  iBuff,
const std::string_view  iClassName 
)
inlinestaticprivate

Definition at line 89 of file SerializationHelper.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), init, and createJobs::tmp.

89  {
91  return {};
92  } else {
93  using CheckType = typename edm::mpl::Pop<TYPELIST>::Item;
94  if (iClassName == ClassName<CheckType>::kName) {
95  std::unique_ptr<CheckType> tmp = makeClass<CheckType>();
96 
97  InputArchive ia(iBuff);
98  ia >> (*tmp);
99  if constexpr (not std::is_same_v<INIT, NoInitializer>) {
100  INIT init;
101  init(*tmp);
102  }
103  return unique_void_ptr(tmp.release(), [](const void* iPtr) { delete static_cast<const T*>(iPtr); });
104 
105  } else {
106  return deserialize_impl<typename edm::mpl::Pop<TYPELIST>::Remaining>(iBuff, iClassName);
107  }
108  }
109  }
int init
Definition: HydjetWrapper.h:66
eos::portable_iarchive InputArchive
Definition: Archive.h:17
tmp
align.sh
Definition: createJobs.py:716
long double T

◆ operator=()

template<typename T , typename INIT = NoInitializer>
const SerializationHelper& cond::serialization::SerializationHelper< T, INIT >::operator= ( const SerializationHelper< T, INIT > &  )
delete

◆ serialize()

template<typename T , typename INIT = NoInitializer>
std::string_view cond::serialization::SerializationHelper< T, INIT >::serialize ( std::streambuf &  oBuff,
void const *  iObj 
) const
inlinefinalvirtual

Implements cond::serialization::SerializationHelperBase.

Definition at line 74 of file SerializationHelper.h.

References runTheMatrix::const, and ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr().

74  {
75  auto iTypedObjectPtr = static_cast<T const*>(iObj);
77  return serialize_impl<typename BaseClassInfo<T>::inheriting_classes_t>(oBuff, iTypedObjectPtr);
78  } else {
79  using BaseClassAndInheriting =
81  return serialize_impl<BaseClassAndInheriting>(oBuff, iTypedObjectPtr);
82  }
83  }
long double T

◆ serialize_impl()

template<typename T , typename INIT = NoInitializer>
template<typename TYPELIST >
static std::string_view cond::serialization::SerializationHelper< T, INIT >::serialize_impl ( std::streambuf &  oBuff,
T const *  iObj 
)
inlinestaticprivate

Definition at line 111 of file SerializationHelper.h.

References runTheMatrix::const, and ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr().

111  {
113  return {};
114  } else {
115  if (typeid(*iObj) == typeid(typename edm::mpl::Pop<TYPELIST>::Item)) {
116  auto iTypedObjectPtr = dynamic_cast<typename edm::mpl::Pop<TYPELIST>::Item const*>(iObj);
117  OutputArchive oa(oBuff);
118  oa << *iTypedObjectPtr;
119 
121 
122  } else {
123  return serialize_impl<typename edm::mpl::Pop<TYPELIST>::Remaining>(oBuff, iObj);
124  }
125  }
126  }
eos::portable_oarchive OutputArchive
Definition: Archive.h:18

◆ type()

template<typename T , typename INIT = NoInitializer>
const std::type_info& cond::serialization::SerializationHelper< T, INIT >::type ( ) const
inlinefinalvirtual

Implements cond::serialization::SerializationHelperBase.

Definition at line 85 of file SerializationHelper.h.

85 { return typeid(T); }
long double T