activemq-cpp-3.6.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
Float.h
Go to the documentation of this file.
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef _DECAF_LANG_FLOAT_H_
19
#define _DECAF_LANG_FLOAT_H_
20
21
#include <
decaf/util/Config.h
>
22
#include <
decaf/lang/Number.h
>
23
#include <
decaf/lang/Comparable.h
>
24
#include <
decaf/lang/exceptions/NumberFormatException.h
>
25
#include <string>
26
27
namespace
decaf{
28
namespace
lang{
29
30
class
DECAF_API
Float
:
public
Number
,
31
public
Comparable
<Float>,
32
public
Comparable
<float> {
33
private
:
34
35
float
value;
36
37
public
:
38
40
static
const
int
SIZE = 32;
41
43
static
const
float
MAX_VALUE
;
44
46
static
const
float
MIN_VALUE
;
47
49
static
const
float
NaN
;
50
52
static
const
float
POSITIVE_INFINITY
;
53
55
static
const
float
NEGATIVE_INFINITY
;
56
57
public
:
58
62
Float
(
float
value );
63
67
Float
(
double
value );
68
72
Float
(
const
std::string& value );
73
74
virtual
~Float
() {}
75
84
virtual
int
compareTo(
const
Float
& f )
const
;
85
90
bool
equals
(
const
Float
& f )
const
{
91
return
this->value == f.value;
92
}
93
99
virtual
bool
operator==
(
const
Float
& f )
const
{
100
return
this->value == f.value;
101
}
102
109
virtual
bool
operator<
(
const
Float
& f )
const
{
110
return
this->value < f.value;
111
}
112
121
virtual
int
compareTo(
const
float
& f )
const
;
122
127
bool
equals
(
const
float
& f )
const
{
128
return
this->value == f;
129
}
130
136
virtual
bool
operator==
(
const
float
& f )
const
{
137
return
this->value == f;
138
}
139
146
virtual
bool
operator<
(
const
float
& f )
const
{
147
return
this->value < f;
148
}
149
153
std::string toString()
const
;
154
159
virtual
double
doubleValue
()
const
{
160
return
(
double
)this->value;
161
}
162
167
virtual
float
floatValue
()
const
{
168
return
this->value;
169
}
170
175
virtual
unsigned
char
byteValue
()
const
{
176
return
(
unsigned
char
)this->value;
177
}
178
183
virtual
short
shortValue
()
const
{
184
return
(
short
)this->value;
185
}
186
191
virtual
int
intValue
()
const
{
192
return
(
int
)this->value;
193
}
194
199
virtual
long
long
longValue
()
const
{
200
return
(
long
long
)this->value;
201
}
202
206
bool
isInfinite()
const
;
207
211
bool
isNaN()
const
;
212
213
public
:
// Statics
214
225
static
int
compare(
float
f1,
float
f2 );
226
248
static
int
floatToIntBits(
float
value );
249
275
static
int
floatToRawIntBits(
float
value );
276
294
static
float
intBitsToFloat(
int
bits );
295
300
static
bool
isInfinite(
float
value );
301
306
static
bool
isNaN(
float
value );
307
315
static
float
parseFloat(
const
std::string& value );
316
351
static
std::string toHexString(
float
value );
352
384
static
std::string toString(
float
value );
385
391
static
Float
valueOf(
float
value );
392
401
static
Float
valueOf(
const
std::string& value );
402
403
private
:
404
405
static
const
unsigned
int
SINGLE_EXPONENT_MASK = 0x7F800000;
406
static
const
unsigned
int
SINGLE_MANTISSA_MASK = 0x007FFFFF;
407
static
const
unsigned
int
SINGLE_NAN_BITS = (SINGLE_EXPONENT_MASK | 0x00400000);
408
409
};
410
411
}}
412
413
#endif
/*_DECAF_LANG_FLOAT_H_*/
src
main
decaf
lang
Float.h
Generated on Mon Mar 4 2013 10:25:46 for activemq-cpp-3.6.0 by
1.8.1.2