|
@@ -22,17 +22,11 @@
|
22
|
22
|
namespace Lemma {
|
23
|
23
|
|
24
|
24
|
// ==================== FRIEND METHODS =====================
|
25
|
|
-#ifdef HAVE_YAMLCPP
|
|
25
|
+
|
26
|
26
|
std::ostream &operator << (std::ostream &stream, const DEMParticle &ob) {
|
27
|
27
|
stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
|
28
|
28
|
return stream;
|
29
|
29
|
}
|
30
|
|
-#else
|
31
|
|
-std::ostream &operator<<(std::ostream &stream, const DEMParticle& ob) {
|
32
|
|
- stream << *(LemmaObject*)(&ob);
|
33
|
|
- return stream;
|
34
|
|
-}
|
35
|
|
-#endif
|
36
|
30
|
|
37
|
31
|
// ==================== LIFECYCLE =======================
|
38
|
32
|
|
|
@@ -45,7 +39,6 @@ DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
|
45
|
39
|
|
46
|
40
|
} // ----- end of method DEMParticle::DEMParticle (constructor) -----
|
47
|
41
|
|
48
|
|
-#ifdef HAVE_YAMLCPP
|
49
|
42
|
//--------------------------------------------------------------------------------------
|
50
|
43
|
// Class: DEMParticle
|
51
|
44
|
// Method: DEMParticle
|
|
@@ -54,7 +47,6 @@ DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
|
54
|
47
|
DEMParticle::DEMParticle (const YAML::Node& node) : LemmaObject(node) {
|
55
|
48
|
this->centreMass = node["centreMass"].as<Vector3r>();
|
56
|
49
|
} // ----- end of method DEMParticle::DEMParticle (constructor) -----
|
57
|
|
-#endif
|
58
|
50
|
|
59
|
51
|
//--------------------------------------------------------------------------------------
|
60
|
52
|
// Class: DEMParticle
|
|
@@ -75,14 +67,13 @@ DEMParticle::~DEMParticle () {
|
75
|
67
|
|
76
|
68
|
} // ----- end of method DEMParticle::~DEMParticle (destructor) -----
|
77
|
69
|
|
78
|
|
-#ifdef HAVE_YAMLCPP
|
79
|
70
|
//--------------------------------------------------------------------------------------
|
80
|
71
|
// Class: DEMParticle
|
81
|
72
|
// Method: Serialize
|
82
|
73
|
//--------------------------------------------------------------------------------------
|
83
|
74
|
YAML::Node DEMParticle::Serialize ( ) const {
|
84
|
75
|
YAML::Node node = LemmaObject::Serialize();;
|
85
|
|
- node.SetTag( this->GetName() );
|
|
76
|
+ node.SetTag( GetName() );
|
86
|
77
|
// FILL IN CLASS SPECIFICS HERE
|
87
|
78
|
node["centreMass"] = centreMass;
|
88
|
79
|
return node;
|
|
@@ -93,12 +84,12 @@ YAML::Node DEMParticle::Serialize ( ) const {
|
93
|
84
|
// Method: DeSerialize
|
94
|
85
|
//--------------------------------------------------------------------------------------
|
95
|
86
|
std::shared_ptr<DEMParticle> DEMParticle::DeSerialize ( const YAML::Node& node ) {
|
|
87
|
+ if (node.Tag() != "DEMParticle") {
|
|
88
|
+ throw DeSerializeTypeMismatch( "DEMParticle", node.Tag());
|
|
89
|
+ }
|
96
|
90
|
std::shared_ptr<DEMParticle> Object(new DEMParticle(node), LemmaObjectDeleter() );
|
97
|
|
- DESERIALIZECHECK( node, Object.get() )
|
98
|
|
- return Object ;
|
|
91
|
+ return Object ;
|
99
|
92
|
} // ----- end of method DEMParticle::DeSerialize -----
|
100
|
|
-#endif
|
101
|
|
-
|
102
|
93
|
|
103
|
94
|
//--------------------------------------------------------------------------------------
|
104
|
95
|
// Class: DEMParticle
|
|
@@ -120,3 +111,5 @@ void DEMParticle::SetCentreMass ( const Vector3r& pos ) {
|
120
|
111
|
|
121
|
112
|
} // ----- end of Lemma name -----
|
122
|
113
|
|
|
114
|
+/* vim: set tabstop=4 expandtab: */
|
|
115
|
+/* vim: set filetype=cpp: */
|