summaryrefslogtreecommitdiffstats
path: root/ue4/mycpu/cdatset.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue4/mycpu/cdatset.h')
-rw-r--r--ue4/mycpu/cdatset.h56
1 files changed, 43 insertions, 13 deletions
diff --git a/ue4/mycpu/cdatset.h b/ue4/mycpu/cdatset.h
index 03e71f4..56a0630 100644
--- a/ue4/mycpu/cdatset.h
+++ b/ue4/mycpu/cdatset.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @module cdat 2 * @module cdatset
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) 3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief Datatype template and datatype definition for CCPU and CMem 4 * @brief Datatype template and datatype definition for CCPU and CMem
5 * @date 26.05.2009 5 * @date 26.05.2009
@@ -8,20 +8,46 @@
8#ifndef CDATSET_H 8#ifndef CDATSET_H
9#define CDATSET_H 1 9#define CDATSET_H 1
10 10
11#include <boost/operators.hpp>
12#include <iostream> 11#include <iostream>
12#include "cdat.h"
13 13
14/** 14/**
15 * @class CDat 15 * @class CDatSet
16 * 16 *
17 * Datatype template for CCPU and CMem. 17 * Datatype template for CCPU and CMem.
18 */ 18 */
19template <class T>
20class CDatSet 19class CDatSet
21 : public CDat<T> 20 : public CDat<int>, public boost::operators<CDatSet>
22{ 21{
23 public: 22 public:
24 /** 23 /**
24 * @method CDatSet
25 * @brief Default ctor
26 * @param -
27 * @return -
28 * @globalvars none
29 * @exception bad_alloc
30 * @pre none
31 * @post none
32 */
33 CDatSet()
34 {}
35
36 /**
37 * @method CDatSet
38 * @brief Copy constructor for int
39 * @param newval new value for CDatSet
40 * @return -
41 * @globalvars none
42 * @exception none
43 * @pre none
44 * @post none
45 */
46 CDatSet(const int newval)
47 : CDat<int>(newval)
48 {}
49
50 /**
25 * @method operator>> 51 * @method operator>>
26 * @brief Shift/read operator for inputstream 52 * @brief Shift/read operator for inputstream
27 * @param stream reference to inputstream 53 * @param stream reference to inputstream
@@ -29,19 +55,23 @@ class CDatSet
29 * @return reference to inputstream 55 * @return reference to inputstream
30 * @globalvars none 56 * @globalvars none
31 * @exception none 57 * @exception none
32 * @conditions none 58 * @pre none
59 * @post none
33 */ 60 */
34 friend std::istream& operator>>(std::istream & stream, CDatSet& cdat) 61 friend std::istream& operator>>(std::istream & stream, CDatSet& cdat)
35 { 62 {
36 std::string s; 63 unsigned count = 0;
37 stream >> s; 64 while(stream.good() && !stream.eof())
38 cdat.m_value = s.size(); 65 {
66 int val = stream.get();
67 if (val != 'o')
68 break;
69 ++count;
70 }
71 stream.clear();
72 cdat.m_value = count;
39 return stream; 73 return stream;
40 } 74 }
41
42 private:
43 /* members */
44 T m_value;
45}; 75};
46 76
47#endif 77#endif