From 22313ba4d5a3a72e627eb596c61fd7e484d2c30f Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Mon, 20 May 2024 13:07:20 +0200 Subject: [PATCH 1/2] #260: Add magistrate alias namespace --- src/checkpoint/checkpoint.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/checkpoint/checkpoint.h b/src/checkpoint/checkpoint.h index a352f611..18b20fea 100644 --- a/src/checkpoint/checkpoint.h +++ b/src/checkpoint/checkpoint.h @@ -73,4 +73,7 @@ #include "checkpoint/checkpoint_api.h" #include "checkpoint/checkpoint_api.impl.h" +// Add namespace alias for the new name of the library +namespace magistrate = checkpoint; + #endif /*INCLUDED_CHECKPOINT_CHECKPOINT_H*/ From 4210f9b302986e2ed1fc46b2ea39b583dd09fd17 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Mon, 20 May 2024 13:09:04 +0200 Subject: [PATCH 2/2] #260: Use new namespace alias in examples --- examples/checkpoint_example_1.cc | 4 +-- examples/checkpoint_example_1_nonintrusive.cc | 8 +++--- examples/checkpoint_example_2.cc | 4 +-- examples/checkpoint_example_2_nonintrusive.cc | 8 +++--- examples/checkpoint_example_3.cc | 7 ++--- examples/checkpoint_example_3_nonintrusive.cc | 13 ++++----- examples/checkpoint_example_polymorphic.cc | 24 ++++++++-------- .../checkpoint_example_polymorphic_macro.cc | 16 +++++------ ..._example_polymorphic_macro_nonintrusive.cc | 8 +++--- ...kpoint_example_polymorphic_nonintrusive.cc | 28 +++++++++---------- examples/checkpoint_example_to_file.cc | 10 +++---- ...checkpoint_example_to_file_nonintrusive.cc | 14 +++++----- examples/checkpoint_example_traversal.cc | 16 +++++------ ...eckpoint_example_traversal_nonintrusive.cc | 20 ++++++------- 14 files changed, 89 insertions(+), 91 deletions(-) diff --git a/examples/checkpoint_example_1.cc b/examples/checkpoint_example_1.cc index 37bd2796..753a82ea 100644 --- a/examples/checkpoint_example_1.cc +++ b/examples/checkpoint_example_1.cc @@ -47,7 +47,7 @@ #include -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { // \struct MyTest // \brief Simple structure with two variables of built-in types @@ -105,7 +105,7 @@ struct MyTest { } }; -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples int main(int, char**) { using namespace magistrate::intrusive::examples; diff --git a/examples/checkpoint_example_1_nonintrusive.cc b/examples/checkpoint_example_1_nonintrusive.cc index 3e8a2e96..ee17a761 100644 --- a/examples/checkpoint_example_1_nonintrusive.cc +++ b/examples/checkpoint_example_1_nonintrusive.cc @@ -48,7 +48,7 @@ #include // \brief Namespace containing type which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Simple structure with three variables of built-in types struct MyTest3 { @@ -60,12 +60,12 @@ struct MyTest3 { } }; -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief Function to serialize the MyTest3 structure. // In Non-Intrusive way, this function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Templated function for serializing/deserializing // a variable of type `MyTest3`. Non-nonintrusive version of the function // placed outside of `MyTest3` structure. @@ -93,7 +93,7 @@ namespace magistrate { namespace nonintrusive { namespace examples { s | my_test3.c; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; diff --git a/examples/checkpoint_example_2.cc b/examples/checkpoint_example_2.cc index 469d3ed5..30e4c7f4 100644 --- a/examples/checkpoint_example_2.cc +++ b/examples/checkpoint_example_2.cc @@ -47,7 +47,7 @@ #include -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { // \struct MyTest2 // \brief Simple structure with one variable of built-in type @@ -125,7 +125,7 @@ struct MyTest { } }; -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples int main(int, char**) { using namespace magistrate::intrusive::examples; diff --git a/examples/checkpoint_example_2_nonintrusive.cc b/examples/checkpoint_example_2_nonintrusive.cc index d564fe73..174caa1d 100644 --- a/examples/checkpoint_example_2_nonintrusive.cc +++ b/examples/checkpoint_example_2_nonintrusive.cc @@ -48,7 +48,7 @@ #include // \brief Namespace containing types which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \struct MyTest2 // \brief Simple structure with one variable of built-in type @@ -90,11 +90,11 @@ struct MyTest { } }; -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Templated function for serializing/deserializing // a variable of type `MyTest` @@ -132,7 +132,7 @@ void serialize(Serializer& s, MyTest2& my_test2) { s | my_test2.c; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; diff --git a/examples/checkpoint_example_3.cc b/examples/checkpoint_example_3.cc index 05667ed5..852bc95e 100644 --- a/examples/checkpoint_example_3.cc +++ b/examples/checkpoint_example_3.cc @@ -53,7 +53,7 @@ // class of a serializable/deserializable type. // -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { // \brief Structure with a variable of built-in type. // @@ -120,13 +120,12 @@ struct TestReconstruct { } }; -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples #include "checkpoint/traits/serializable_traits.h" -namespace magistrate { +namespace checkpoint { -using namespace ::checkpoint; using namespace intrusive::examples; static_assert( diff --git a/examples/checkpoint_example_3_nonintrusive.cc b/examples/checkpoint_example_3_nonintrusive.cc index 1238e6bb..ed090151 100644 --- a/examples/checkpoint_example_3_nonintrusive.cc +++ b/examples/checkpoint_example_3_nonintrusive.cc @@ -54,7 +54,7 @@ // // \brief Namespace containing types which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Structure with a variable of built-in type. struct TestDefaultCons { @@ -103,11 +103,11 @@ struct TestReconstruct { } }; -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Non-Intrusive Serialize method for TestDefaultCons structure. // @@ -130,13 +130,12 @@ void serialize(Serializer& s, TestReconstruct& tr) { s | tr.a; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples #include "checkpoint/traits/serializable_traits.h" -namespace magistrate { +namespace checkpoint { -using namespace ::checkpoint; using namespace nonintrusive::examples; static_assert( @@ -158,7 +157,7 @@ static_assert( "Should be serializable" ); -} // end namespace magistrate +} // end namespace checkpoint int main(int, char**) { diff --git a/examples/checkpoint_example_polymorphic.cc b/examples/checkpoint_example_polymorphic.cc index eafa2355..1b589573 100644 --- a/examples/checkpoint_example_polymorphic.cc +++ b/examples/checkpoint_example_polymorphic.cc @@ -46,11 +46,11 @@ #include #include "checkpoint/dispatch/dispatch_virtual.h" -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { -struct MyBase : ::checkpoint::SerializableBase { +struct MyBase : ::magistrate::SerializableBase { MyBase() { printf("MyBase cons\n"); } - explicit MyBase(::checkpoint::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } + explicit MyBase(::magistrate::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } virtual ~MyBase() = default; @@ -65,9 +65,9 @@ struct MyBase : ::checkpoint::SerializableBase { virtual void test() = 0; }; -struct MyObj : ::checkpoint::SerializableDerived { +struct MyObj : ::magistrate::SerializableDerived { explicit MyObj(int val) { printf("MyObj cons\n"); val_ = val;} - explicit MyObj(::checkpoint::SERIALIZE_CONSTRUCT_TAG){} + explicit MyObj(::magistrate::SERIALIZE_CONSTRUCT_TAG){} template void serialize(SerializerT&) { @@ -80,9 +80,9 @@ struct MyObj : ::checkpoint::SerializableDerived { } }; -struct MyObj2 : ::checkpoint::SerializableDerived { +struct MyObj2 : ::magistrate::SerializableDerived { explicit MyObj2(int val) { printf("MyObj2 cons\n"); val_=val; } - explicit MyObj2(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj2(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} template void serialize(SerializerT&) { @@ -94,10 +94,10 @@ struct MyObj2 : ::checkpoint::SerializableDerived { } }; -struct MyObj3 : ::checkpoint::SerializableDerived { +struct MyObj3 : ::magistrate::SerializableDerived { int a=0, b=0, c=0; explicit MyObj3(int val) { printf("MyObj3 cons\n"); a= 10; b=20; c=100; val_=val;} - explicit MyObj3(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj3(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} template void serialize(SerializerT& s) { @@ -134,21 +134,21 @@ void test() { v.vec.push_back(std::make_unique(20)); v.vec.push_back(std::make_unique(10)); - auto ret = checkpoint::serialize(v); + auto ret = magistrate::serialize(v); auto const& buf = ret->getBuffer(); auto const& buf_size = ret->getSize(); printf("ptr=%p, size=%ld\n*****\n\n", static_cast(buf), buf_size); - auto t = checkpoint::deserialize(buf); + auto t = magistrate::deserialize(buf); for (auto&& elm : t->vec) { elm->test(); } } -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples int main(int, char**) { using namespace magistrate::intrusive::examples; diff --git a/examples/checkpoint_example_polymorphic_macro.cc b/examples/checkpoint_example_polymorphic_macro.cc index f1f17a59..5f0170c9 100644 --- a/examples/checkpoint_example_polymorphic_macro.cc +++ b/examples/checkpoint_example_polymorphic_macro.cc @@ -46,13 +46,13 @@ #include #include "checkpoint/dispatch/dispatch_virtual.h" -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { // \struct Abstract base class struct MyBase { MyBase() { printf("MyBase cons\n"); } - explicit MyBase(::checkpoint::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } + explicit MyBase(::magistrate::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } virtual ~MyBase() = default; @@ -73,7 +73,7 @@ struct MyBase { struct MyObj : public MyBase { explicit MyObj(int val) : MyBase() { printf("MyObj cons\n"); val_ = val;} - explicit MyObj(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} // Add macro for serialization checkpoint_virtual_serialize_derived_from(MyBase) @@ -91,7 +91,7 @@ struct MyObj : public MyBase { struct MyObj2 : public MyBase { explicit MyObj2(int val) { printf("MyObj2 cons\n"); val_=val; } - explicit MyObj2(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj2(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} // Add macro for serialization checkpoint_virtual_serialize_derived_from(MyBase) @@ -111,7 +111,7 @@ struct MyObj3 : public MyBase { int a=0, b=0, c=0; explicit MyObj3(int val) { printf("MyObj3 cons\n"); a= 10; b=20; c=100; val_=val;} - explicit MyObj3(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj3(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} // Add macro for serialization checkpoint_virtual_serialize_derived_from(MyBase) @@ -151,7 +151,7 @@ void test() { v.vec.push_back(std::make_unique(20)); v.vec.push_back(std::make_unique(10)); - auto ret = checkpoint::serialize(v); + auto ret = magistrate::serialize(v); { // Display information about serialization result @@ -160,14 +160,14 @@ void test() { printf("ptr=%p, size=%ld\n*****\n\n", static_cast(buf), buf_size); } - auto t = checkpoint::deserialize(ret->getBuffer()); + auto t = magistrate::deserialize(ret->getBuffer()); for (auto&& elm : t->vec) { elm->test(); } } -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples int main(int, char**) { using namespace magistrate::intrusive::examples; diff --git a/examples/checkpoint_example_polymorphic_macro_nonintrusive.cc b/examples/checkpoint_example_polymorphic_macro_nonintrusive.cc index edb88041..6708c2ac 100644 --- a/examples/checkpoint_example_polymorphic_macro_nonintrusive.cc +++ b/examples/checkpoint_example_polymorphic_macro_nonintrusive.cc @@ -47,7 +47,7 @@ #include "checkpoint/dispatch/dispatch_virtual.h" // \brief Namespace containing types which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \struct Abstract base class struct MyBase { @@ -138,11 +138,11 @@ void test() { } } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { template void serialize(S& s, MyBase& obj) { @@ -173,7 +173,7 @@ void serialize(SerializerT& s, ExampleVector& obj) { s | obj.vec; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; diff --git a/examples/checkpoint_example_polymorphic_nonintrusive.cc b/examples/checkpoint_example_polymorphic_nonintrusive.cc index 0eb9cceb..76f136bc 100644 --- a/examples/checkpoint_example_polymorphic_nonintrusive.cc +++ b/examples/checkpoint_example_polymorphic_nonintrusive.cc @@ -47,11 +47,11 @@ #include "checkpoint/dispatch/dispatch_virtual.h" // \brief Namespace containing types which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { -struct MyBase : ::checkpoint::SerializableBase { +struct MyBase : ::magistrate::SerializableBase { MyBase() { printf("MyBase cons\n"); } - explicit MyBase(::checkpoint::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } + explicit MyBase(::magistrate::SERIALIZE_CONSTRUCT_TAG) { printf("MyBase recons\n"); } virtual ~MyBase() = default; @@ -60,9 +60,9 @@ struct MyBase : ::checkpoint::SerializableBase { virtual void test() = 0; }; -struct MyObj : ::checkpoint::SerializableDerived { +struct MyObj : ::magistrate::SerializableDerived { explicit MyObj(int val) { printf("MyObj cons\n"); val_ = val;} - explicit MyObj(::checkpoint::SERIALIZE_CONSTRUCT_TAG){} + explicit MyObj(::magistrate::SERIALIZE_CONSTRUCT_TAG){} void test() override { printf("test MyObj 10 == %d ?\n", val_); @@ -70,9 +70,9 @@ struct MyObj : ::checkpoint::SerializableDerived { } }; -struct MyObj2 : ::checkpoint::SerializableDerived { +struct MyObj2 : ::magistrate::SerializableDerived { explicit MyObj2(int val) { printf("MyObj2 cons\n"); val_=val; } - explicit MyObj2(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj2(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} void test() override { printf("test MyObj2 20 == %d ?\n", val_); @@ -80,10 +80,10 @@ struct MyObj2 : ::checkpoint::SerializableDerived { } }; -struct MyObj3 : ::checkpoint::SerializableDerived { +struct MyObj3 : ::magistrate::SerializableDerived { int a=0, b=0, c=0; explicit MyObj3(int val) { printf("MyObj3 cons\n"); a= 10; b=20; c=100; val_=val;} - explicit MyObj3(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {} + explicit MyObj3(::magistrate::SERIALIZE_CONSTRUCT_TAG) {} void test() override { printf("val_ 30 a 10 b 20 c 100 = %d %d %d %d\n", val_, a, b, c); @@ -109,25 +109,25 @@ void test() { v.vec.push_back(std::make_unique(20)); v.vec.push_back(std::make_unique(10)); - auto ret = checkpoint::serialize(v); + auto ret = magistrate::serialize(v); auto const& buf = ret->getBuffer(); auto const& buf_size = ret->getSize(); printf("ptr=%p, size=%ld\n*****\n\n", static_cast(buf), buf_size); - auto t = checkpoint::deserialize(buf); + auto t = magistrate::deserialize(buf); for (auto&& elm : t->vec) { elm->test(); } } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { template void serialize(S& s, MyBase& obj) { @@ -158,7 +158,7 @@ void serialize(SerializerT& s, ExampleVector& obj) { s | obj.vec; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; diff --git a/examples/checkpoint_example_to_file.cc b/examples/checkpoint_example_to_file.cc index 7436b652..c370a6fc 100644 --- a/examples/checkpoint_example_to_file.cc +++ b/examples/checkpoint_example_to_file.cc @@ -48,7 +48,7 @@ #include #include -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { static constexpr int const u_val = 934; @@ -123,7 +123,7 @@ bool operator==(const MyTestType &c1, const MyTestType &c2) return isEqual; } -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples int main(int, char**) { @@ -135,13 +135,13 @@ int main(int, char**) { // Call the serialization routine for the variable `my_test_inst` // The output is a unique pointer: `std::unique_ptr` // (defined in `src/checkpoint_api.h`) - checkpoint::serializeToFile(my_test_inst, "hello.txt"); + magistrate::serializeToFile(my_test_inst, "hello.txt"); // // De-serializes from the file an object of type 'MyTestType' // out will be an object of type 'std::unique_ptr' // - auto out = checkpoint::deserializeFromFile("hello.txt"); + auto out = magistrate::deserializeFromFile("hello.txt"); if (my_test_inst == *out) std::cout << " Serialization / Deserialization from file worked. \n"; @@ -157,7 +157,7 @@ int main(int, char**) { // Here 'out_2' will contain an empty vector and an integer 'len_' set to 0. // - checkpoint::deserializeInPlaceFromFile("hello.txt", &out_2); + magistrate::deserializeInPlaceFromFile("hello.txt", &out_2); // // Now 'out_2' will contain: diff --git a/examples/checkpoint_example_to_file_nonintrusive.cc b/examples/checkpoint_example_to_file_nonintrusive.cc index 2fd65a32..aaa9412e 100644 --- a/examples/checkpoint_example_to_file_nonintrusive.cc +++ b/examples/checkpoint_example_to_file_nonintrusive.cc @@ -49,7 +49,7 @@ #include // \brief Namespace containing type which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { static constexpr int const u_val = 934; @@ -103,11 +103,11 @@ bool operator==(const MyTestType &c1, const MyTestType &c2) return isEqual; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize function needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { // \brief Templated function for serializing/deserializing // a variable of type `MyTestType` @@ -129,7 +129,7 @@ void serialize(Serializer& s, MyTestType& c) { s | c.len_; } -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; @@ -140,13 +140,13 @@ int main(int, char**) { // Call the serialization routine for the variable `my_test_inst` // The output is a unique pointer: `std::unique_ptr` // (defined in `src/checkpoint_api.h`) - checkpoint::serializeToFile(my_test_inst, "hello.txt"); + magistrate::serializeToFile(my_test_inst, "hello.txt"); // // De-serializes from the file an object of type 'MyTestType' // out will be an object of type 'std::unique_ptr' // - auto out = checkpoint::deserializeFromFile("hello.txt"); + auto out = magistrate::deserializeFromFile("hello.txt"); if (my_test_inst == *out) { std::cout << " Serialization / Deserialization from file worked. \n"; @@ -164,7 +164,7 @@ int main(int, char**) { // Here 'out_2' will contain an empty vector and an integer 'len_' set to 0. // - checkpoint::deserializeInPlaceFromFile("hello.txt", &out_2); + magistrate::deserializeInPlaceFromFile("hello.txt", &out_2); // // Now 'out_2' will contain: diff --git a/examples/checkpoint_example_traversal.cc b/examples/checkpoint_example_traversal.cc index eea1583a..b180783c 100644 --- a/examples/checkpoint_example_traversal.cc +++ b/examples/checkpoint_example_traversal.cc @@ -48,7 +48,7 @@ #include #include -namespace magistrate { namespace intrusive { namespace examples { +namespace checkpoint { namespace intrusive { namespace examples { struct TestObject { @@ -77,11 +77,11 @@ struct TestObject { std::vector vec3; }; -}}} // end namespace magistrate::intrusive::examples +}}} // end namespace checkpoint::intrusive::examples /// Custom traverser for printing raw bytes -struct PrintBytesTraverse : checkpoint::BaseSerializer { - PrintBytesTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { } +struct PrintBytesTraverse : magistrate::BaseSerializer { + PrintBytesTraverse() : magistrate::BaseSerializer(magistrate::eSerializationMode::None) { } void contiguousBytes(void*, std::size_t size, std::size_t num_elms) { printf("PrintBytesTraverse: size=%zu, num_elms=%zu\n", size, num_elms); @@ -125,11 +125,11 @@ struct CustomDispatch> { }; /// Custom traverser for printing typed ranges -struct TypedTraverse : checkpoint::BaseSerializer { +struct TypedTraverse : magistrate::BaseSerializer { template using DispatcherType = CustomDispatch; - TypedTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { } + TypedTraverse() : magistrate::BaseSerializer(magistrate::eSerializationMode::None) { } template void contiguousTyped(SerializerT&, T*, std::size_t num_elms) { @@ -143,11 +143,11 @@ int main(int, char**) { TestObject my_obj(TestObject::MakeTag{}); // Traverse my_obj with a custom traverser that prints the bytes - checkpoint::dispatch::Traverse::with(my_obj); + magistrate::dispatch::Traverse::with(my_obj); // Traverse my_obj with a custom traverser and dispatcher that prints the // types and lens - checkpoint::dispatch::Traverse::with(my_obj); + magistrate::dispatch::Traverse::with(my_obj); return 0; } diff --git a/examples/checkpoint_example_traversal_nonintrusive.cc b/examples/checkpoint_example_traversal_nonintrusive.cc index 8131c461..caa4dca8 100644 --- a/examples/checkpoint_example_traversal_nonintrusive.cc +++ b/examples/checkpoint_example_traversal_nonintrusive.cc @@ -49,7 +49,7 @@ #include // \brief Namespace containing type which will be serialized -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { struct TestObject { @@ -76,11 +76,11 @@ struct TestObject { std::vector vec3; }; -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples // \brief In Non-Intrusive way, serialize functionality needs to be placed in the namespace // of the type which will be serialized. -namespace magistrate { namespace nonintrusive { namespace examples { +namespace checkpoint { namespace nonintrusive { namespace examples { template void serialize(Serializer& s, TestObject& obj) { @@ -92,8 +92,8 @@ void serialize(Serializer& s, TestObject& obj) { } /// Custom traverser for printing raw bytes -struct PrintBytesTraverse : checkpoint::BaseSerializer { - PrintBytesTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { } +struct PrintBytesTraverse : magistrate::BaseSerializer { + PrintBytesTraverse() : magistrate::BaseSerializer(magistrate::eSerializationMode::None) { } void contiguousBytes(void*, std::size_t size, std::size_t num_elms) { printf("PrintBytesTraverse: size=%zu, num_elms=%zu\n", size, num_elms); @@ -137,11 +137,11 @@ struct CustomDispatch> { }; /// Custom traverser for printing typed ranges -struct TypedTraverse : checkpoint::BaseSerializer { +struct TypedTraverse : magistrate::BaseSerializer { template using DispatcherType = CustomDispatch; - TypedTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { } + TypedTraverse() : magistrate::BaseSerializer(magistrate::eSerializationMode::None) { } template void contiguousTyped(SerializerT&, T*, std::size_t num_elms) { @@ -149,7 +149,7 @@ struct TypedTraverse : checkpoint::BaseSerializer { } }; -}}} // end namespace magistrate::nonintrusive::examples +}}} // end namespace checkpoint::nonintrusive::examples int main(int, char**) { using namespace magistrate::nonintrusive::examples; @@ -157,11 +157,11 @@ int main(int, char**) { TestObject my_obj(TestObject::MakeTag{}); // Traverse my_obj with a custom traverser that prints the bytes - checkpoint::dispatch::Traverse::with(my_obj); + magistrate::dispatch::Traverse::with(my_obj); // Traverse my_obj with a custom traverser and dispatcher that prints the // types and lens - checkpoint::dispatch::Traverse::with(my_obj); + magistrate::dispatch::Traverse::with(my_obj); return 0; }