Skip to content

Commit

Permalink
#249: Change namespace style
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable committed Jul 26, 2022
1 parent c074cf8 commit a562826
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions examples/checkpoint_example_1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include <cstdio>

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

// \struct MyTest
// \brief Simple structure with two variables of built-in types
Expand Down Expand Up @@ -105,7 +105,7 @@ struct MyTest {
}
};

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples

int main(int, char**) {
using namespace magistrate::intrusive::examples;
Expand Down
8 changes: 4 additions & 4 deletions examples/checkpoint_example_1_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <cstdio>

// \brief Namespace containing type which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \brief Simple structure with three variables of built-in types
struct MyTest3 {
Expand All @@ -60,12 +60,12 @@ struct MyTest3 {
}
};

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { 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.
Expand Down Expand Up @@ -93,7 +93,7 @@ namespace magistrate::nonintrusive::examples {
s | my_test3.c;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

int main(int, char**) {
using namespace magistrate::nonintrusive::examples;
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include <cstdio>

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

// \struct MyTest2
// \brief Simple structure with one variable of built-in type
Expand Down Expand Up @@ -125,7 +125,7 @@ struct MyTest {
}
};

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples

int main(int, char**) {
using namespace magistrate::intrusive::examples;
Expand Down
8 changes: 4 additions & 4 deletions examples/checkpoint_example_2_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <cstdio>

// \brief Namespace containing types which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \struct MyTest2
// \brief Simple structure with one variable of built-in type
Expand Down Expand Up @@ -90,11 +90,11 @@ struct MyTest {
}
};

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \brief Templated function for serializing/deserializing
// a variable of type `MyTest`
Expand Down Expand Up @@ -132,7 +132,7 @@ void serialize(Serializer& s, MyTest2& my_test2) {
s | my_test2.c;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

int main(int, char**) {
using namespace magistrate::nonintrusive::examples;
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
// class of a serializable/deserializable type.
//

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

// \brief Structure with a variable of built-in type.
//
Expand Down Expand Up @@ -120,7 +120,7 @@ struct TestReconstruct {
}
};

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples

#include "checkpoint/traits/serializable_traits.h"

Expand Down
12 changes: 6 additions & 6 deletions examples/checkpoint_example_3_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//

// \brief Namespace containing types which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \brief Structure with a variable of built-in type.
struct TestDefaultCons {
Expand All @@ -81,7 +81,7 @@ struct TestNoSerialize {
struct TestShouldFailReconstruct {
int a = 29;

TestShouldFailReconstruct(int const) { }
explicit TestShouldFailReconstruct(int const) { }
TestShouldFailReconstruct() = delete;
};

Expand All @@ -94,7 +94,7 @@ struct TestShouldFailReconstruct {
struct TestReconstruct {
int a = 29;

TestReconstruct(int const) { }
explicit TestReconstruct(int const) { }
TestReconstruct() = delete;

static TestReconstruct& reconstruct(void* buf) {
Expand All @@ -103,11 +103,11 @@ struct TestReconstruct {
}
};

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \breif Non-Intrusive Serialize method for TestDefaultCons structure.
//
Expand All @@ -130,7 +130,7 @@ void serialize(Serializer& s, TestReconstruct& tr) {
s | tr.a;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

#include "checkpoint/traits/serializable_traits.h"

Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <checkpoint/checkpoint.h>
#include "checkpoint/dispatch/dispatch_virtual.h"

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

struct MyBase : ::checkpoint::SerializableBase<MyBase> {
MyBase() { printf("MyBase cons\n"); }
Expand Down Expand Up @@ -148,7 +148,7 @@ void test() {
}
}

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples

int main(int, char**) {
using namespace magistrate::intrusive::examples;
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic_macro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <checkpoint/checkpoint.h>
#include "checkpoint/dispatch/dispatch_virtual.h"

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

// \struct Abstract base class
struct MyBase {
Expand Down Expand Up @@ -167,7 +167,7 @@ void test() {
}
}

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples

int main(int, char**) {
using namespace magistrate::intrusive::examples;
Expand Down
8 changes: 4 additions & 4 deletions examples/checkpoint_example_polymorphic_macro_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "checkpoint/dispatch/dispatch_virtual.h"

// \brief Namespace containing types which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \struct Abstract base class
struct MyBase {
Expand Down Expand Up @@ -142,11 +142,11 @@ void test() {
}
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

template <typename S>
void serialize(S& s, MyBase& obj) {
Expand Down Expand Up @@ -177,7 +177,7 @@ void serialize(SerializerT& s, ExampleVector& obj) {
s | obj.vec;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

int main(int, char**) {
using namespace magistrate::nonintrusive::examples;
Expand Down
8 changes: 4 additions & 4 deletions examples/checkpoint_example_polymorphic_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "checkpoint/dispatch/dispatch_virtual.h"

// \brief Namespace containing types which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

struct MyBase : ::checkpoint::SerializableBase<MyBase> {
MyBase() { printf("MyBase cons\n"); }
Expand Down Expand Up @@ -123,11 +123,11 @@ void test() {
}
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

template <typename S>
void serialize(S& s, MyBase& obj) {
Expand Down Expand Up @@ -158,7 +158,7 @@ void serialize(SerializerT& s, ExampleVector& obj) {
s | obj.vec;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

int main(int, char**) {
using namespace magistrate::nonintrusive::examples;
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_to_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <iostream>
#include <vector>

namespace magistrate::intrusive::examples {
namespace magistrate { namespace intrusive { namespace examples {

static constexpr int const u_val = 934;

Expand Down Expand Up @@ -123,7 +123,7 @@ bool operator==(const MyTestType &c1, const MyTestType &c2)
return isEqual;
}

} // end namespace magistrate::intrusive::examples
}}} // end namespace magistrate::intrusive::examples


int main(int, char**) {
Expand Down
8 changes: 4 additions & 4 deletions examples/checkpoint_example_to_file_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <vector>

// \brief Namespace containing type which will be serialized
namespace magistrate::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

static constexpr int const u_val = 934;

Expand Down Expand Up @@ -103,11 +103,11 @@ bool operator==(const MyTestType &c1, const MyTestType &c2)
return isEqual;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::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::nonintrusive::examples {
namespace magistrate { namespace nonintrusive { namespace examples {

// \brief Templated function for serializing/deserializing
// a variable of type `MyTestType`
Expand All @@ -129,7 +129,7 @@ void serialize(Serializer& s, MyTestType& c) {
s | c.len_;
}

} // end namespace magistrate::nonintrusive::examples
}}} // end namespace magistrate::nonintrusive::examples

int main(int, char**) {
using namespace magistrate::nonintrusive::examples;
Expand Down

0 comments on commit a562826

Please sign in to comment.