Browse Source

Cleaning up yaml parts of Lemma.

enhancement_3
Trevor Irons 8 years ago
parent
commit
6f0e4f605d

+ 0
- 4
LemmaCore/include/EarthModel.h View File

32
         public:
32
         public:
33
 
33
 
34
             // ====================  LIFECYCLE     =======================
34
             // ====================  LIFECYCLE     =======================
35
-            #ifdef HAVE_YAMLCPP
36
             /** YAML Serializing method
35
             /** YAML Serializing method
37
              */
36
              */
38
             YAML::Node Serialize() const;
37
             YAML::Node Serialize() const;
39
             //static LayeredEarth* DeSerialize(const YAML::Node& node);
38
             //static LayeredEarth* DeSerialize(const YAML::Node& node);
40
-            #endif
41
 
39
 
42
             // ====================  OPERATORS     =======================
40
             // ====================  OPERATORS     =======================
43
 
41
 
99
             /// Default protected constructor.
97
             /// Default protected constructor.
100
             EarthModel (const std::string& name);
98
             EarthModel (const std::string& name);
101
 
99
 
102
-            #ifdef HAVE_YAMLCPP
103
             /** Deserialize constructor */
100
             /** Deserialize constructor */
104
             EarthModel (const YAML::Node& node);
101
             EarthModel (const YAML::Node& node);
105
-            #endif
106
 
102
 
107
             /// Default protected constructor.
103
             /// Default protected constructor.
108
             ~EarthModel ();
104
             ~EarthModel ();

+ 2
- 3
LemmaCore/include/GridReader.h View File

30
      */
30
      */
31
     class GridReader : public LemmaObject {
31
     class GridReader : public LemmaObject {
32
 
32
 
33
-        friend std::ostream &operator<<(std::ostream &stream,
34
-                const GridReader &ob) {
35
-            stream << *(LemmaObject*)(&ob);
33
+        friend std::ostream &operator << (std::ostream &stream, const GridReader &ob) {
34
+            stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
36
             return stream;
35
             return stream;
37
         }
36
         }
38
 
37
 

+ 0
- 4
LemmaCore/include/LayeredEarth.h View File

80
              */
80
              */
81
 			Real GetLayerDepth(const int & lay);
81
 			Real GetLayerDepth(const int & lay);
82
 
82
 
83
-            #ifdef HAVE_YAMLCPP
84
             /** YAML Serializing method
83
             /** YAML Serializing method
85
              */
84
              */
86
             YAML::Node Serialize() const;
85
             YAML::Node Serialize() const;
87
             //static LayeredEarth* DeSerialize(const YAML::Node& node);
86
             //static LayeredEarth* DeSerialize(const YAML::Node& node);
88
-            #endif
89
 
87
 
90
 		protected:
88
 		protected:
91
 
89
 
94
 			/** Default protected constructor. */
92
 			/** Default protected constructor. */
95
 			LayeredEarth (const std::string& name);
93
 			LayeredEarth (const std::string& name);
96
 
94
 
97
-            #ifdef HAVE_YAMLCPP
98
             /** Default protected constructor. */
95
             /** Default protected constructor. */
99
 			LayeredEarth (const YAML::Node& node);
96
 			LayeredEarth (const YAML::Node& node);
100
-            #endif
101
 
97
 
102
 			/** Default protected constructor. */
98
 			/** Default protected constructor. */
103
 			~LayeredEarth ();
99
 			~LayeredEarth ();

+ 11
- 20
LemmaCore/include/LemmaObject.h View File

15
 
15
 
16
 #include "helper.h"
16
 #include "helper.h"
17
 #include "lemma.h"
17
 #include "lemma.h"
18
-
19
-#ifdef HAVE_YAMLCPP
20
 #include "yaml-cpp/yaml.h"
18
 #include "yaml-cpp/yaml.h"
21
-#endif
22
 
19
 
23
 #include <chrono>
20
 #include <chrono>
24
 #include <memory>
21
 #include <memory>
37
   */
34
   */
38
 class LemmaObject {
35
 class LemmaObject {
39
 
36
 
40
-    /** Recursively prints information about this object
37
+    /**
38
+     *  Streams class information as YAML::Node
41
      */
39
      */
42
-    friend std::ostream &operator<<(std::ostream &stream, const LemmaObject &ob);
43
-
44
-    #ifdef HAVE_YAMLCPP
45
     friend YAML::Emitter& operator << (YAML::Emitter& out, const LemmaObject &ob) ;
40
     friend YAML::Emitter& operator << (YAML::Emitter& out, const LemmaObject &ob) ;
46
-    #endif
47
 
41
 
48
     friend class LemmaObjectDeleter;
42
     friend class LemmaObjectDeleter;
49
 
43
 
66
         /** Returns the name of the class, similiar to Python's type */
60
         /** Returns the name of the class, similiar to Python's type */
67
         std::string GetName() const;
61
         std::string GetName() const;
68
 
62
 
69
-        #ifdef HAVE_YAMLCPP
70
         /**
63
         /**
71
          *  Uses YAML to serialize this object.
64
          *  Uses YAML to serialize this object.
72
          *  @return a YAML::Node
65
          *  @return a YAML::Node
80
          */
73
          */
81
         virtual YAML::Node Serialize() const {
74
         virtual YAML::Node Serialize() const {
82
             YAML::Node node = YAML::Node();
75
             YAML::Node node = YAML::Node();
83
-
84
             std::time_t now = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
76
             std::time_t now = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
85
             node["Serialized"] = std::ctime(&now);
77
             node["Serialized"] = std::ctime(&now);
86
             return node;
78
             return node;
87
         };
79
         };
88
-        #endif
89
 
80
 
90
     protected:
81
     protected:
91
 
82
 
96
          */
87
          */
97
         LemmaObject (const std::string &name);
88
         LemmaObject (const std::string &name);
98
 
89
 
99
-        #ifdef HAVE_YAMLCPP
100
         /** Protected DeDerializing constructor, use factory DeSerialize  method*/
90
         /** Protected DeDerializing constructor, use factory DeSerialize  method*/
101
         LemmaObject (const YAML::Node& node);
91
         LemmaObject (const YAML::Node& node);
102
-        #endif
103
 
92
 
104
         /** Protected default destructor. This is an abstract class and
93
         /** Protected default destructor. This is an abstract class and
105
          *  cannot be instantiated.
94
          *  cannot be instantiated.
110
 
99
 
111
         // ====================  DATA MEMBERS  ==============================
100
         // ====================  DATA MEMBERS  ==============================
112
 
101
 
102
+        static const std::string  CName;
103
+
113
         /** Stores an ASCII string representation of the class name */
104
         /** Stores an ASCII string representation of the class name */
114
         std::string Name;
105
         std::string Name;
115
 
106
 
121
         void operator()(LemmaObject* p) { delete p; }
112
         void operator()(LemmaObject* p) { delete p; }
122
 };
113
 };
123
 
114
 
124
-    /////////////////////////////////////////////////////////////////
125
-    // BOILERPLATE MACROS
126
-    #define DESERIALIZECHECK( node, Object ) { \
127
-        if (node.Tag() != Object->GetName()) {  \
128
-            throw  DeSerializeTypeMismatch(Object, node.Tag()) ; \
129
-        } } \
115
+//     /////////////////////////////////////////////////////////////////
116
+//     // BOILERPLATE MACROS
117
+//     #define DESERIALIZECHECK( node, Object ) { \
118
+//         if (node.Tag() != Object->GetName()) {  \
119
+//             throw  DeSerializeTypeMismatch(Object, node.Tag()) ; \
120
+//         } } \
130
 
121
 
131
     /////////////////////////////////////////////////////////////////
122
     /////////////////////////////////////////////////////////////////
132
     // Error Classes
123
     // Error Classes
136
      */
127
      */
137
     class DeSerializeTypeMismatch : public std::runtime_error {
128
     class DeSerializeTypeMismatch : public std::runtime_error {
138
         public:
129
         public:
139
-            DeSerializeTypeMismatch(LemmaObject *ptr, const std::string& got);
130
+            DeSerializeTypeMismatch(const std::string& expected, const std::string& got);
140
 
131
 
141
     };
132
     };
142
 
133
 

+ 0
- 6
LemmaCore/include/helper.h View File

23
 #define  HELPER_INC
23
 #define  HELPER_INC
24
 
24
 
25
 #include "lemma.h"
25
 #include "lemma.h"
26
-
27
-#ifdef HAVE_YAMLCPP
28
 #include "yaml-cpp/yaml.h"
26
 #include "yaml-cpp/yaml.h"
29
-#endif
30
 
27
 
31
 namespace Lemma {
28
 namespace Lemma {
32
 
29
 
102
 
99
 
103
 } // end namespace Lemma
100
 } // end namespace Lemma
104
 
101
 
105
-#ifdef HAVE_YAMLCPP
106
-
107
 ///////////////////////////////////////////////////////
102
 ///////////////////////////////////////////////////////
108
 // YAML Serializing helper functions. Can we move this into helper.h
103
 // YAML Serializing helper functions. Can we move this into helper.h
109
 namespace YAML {
104
 namespace YAML {
271
 };
266
 };
272
 
267
 
273
 }
