blob: 2fc103e2b4ba771ebe5b616e712590fd5286dd99 (
plain)
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
|
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _Units_Measurement_HeaderFile
#define _Units_Measurement_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_Units_Token_HeaderFile
#include <Handle_Units_Token.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class Units_Token;
//! This class defines a measurement which is the <br>
//! association of a real value and a unit. <br>
class Units_Measurement {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! It is the empty constructor of the class. <br>
Standard_EXPORT Units_Measurement();
//! Returns an instance of this class. <avalue> defines <br>
//! the measurement, and <atoken> the token which defines <br>
//! the unit used. <br>
Standard_EXPORT Units_Measurement(const Standard_Real avalue,const Handle(Units_Token)& atoken);
//! Returns an instance of this class. <avalue> defines <br>
//! the measurement, and <aunit> the unit used, <br>
//! described in natural language. <br>
Standard_EXPORT Units_Measurement(const Standard_Real avalue,const Standard_CString aunit);
//! Converts (if possible) the measurement object into <br>
//! another unit. <aunit> must have the same <br>
//! dimensionality as the unit contained in the token <br>
//! <thetoken>. <br>
Standard_EXPORT void Convert(const Standard_CString aunit) ;
//! Returns a Measurement object with the integer value of <br>
//! the measurement contained in <me>. <br>
Standard_EXPORT Units_Measurement Integer() const;
//! Returns a Measurement object with the fractional value <br>
//! of the measurement contained in <me>. <br>
Standard_EXPORT Units_Measurement Fractional() const;
//! Returns the value of the measurement. <br>
Standard_EXPORT Standard_Real Measurement() const;
//! Returns the token contained in <me>. <br>
Standard_EXPORT Handle_Units_Token Token() const;
//! Returns (if it is possible) a measurement which is the <br>
//! addition of <me> and <ameasurement>. The chosen <br>
//! returned unit is the unit of <me>. <br>
Standard_EXPORT Units_Measurement Add(const Units_Measurement& ameasurement) const;
Units_Measurement operator +(const Units_Measurement& ameasurement) const
{
return Add(ameasurement);
}
//! Returns (if it is possible) a measurement which is the <br>
//! subtraction of <me> and <ameasurement>. The chosen <br>
//! returned unit is the unit of <me>. <br>
Standard_EXPORT Units_Measurement Subtract(const Units_Measurement& ameasurement) const;
Units_Measurement operator -(const Units_Measurement& ameasurement) const
{
return Subtract(ameasurement);
}
//! Returns a measurement which is the multiplication of <br>
//! <me> and <ameasurement>. <br>
Standard_EXPORT Units_Measurement Multiply(const Units_Measurement& ameasurement) const;
Units_Measurement operator *(const Units_Measurement& ameasurement) const
{
return Multiply(ameasurement);
}
//! Returns a measurement which is the multiplication of <br>
//! <me> with the value <avalue>. <br>
Standard_EXPORT Units_Measurement Multiply(const Standard_Real avalue) const;
Units_Measurement operator *(const Standard_Real avalue) const
{
return Multiply(avalue);
}
//! Returns a measurement which is the division of <me> by <br>
//! <ameasurement>. <br>
Standard_EXPORT Units_Measurement Divide(const Units_Measurement& ameasurement) const;
Units_Measurement operator /(const Units_Measurement& ameasurement) const
{
return Divide(ameasurement);
}
//! Returns a measurement which is the division of <me> by <br>
//! the constant <avalue>. <br>
Standard_EXPORT Units_Measurement Divide(const Standard_Real avalue) const;
Units_Measurement operator /(const Standard_Real avalue) const
{
return Divide(avalue);
}
//! Returns a measurement which is <me> powered <br>
//! <anexponent>. <br>
Standard_EXPORT Units_Measurement Power(const Standard_Real anexponent) const;
Standard_EXPORT Standard_Boolean HasToken() const;
//! Useful for debugging. <br>
Standard_EXPORT void Dump() const;
protected:
private:
Standard_Real themeasurement;
Handle_Units_Token thetoken;
Standard_Boolean myHasToken;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif
|