diff --git a/src/checkpoint/dispatch/vrt/base.h b/src/checkpoint/dispatch/vrt/base.h index 5d4f3225..4235fbc8 100644 --- a/src/checkpoint/dispatch/vrt/base.h +++ b/src/checkpoint/dispatch/vrt/base.h @@ -51,27 +51,29 @@ #include "checkpoint/dispatch/vrt/inheritance_assert_helpers.h" #include "checkpoint/dispatch/vrt/serialize_instantiator.h" -#define checkpoint_virtual_serialize_root() \ - auto _CheckpointVSBaseTypeFn() -> decltype(auto) { return this; } \ - virtual void _checkpointDynamicSerialize( \ - void* s, \ - ::checkpoint::dispatch::vrt::TypeIdx ser_idx, \ - ::checkpoint::dispatch::vrt::TypeIdx expected_idx \ - ) { \ - using _CheckpointVirtualSerializerBaseType = ::checkpoint::dispatch::vrt::checkpoint_base_type_t; \ - ::checkpoint::instantiateObjSerializer< \ - _CheckpointVirtualSerializerBaseType, \ - checkpoint_serializer_variadic_args() \ - >(); \ - ::checkpoint::dispatch::vrt::assertTypeIdxMatch<_CheckpointVirtualSerializerBaseType>(expected_idx); \ - auto dispatcher = \ - ::checkpoint::dispatch::vrt::serializer_registry::getObjIdx<_CheckpointVirtualSerializerBaseType>(ser_idx); \ - dispatcher(s, *static_cast<_CheckpointVirtualSerializerBaseType*>(this)); \ - } \ - virtual ::checkpoint::dispatch::vrt::TypeIdx _checkpointDynamicTypeIndex() { \ - using _CheckpointVirtualSerializerBaseType = ::checkpoint::dispatch::vrt::checkpoint_base_type_t; \ - return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointVirtualSerializerBaseType>(); \ - } \ +#define checkpoint_virtual_serialize_root() \ + auto _CheckpointVSBaseTypeFn() -> decltype(auto) { return this; } \ + virtual void _checkpointDynamicSerialize( \ + void* s, \ + ::checkpoint::dispatch::vrt::TypeIdx ser_idx, \ + ::checkpoint::dispatch::vrt::TypeIdx expected_idx \ + ) { \ + using _CheckpointBaseType = \ + ::checkpoint::dispatch::vrt::checkpoint_base_type_t; \ + ::checkpoint::instantiateObjSerializer< \ + _CheckpointBaseType, \ + checkpoint_serializer_variadic_args() \ + >(); \ + ::checkpoint::dispatch::vrt::assertTypeIdxMatch<_CheckpointBaseType>(expected_idx); \ + auto dispatcher = \ + ::checkpoint::dispatch::vrt::serializer_registry::getObjIdx<_CheckpointBaseType>(ser_idx); \ + dispatcher(s, *static_cast<_CheckpointBaseType*>(this)); \ + } \ + virtual ::checkpoint::dispatch::vrt::TypeIdx _checkpointDynamicTypeIndex() { \ + using _CheckpointBaseType = \ + ::checkpoint::dispatch::vrt::checkpoint_base_type_t; \ + return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointBaseType>(); \ + } #define checkpoint_virtual_serialize_base(BASE) checkpoint_virtual_serialize_root() diff --git a/src/checkpoint/dispatch/vrt/derived.h b/src/checkpoint/dispatch/vrt/derived.h index 806a8759..81290d01 100644 --- a/src/checkpoint/dispatch/vrt/derived.h +++ b/src/checkpoint/dispatch/vrt/derived.h @@ -51,38 +51,40 @@ #include "checkpoint/dispatch/vrt/inheritance_assert_helpers.h" #include "checkpoint/dispatch/vrt/serialize_instantiator.h" -#define checkpoint_virtual_serialize_derived_from(PARENT) \ - void _checkpointDynamicSerialize( \ - void* s, \ - ::checkpoint::dispatch::vrt::TypeIdx base_ser_idx, \ - ::checkpoint::dispatch::vrt::TypeIdx expected_idx \ - ) override { \ - using _CheckpointDerivedType = ::checkpoint::dispatch::vrt::checkpoint_derived_type_t; \ - ::checkpoint::instantiateObjSerializer< \ - _CheckpointDerivedType, \ - checkpoint_serializer_variadic_args() \ - >(); \ - debug_checkpoint( \ - "%s: BEGIN: _checkpointDynamicSerialize: serializer_idx=%d {\n", \ - typeid(_CheckpointDerivedType).name(), base_ser_idx \ - ); \ - ::checkpoint::dispatch::vrt::assertTypeIdxMatch<_CheckpointDerivedType>(expected_idx); \ - auto base_idx = ::checkpoint::dispatch::vrt::objregistry::makeObjIdx(); \ - PARENT::_checkpointDynamicSerialize(s, base_ser_idx, base_idx); \ - auto dispatcher = \ - ::checkpoint::dispatch::vrt::serializer_registry::getBaseIdx<_CheckpointDerivedType>( \ - base_ser_idx \ - ); \ - dispatcher(s, *static_cast<_CheckpointDerivedType*>(this)); \ - debug_checkpoint( \ - "%s: END: _checkpointDynamicSerialize: serializer_idx=%d }\n", \ - typeid(_CheckpointDerivedType).name(), base_ser_idx \ - ); \ - } \ - ::checkpoint::dispatch::vrt::TypeIdx _checkpointDynamicTypeIndex() override { \ - using _CheckpointDerivedType = ::checkpoint::dispatch::vrt::checkpoint_derived_type_t; \ - return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointDerivedType>(); \ - } \ +#define checkpoint_virtual_serialize_derived_from(PARENT) \ + void _checkpointDynamicSerialize( \ + void* s, \ + ::checkpoint::dispatch::vrt::TypeIdx base_ser_idx, \ + ::checkpoint::dispatch::vrt::TypeIdx expected_idx \ + ) override { \ + using _CheckpointDerivedType = \ + ::checkpoint::dispatch::vrt::checkpoint_derived_type_t; \ + ::checkpoint::instantiateObjSerializer< \ + _CheckpointDerivedType, \ + checkpoint_serializer_variadic_args() \ + >(); \ + debug_checkpoint( \ + "%s: BEGIN: _checkpointDynamicSerialize: serializer_idx=%d {\n", \ + typeid(_CheckpointDerivedType).name(), base_ser_idx \ + ); \ + ::checkpoint::dispatch::vrt::assertTypeIdxMatch<_CheckpointDerivedType>(expected_idx); \ + auto base_idx = ::checkpoint::dispatch::vrt::objregistry::makeObjIdx(); \ + PARENT::_checkpointDynamicSerialize(s, base_ser_idx, base_idx); \ + auto dispatcher = \ + ::checkpoint::dispatch::vrt::serializer_registry::getBaseIdx<_CheckpointDerivedType>( \ + base_ser_idx \ + ); \ + dispatcher(s, *static_cast<_CheckpointDerivedType*>(this)); \ + debug_checkpoint( \ + "%s: END: _checkpointDynamicSerialize: serializer_idx=%d }\n", \ + typeid(_CheckpointDerivedType).name(), base_ser_idx \ + ); \ + } \ + ::checkpoint::dispatch::vrt::TypeIdx _checkpointDynamicTypeIndex() override { \ + using _CheckpointDerivedType = \ + ::checkpoint::dispatch::vrt::checkpoint_derived_type_t; \ + return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointDerivedType>(); \ + } #define checkpoint_virtual_serialize_derived(DERIVED, PARENT) checkpoint_virtual_serialize_derived_from(PARENT) diff --git a/src/checkpoint/dispatch/vrt/registry_common.h b/src/checkpoint/dispatch/vrt/registry_common.h index 3c76f4b1..aa92fc06 100644 --- a/src/checkpoint/dispatch/vrt/registry_common.h +++ b/src/checkpoint/dispatch/vrt/registry_common.h @@ -68,7 +68,8 @@ struct _CheckpointBaseType*> { using type = BaseT; }; template -using checkpoint_base_type_t = typename _CheckpointBaseType()._CheckpointVSBaseTypeFn())>::type; +using checkpoint_base_type_t = + typename _CheckpointBaseType()._CheckpointVSBaseTypeFn())>::type; }}} /* end namespace checkpoint::dispatch::vrt */