-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCSyntype.h
184 lines (162 loc) · 7.58 KB
/
SCSyntype.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*------------------------------------------------------------------------------+
| |
| SCL - Simulation Class Library |
| |
| (c) 1995 Joerg Ruehl |
| University of Essen, Germany |
| |
| SCL-Version (c) 1995 Marc Diefenbruch, Wolfgang Textor |
| |
+---------------+-------------------+---------------+-------------------+-------+
| Module | File | Created | Project | |
+---------------+-------------------+---------------+-------------------+-------+
| SCSyntype | SCSyntype.h | 28. Jul 1995 | SCL | |
+---------------+-------------------+---------------+-------------------+-------+
| |
| Change Log |
| |
| Nr. Date Description |
| ----- -------- ------------------------------------------------------- |
| 001 |
| 000 --.--.-- Neu angelegt |
| |
+------------------------------------------------------------------------------*/
/* Lineal
000000000011111111112222222222333333333344444444445555555555666666666677777777778
012345678901234567890123456789012345678901234567890123456789012345678901234567890
*/
#ifndef __SCSYNTYPE__
#define __SCSYNTYPE__
#include "SCDataType.h"
template<class T> class SCSyntype : public SCDataType
{
public:
SCSyntype (const T pMinimum,
const T pMaximum,
const SCObject* father = NULL);
SCSyntype (const T pMinimum,
const T pMaximum,
const T pValue,
const SCObject* father = NULL);
SCSyntype (const T pMinimum,
const T pMaximum,
const SCBoolean pNoMin,
const SCBoolean pNoMax,
const T pValue,
const SCObject* father = NULL);
SCSyntype (const T pValue);
virtual ~SCSyntype (void);
SCBoolean Equal (const SCDataType& second) const;
SCDataType * Clone (void) const;
// doesn't work with explicit template instantiation!
// friend SCStream & operator<< (SCStream &pStream,
// const SCSyntype<T> &pData);
virtual SCStream & Display (SCStream &pStream) const;
T GetValue (void) const;
void SetValue (const T pValue);
void SetMin (const T pMinimum);
void SetNoMin (void);
void SetMax (const T pMaximum);
void SetNoMax (void);
SCBoolean operator== (const SCSyntype<T>& second) const;
SCBoolean operator!= (const SCSyntype<T>& second) const;
SCBoolean operator> (const SCSyntype<T>& second) const;
SCBoolean operator< (const SCSyntype<T>& second) const;
SCBoolean operator>= (const SCSyntype<T>& second) const;
SCBoolean operator<= (const SCSyntype<T>& second) const;
SCBoolean operator== (const T second) const;
SCBoolean operator!= (const T second) const;
SCBoolean operator> (const T second) const;
SCBoolean operator< (const T second) const;
SCBoolean operator>= (const T second) const;
SCBoolean operator<= (const T second) const;
friend SCBoolean operator== (const T first, const SCSyntype<T>& second)
{
return (first == second.value);
}
friend SCBoolean operator!= (const T first, const SCSyntype<T>& second)
{
return (first != second.value);
}
friend SCBoolean operator> (const T first, const SCSyntype<T>& second)
{
return (first > second.value);
}
friend SCBoolean operator< (const T first, const SCSyntype<T>& second)
{
return (first < second.value);
}
friend SCBoolean operator>= (const T first, const SCSyntype<T>& second)
{
return (first >= second.value);
}
friend SCBoolean operator<= (const T first, const SCSyntype<T>& second)
{
return (first <= second.value);
}
SCSyntype<T>& operator= (const T orig);
SCSyntype<T>& operator= (const SCSyntype<T>& orig);
operator T (void) const;
SCSyntype<T> operator+ (const SCSyntype<T>& second) const;
SCSyntype<T> operator- (const SCSyntype<T>& second) const;
SCSyntype<T> operator* (const SCSyntype<T>& second) const;
SCSyntype<T> operator/ (const SCSyntype<T>& second) const;
SCSyntype<T> operator% (const SCSyntype<T>& second) const;
SCSyntype<T> operator+ (const T second) const;
SCSyntype<T> operator- (const T second) const;
SCSyntype<T> operator* (const T second) const;
SCSyntype<T> operator/ (const T second) const;
SCSyntype<T> operator% (const T second) const;
friend SCSyntype<T> operator+ (const T first, const SCSyntype<T>& second)
{
SCSyntype<T> s (second);
s.SetValue (first + second.value);
return (s);
}
friend SCSyntype<T> operator- (const T first, const SCSyntype<T>& second)
{
SCSyntype<T> s (second);
s.SetValue (first - second.value);
return (s);
}
friend SCSyntype<T> operator* (const T first, const SCSyntype<T>& second)
{
SCSyntype<T> s (second);
s.SetValue (first * second.value);
return (s);
}
friend SCSyntype<T> operator/ (const T first, const SCSyntype<T>& second)
{
SCSyntype<T> s (second);
s.SetValue (first / second.value);
return (s);
}
friend SCSyntype<T> operator% (const T first, const SCSyntype<T>& second)
{
SCSyntype<T> s (second);
s.SetValue (first % second.value);
return (s);
}
protected:
void copy (const SCSyntype<T>&);
T value;
T minimum;
T maximum;
SCBoolean noMin;
SCBoolean noMax;
};
template<class T> inline SCBoolean SCSyntype<T>::Equal (const SCDataType &second) const
{
return (value == ((SCSyntype<T> *)&second)->value);
}
template<class T> inline SCDataType *SCSyntype<T>::Clone (void) const
{
return (new SCSyntype<T> (*this));
}
#if !_SC_NOINLINES
#include "SCSyntype.inl.h"
#endif
#ifndef __GNUC__
#include "SCSyntype.tmpl.h" // Sun CC Compiler needs this
#endif
#endif // __SCSYNTYPE__