268
 }
274
-#endif //HAVE_YAMLCPP
275
 
269
 
276
 #endif   // ----- #ifndef HELPER_INC  -----
270
 #endif   // ----- #ifndef HELPER_INC  -----
277
 
271
 

+ 2
- 4
LemmaCore/src/ASCIIParser.cpp View File

24
 
24
 
25
     // ====================  FRIEND METHODS  =====================
25
     // ====================  FRIEND METHODS  =====================
26
 
26
 
27
-    std::ostream &operator<<(std::ostream &stream, const ASCIIParser &ob) {
28
-
29
-        stream << *(LemmaObject*)(&ob);
30
-
27
+    std::ostream &operator << (std::ostream &stream, const ASCIIParser &ob) {
28
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
31
         return stream;
29
         return stream;
32
     }
30
     }
33
 
31
 

+ 2
- 4
LemmaCore/src/CubicSplineInterpolator.cpp View File

29
 
29
 
30
     // ====================  FRIEND METHODS  =====================
30
     // ====================  FRIEND METHODS  =====================
31
 
31
 
32
-    std::ostream &operator<<(std::ostream &stream, const CubicSplineInterpolator &ob) {
33
-
34
-        stream << *(LemmaObject*)(&ob);
35
-
32
+    std::ostream &operator << (std::ostream &stream, const CubicSplineInterpolator &ob) {
33
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
36
         return stream;
34
         return stream;
37
     }
35
     }
38
 
36
 

