author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 12 Mar 2008 11:35:00 -0700 | |
changeset 2599 | fcc1728eb669 |
parent 2584 | 5011c132ed6c |
child 2928 | 554e10cdc747 |
permissions | -rw-r--r-- |
2581
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
2 |
/* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
4 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
7 |
* published by the Free Software Foundation; |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
8 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
12 |
* GNU General Public License for more details. |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
13 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
17 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
18 |
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2486
diff
changeset
|
19 |
*/ |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
20 |
#ifndef INTEGER_H |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
21 |
#define INTEGER_H |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
2438
e2ac9f9aeeb9
value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2437
diff
changeset
|
23 |
#include "attribute.h" |
2451
8979f07befd5
value-helper.h -> attribute-helper.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2439
diff
changeset
|
24 |
#include "attribute-helper.h" |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <stdint.h> |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
namespace ns3 { |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
2584
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
29 |
/** |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
30 |
* \brief Hold a signed integer type |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
31 |
* |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
32 |
* This class can be used to hold variables of signed integer |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
33 |
* type such as int8_t, int16_t, int32_t, int64_t, or, |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
34 |
* int, etc. |
5011c132ed6c
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
35 |
*/ |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
36 |
class Integer |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
{ |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
public: |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
39 |
Integer (int64_t value); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
40 |
Integer (); |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
void Set (int64_t value); |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
int64_t Get (void) const; |
6f8733409b3b
add back IntValue support
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 |
operator int64_t () const; |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
45 |
ATTRIBUTE_CONVERTER_DEFINE (Integer); |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
private: |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
int64_t m_value; |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
}; |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
50 |
std::ostream &operator << (std::ostream &os, const Integer &integer); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
51 |
std::istream &operator >> (std::istream &is, Integer &integer); |
2410
88dc7d4a6731
introduce top-level ParamSpec for bindings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2408
diff
changeset
|
52 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
53 |
ATTRIBUTE_VALUE_DEFINE(Integer); |
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
54 |
ATTRIBUTE_ACCESSOR_DEFINE(Integer); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
55 |
|
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
56 |
template <typename T> |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
57 |
Ptr<const AttributeChecker> MakeIntegerChecker (void); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
58 |
|
2486
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
59 |
template <typename T> |
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
60 |
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min); |
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
61 |
|
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
62 |
template <typename T> |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
63 |
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max); |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
|
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
} // namespace ns3 |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
|
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
67 |
#include "type-name.h" |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
68 |
|
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
namespace ns3 { |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
|
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
71 |
namespace internal { |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
72 |
|
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
73 |
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max, std::string name); |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
74 |
|
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
75 |
} // internal |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
76 |
|
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
77 |
template <typename T> |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
78 |
Ptr<const AttributeChecker> |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
79 |
MakeIntegerChecker (int64_t min, int64_t max) |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
80 |
{ |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
81 |
return internal::MakeIntegerChecker (min, |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
82 |
max, TypeNameGet<T> ()); |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
83 |
} |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
84 |
|
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
85 |
template <typename T> |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
86 |
Ptr<const AttributeChecker> |
2486
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
87 |
MakeIntegerChecker (int64_t min) |
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
88 |
{ |
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
89 |
return internal::MakeIntegerChecker (min, |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
90 |
std::numeric_limits<T>::max (), |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
91 |
TypeNameGet<T> ()); |
2486
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
92 |
} |
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
93 |
|
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
94 |
template <typename T> |
aeee361ade33
add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
95 |
Ptr<const AttributeChecker> |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
96 |
MakeIntegerChecker (void) |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
97 |
{ |
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
98 |
return internal::MakeIntegerChecker (std::numeric_limits<T>::min (), |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
99 |
std::numeric_limits<T>::max (), |
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2584
diff
changeset
|
100 |
TypeNameGet<T> ()); |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
102 |
|
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
} // namespace ns3 |
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
|
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
105 |
#endif /* INTEGER_H */ |