author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Tue, 26 Feb 2008 20:22:13 +0100 | |
changeset 2485 | 1590feefbf20 |
parent 2455 | 8253e8353689 |
child 2581 | 31d4960dc31b |
permissions | -rw-r--r-- |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1 |
#ifndef UINTEGER_H |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
2 |
#define UINTEGER_H |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
|
2438
e2ac9f9aeeb9
value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2437
diff
changeset
|
4 |
#include "attribute.h" |
2451
8979f07befd5
value-helper.h -> attribute-helper.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2439
diff
changeset
|
5 |
#include "attribute-helper.h" |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
#include <stdint.h> |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
|
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
namespace ns3 { |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
10 |
class Uinteger |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
{ |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
public: |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
13 |
Uinteger (uint64_t value); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
14 |
Uinteger (); |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
|
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
void Set (uint64_t value); |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
uint64_t Get (void) const; |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
19 |
operator uint64_t () const; |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
20 |
|
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
21 |
ATTRIBUTE_CONVERTER_DEFINE (Uinteger); |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
private: |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
uint64_t m_value; |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
}; |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
26 |
std::ostream & operator << (std::ostream &os, const Uinteger &uinteger); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
27 |
std::istream & operator >> (std::istream &is, Uinteger &uinteger); |
2410
88dc7d4a6731
introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
28 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
29 |
ATTRIBUTE_VALUE_DEFINE (Uinteger); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
30 |
ATTRIBUTE_ACCESSOR_DEFINE (Uinteger); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
31 |
|
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
32 |
template <typename T> |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
33 |
Ptr<const AttributeChecker> MakeUintegerChecker (void); |
2428
9c8d27c408db
move checker creation function to .cc file.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
34 |
|
2485
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
35 |
template <typename T> |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
36 |
Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min); |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
37 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
38 |
Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max); |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
|
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
} // namespace ns3 |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
|
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
namespace ns3 { |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
44 |
template <typename T> |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
45 |
Ptr<const AttributeChecker> MakeUintegerChecker (void) |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
{ |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
47 |
return MakeUintegerChecker (std::numeric_limits<T>::min (), |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
48 |
std::numeric_limits<T>::max ()); |
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
} |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
|
2485
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
51 |
template <typename T> |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
52 |
Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min) |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
53 |
{ |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
54 |
return MakeUintegerChecker (min, |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
55 |
std::numeric_limits<T>::max ()); |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
56 |
} |
1590feefbf20
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
57 |
|
2379
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
} // namespace ns3 |
db1eb36bfaa4
forgot to add new files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
60 |
#endif /* UINTEGER_H */ |