Skip to content

Commit

Permalink
#132 Virtual Serialize: Rename revised macro to not break code
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed Oct 7, 2020
1 parent e7dcac9 commit fd46149
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/checkpoint/dispatch/dispatch_virtual.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
*
* - Insert checkpoint macros in your virtual class hierarchy for derived and
* base classes with the corresponding macros:
* - \c checkpoint_virtual_serialize_base()
* - \c checkpoint_virtual_serialize_root()
* - \c checkpoint_virtual_serialize_derived_from(ParentT)
*
* Invoking the virtual serializer:
Expand Down
6 changes: 4 additions & 2 deletions src/checkpoint/dispatch/vrt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "checkpoint/dispatch/vrt/inheritance_assert_helpers.h"
#include "checkpoint/dispatch/vrt/serialize_instantiator.h"

#define checkpoint_virtual_serialize_base() \
#define checkpoint_virtual_serialize_root() \
auto _CheckpointVSBaseTypeFn() -> decltype(auto) { return this; } \
virtual void _checkpointDynamicSerialize( \
void* s, \
Expand All @@ -73,6 +73,8 @@
return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointVirtualSerializerBaseType>(); \
} \

#define checkpoint_virtual_serialize_base(BASE) checkpoint_virtual_serialize_root()

namespace checkpoint { namespace dispatch { namespace vrt {

/**
Expand All @@ -83,7 +85,7 @@ namespace checkpoint { namespace dispatch { namespace vrt {
*/
template <typename BaseT>
struct SerializableBase {
checkpoint_virtual_serialize_base()
checkpoint_virtual_serialize_root()
};

}}} /* end namespace checkpoint::dispatch::vrt */
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ inline void assertTypeIdxMatch(TypeIdx const expected_idx) {
"\" does not matched expected value. "
"You are probably missing a SerializableBase<T> or SerializableDerived<T> "
"in the virtual class hierarchy; or, if you are using macros: "
"checkpoint_virtual_serialize_base() or checkpoint_virtual_serialize_derived(..)";
"checkpoint_virtual_serialize_root() or checkpoint_virtual_serialize_derived_from(..)";
checkpointAssert(
obj_idx == expected_idx or expected_idx == no_type_idx, debug_str.c_str()
);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_footprinter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ TEST_F(TestFootprinter, test_vector) {

struct TestBase {

checkpoint_virtual_serialize_base()
checkpoint_virtual_serialize_root()

virtual ~TestBase() = default;

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_virtual_serialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct TestBase {
explicit TestBase(TEST_CONSTRUCT) { init(); }
explicit TestBase(SERIALIZE_CONSTRUCT_TAG) {}

checkpoint_virtual_serialize_base()
checkpoint_virtual_serialize_root()

virtual ~TestBase() = default;

Expand Down Expand Up @@ -425,7 +425,7 @@ struct TestBase {
explicit TestBase(TEST_CONSTRUCT) { init(); }
explicit TestBase(SERIALIZE_CONSTRUCT_TAG) {}

checkpoint_virtual_serialize_base()
checkpoint_virtual_serialize_root()

virtual ~TestBase() = default;

Expand Down Expand Up @@ -455,7 +455,7 @@ struct TestDerived1 : TestBase {
explicit TestDerived1(TEST_CONSTRUCT tag) : Parent(tag) { init(); }
explicit TestDerived1(SERIALIZE_CONSTRUCT_TAG tag) : Parent(tag) {}

checkpoint_virtual_serialize_derived(TestDerived1, TestBase)
checkpoint_virtual_serialize_derived_from(Parent)

template <typename SerializerT>
void serialize(SerializerT& s) {
Expand Down Expand Up @@ -500,7 +500,7 @@ struct TestDerived2 : TestBase {
explicit TestDerived2(TEST_CONSTRUCT tag) : Parent(tag) { init(); }
explicit TestDerived2(SERIALIZE_CONSTRUCT_TAG tag) : Parent(tag) {}

checkpoint_virtual_serialize_derived(TestDerived2, TestBase)
checkpoint_virtual_serialize_derived_from(Parent)

template <typename SerializerT>
void serialize(SerializerT& s) {
Expand Down

0 comments on commit fd46149

Please sign in to comment.