summaryrefslogtreecommitdiffstats
path: root/ue4/mycpu/cmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue4/mycpu/cmem.h')
-rw-r--r--ue4/mycpu/cmem.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/ue4/mycpu/cmem.h b/ue4/mycpu/cmem.h
index 5045c34..6b23111 100644
--- a/ue4/mycpu/cmem.h
+++ b/ue4/mycpu/cmem.h
@@ -2,7 +2,7 @@
2 * @module cmem 2 * @module cmem
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) 3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief Memory template and memory definition for CCPU 4 * @brief Memory template and memory definition for CCPU
5 * @date 10.05.2009 5 * @date 26.05.2009
6 */ 6 */
7 7
8#ifndef CMEM_H 8#ifndef CMEM_H
@@ -17,21 +17,23 @@
17# include <iostream> 17# include <iostream>
18# include <iomanip> 18# include <iomanip>
19#endif 19#endif
20#include "cdat.h"
21 20
22/** 21/**
23 * @class CVectorMem 22 * @class CMem
24 * 23 *
25 * Extends std::vector template for use as memory for CCPU. 24 * Extends std::vector template for use as memory for CCPU.
26 */ 25 */
27template <class T, class Allocator=std::allocator<T> > 26template <class T>
28class CVectorMem 27class CMem
29 : public std::vector<T, Allocator> 28 : public std::vector<T>
30{ 29{
31 public: 30 typedef std::vector<T> super;
32 using std::vector<T, Allocator>::size; 31 typedef typename super::iterator iterator;
33 using std::vector<T, Allocator>::at; 32 using super::size;
33 using super::begin;
34 using super::end;
34 35
36 public:
35 /** 37 /**
36 * @method initialize 38 * @method initialize
37 * @brief initialize the vector with the content of istream. istream is 39 * @brief initialize the vector with the content of istream. istream is
@@ -88,22 +90,17 @@ class CVectorMem
88 void dump(std::ostream& out) 90 void dump(std::ostream& out)
89 { 91 {
90 out << "[MEMORY DUMP]" << std::endl; 92 out << "[MEMORY DUMP]" << std::endl;
91 for(unsigned i = 0; i < size(); ++i) 93 unsigned i = 0;
94 for(iterator it = begin(); it != end(); ++it)
92 { 95 {
93 out << "[" << std::setw(4) << std::setfill('0') << i << "] " 96 out << "[" << std::setw(4) << std::setfill('0') << i << "] "
94 << at(i) << std::endl; 97 << *it << std::endl;
98 ++i;
95 } 99 }
96 } 100 }
97#endif 101#endif
98}; 102};
99 103
100/**
101 * @class CMem
102 *
103 * Memory definition for CCPU
104 */
105typedef CVectorMem<CDat> CMem;
106
107#endif 104#endif
108 105
109/* vim: set et sw=2 ts=2: */ 106/* vim: set et sw=2 ts=2: */