Skip to content

Commit

Permalink
#132: Fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed Oct 8, 2020
1 parent 9631a41 commit 5074ca8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 54 deletions.
44 changes: 23 additions & 21 deletions src/checkpoint/dispatch/vrt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(*this)>; \
::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<decltype(*this)>; \
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<decltype(*this)>; \
::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<decltype(*this)>; \
return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointBaseType>(); \
}

#define checkpoint_virtual_serialize_base(BASE) checkpoint_virtual_serialize_root()

Expand Down
66 changes: 34 additions & 32 deletions src/checkpoint/dispatch/vrt/derived.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(this)>; \
::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>(); \
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<decltype(this)>; \
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<decltype(this)>; \
::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>(); \
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<decltype(this)>; \
return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointDerivedType>(); \
}

#define checkpoint_virtual_serialize_derived(DERIVED, PARENT) checkpoint_virtual_serialize_derived_from(PARENT)

Expand Down
3 changes: 2 additions & 1 deletion src/checkpoint/dispatch/vrt/registry_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ struct _CheckpointBaseType<SerializableBase<BaseT>*> {
using type = BaseT;
};
template <typename ObjT>
using checkpoint_base_type_t = typename _CheckpointBaseType<decltype(std::declval<ObjT>()._CheckpointVSBaseTypeFn())>::type;
using checkpoint_base_type_t =
typename _CheckpointBaseType<decltype(std::declval<ObjT>()._CheckpointVSBaseTypeFn())>::type;

}}} /* end namespace checkpoint::dispatch::vrt */

Expand Down

0 comments on commit 5074ca8

Please sign in to comment.