Browse Source

Documented memory_test & Network

Thomas Buck 10 years ago
parent
commit
dda3ec4fb0
6 changed files with 72 additions and 379 deletions
  1. 38
    253
      include/Network.h
  2. 14
    40
      include/memory_test.h
  3. 5
    29
      src/Network.cpp
  4. 5
    19
      src/memory_test.cpp
  5. 5
    19
      test/Network.cpp
  6. 5
    19
      test/memory_test.cpp

+ 38
- 253
include/Network.h View File

@@ -1,328 +1,113 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file include/Network.h
3
+ * \brief Networking Singleton class
3 4
  *
4
- * Project : UnRaider
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Network
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments:
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History ------------------------------------------------
17
- *
18
- * 2002.06.21:
19
- * Mongoose - Created
20
- ================================================================*/
21
-
5
+ * \author Mongoose
6
+ */
22 7
 
23 8
 #ifndef _NETWORK_H_
24 9
 #define _NETWORK_H_
25 10
 
26
-/*----------------------------------------------
27
- * The packet holds the data for the network
28
- *  layer.  This is encapsulated in the frame.
11
+/*!
12
+ * \brief The packet holds the data for the network.
29 13
  *
30
- * data  - a short (32 char) string
31
- ---------------------------------------------*/
32
-typedef struct network_packet_s
33
-{
14
+ * This is encapsulated in the frame.
15
+ */
16
+typedef struct network_packet_s {
34 17
     char send;
35 18
     unsigned int port;
36 19
     unsigned int cid;
37
-    char  data[32];
20
+    char  data[32];    //!< A short (32 char) string
38 21
     float pos[3];
39 22
     float pitch;
40 23
     float yaw;
41 24
     int aframe;
42 25
     int bframe;
43 26
     int view_model;
44
-
45
-    char gurantee; // TCP like
46
-
27
+    char gurantee;     //!< TCP like
47 28
 } network_packet_t;
48 29
 
49
-
50
-/*----------------------------------------------
51
- * The frame holds the data for the datalink
52
- *  layer.  This goes over the line.
30
+/*!
31
+ * \brief The frame holds the data for the datalink layer.
53 32
  *
54
- * header - The header flags
55
- * seq    - The sequence number
56
- * data   - The packet for the NL
57
- ---------------------------------------------*/
58
-typedef struct network_frame_s
59
-{
60
-    unsigned int header;
61
-    unsigned int seq;
33
+ * This goes over the line.
34
+ */
35
+typedef struct network_frame_s {
36
+    unsigned int header;   //!< The header flags
37
+    unsigned int seq;      //!< The sequence number
62 38
     unsigned int uid;
63
-
64
-    network_packet_t data;
65
-
39
+    network_packet_t data; //!< The packet for the NL
66 40
 } network_frame_t;
67 41
 
68
-
69 42
 void from_network_layer(network_packet_t *p, unsigned int *last_id);
70 43
 void to_network_layer(network_packet_t p);
71 44
 
72
-
73 45
 void killNetworkSingleton();
74 46
 
75 47
 #define REMOTE_HOST_STR_SZ 64
76 48
 #define BIND_HOST_STR_SZ 64
77 49
 
78
-
79
-class Network
80
-{
81
- public:
82
-
83
-    ////////////////////////////////////////////////////////////
84
-    // Constructors ( Singleton )
85
-    ////////////////////////////////////////////////////////////
86
-
50
+/*!
51
+ * \brief Networking Singleton class
52
+ */
53
+class Network {
54
+public:
55
+    /*!
56
+     * \brief Get the Singleton or create it on first use
57
+     * \returns Singleton of type Network
58
+     */
87 59
     static Network *Instance();
88
-    /*------------------------------------------------------
89
-     * Pre  :
90
-     * Post : Constructs the object of Network or
91
-     *        returns pointer to it if previously allocated
92
-     *
93
-     *-- History ------------------------------------------
94
-     *
95
-     * 2001.08.24:
96
-     * Mongoose - Created
97
-     ------------------------------------------------------*/
98 60
 
61
+    /*!
62
+     * \brief Deconstructs an object of Network
63
+     */
99 64
     ~Network();
100
-    /*------------------------------------------------------
101
-     * Pre  : Network object is allocated
102
-     * Post : Deconstructs an object of Network
103
-     *
104
-     *-- History ------------------------------------------
105
-     *
106
-     * 2002.06.21:
107
-     * Mongoose - Created
108
-     ------------------------------------------------------*/
109
-
110
-    ////////////////////////////////////////////////////////////
111
-    // Public Accessors
112
-    ////////////////////////////////////////////////////////////
113 65
 
114 66
     network_frame_t &getPiggyBack();
115
-    /*------------------------------------------------------
116
-     * Pre  :
117
-     * Post :
118
-     *
119
-     *-- History ------------------------------------------
120
-     *
121
-     * 2002.09.03:
122
-     * Mongoose - Created
123
-     ------------------------------------------------------*/
124 67
 
125 68
     unsigned int getUID();
126
-    /*------------------------------------------------------
127
-     * Pre  :
128
-     * Post :
129
-     *
130
-     *-- History ------------------------------------------
131
-     *
132
-     * 2002.09.03:
133
-     * Mongoose - Created
134
-     ------------------------------------------------------*/
135 69
 
136 70
     float getRandom(float from, float to);
137
-    /*------------------------------------------------------
138
-     * Pre  :
139
-     * Post :
140
-     *
141
-     *-- History ------------------------------------------
142
-     *
143
-     * 2002.09.03:
144
-     * Mongoose - Created
145
-     ------------------------------------------------------*/
146 71
 
147 72
     int getPort();
148
-    /*------------------------------------------------------
149
-     * Pre  :
150
-     * Post :
151
-     *
152
-     *-- History ------------------------------------------
153
-     *
154
-     * 2002.09.03:
155
-     * Mongoose - Created
156
-     ------------------------------------------------------*/
157
-
158
-    ////////////////////////////////////////////////////////////
159
-    // Public Mutators
160
-    ////////////////////////////////////////////////////////////
161 73
 
162 74
     void setDebug(bool toggle);
163
-    /*------------------------------------------------------
164
-     * Pre  :
165
-     * Post :
166
-     *
167
-     *-- History ------------------------------------------
168
-     *
169
-     * 2002.12.15:
170
-     * Mongoose - Created
171
-     ------------------------------------------------------*/
172 75
 
173 76
     void setPort(unsigned int port);
174
-    /*------------------------------------------------------
175
-     * Pre  :
176
-     * Post :
177
-     *
178
-     *-- History ------------------------------------------
179
-     *
180
-     * 2002.09.03:
181
-     * Mongoose - Created
182
-     ------------------------------------------------------*/
183 77
 
184 78
     void setBindHost(char *s);
185
-    /*------------------------------------------------------
186
-     * Pre  :
187
-     * Post :
188
-     *
189
-     *-- History ------------------------------------------
190
-     *
191
-     * 2002.09.10:
192
-     * Mongoose - Created
193
-     ------------------------------------------------------*/
194 79
 
195 80
     void setRemoteHost(char *s);
196
-    /*------------------------------------------------------
197
-     * Pre  :
198
-     * Post :
199
-     *
200
-     *-- History ------------------------------------------
201
-     *
202
-     * 2002.09.03:
203
-     * Mongoose - Created
204
-     ------------------------------------------------------*/
205 81
 
206 82
     void killServerThread();
207
-    /*------------------------------------------------------
208
-     * Pre  :
209
-     * Post :
210
-     *
211
-     *-- History ------------------------------------------
212
-     *
213
-     * 2002.09.03:
214
-     * Mongoose - Created
215
-     ------------------------------------------------------*/
216 83
 
217 84
     void killClientThread();
218
-    /*------------------------------------------------------
219
-     * Pre  :
220
-     * Post :
221
-     *
222
-     *-- History ------------------------------------------
223
-     *
224
-     * 2002.09.03:
225
-     * Mongoose - Created
226
-     ------------------------------------------------------*/
227 85
 
228 86
     void spawnServerThread();
229
-    /*------------------------------------------------------
230
-     * Pre  :
231
-     * Post :
232
-     *
233
-     *-- History ------------------------------------------
234
-     *
235
-     * 2002.09.03:
236
-     * Mongoose - Created
237
-     ------------------------------------------------------*/
238 87
 
239 88
     void spawnClientThread();
240
-    /*------------------------------------------------------
241
-     * Pre  :
242
-     * Post :
243
-     *
244
-     *-- History ------------------------------------------
245
-     *
246
-     * 2002.09.03:
247
-     * Mongoose - Created
248
-     ------------------------------------------------------*/
249 89
 
250 90
     int runServer();
251
-    /*------------------------------------------------------
252
-     * Pre  :
253
-     * Post :
254
-     *
255
-     *-- History ------------------------------------------
256
-     *
257
-     * 2002.09.03:
258
-     * Mongoose - Created
259
-     ------------------------------------------------------*/
260 91
 
261 92
     void runClient();
262
-    /*------------------------------------------------------
263
-     * Pre  :
264
-     * Post :
265
-     *
266
-     *-- History ------------------------------------------
267
-     *
268
-     * 2002.09.03:
269
-     * Mongoose - Created
270
-     ------------------------------------------------------*/
271
-
272
- protected:
273
-
274
-    ////////////////////////////////////////////////////////////
275
-    // Constructors ( Singleton )
276
-    ////////////////////////////////////////////////////////////
277 93
 
94
+protected:
95
+    /*!
96
+     * \brief Constructs an object of Network
97
+     */
278 98
     Network();
279
-    /*------------------------------------------------------
280
-     * Pre  :
281
-     * Post : Constructs an object of Network
282
-     *
283
-     *-- History ------------------------------------------
284
-     *
285
-     * 2002.06.21:
286
-     * Mongoose - Created
287
-     ------------------------------------------------------*/
288
-
289
-
290
-    ////////////////////////////////////////////////////////////
291
-    // Protected Mutators
292
-    ////////////////////////////////////////////////////////////
293
-
294
- private:
295
-
296
-    ////////////////////////////////////////////////////////////
297
-    // Private Accessors
298
-    ////////////////////////////////////////////////////////////
299
-
300
-
301
-    ////////////////////////////////////////////////////////////
302
-    // Private Mutators
303
-    ////////////////////////////////////////////////////////////
304
-
305
-
306
-    static Network *mInstance;      /* Singleton use */
307 99
 
100
+private:
101
+    static Network *mInstance;            //!< Singleton use
308 102
     bool mSpawnedClient;
309
-
310 103
     bool mSpawnedServer;
311
-
312 104
     int mPort;
313
-
314 105
     char mRemoteHost[REMOTE_HOST_STR_SZ];
315
-
316 106
     char mBindHost[BIND_HOST_STR_SZ];
317
-
318 107
     bool mPiggyBack;
319
-
320 108
     bool mNetworkReliable;
321
-
322 109
     bool mKillClient;
323
-
324 110
     bool mKillServer;
325
-
326 111
     bool mDebug;
327 112
 };
328 113
 

+ 14
- 40
include/memory_test.h View File

@@ -1,29 +1,15 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file include/memory_test.h
3
+ * Memory testing Toolkit
3 4
  *
4
- * Project : MTK
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  :
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments: Memory testing tool kit
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History ------------------------------------------------
17
- *
18
- * 2002.03.27:
19
- * Mongoose - Created
20
- ================================================================*/
21
-
22
-#include <cstddef>
5
+ * \author Mongoose
6
+ */
23 7
 
24 8
 #ifndef _MEMORY_TEST_H_
25 9
 #define _MEMORY_TEST_H_
26 10
 
11
+#include <cstddef>
12
+
27 13
 #if defined(DEBUG_MEMORY) && !defined(UNIT_TEST_MEMORY)
28 14
 
29 15
 #define DEBUG_NEW new(__FILE__, __LINE__)
@@ -44,32 +30,20 @@ void operator delete [](void *p);
44 30
 #define new DEBUG_NEW
45 31
 #define delete DEBUG_DELETE
46 32
 
47
-
48 33
 void delete_check(const char *file, int line, int print);
49 34
 
50 35
 void display_memory_usage();
51 36
 
37
+/*!
38
+ * \brief Get total memory usage
39
+ * \returns amount of total memory used
40
+ */
52 41
 long memory_used();
53
-/*------------------------------------------------------
54
- * Pre  :
55
- * Post : Returns amount of total memory used
56
- *
57
- *-- History ------------------------------------------
58
- *
59
- * 2002.03.27:
60
- * Mongoose - Created
61
- ------------------------------------------------------*/
62 42
 
43
+/*!
44
+ * \brief Dumps raw Tree holding memory accounting
45
+ */
63 46
 void dump_memory_report();
64
-/*------------------------------------------------------
65
- * Pre  :
66
- * Post : Dumps raw Tree holding memory accounting
67
- *
68
- *-- History ------------------------------------------
69
- *
70
- * 2002.03.27:
71
- * Mongoose - Created
72
- ------------------------------------------------------*/
73 47
 
74 48
 #ifdef DEBUG_MEMORY
75 49
 

+ 5
- 29
src/Network.cpp View File

@@ -1,23 +1,9 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file src/Network.cpp
3
+ * \brief Networking Singleton class
3 4
  *
4
- * Project : UnRaider
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Network
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments:
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2002.06.21:
19
- * Mongoose - Created
20
- =================================================================*/
5
+ * \author Mongoose
6
+ */
21 7
 
22 8
 #include <Network.h>
23 9
 
@@ -691,13 +677,3 @@ void Network::runClient()
691 677
     mKillServer = false;
692 678
 }
693 679
 
694
-
695
-////////////////////////////////////////////////////////////
696
-// Private Accessors
697
-////////////////////////////////////////////////////////////
698
-
699
-
700
-////////////////////////////////////////////////////////////
701
-// Private Mutators
702
-////////////////////////////////////////////////////////////
703
-

+ 5
- 19
src/memory_test.cpp View File

@@ -1,23 +1,9 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file src/memory_test.cpp
3
+ * Memory testing Toolkit
3 4
  *
4
- * Project : MTK
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : memory_test
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments: Memory testing tool kit
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2002.03.27:
19
- * Mongoose - Created
20
- =================================================================*/
5
+ * \author Mongoose
6
+ */
21 7
 
22 8
 #include <string.h>
23 9
 #include <stdio.h>

+ 5
- 19
test/Network.cpp View File

@@ -1,23 +1,9 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file test/Network.cpp
3
+ * \brief Networking Singleton Unit test
3 4
  *
4
- * Project : UnRaider
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Network
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments:
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2002.06.21:
19
- * Mongoose - Created
20
- =================================================================*/
5
+ * \author Mongoose
6
+ */
21 7
 
22 8
 #include <Network.h>
23 9
 

+ 5
- 19
test/memory_test.cpp View File

@@ -1,23 +1,9 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file test/memory_test.cpp
3
+ * Memory testing Toolkit Unit test
3 4
  *
4
- * Project : MTK
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : memory_test
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments: Memory testing tool kit
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2002.03.27:
19
- * Mongoose - Created
20
- =================================================================*/
5
+ * \author Mongoose
6
+ */
21 7
 
22 8
 #include <string.h>
23 9
 #include <stdio.h>

Loading…
Cancel
Save