NDDEM
Functions
cereal::polymorphic_detail Namespace Reference

Functions

template<class Archive >
typename ::cereal::detail::InputBindingMap< Archive >::Serializers getInputBinding (Archive &ar, std::uint32_t const nameid)
 Get an input binding from the given archive by deserializing the type meta data. More...
 
template<class Archive , class T >
std::enable_if<(traits::is_default_constructible< T >::value||traits::has_load_and_construct< T, Archive >::value) &&!std::is_abstract< T >::value, bool >::type serialize_wrapper (Archive &ar, std::shared_ptr< T > &ptr, std::uint32_t const nameid)
 Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee. More...
 
template<class Archive , class T , class D >
std::enable_if<(traits::is_default_constructible< T >::value||traits::has_load_and_construct< T, Archive >::value) &&!std::is_abstract< T >::value, bool >::type serialize_wrapper (Archive &ar, std::unique_ptr< T, D > &ptr, std::uint32_t const nameid)
 Serialize a unique_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee. More...
 
template<class Archive , class T >
std::enable_if<(!traits::is_default_constructible< T >::value &&!traits::has_load_and_construct< T, Archive >::value)||std::is_abstract< T >::value, bool >::type serialize_wrapper (Archive &, std::shared_ptr< T > &, std::uint32_t const nameid)
 Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee. More...
 
template<class Archive , class T , class D >
std::enable_if<(!traits::is_default_constructible< T >::value &&!traits::has_load_and_construct< T, Archive >::value)||std::is_abstract< T >::value, bool >::type serialize_wrapper (Archive &, std::unique_ptr< T, D > &, std::uint32_t const nameid)
 Serialize a unique_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee. More...
 

Function Documentation

◆ getInputBinding()

template<class Archive >
typename ::cereal::detail::InputBindingMap<Archive>::Serializers cereal::polymorphic_detail::getInputBinding ( Archive &  ar,
std::uint32_t const  nameid 
)
inline

Get an input binding from the given archive by deserializing the type meta data.

◆ serialize_wrapper() [1/4]

template<class Archive , class T >
std::enable_if<(!traits::is_default_constructible<T>::value && !traits::has_load_and_construct<T, Archive>::value) || std::is_abstract<T>::value, bool>::type cereal::polymorphic_detail::serialize_wrapper ( Archive &  ,
std::shared_ptr< T > &  ,
std::uint32_t const  nameid 
)
inline

Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee.

This case is for when we can't actually construct the shared pointer. Normally this would be caught as the pointer itself is serialized, but since this is a polymorphic pointer, if we tried to serialize the pointer we'd end up back here recursively. So we have to catch the error here as well, if this was a polymorphic type serialized by its proper pointer type

◆ serialize_wrapper() [2/4]

template<class Archive , class T , class D >
std::enable_if<(!traits::is_default_constructible<T>::value && !traits::has_load_and_construct<T, Archive>::value) || std::is_abstract<T>::value, bool>::type cereal::polymorphic_detail::serialize_wrapper ( Archive &  ,
std::unique_ptr< T, D > &  ,
std::uint32_t const  nameid 
)
inline

Serialize a unique_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee.

This case is for when we can't actually construct the unique pointer. Normally this would be caught as the pointer itself is serialized, but since this is a polymorphic pointer, if we tried to serialize the pointer we'd end up back here recursively. So we have to catch the error here as well, if this was a polymorphic type serialized by its proper pointer type

◆ serialize_wrapper() [3/4]

template<class Archive , class T >
std::enable_if<(traits::is_default_constructible<T>::value || traits::has_load_and_construct<T, Archive>::value) && !std::is_abstract<T>::value, bool>::type cereal::polymorphic_detail::serialize_wrapper ( Archive &  ar,
std::shared_ptr< T > &  ptr,
std::uint32_t const  nameid 
)
inline

Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee.

This check lets us try and skip doing polymorphic machinery if we can get away with using the derived class serialize function

Note that on MSVC 2013 preview, is_default_constructible<T> returns true for abstract classes with default constructors, but on clang/gcc this will return false. So we also need to check for that here.

◆ serialize_wrapper() [4/4]

template<class Archive , class T , class D >
std::enable_if<(traits::is_default_constructible<T>::value || traits::has_load_and_construct<T, Archive>::value) && !std::is_abstract<T>::value, bool>::type cereal::polymorphic_detail::serialize_wrapper ( Archive &  ar,
std::unique_ptr< T, D > &  ptr,
std::uint32_t const  nameid 
)
inline

Serialize a unique_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee.

This check lets us try and skip doing polymorphic machinery if we can get away with using the derived class serialize function