+ 4
- 5
LemmaCore/src/Data.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-			const Data &ob) {
20
-		stream << *(LemmaObject*)(&ob);
21
-		return stream;
22
-	}
18
+    std::ostream &operator << (std::ostream &stream, const Data &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
23
 
22
 
24
 	Data::Data(const std::string &name) : LemmaObject(name) {
23
 	Data::Data(const std::string &name) : LemmaObject(name) {
25
 	}
24
 	}

+ 4
- 5
LemmaCore/src/DataReader.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-		const DataReader &ob) {
20
-		stream << *(LemmaObject*)(&ob);
21
-		return stream;
22
-	}
18
+    std::ostream &operator << (std::ostream &stream, const DataReader &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
23
 
22
 
24
 	DataReader::DataReader(const std::string &name) :
23
 	DataReader::DataReader(const std::string &name) :
25
 			LemmaObject(name) {
24
 			LemmaObject(name) {

+ 4
- 8
LemmaCore/src/EarthModel.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-				const EarthModel &ob) {
20
-
21
-		stream << *(LemmaObject*)(&ob);
22
-		return stream;
23
-	}
18
+    std::ostream &operator << (std::ostream &stream, const EarthModel &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
24
 
22
 
25
 	// ====================  LIFECYCLE     =======================
23
 	// ====================  LIFECYCLE     =======================
26
 
24
 
28
 			LemmaObject(name), BField(0,0,0), BFieldUnit(0,0,0), BInc(0), BDec(0), BMag(0) {
26
 			LemmaObject(name), BField(0,0,0), BFieldUnit(0,0,0), BInc(0), BDec(0), BMag(0) {
29
 	}
27
 	}
30
 
28
 
31
-    #ifdef HAVE_YAMLCPP
32
     EarthModel::EarthModel(const YAML::Node& node) : LemmaObject(node) {
29
     EarthModel::EarthModel(const YAML::Node& node) : LemmaObject(node) {
33
         BInc = node["BInc"].as<double>();
30
         BInc = node["BInc"].as<double>();
34
         BDec = node["BDec"].as<double>();
31
         BDec = node["BDec"].as<double>();
46
         node["BMag"] = BMag;
43
         node["BMag"] = BMag;
47
         return node;
44
         return node;
48
     }
45
     }
49
-    #endif
50
 
46
 
51
 	EarthModel::~EarthModel() {
47
 	EarthModel::~EarthModel() {
52
 	}
48
 	}

+ 4
- 5
LemmaCore/src/Grid.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-				const Grid &ob) {
18
+    std::ostream &operator << (std::ostream &stream, const Grid &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
20
 
22
 
21
-		stream << *(LemmaObject*)(&ob);
22
-		return stream;
23
-	}
24
 
23
 
25
 	Grid::Grid  ( const std::string& name ) : LemmaObject(name) {
24
 	Grid::Grid  ( const std::string& name ) : LemmaObject(name) {
26
 	}
25
 	}

+ 4
- 6
LemmaCore/src/Instrument.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-				const Instrument &ob) {
20
-
21
-		stream << *(LemmaObject*)(&ob);
22
-		return stream;
23
-	}
18
+    std::ostream &operator << (std::ostream &stream, const Instrument &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
24
 
22
 
25
 	Instrument::Instrument(const std::string &name) :
23
 	Instrument::Instrument(const std::string &name) :
26
 			LemmaObject(name) {
24
 			LemmaObject(name) {

+ 8
- 4
LemmaCore/src/LayeredEarth.cpp View File

16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
 	// ====================    FRIENDS     ======================
18
 	// ====================    FRIENDS     ======================
19
+
20
+    /*
19
 	std::ostream &operator<<(std::ostream &stream,
21
 	std::ostream &operator<<(std::ostream &stream,
20
 				const LayeredEarth &ob) {
22
 				const LayeredEarth &ob) {
21
 		stream << *(EarthModel*)(&ob);
23
 		stream << *(EarthModel*)(&ob);
22
   		//stream << "Class Name : "<< ob.Name  << "\n";
24
   		//stream << "Class Name : "<< ob.Name  << "\n";
23
   		stream << "Number of Layers "<< ob.NumberOfLayers  << "\n";
25
   		stream << "Number of Layers "<< ob.NumberOfLayers  << "\n";
24
-
25
   		return stream;
26
   		return stream;
26
 	}
27
 	}
28
+    */
29
+
30
+    std::ostream &operator << (std::ostream &stream, const LayeredEarth &ob) {
31
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
32
+        return stream;
33
+    }
27
 
34
 
28
 	// ====================  LIFECYCLE     ===================================
35
 	// ====================  LIFECYCLE     ===================================
29
 
36
 
37
 	LayeredEarth::~LayeredEarth() {
44
 	LayeredEarth::~LayeredEarth() {
38
 	}
45
 	}
39
 
46
 
40
-    #ifdef HAVE_YAMLCPP
41
     LayeredEarth::LayeredEarth(const YAML::Node& node) : EarthModel(node)
47
     LayeredEarth::LayeredEarth(const YAML::Node& node) : EarthModel(node)
42
     {
48
     {
43
         NumberOfLayers = node["NumberOfLayers"].as<int>();
49
         NumberOfLayers = node["NumberOfLayers"].as<int>();
47
 
53
 
48
     YAML::Node LayeredEarth::Serialize() const {
54
     YAML::Node LayeredEarth::Serialize() const {
49
         YAML::Node node = EarthModel::Serialize();
55
         YAML::Node node = EarthModel::Serialize();
50
-
51
         node["NumberOfLayers"] = NumberOfLayers;
56
         node["NumberOfLayers"] = NumberOfLayers;
52
         node["NumberOfInterfaces"] = NumberOfInterfaces;
57
         node["NumberOfInterfaces"] = NumberOfInterfaces;
53
         node["LayerThickness"] = LayerThickness;
58
         node["LayerThickness"] = LayerThickness;
54
         node.SetTag( this->GetName() );
59
         node.SetTag( this->GetName() );
55
         return node;
60
         return node;
56
     }
61
     }
57
-    #endif
58
 
62
 
59
 	// ====================  OPERATIONS    ===================================
63
 	// ====================  OPERATIONS    ===================================
60
 
64
 

+ 3
- 11
LemmaCore/src/LemmaObject.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-    std::ostream &operator<<(std::ostream &stream,
19
-                const LemmaObject &ob) {
20
-      stream << "Class name= " << ob.Name  << "\n";
21
-      return stream;
22
-    }
18
+    //LemmaObject::CName = std::string("LemmaObject");
23
 
19
 
24
-    #ifdef HAVE_YAMLCPP
25
     YAML::Emitter& operator << (YAML::Emitter& out, const LemmaObject& ob) {
20
     YAML::Emitter& operator << (YAML::Emitter& out, const LemmaObject& ob) {
26
         out << YAML::BeginMap;
21
         out << YAML::BeginMap;
27
         out << YAML::Key <<"Class Name"    << YAML::Value << ob.GetName();
22
         out << YAML::Key <<"Class Name"    << YAML::Value << ob.GetName();
28
         return out;
23
         return out;
29
     }
24
     }
30
-    #endif
31
 
25
 
32
     // ====================  LIFECYCLE     ==============================
26
     // ====================  LIFECYCLE     ==============================
33
 
27
 
35
     LemmaObject::LemmaObject(const std::string& name) : Name(name) {
29
     LemmaObject::LemmaObject(const std::string& name) : Name(name) {
36
     }
30
     }
37
 
31
 
38
-    #ifdef HAVE_YAMLCPP
39
     LemmaObject::LemmaObject(const YAML::Node &node) : Name(node.Tag()) {
32
     LemmaObject::LemmaObject(const YAML::Node &node) : Name(node.Tag()) {
40
     }
33
     }
41
-    #endif
42
 
34
 
43
     // Destructor
35
     // Destructor
44
     LemmaObject::~LemmaObject() {
36
     LemmaObject::~LemmaObject() {
61
     //////////////////////////////////////////////////////////////////////
53
     //////////////////////////////////////////////////////////////////////
62
     //////////////////////////////////////////////////////////////////////
54
     //////////////////////////////////////////////////////////////////////
63
 
55
 
64
-    DeSerializeTypeMismatch::DeSerializeTypeMismatch(LemmaObject *ptr, const std::string& got) :
56
+    DeSerializeTypeMismatch::DeSerializeTypeMismatch(const std::string& expected, const std::string& got) :
65
         runtime_error("DESERIALIZE TYPE MISMATCH") {
57
         runtime_error("DESERIALIZE TYPE MISMATCH") {
66
-            std::cerr << "Expected " << ptr->GetName() << " got " << got << std::endl;
58
+            std::cerr << "Expected " << expected << " got " << got << std::endl;
67
         }
59
         }
68
 
60
 
69
     RequestToReturnNullPointer::
61
     RequestToReturnNullPointer::

+ 6
- 2
LemmaCore/src/RectilinearGrid.cpp View File

15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
+    std::ostream &operator << (std::ostream &stream, const RectilinearGrid &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
20
+        return stream;
21
+    }
18
 
22
 
23
+    /*
19
 	std::ostream &operator<<(std::ostream &stream, const
24
 	std::ostream &operator<<(std::ostream &stream, const
20
 	    RectilinearGrid &ob) {
25
 	    RectilinearGrid &ob) {
21
-
22
 		stream << *(LemmaObject*)(&ob);
26
 		stream << *(LemmaObject*)(&ob);
23
-
24
         stream << "\tnx=" << ob.nx << "\tny=" << ob.ny << "\tnz=" << ob.nz << std::endl;
27
         stream << "\tnx=" << ob.nx << "\tny=" << ob.ny << "\tnz=" << ob.nz << std::endl;
25
         stream << "\tox=" << ob.ox << "\toy=" << ob.oy << "\toz=" << ob.oz << std::endl;
28
         stream << "\tox=" << ob.ox << "\toy=" << ob.oy << "\toz=" << ob.oz << std::endl;
26
         stream << "\tdx=" << ob.dx.transpose() << std::endl;
29
         stream << "\tdx=" << ob.dx.transpose() << std::endl;
28
         stream << "\tdz=" << ob.dz.transpose() << std::endl;
31
         stream << "\tdz=" << ob.dz.transpose() << std::endl;
29
 		return stream;
32
 		return stream;
30
 	}
33
 	}
34
+    */
31
 
35
 
32
     // ====================  LIFECYCLE     =======================
36
     // ====================  LIFECYCLE     =======================
33
 
37
 

+ 2
- 4
LemmaCore/src/RectilinearGridReader.cpp View File

21
 
21
 
22
     // ====================  FRIEND METHODS  =====================
22
     // ====================  FRIEND METHODS  =====================
23
 
23
 
24
-    std::ostream &operator<<(std::ostream &stream, const RectilinearGridReader &ob) {
25
-
26
-        stream << *(GridReader*)(&ob);
27
-
24
+    std::ostream &operator << (std::ostream &stream, const RectilinearGridReader &ob) {
25
+        stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
28
         return stream;
26
         return stream;
29
     }
27
     }
30
 
28
 

+ 3
- 2
LemmaCore/src/RectilinearGridVTKExporter.cpp View File

25
 
25
 
26
 // ====================  FRIEND METHODS  =====================
26
 // ====================  FRIEND METHODS  =====================
27
 
27
 
28
-std::ostream &operator<<(std::ostream &stream, const RectilinearGridVTKExporter &ob) {
29
-    stream << *(LemmaObject*)(&ob);
28
+std::ostream &operator << (std::ostream &stream, const RectilinearGridVTKExporter &ob) {
29
+    stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
30
     return stream;
30
     return stream;
31
 }
31
 }
32
 
32
 
33
+
33
 // ====================  LIFECYCLE     =======================
34
 // ====================  LIFECYCLE     =======================
34
 
35
 
35
 //--------------------------------------------------------------------------------------
36
 //--------------------------------------------------------------------------------------

+ 21
- 0
vim/c.vim View File

1
+"===================================================================================
2
+"
3
+"         FILE:  c.vim
4
+"  DESCRIPTION:  syntax file
5
+"                enable syntax based folding
6
+"                part of the c-support plugin
7
+"
8
+"       AUTHOR:  Trevor Irons
9
+"        EMAIL:  tirons@mines.edu
10
+"      COMPANY:  FH Südwestfalen, Iserlohn
11
+"      VERSION:  1.0
12
+"      CREATED:  11.03.2006
13
+"     REVISION:  ---
14
+"===================================================================================
15
+"
16
+" fold C blocks
17
+"
18
+syn region cBlock start="{" end="}" transparent fold
19
+set foldmethod=syntax
20
+set foldlevel=999
21
+

+ 675
- 0
vim/cpp.cpp.template View File

1
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
+$
3
+== cpp.cin ==
4
+cin	>> <CURSOR>;
5
+$
6
+== cpp.cout-variabe ==
7
+cout	<< <CURSOR> << endl;
8
+$
9
+== cpp.cout-string ==
10
+cout	<< "<CURSOR>\n";
11
+$
12
+== cpp.cout-operator == insert ==
13
+<< "<CURSOR>"
14
+$
15
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
+== cpp.output-manipulator-boolalpha       == insert ==
17
+<< boolalpha <CURSOR>
18
+== cpp.output-manipulator-dec             == insert ==
19
+<< dec <CURSOR>
20
+== cpp.output-manipulator-endl            == insert ==
21
+<< endl <CURSOR>
22
+== cpp.output-manipulator-fixed           == insert ==
23
+<< fixed <CURSOR>
24
+== cpp.output-manipulator-flush           == insert ==
25
+<< flush <CURSOR>
26
+== cpp.output-manipulator-hex             == insert ==
27
+<< hex <CURSOR>
28
+== cpp.output-manipulator-internal        == insert ==
29
+<< internal <CURSOR>
30
+== cpp.output-manipulator-left            == insert ==
31
+<< left <CURSOR>
32
+== cpp.output-manipulator-oct             == insert ==
33
+<< oct <CURSOR>
34
+== cpp.output-manipulator-right           == insert ==
35
+<< right <CURSOR>
36
+== cpp.output-manipulator-scientific      == insert ==
37
+<< scientific <CURSOR>
38
+== cpp.output-manipulator-setbase         == insert ==
39
+<< setbase(10<CURSOR>)
40
+== cpp.output-manipulator-setfill         == insert ==
41
+<< setfill(<CURSOR>)
42
+== cpp.output-manipulator-setiosflag      == insert ==
43
+<< setiosflags(<CURSOR>)
44
+== cpp.output-manipulator-setprecision    == insert ==
45
+<< setprecision(6<CURSOR>)
46
+== cpp.output-manipulator-setw            == insert ==
47
+<< setw(0<CURSOR>)
48
+== cpp.output-manipulator-showbase        == insert ==
49
+<< showbase <CURSOR>
50
+== cpp.output-manipulator-showpoint       == insert ==
51
+<< showpoint <CURSOR>
52
+== cpp.output-manipulator-showpos         == insert ==
53
+<< showpos <CURSOR>
54
+== cpp.output-manipulator-uppercase       == insert ==
55
+<< uppercase <CURSOR>
56
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57
+== cpp.method-implementation ==
58
+//--------------------------------------------------------------------------------------
59
+//       Class:  |?CLASSNAME|
60
+//      Method:  |?METHODNAME|
61
+//--------------------------------------------------------------------------------------
62
+<CURSOR>void |CLASSNAME|::|METHODNAME| (  ) {
63
+    return ;
64
+}		// -----  end of method |CLASSNAME|::|METHODNAME|  -----
65
+
66
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67
+== cpp.accessor-implementation ==
68
+//--------------------------------------------------------------------------------------
69
+//       Class:  |?CLASSNAME|
70
+//      Method:  get_|?ATTRIBUTE|
71
+//--------------------------------------------------------------------------------------
72
+inline <CURSOR>int |CLASSNAME|::get_|ATTRIBUTE| (  ) {
73
+	return |ATTRIBUTE|;
74
+}		// -----  end of method |CLASSNAME|::get_|ATTRIBUTE|  -----
75
+
76
+//--------------------------------------------------------------------------------------
77
+//       Class:  |CLASSNAME|
78
+//      Method:  set_|ATTRIBUTE|
79
+//--------------------------------------------------------------------------------------
80
+inline void |CLASSNAME|::set_|ATTRIBUTE| ( int value ) {
81
+	|ATTRIBUTE|	= value;
82
+	return ;
83
+}		// -----  end of method |CLASSNAME|::set_|ATTRIBUTE|  -----
84
+
85
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86
+== cpp.class-definition ==
87
+/**
88
+   \brief  <CURSOR>
89
+   \details
90
+ */
91
+class |?CLASSNAME:c| : public |?BASECLASS:c| {
92
+
93
+// ====================  LIFECYCLE     =======================
94
+
95
+/** Default constructor */
96
+|CLASSNAME| ( );
97
+
98
+/** Default destructor */
99
+~|CLASSNAME| ();
100
+
101
+// ====================  OPERATORS     =======================
102
+
103
+// ====================  OPERATIONS    =======================
104
+
105
+// ====================  ACCESS        =======================
106
+
107
+// ====================  INQUIRY       =======================
108
+
109
+protected:
110
+
111
+// ====================  DATA MEMBERS  =========================
112
+
113
+private:
114
+
115
+}; // -----  end of class  |CLASSNAME|  -----
116
+
117
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118
+== cpp.class-definitionLemma ==
119
+#pragma once
120
+#include "|?BASECLASS|.h"
121
+
122
+namespace Lemma {
123
+
124
+/**
125
+   \brief  <CURSOR>
126
+   \details
127
+ */
128
+class |?CLASSNAME:c| : public |BASECLASS:c| {
129
+
130
+	friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob);
131
+
132
+	public:
133
+
134
+	    // ====================  LIFECYCLE     =======================
135
+
136
+        /*
137
+         *  Factory method for generating concrete class.
138
+         *  @return a std::shared_ptr of type |CLASSNAME|
139
+         */
140
+	    static std::shared_ptr< |CLASSNAME| > NewSP();
141
+
142
+        /**
143
+         *  Uses YAML to serialize this object.
144
+         *  @return a YAML::Node
145
+         *   @see |CLASSNAME|::DeSerialize
146
+         */
147
+        YAML::Node Serialize() const;
148
+
149
+        /**
150
+         *   Constructs an |CLASSNAME| object from a YAML::Node.
151
+         *   @see |CLASSNAME|::Serialize
152
+         */
153
+        static std::shared_ptr<|CLASSNAME|> DeSerialize(const YAML::Node& node);
154
+
155
+        // ====================  OPERATORS     =======================
156
+
157
+        // ====================  OPERATIONS    =======================
158
+
159
+        // ====================  ACCESS        =======================
160
+
161
+        // ====================  INQUIRY       =======================
162
+
163
+
164
+
165
+    protected:
166
+
167
+        // ====================  LIFECYCLE     =======================
168
+
169
+        /**
170
+         * Default protected constructor, use NewSP methods to construct
171
+         * @see |CLASSNAME|::NewSP
172
+         */
173
+        |CLASSNAME| (const std::string& name);
174
+
175
+        /**
176
+         * Protected DeDerializing constructor, use factory DeSerialize  method.
177
+         * @see |CLASSNAME|::DeSerialize
178
+         */
179
+        |CLASSNAME| (const YAML::Node& node);
180
+
181
+        /** Default protected destructor, use smart pointers (std::shared_ptr) */
182
+        ~|CLASSNAME| ();
183
+
184
+	// ====================  DATA MEMBERS  =========================
185
+
186
+    private:
187
+
188
+}; // -----  end of class  |CLASSNAME|  -----
189
+}  // -----  end of namespace Lemma ----
190
+
191
+/* vim: set tabstop=4 expandtab: */
192
+/* vim: set filetype=cpp: */
193
+
194
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
195
+== cpp.class-definitionLemmaAbstract ==
196
+/**
197
+   \brief  <CURSOR>
198
+   \details
199
+ */
200
+class |?CLASSNAME:c| : public |?BASECLASS:c| {
201
+
202
+    friend std::ostream &operator<<(std::ostream &stream,
203
+            const |CLASSNAME| &ob) {
204
+        stream << *(|BASECLASS|*)(&ob);
205
+        return stream;
206
+    }
207
+
208
+    public:
209
+
210
+// ====================  LIFECYCLE     =======================
211
+
212
+// ====================  OPERATORS     =======================
213
+
214
+// ====================  OPERATIONS    =======================
215
+virtual void APIDemo()=0; // REMEMBER TO MAKE PURE VIRTUAL DUMMY
216
+
217
+// ====================  ACCESS        =======================
218
+
219
+// ====================  INQUIRY       =======================
220
+
221
+protected:
222
+
223
+// ====================  LIFECYCLE     =======================
224
+
225
+/** Default protected constructor, abstract class this cannot be called */
226
+|CLASSNAME| (const std::string& name);
227
+
228
+/** Default protected destructor, this is an abstract class, this cannot be called */
229
+~|CLASSNAME| ();
230
+
231
+// ====================  DATA MEMBERS  =========================
232
+
233
+private:
234
+
235
+}; // -----  end of class  |CLASSNAME|  -----
236
+
237
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
+== cpp.class-implementationLemma ==
239
+#include "|?CLASSNAME|.h"
240
+
241
+namespace Lemma {
242
+
243
+// ====================  FRIEND METHODS  =====================
244
+
245
+std::ostream &operator << (std::ostream &stream, const |CLASSNAME| &ob) {
246
+    stream << ob.Serialize()  << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
247
+    return stream;
248
+}
249
+
250
+// ====================  LIFECYCLE     =======================
251
+
252
+//--------------------------------------------------------------------------------------
253
+//       Class:  |CLASSNAME|
254
+//      Method:  |CLASSNAME|
255
+// Description:  constructor (protected)
256
+//--------------------------------------------------------------------------------------
257
+|CLASSNAME|::|CLASSNAME| (const std::string& name) : |?BASECLASS|(name) {
258
+
259
+}  // -----  end of method |CLASSNAME|::|CLASSNAME|  (constructor)  -----
260
+
261
+//--------------------------------------------------------------------------------------
262
+//       Class:  |CLASSNAME|
263
+//      Method:  |CLASSNAME|
264
+// Description:  DeSerializing constructor (protected)
265
+//--------------------------------------------------------------------------------------
266
+|CLASSNAME|::|CLASSNAME| (const YAML::Node& node) : |BASECLASS|(node) {
267
+
268
+}  // -----  end of method |CLASSNAME|::|CLASSNAME|  (constructor)  -----
269
+
270
+//--------------------------------------------------------------------------------------
271
+//       Class:  |CLASSNAME|
272
+//      Method:  NewSP()
273
+// Description:  public constructor returing a shared_ptr
274
+//--------------------------------------------------------------------------------------
275
+std::shared_ptr< |CLASSNAME| >  |CLASSNAME|::NewSP() {
276
+    std::shared_ptr< |CLASSNAME| > sp(new  |CLASSNAME|("|CLASSNAME|"), LemmaObjectDeleter() );
277
+    return sp;
278
+}
279
+
280
+//--------------------------------------------------------------------------------------
281
+//       Class:  |CLASSNAME|
282
+//      Method:  ~|CLASSNAME|
283
+// Description:  destructor (protected)
284
+//--------------------------------------------------------------------------------------
285
+|CLASSNAME|::~|CLASSNAME| () {
286
+
287
+}  // -----  end of method |CLASSNAME|::~|CLASSNAME|  (destructor)  -----
288
+
289
+//--------------------------------------------------------------------------------------
290
+//       Class:  |CLASSNAME|
291
+//      Method:  Serialize
292
+//--------------------------------------------------------------------------------------
293
+YAML::Node  |CLASSNAME|::Serialize (  ) const {
294
+    YAML::Node node = |BASECLASS|::Serialize();
295
+    node.SetTag( GetName() );
296
+    // FILL IN CLASS SPECIFICS HERE
297
+    return node;
298
+}		// -----  end of method |CLASSNAME|::Serialize  -----
299
+
300
+//--------------------------------------------------------------------------------------
301
+//       Class:  |CLASSNAME|
302
+//      Method:  DeSerialize
303
+//--------------------------------------------------------------------------------------
304
+std::shared_ptr<|CLASSNAME|> |CLASSNAME|::DeSerialize ( const YAML::Node& node  ) {
305
+    if (node.Tag() !=  "|CLASSNAME|" ) {
306
+        throw  DeSerializeTypeMismatch( "|CLASSNAME|", node.Tag());
307
+    }
308
+    std::shared_ptr< |CLASSNAME| > Object(new |CLASSNAME|(node), LemmaObjectDeleter() );
309
+    return Object ;
310
+}		// -----  end of method |CLASSNAME|::DeSerialize  -----
311
+
312
+} // ----  end of namespace Lemma  ----
313
+
314
+/* vim: set tabstop=4 expandtab: */
315
+/* vim: set filetype=cpp: */
316
+
317
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
+== cpp.class-implementation ==
319
+
320
+// ====================  LIFECYCLE     =======================
321
+
322
+//--------------------------------------------------------------------------------------
323
+//       Class:  |CLASSNAME|
324
+//      Method:  |CLASSNAME|
325
+// Description:  constructor (protected)
326
+//--------------------------------------------------------------------------------------
327
+|CLASSNAME|::|CLASSNAME| ( ) : |BASECLASS|(name) {
328
+
329
+}  // -----  end of method |CLASSNAME|::|CLASSNAME|  (constructor)  -----
330
+
331
+//--------------------------------------------------------------------------------------
332
+//       Class:  |CLASSNAME|
333
+//      Method:  ~|CLASSNAME|
334
+// Description:  destructor
335
+//--------------------------------------------------------------------------------------
336
+|CLASSNAME|::~|CLASSNAME| () {
337
+<CURSOR>
338
+}  // -----  end of method |CLASSNAME|::~|CLASSNAME|  (destructor)  -----
339
+
340
+
341
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342
+== cpp.class-using-new-definition ==
343
+// =====================================================================================
344
+//        Class:  |?CLASSNAME:c|
345
+//  Description:  <CURSOR>
346
+// =====================================================================================
347
+class |CLASSNAME|
348
+{
349
+  public:
350
+
351
+    // ====================  LIFECYCLE     =======================================
352
+    |CLASSNAME| ();                             // constructor
353
+    |CLASSNAME| ( const |CLASSNAME| &other );   // copy constructor
354
+    ~|CLASSNAME| ();                            // destructor
355
+
356
+    // ====================  OPERATORS     =======================================
357
+    const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
358
+
359
+    // ====================  OPERATIONS    =======================================
360
+
361
+    // ====================  ACCESS        =======================================
362
+
363
+    // ====================  INQUIRY       =======================================
364
+
365
+    // ====================  DATA MEMBERS  =======================================
366
+  protected:
367
+
368
+  private:
369
+
370
+}; // -----  end of class  |CLASSNAME|  -----
371
+
372
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373
+== cpp.class-using-new-implementation ==
374
+//--------------------------------------------------------------------------------------
375
+//       Class:  |?CLASSNAME|
376
+//      Method:  |CLASSNAME|
377
+// Description:  constructor
378
+//--------------------------------------------------------------------------------------
379
+|CLASSNAME|::|CLASSNAME| ()
380
+{
381
+}  // -----  end of method |CLASSNAME|::|CLASSNAME|  (constructor)  -----
382
+
383
+//--------------------------------------------------------------------------------------
384
+//       Class:  |CLASSNAME|
385
+//      Method:  |CLASSNAME|
386
+// Description:  copy constructor
387
+//--------------------------------------------------------------------------------------
388
+|CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other )
389
+{
390
+}  // -----  end of method |CLASSNAME|::|CLASSNAME|  (copy constructor)  -----
391
+
392
+//--------------------------------------------------------------------------------------
393
+//       Class:  |CLASSNAME|
394
+//      Method:  ~|CLASSNAME|
395
+// Description:  destructor
396
+//--------------------------------------------------------------------------------------
397
+|CLASSNAME|::~|CLASSNAME| ()
398
+{
399
+}  // -----  end of method |CLASSNAME|::~|CLASSNAME|  (destructor)  -----
400
+
401
+//--------------------------------------------------------------------------------------
402
+//       Class:  |CLASSNAME|
403
+//      Method:  operator =
404
+// Description:  assignment operator
405
+//--------------------------------------------------------------------------------------
406
+const |CLASSNAME|&
407
+|CLASSNAME|::operator = ( const |CLASSNAME| &other )
408
+{
409
+  if ( this != &other ) {
410
+  }
411
+  return *this;
412
+}  // -----  end of method |CLASSNAME|::operator =  (assignment operator)  -----
413
+
414
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
415
+== cpp.error-class ==
416
+// =====================================================================================
417
+//        Class:  |?CLASSNAME:c|
418
+//  Description:  <CURSOR>
419
+// =====================================================================================
420
+class |CLASSNAME|
421
+{
422
+  public:     |CLASSNAME| ( string msg = "|CLASSNAME|" ):message(msg)  { }
423
+              virtual ~|CLASSNAME| ( )  { }
424
+              virtual string what ( ) const throw ( )  { return message; }
425
+  protected:  string  message;
426
+}; // ----------  end of class  |CLASSNAME|  ----------
427
+
428
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429
+== cpp.template-method-implementation ==
430
+template < class T >
431
+void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| (  )
432
+{
433
+	return ;
434
+}		// -----  end of method |CLASSNAME|<T>::|METHODNAME|  -----
435
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436
+== cpp.template-accessor-implementation ==
437
+//--------------------------------------------------------------------------------------
438
+//       Class:  |?CLASSNAME|
439
+//      Method:  get_|?ATTRIBUTE|
440
+//--------------------------------------------------------------------------------------
441
+template < class T >
442
+inline  <CURSOR>int |CLASSNAME|<T>::get_|ATTRIBUTE| (  )
443
+{
444
+	return |ATTRIBUTE|;
445
+}		// -----  end of method |CLASSNAME|<T>::get_|ATTRIBUTE|  -----
446
+
447
+//--------------------------------------------------------------------------------------
448
+//       Class:  |CLASSNAME|
449
+//      Method:  set_|ATTRIBUTE|
450
+//--------------------------------------------------------------------------------------
451
+template < class T >
452
+inline  void |CLASSNAME|<T>::set_|ATTRIBUTE| ( int value )
453
+{
454
+	|ATTRIBUTE|	= value;
455
+	return ;
456
+}		// -----  end of method |CLASSNAME|<T>::set_|ATTRIBUTE|  -----
457
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458
+== cpp.template-class-definition ==
459
+// =====================================================================================
460
+//        Class:  |?CLASSNAME:c|
461
+//  Description:  <CURSOR>
462
+// =====================================================================================
463
+
464
+template < class T >
465
+class |CLASSNAME|
466
+{
467
+  public:
468
+
469
+    // ====================  LIFECYCLE     =======================================
470
+    |CLASSNAME| ();                             // constructor
471
+
472
+    // ====================  OPERATORS     =======================================
473
+
474
+    // ====================  OPERATIONS    =======================================
475
+
476
+    // ====================  ACCESS        =======================================
477
+
478
+    // ====================  INQUIRY       =======================================
479
+
480
+    // ====================  DATA MEMBERS  =======================================
481
+  protected:
482
+
483
+  private:
484
+
485
+}; // -----  end of template class  |CLASSNAME|  -----
486
+
487
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488
+== cpp.template-class-implementation ==
489
+//--------------------------------------------------------------------------------------
490
+//       Class:  |?CLASSNAME|
491
+//      Method:  |CLASSNAME|
492
+// Description:  constructor
493
+//--------------------------------------------------------------------------------------
494
+template < class T >
495
+|CLASSNAME| <T>:: |CLASSNAME| ()
496
+{
497
+}  // -----  end of constructor of template class |CLASSNAME|  -----
498
+
499
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500
+== cpp.template-class-using-new-definition ==
501
+// =====================================================================================
502
+//        Class:  |?CLASSNAME:c|
503
+//  Description:  <CURSOR>
504
+// =====================================================================================
505
+
506
+template < class T >
507
+class |CLASSNAME|
508
+{
509
+  public:
510
+
511
+    // ====================  LIFECYCLE     =======================================
512
+    |CLASSNAME| ();                           // constructor
513
+    |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
514
+    ~|CLASSNAME| ();                          // destructor
515
+
516
+    // ====================  OPERATORS     =======================================
517
+
518
+    const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
519
+
520
+    // ====================  OPERATIONS    =======================================
521
+
522
+    // ====================  ACCESS        =======================================
523
+
524
+    // ====================  INQUIRY       =======================================
525
+
526
+    // ====================  DATA MEMBERS  =======================================
527
+  protected:
528
+
529
+  private:
530
+
531
+}; // -----  end of template class  |CLASSNAME|  -----
532
+
533
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534
+== cpp.template-class-using-new-implementation ==
535
+//--------------------------------------------------------------------------------------
536
+//       Class:  |?CLASSNAME|
537
+//      Method:  |CLASSNAME|
538
+// Description:  constructor
539
+//--------------------------------------------------------------------------------------
540
+template < class T >
541
+|CLASSNAME|<T>::|CLASSNAME| ()
542
+{
543
+}  // -----  end of constructor of template class |CLASSNAME|  -----
544
+
545
+//--------------------------------------------------------------------------------------
546
+//       Class:  |CLASSNAME|
547
+//      Method:  |CLASSNAME|
548
+// Description:  copy constructor
549
+//--------------------------------------------------------------------------------------
550
+template < class T >
551
+|CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other )
552
+{
553
+}  // -----  end of copy constructor of template class |CLASSNAME|  -----
554
+
555
+//--------------------------------------------------------------------------------------
556
+//       Class:  |CLASSNAME|
557
+//      Method:  ~|CLASSNAME|
558
+// Description:  destructor
559
+//--------------------------------------------------------------------------------------
560
+template < class T >
561
+|CLASSNAME|<T>::~|CLASSNAME| ()
562
+{
563
+}  // -----  end of destructor of template class |CLASSNAME|  -----
564
+
565
+//--------------------------------------------------------------------------------------
566
+//       Class:  |CLASSNAME|
567
+//      Method:  operator =
568
+// Description:  assignment operator
569
+//--------------------------------------------------------------------------------------
570
+template < class T >
571
+const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other )
572
+{
573
+  if ( this != &other ) {
574
+  }
575
+  return *this;
576
+}  // -----  end of assignment operator of template class |CLASSNAME|  -----
577
+
578
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
579
+== cpp.template-function ==
580
+template <class T>
581
+<CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param )
582
+{
583
+	return ;
584
+}		// -----  end of template function |?TEMPALTE_FUNCTION_NAME|  -----
585
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586
+== cpp.operator-in ==
587
+ostream &
588
+operator << ( ostream & os, const |?CLASSNAME| & obj )
589
+{
590
+	os << obj.<CURSOR> ;
591
+	return os;
592
+}		// -----  end of function operator <<  -----
593
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
594
+== cpp.operator-out ==
595
+istream &
596
+operator >> ( istream & is, |?CLASSNAME| & obj )
597
+{
598
+	is >> obj.<CURSOR> ;
599
+	return is;
600
+}		// -----  end of function operator >>  -----
601
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
602
+== cpp.try-catch ==
603
+try {
604
+<SPLIT>}
605
+catch ( const <CURSOR> &ExceptObj ) {		// handle exception:
606
+}
607
+catch (...) {		// handle exception: unspezified
608
+}
609
+
610
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
611
+== cpp.catch ==
612
+catch ( <CURSOR>const &ExceptObj ) {		// handle exception:
613
+<SPLIT>}
614
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615
+== cpp.catch-points ==
616
+catch (...) {		// handle exception:
617
+<SPLIT>}
618
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
619
+== cpp.extern ==
620
+extern "C" {<CURSOR>
621
+<SPLIT>}
622
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623
+== cpp.open-input-file ==
624
+string    ifs_file_name = "<CURSOR>";                 // input  file name
625
+ifstream  ifs;                                // create ifstream object
626
+
627
+ifs.open ( ifs_file_name.c_str() );           // open ifstream
628
+if (!ifs) {
629
+	cerr << "\nERROR : failed to open input  file " << ifs_file_name << endl;
630
+	exit (EXIT_FAILURE);
631
+}
632
+
633
+
634
+ifs.close ();                                 // close ifstream
635
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
636
+== cpp.open-output-file ==
637
+string    ofs_file_name = "<CURSOR>";                 // input  file name
638
+ofstream  ofs;                                // create ofstream object
639
+
640
+ofs.open ( ofs_file_name.c_str() );           // open ofstream
641
+if (!ofs) {
642
+	cerr << "\nERROR : failed to open output file " << ofs_file_name << endl;
643
+	exit (EXIT_FAILURE);
644
+}
645
+
646
+
647
+ofs.close ();                                 // close ofstream
648
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649
+== cpp.namespace-std ==
650
+using namespace std;
651
+== cpp.namespace ==
652
+using namespace |?NAMESPACE|;
653
+== cpp.namespace-block ==
654
+namespace |?NAMESPACE| {
655
+<CURSOR>
656
+<SPLIT>}		// -----  end of |NAMESPACE|  name  -----
657
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
658
+== cpp.rtti-typeid == insert ==
659
+typeid(<CURSOR><SPLIT>)
660
+$
661
+== cpp.rtti-static-cast == insert ==
662
+static_cast<>(<CURSOR><SPLIT>)
663
+$
664
+== cpp.rtti-const-cast == insert ==
665
+const_cast<>(<CURSOR><SPLIT>)
666
+$
667
+== cpp.rtti-reinterpret-cast == insert ==
668
+reinterpret_cast<>(<CURSOR><SPLIT>)
669
+$
670
+== cpp.rtti-dynamic-cast == insert ==
671
+dynamic_cast<>(<CURSOR><SPLIT>)
672
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
673
+
674
+/* vim: set tabstop=4 expandtab: */
675
+/* vim: set filetype=cpp: */

Loading…
Cancel
Save