1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120 |
- #ifndef CEREAL_CEREAL_HPP_
- #define CEREAL_CEREAL_HPP_
- #include <type_traits>
- #include <string>
- #include <memory>
- #include <functional>
- #include <unordered_map>
- #include <unordered_set>
- #include <vector>
- #include <cstddef>
- #include <cstdint>
- #include <functional>
- #include "cereal/macros.hpp"
- #include "cereal/details/traits.hpp"
- #include "cereal/details/helpers.hpp"
- #include "cereal/types/base_class.hpp"
- namespace cereal
- {
-
-
-
- template <class T> inline
- NameValuePair<T> make_nvp( std::string const & name, T && value )
- {
- return {name.c_str(), std::forward<T>(value)};
- }
-
-
- template <class T> inline
- NameValuePair<T> make_nvp( const char * name, T && value )
- {
- return {name, std::forward<T>(value)};
- }
-
-
- #define CEREAL_NVP(T) ::cereal::make_nvp(#T, T)
-
-
-
- template <class T> inline
- BinaryData<T> binary_data( T && data, size_t size )
- {
- return {std::forward<T>(data), size};
- }
-
-
-
- template <class T> inline
- SizeTag<T> make_size_tag( T && sz )
- {
- return {std::forward<T>(sz)};
- }
-
-
-
- template <class T> inline
- DeferredData<T> defer( T && value )
- {
- return {std::forward<T>(value)};
- }
-
-
-
-
- template <class Archive, class T> inline
- void prologue( Archive & , T const & )
- { }
-
-
-
- template <class Archive, class T> inline
- void epilogue( Archive & , T const & )
- { }
-
-
-
- enum Flags { AllowEmptyClassElision = 1 };
-
-
-
- #define CEREAL_REGISTER_ARCHIVE(Archive) \
- namespace cereal { namespace detail { \
- template <class T, class BindingTag> \
- typename polymorphic_serialization_support<Archive, T>::type \
- instantiate_polymorphic_binding( T*, Archive*, BindingTag, adl_tag ); \
- } }
-
- #if defined(__GNUC__)
-
- #define CEREAL_UNUSED_FUNCTION
- #else
- #define CEREAL_UNUSED_FUNCTION static void unused() { (void)version; }
- #endif
-
-
-
-
-
-
- #ifdef CEREAL_HAS_CPP17
- #define CEREAL_CLASS_VERSION(TYPE, VERSION_NUMBER) \
- namespace cereal { namespace detail { \
- template <> struct Version<TYPE> \
- { \
- static std::uint32_t registerVersion() \
- { \
- ::cereal::detail::StaticObject<Versions>::getInstance().mapping.emplace( \
- std::type_index(typeid(TYPE)).hash_code(), VERSION_NUMBER ); \
- return VERSION_NUMBER; \
- } \
- static inline const std::uint32_t version = registerVersion(); \
- CEREAL_UNUSED_FUNCTION \
- }; \
- } }
- #else
- #define CEREAL_CLASS_VERSION(TYPE, VERSION_NUMBER) \
- namespace cereal { namespace detail { \
- template <> struct Version<TYPE> \
- { \
- static const std::uint32_t version; \
- static std::uint32_t registerVersion() \
- { \
- ::cereal::detail::StaticObject<Versions>::getInstance().mapping.emplace( \
- std::type_index(typeid(TYPE)).hash_code(), VERSION_NUMBER ); \
- return VERSION_NUMBER; \
- } \
- CEREAL_UNUSED_FUNCTION \
- }; \
- const std::uint32_t Version<TYPE>::version = \
- Version<TYPE>::registerVersion(); \
- } }
- #endif
-
-
-
- template<class ArchiveType, std::uint32_t Flags = 0>
- class OutputArchive : public detail::OutputArchiveBase
- {
- public:
-
-
- OutputArchive(ArchiveType * const derived) : self(derived), itsCurrentPointerId(1), itsCurrentPolymorphicTypeId(1)
- { }
- OutputArchive & operator=( OutputArchive const & ) = delete;
-
-
- template <class ... Types> inline
- ArchiveType & operator()( Types && ... args )
- {
- self->process( std::forward<Types>( args )... );
- return *self;
- }
-
-
- void serializeDeferments()
- {
- for( auto & deferment : itsDeferments )
- deferment();
- }
-
-
-
-
- using is_loading = std::false_type;
-
-
- using is_saving = std::true_type;
-
-
- template <class T> inline
- ArchiveType & operator&( T && arg )
- {
- self->process( std::forward<T>( arg ) );
- return *self;
- }
-
-
- template <class T> inline
- ArchiveType & operator<<( T && arg )
- {
- self->process( std::forward<T>( arg ) );
- return *self;
- }
-
-
-
- inline std::uint32_t registerSharedPointer(const std::shared_ptr<const void>& sharedPointer)
- {
- void const * addr = sharedPointer.get();
-
- if(addr == 0) return 0;
- itsSharedPointerStorage.push_back(sharedPointer);
- auto id = itsSharedPointerMap.find( addr );
- if( id == itsSharedPointerMap.end() )
- {
- auto ptrId = itsCurrentPointerId++;
- itsSharedPointerMap.insert( {addr, ptrId} );
- return ptrId | detail::msb_32bit;
- }
- else
- return id->second;
- }
-
-
- inline std::uint32_t registerPolymorphicType( char const * name )
- {
- auto id = itsPolymorphicTypeMap.find( name );
- if( id == itsPolymorphicTypeMap.end() )
- {
- auto polyId = itsCurrentPolymorphicTypeId++;
- itsPolymorphicTypeMap.insert( {name, polyId} );
- return polyId | detail::msb_32bit;
- }
- else
- return id->second;
- }
- private:
-
- template <class T> inline
- void process( T && head )
- {
- prologue( *self, head );
- self->processImpl( head );
- epilogue( *self, head );
- }
-
- template <class T, class ... Other> inline
- void process( T && head, Other && ... tail )
- {
- self->process( std::forward<T>( head ) );
- self->process( std::forward<Other>( tail )... );
- }
-
-
- template <class T> inline
- ArchiveType & processImpl(virtual_base_class<T> const & b)
- {
- traits::detail::base_class_id id(b.base_ptr);
- if(itsBaseClassSet.count(id) == 0)
- {
- itsBaseClassSet.insert(id);
- self->processImpl( *b.base_ptr );
- }
- return *self;
- }
-
-
- template <class T> inline
- ArchiveType & processImpl(base_class<T> const & b)
- {
- self->processImpl( *b.base_ptr );
- return *self;
- }
- std::vector<std::function<void(void)>> itsDeferments;
- template <class T> inline
- ArchiveType & processImpl(DeferredData<T> const & d)
- {
- std::function<void(void)> deferment( [this, d](){ self->process( d.value ); } );
- itsDeferments.emplace_back( std::move(deferment) );
- return *self;
- }
-
-
- #define PROCESS_IF(name) \
- traits::EnableIf<traits::has_##name<T, ArchiveType>::value, \
- !traits::has_invalid_output_versioning<T, ArchiveType>::value, \
- (traits::is_output_serializable<T, ArchiveType>::value && \
- (traits::is_specialized_##name<T, ArchiveType>::value || \
- !traits::is_specialized<T, ArchiveType>::value))> = traits::sfinae
-
- template <class T, PROCESS_IF(member_serialize)> inline
- ArchiveType & processImpl(T const & t)
- {
- access::member_serialize(*self, const_cast<T &>(t));
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_serialize)> inline
- ArchiveType & processImpl(T const & t)
- {
- CEREAL_SERIALIZE_FUNCTION_NAME(*self, const_cast<T &>(t));
- return *self;
- }
-
- template <class T, PROCESS_IF(member_save)> inline
- ArchiveType & processImpl(T const & t)
- {
- access::member_save(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_save)> inline
- ArchiveType & processImpl(T const & t)
- {
- CEREAL_SAVE_FUNCTION_NAME(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(member_save_minimal)> inline
- ArchiveType & processImpl(T const & t)
- {
- self->process( access::member_save_minimal(*self, t) );
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_save_minimal)> inline
- ArchiveType & processImpl(T const & t)
- {
- self->process( CEREAL_SAVE_MINIMAL_FUNCTION_NAME(*self, t) );
- return *self;
- }
-
- template <class T, traits::EnableIf<(Flags & AllowEmptyClassElision),
- !traits::is_output_serializable<T, ArchiveType>::value,
- std::is_empty<T>::value> = traits::sfinae> inline
- ArchiveType & processImpl(T const &)
- {
- return *self;
- }
-
-
- template <class T, traits::EnableIf<traits::has_invalid_output_versioning<T, ArchiveType>::value ||
- (!traits::is_output_serializable<T, ArchiveType>::value &&
- (!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !std::is_empty<T>::value)))> = traits::sfinae> inline
- ArchiveType & processImpl(T const &)
- {
- static_assert(traits::detail::count_output_serializers<T, ArchiveType>::value != 0,
- "cereal could not find any output serialization functions for the provided type and archive combination. \n\n "
- "Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). \n "
- "Serialize functions generally have the following signature: \n\n "
- "template<class Archive> \n "
- " void serialize(Archive & ar) \n "
- " { \n "
- " ar( member1, member2, member3 ); \n "
- " } \n\n " );
- static_assert(traits::detail::count_output_serializers<T, ArchiveType>::value < 2,
- "cereal found more than one compatible output serialization function for the provided type and archive combination. \n\n "
- "Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). \n "
- "Use specialization (see access.hpp) if you need to disambiguate between serialize vs load/save functions. \n "
- "Note that serialization functions can be inherited which may lead to the aforementioned ambiguities. \n "
- "In addition, you may not mix versioned with non-versioned serialization functions. \n\n ");
- return *self;
- }
-
-
- template <class T> inline
- std::uint32_t registerClassVersion()
- {
- static const auto hash = std::type_index(typeid(T)).hash_code();
- const auto insertResult = itsVersionedTypes.insert( hash );
- const auto lock = detail::StaticObject<detail::Versions>::lock();
- const auto version =
- detail::StaticObject<detail::Versions>::getInstance().find( hash, detail::Version<T>::version );
- if( insertResult.second )
- process( make_nvp<ArchiveType>("cereal_class_version", version) );
- return version;
- }
-
-
- template <class T, PROCESS_IF(member_versioned_serialize)> inline
- ArchiveType & processImpl(T const & t)
- {
- access::member_serialize(*self, const_cast<T &>(t), registerClassVersion<T>());
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_serialize)> inline
- ArchiveType & processImpl(T const & t)
- {
- CEREAL_SERIALIZE_FUNCTION_NAME(*self, const_cast<T &>(t), registerClassVersion<T>());
- return *self;
- }
-
-
- template <class T, PROCESS_IF(member_versioned_save)> inline
- ArchiveType & processImpl(T const & t)
- {
- access::member_save(*self, t, registerClassVersion<T>());
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_save)> inline
- ArchiveType & processImpl(T const & t)
- {
- CEREAL_SAVE_FUNCTION_NAME(*self, t, registerClassVersion<T>());
- return *self;
- }
-
-
- template <class T, PROCESS_IF(member_versioned_save_minimal)> inline
- ArchiveType & processImpl(T const & t)
- {
- self->process( access::member_save_minimal(*self, t, registerClassVersion<T>()) );
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_save_minimal)> inline
- ArchiveType & processImpl(T const & t)
- {
- self->process( CEREAL_SAVE_MINIMAL_FUNCTION_NAME(*self, t, registerClassVersion<T>()) );
- return *self;
- }
- #undef PROCESS_IF
- private:
- ArchiveType * const self;
-
- std::unordered_set<traits::detail::base_class_id, traits::detail::base_class_id_hash> itsBaseClassSet;
-
- std::unordered_map<void const *, std::uint32_t> itsSharedPointerMap;
-
-
- std::vector<std::shared_ptr<const void>> itsSharedPointerStorage;
-
- std::uint32_t itsCurrentPointerId;
-
- std::unordered_map<char const *, std::uint32_t> itsPolymorphicTypeMap;
-
- std::uint32_t itsCurrentPolymorphicTypeId;
-
- std::unordered_set<size_type> itsVersionedTypes;
- };
-
-
-
- template<class ArchiveType, std::uint32_t Flags = 0>
- class InputArchive : public detail::InputArchiveBase
- {
- public:
-
-
- InputArchive(ArchiveType * const derived) :
- self(derived),
- itsBaseClassSet(),
- itsSharedPointerMap(),
- itsPolymorphicTypeMap(),
- itsVersionedTypes()
- { }
- InputArchive & operator=( InputArchive const & ) = delete;
-
-
- template <class ... Types> inline
- ArchiveType & operator()( Types && ... args )
- {
- process( std::forward<Types>( args )... );
- return *self;
- }
-
-
- void serializeDeferments()
- {
- for( auto & deferment : itsDeferments )
- deferment();
- }
-
-
-
-
- using is_loading = std::true_type;
-
-
- using is_saving = std::false_type;
-
-
- template <class T> inline
- ArchiveType & operator&( T && arg )
- {
- self->process( std::forward<T>( arg ) );
- return *self;
- }
-
-
- template <class T> inline
- ArchiveType & operator>>( T && arg )
- {
- self->process( std::forward<T>( arg ) );
- return *self;
- }
-
-
-
- inline std::shared_ptr<void> getSharedPointer(std::uint32_t const id)
- {
- if(id == 0) return std::shared_ptr<void>(nullptr);
- auto iter = itsSharedPointerMap.find( id );
- if(iter == itsSharedPointerMap.end())
- throw Exception("Error while trying to deserialize a smart pointer. Could not find id " + std::to_string(id));
- return iter->second;
- }
-
-
- inline void registerSharedPointer(std::uint32_t const id, std::shared_ptr<void> ptr)
- {
- std::uint32_t const stripped_id = id & ~detail::msb_32bit;
- itsSharedPointerMap[stripped_id] = ptr;
- }
-
-
- inline std::string getPolymorphicName(std::uint32_t const id)
- {
- auto name = itsPolymorphicTypeMap.find( id );
- if(name == itsPolymorphicTypeMap.end())
- {
- throw Exception("Error while trying to deserialize a polymorphic pointer. Could not find type id " + std::to_string(id));
- }
- return name->second;
- }
-
-
- inline void registerPolymorphicName(std::uint32_t const id, std::string const & name)
- {
- std::uint32_t const stripped_id = id & ~detail::msb_32bit;
- itsPolymorphicTypeMap.insert( {stripped_id, name} );
- }
- private:
-
- template <class T> inline
- void process( T && head )
- {
- prologue( *self, head );
- self->processImpl( head );
- epilogue( *self, head );
- }
-
- template <class T, class ... Other> inline
- void process( T && head, Other && ... tail )
- {
- process( std::forward<T>( head ) );
- process( std::forward<Other>( tail )... );
- }
-
-
- template <class T> inline
- ArchiveType & processImpl(virtual_base_class<T> & b)
- {
- traits::detail::base_class_id id(b.base_ptr);
- if(itsBaseClassSet.count(id) == 0)
- {
- itsBaseClassSet.insert(id);
- self->processImpl( *b.base_ptr );
- }
- return *self;
- }
-
-
- template <class T> inline
- ArchiveType & processImpl(base_class<T> & b)
- {
- self->processImpl( *b.base_ptr );
- return *self;
- }
- std::vector<std::function<void(void)>> itsDeferments;
- template <class T> inline
- ArchiveType & processImpl(DeferredData<T> const & d)
- {
- std::function<void(void)> deferment( [this, d](){ self->process( d.value ); } );
- itsDeferments.emplace_back( std::move(deferment) );
- return *self;
- }
-
-
- #define PROCESS_IF(name) \
- traits::EnableIf<traits::has_##name<T, ArchiveType>::value, \
- !traits::has_invalid_input_versioning<T, ArchiveType>::value, \
- (traits::is_input_serializable<T, ArchiveType>::value && \
- (traits::is_specialized_##name<T, ArchiveType>::value || \
- !traits::is_specialized<T, ArchiveType>::value))> = traits::sfinae
-
- template <class T, PROCESS_IF(member_serialize)> inline
- ArchiveType & processImpl(T & t)
- {
- access::member_serialize(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_serialize)> inline
- ArchiveType & processImpl(T & t)
- {
- CEREAL_SERIALIZE_FUNCTION_NAME(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(member_load)> inline
- ArchiveType & processImpl(T & t)
- {
- access::member_load(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_load)> inline
- ArchiveType & processImpl(T & t)
- {
- CEREAL_LOAD_FUNCTION_NAME(*self, t);
- return *self;
- }
-
- template <class T, PROCESS_IF(member_load_minimal)> inline
- ArchiveType & processImpl(T & t)
- {
- using OutArchiveType = typename traits::detail::get_output_from_input<ArchiveType>::type;
- typename traits::has_member_save_minimal<T, OutArchiveType>::type value;
- self->process( value );
- access::member_load_minimal(*self, t, value);
- return *self;
- }
-
- template <class T, PROCESS_IF(non_member_load_minimal)> inline
- ArchiveType & processImpl(T & t)
- {
- using OutArchiveType = typename traits::detail::get_output_from_input<ArchiveType>::type;
- typename traits::has_non_member_save_minimal<T, OutArchiveType>::type value;
- self->process( value );
- CEREAL_LOAD_MINIMAL_FUNCTION_NAME(*self, t, value);
- return *self;
- }
-
- template <class T, traits::EnableIf<(Flags & AllowEmptyClassElision),
- !traits::is_input_serializable<T, ArchiveType>::value,
- std::is_empty<T>::value> = traits::sfinae> inline
- ArchiveType & processImpl(T const &)
- {
- return *self;
- }
-
-
- template <class T, traits::EnableIf<traits::has_invalid_input_versioning<T, ArchiveType>::value ||
- (!traits::is_input_serializable<T, ArchiveType>::value &&
- (!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !std::is_empty<T>::value)))> = traits::sfinae> inline
- ArchiveType & processImpl(T const &)
- {
- static_assert(traits::detail::count_input_serializers<T, ArchiveType>::value != 0,
- "cereal could not find any input serialization functions for the provided type and archive combination. \n\n "
- "Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). \n "
- "Serialize functions generally have the following signature: \n\n "
- "template<class Archive> \n "
- " void serialize(Archive & ar) \n "
- " { \n "
- " ar( member1, member2, member3 ); \n "
- " } \n\n " );
- static_assert(traits::detail::count_input_serializers<T, ArchiveType>::value < 2,
- "cereal found more than one compatible input serialization function for the provided type and archive combination. \n\n "
- "Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). \n "
- "Use specialization (see access.hpp) if you need to disambiguate between serialize vs load/save functions. \n "
- "Note that serialization functions can be inherited which may lead to the aforementioned ambiguities. \n "
- "In addition, you may not mix versioned with non-versioned serialization functions. \n\n ");
- return *self;
- }
-
- template <class A, class B, bool C, bool D, bool E, bool F> friend struct detail::Construct;
-
-
- template <class T> inline
- std::uint32_t loadClassVersion()
- {
- static const auto hash = std::type_index(typeid(T)).hash_code();
- auto lookupResult = itsVersionedTypes.find( hash );
- if( lookupResult != itsVersionedTypes.end() )
- return lookupResult->second;
- else
- {
- std::uint32_t version;
- process( make_nvp<ArchiveType>("cereal_class_version", version) );
- itsVersionedTypes.emplace_hint( lookupResult, hash, version );
- return version;
- }
- }
-
-
- template <class T, PROCESS_IF(member_versioned_serialize)> inline
- ArchiveType & processImpl(T & t)
- {
- const auto version = loadClassVersion<T>();
- access::member_serialize(*self, t, version);
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_serialize)> inline
- ArchiveType & processImpl(T & t)
- {
- const auto version = loadClassVersion<T>();
- CEREAL_SERIALIZE_FUNCTION_NAME(*self, t, version);
- return *self;
- }
-
-
- template <class T, PROCESS_IF(member_versioned_load)> inline
- ArchiveType & processImpl(T & t)
- {
- const auto version = loadClassVersion<T>();
- access::member_load(*self, t, version);
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_load)> inline
- ArchiveType & processImpl(T & t)
- {
- const auto version = loadClassVersion<T>();
- CEREAL_LOAD_FUNCTION_NAME(*self, t, version);
- return *self;
- }
-
-
- template <class T, PROCESS_IF(member_versioned_load_minimal)> inline
- ArchiveType & processImpl(T & t)
- {
- using OutArchiveType = typename traits::detail::get_output_from_input<ArchiveType>::type;
- const auto version = loadClassVersion<T>();
- typename traits::has_member_versioned_save_minimal<T, OutArchiveType>::type value;
- self->process(value);
- access::member_load_minimal(*self, t, value, version);
- return *self;
- }
-
-
- template <class T, PROCESS_IF(non_member_versioned_load_minimal)> inline
- ArchiveType & processImpl(T & t)
- {
- using OutArchiveType = typename traits::detail::get_output_from_input<ArchiveType>::type;
- const auto version = loadClassVersion<T>();
- typename traits::has_non_member_versioned_save_minimal<T, OutArchiveType>::type value;
- self->process(value);
- CEREAL_LOAD_MINIMAL_FUNCTION_NAME(*self, t, value, version);
- return *self;
- }
- #undef PROCESS_IF
- private:
- ArchiveType * const self;
-
- std::unordered_set<traits::detail::base_class_id, traits::detail::base_class_id_hash> itsBaseClassSet;
-
- std::unordered_map<std::uint32_t, std::shared_ptr<void>> itsSharedPointerMap;
-
- std::unordered_map<std::uint32_t, std::string> itsPolymorphicTypeMap;
-
- std::unordered_map<std::size_t, std::uint32_t> itsVersionedTypes;
- };
- }
- #include "cereal/types/common.hpp"
- #endif
|