author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 19 Jun 2009 08:43:58 +0200 | |
changeset 4554 | b1940a738981 |
parent 3763 | e46e361a4262 |
permissions | -rw-r--r-- |
2581
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
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:
2572
diff
changeset
|
2 |
/* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
4 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
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:
2572
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:
2572
diff
changeset
|
7 |
* published by the Free Software Foundation; |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
8 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
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:
2572
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:
2572
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:
2572
diff
changeset
|
12 |
* GNU General Public License for more details. |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
13 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
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:
2572
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:
2572
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:
2572
diff
changeset
|
17 |
* |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
18 |
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
31d4960dc31b
add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
19 |
*/ |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#ifdef RUN_SELF_TESTS |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#include "test.h" |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#include "object.h" |
2452
8efda0e4423a
boolean-value -> boolean
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2450
diff
changeset
|
23 |
#include "boolean.h" |
2454
23ab3212cec4
int-value -> integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2452
diff
changeset
|
24 |
#include "integer.h" |
2455
8253e8353689
uint-value -> uinteger
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2454
diff
changeset
|
25 |
#include "uinteger.h" |
2457
87f009efcb3f
enum-value -> enum
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2456
diff
changeset
|
26 |
#include "enum.h" |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2495
diff
changeset
|
27 |
#include "string.h" |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2381
diff
changeset
|
28 |
#include "random-variable.h" |
2456
8f40bc572412
fp-value -> double
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2455
diff
changeset
|
29 |
#include "double.h" |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
30 |
#include "object-vector.h" |
2482
adbc284a5849
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2469
diff
changeset
|
31 |
#include "traced-value.h" |
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
32 |
#include "callback.h" |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2462
diff
changeset
|
33 |
#include "trace-source-accessor.h" |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
34 |
#include "pointer.h" |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
35 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
namespace ns3 { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
|
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
38 |
class ValueClassTest |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
39 |
{ |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
40 |
public: |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
41 |
ValueClassTest () {} |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
42 |
private: |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
43 |
int m_v; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
44 |
}; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
45 |
bool operator != (const ValueClassTest &a, const ValueClassTest &b) |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
46 |
{ |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
47 |
return true; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
48 |
} |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
49 |
std::ostream & operator << (std::ostream &os, ValueClassTest v) |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
50 |
{ |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
51 |
return os; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
52 |
} |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
53 |
std::istream & operator >> (std::istream &is, ValueClassTest &v) |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
54 |
{ |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
55 |
return is; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
56 |
} |
3094
6e787ec9c8aa
ATTRIBUTE_HELPER_HEADER_2 -> ATTRIBUTE_HELPER_HEADER
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
57 |
ATTRIBUTE_HELPER_HEADER (ValueClassTest); |
2582
3e28107b870f
rename old VALUE leftovers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2581
diff
changeset
|
58 |
ATTRIBUTE_HELPER_CPP (ValueClassTest); |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
59 |
|
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
60 |
class AttributeTest : public Test |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
{ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
public: |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
63 |
AttributeTest (); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
virtual bool RunTests (void); |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
private: |
2468
23b763621698
replace IntegerTraceSource with ValueTraceSource
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2466
diff
changeset
|
66 |
void NotifySource1 (int8_t old, int8_t n) { |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
67 |
m_got1 = n; |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2462
diff
changeset
|
68 |
} |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
69 |
void NotifySource2 (double a, int b, float c) { |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
70 |
m_got2 = a; |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
71 |
} |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
72 |
void NotifySourceValue (ValueClassTest old, ValueClassTest n) { |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
73 |
m_gotValue = n; |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
74 |
} |
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
75 |
void NotifyCallbackValue (int8_t a) { |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
76 |
m_gotCbValue = a; |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
77 |
} |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
78 |
int64_t m_got1; |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
79 |
double m_got2; |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
80 |
ValueClassTest m_gotValue; |
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
81 |
int16_t m_gotCbValue; |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
}; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
class Derived : public Object |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
{ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
public: |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
static TypeId GetTypeId (void) { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
static TypeId tid = TypeId ("Derived") |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
.SetParent<Object> () |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
return tid; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
}; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
|
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
95 |
class AttributeObjectTest : public Object |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
{ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
public: |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
98 |
enum Test_e { |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
TEST_A, |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
TEST_B, |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
TEST_C |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
}; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
static TypeId GetTypeId (void) { |
2613
0e1267814e1c
need to use ns3:: prefix for TypeId names now.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
104 |
static TypeId tid = TypeId ("ns3::AttributeObjectTest") |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
.SetParent<Object> () |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2599
diff
changeset
|
106 |
.HideFromDocumentation () |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
107 |
.AddAttribute ("TestBoolName", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
108 |
BooleanValue (false), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
109 |
MakeBooleanAccessor (&AttributeObjectTest::m_boolTest), |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
110 |
MakeBooleanChecker ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
111 |
.AddAttribute ("TestBoolA", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
112 |
BooleanValue (false), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
113 |
MakeBooleanAccessor (&AttributeObjectTest::DoSetTestB, |
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
114 |
&AttributeObjectTest::DoGetTestB), |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
115 |
MakeBooleanChecker ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
116 |
.AddAttribute ("TestInt16", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
117 |
IntegerValue (-2), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
118 |
MakeIntegerAccessor (&AttributeObjectTest::m_int16), |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
119 |
MakeIntegerChecker<int16_t> ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
120 |
.AddAttribute ("TestInt16WithBounds", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
121 |
IntegerValue (-2), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
122 |
MakeIntegerAccessor (&AttributeObjectTest::m_int16WithBounds), |
2599
fcc1728eb669
Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2594
diff
changeset
|
123 |
MakeIntegerChecker<int16_t> (-5, 10)) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
124 |
.AddAttribute ("TestInt16SetGet", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
125 |
IntegerValue (6), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
126 |
MakeIntegerAccessor (&AttributeObjectTest::DoSetInt16, |
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
127 |
&AttributeObjectTest::DoGetInt16), |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
128 |
MakeIntegerChecker<int16_t> ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
129 |
.AddAttribute ("TestUint8", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
130 |
UintegerValue (1), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
131 |
MakeUintegerAccessor (&AttributeObjectTest::m_uint8), |
2439
4a0b22a3f5fa
UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
132 |
MakeUintegerChecker<uint8_t> ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
133 |
.AddAttribute ("TestEnum", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
134 |
EnumValue (TEST_A), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
135 |
MakeEnumAccessor (&AttributeObjectTest::m_enum), |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
136 |
MakeEnumChecker (TEST_A, "TestA", |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
137 |
TEST_B, "TestB", |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
138 |
TEST_C, "TestC")) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
139 |
.AddAttribute ("TestRandom", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
140 |
RandomVariableValue (ConstantVariable (1.0)), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
141 |
MakeRandomVariableAccessor (&AttributeObjectTest::m_random), |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
142 |
MakeRandomVariableChecker ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
143 |
.AddAttribute ("TestFloat", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
144 |
DoubleValue (-1.1), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
145 |
MakeDoubleAccessor (&AttributeObjectTest::m_float), |
2444
74fb004db27c
fpValue -> Double
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2441
diff
changeset
|
146 |
MakeDoubleChecker<float> ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
147 |
.AddAttribute ("TestVector1", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
148 |
ObjectVectorValue (), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
149 |
MakeObjectVectorAccessor (&AttributeObjectTest::m_vector1), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
150 |
MakeObjectVectorChecker<Derived> ()) |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2457
diff
changeset
|
151 |
.AddAttribute ("TestVector2", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
152 |
ObjectVectorValue (), |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
153 |
MakeObjectVectorAccessor (&AttributeObjectTest::DoGetVectorN, |
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
154 |
&AttributeObjectTest::DoGetVector), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
155 |
MakeObjectVectorChecker<Derived> ()) |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
156 |
.AddAttribute ("IntegerTraceSource1", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
157 |
IntegerValue (-2), |
2464
aafe5d5c2922
get rid of useless accessor maker
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
158 |
MakeIntegerAccessor (&AttributeObjectTest::m_intSrc1), |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
159 |
MakeIntegerChecker<int8_t> ()) |
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
160 |
.AddAttribute ("IntegerTraceSource2", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
161 |
IntegerValue (-2), |
2464
aafe5d5c2922
get rid of useless accessor maker
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
162 |
MakeIntegerAccessor (&AttributeObjectTest::DoSetIntSrc, |
aafe5d5c2922
get rid of useless accessor maker
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
163 |
&AttributeObjectTest::DoGetIntSrc), |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
164 |
MakeIntegerChecker<int8_t> ()) |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
165 |
.AddAttribute ("ValueClassSource", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
166 |
ValueClassTestValue (ValueClassTest ()), |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
167 |
MakeValueClassTestAccessor (&AttributeObjectTest::m_valueSrc), |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
168 |
MakeValueClassTestChecker ()) |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2462
diff
changeset
|
169 |
.AddTraceSource ("Source1", "help test", |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2462
diff
changeset
|
170 |
MakeTraceSourceAccessor (&AttributeObjectTest::m_intSrc1)) |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
171 |
.AddTraceSource ("Source2", "help text", |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
172 |
MakeTraceSourceAccessor (&AttributeObjectTest::m_cb)) |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
173 |
.AddTraceSource ("ValueSource", "help text", |
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
174 |
MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc)) |
3190
51fe9001a679
add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3094
diff
changeset
|
175 |
.AddAttribute ("Pointer", "help text", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
176 |
PointerValue (), |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
177 |
MakePointerAccessor (&AttributeObjectTest::m_ptr), |
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
178 |
MakePointerChecker<Derived> ()) |
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
179 |
.AddAttribute ("Callback", "help text", |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
180 |
CallbackValue (), |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
181 |
MakeCallbackAccessor (&AttributeObjectTest::m_cbValue), |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
182 |
MakeCallbackChecker ()) |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
183 |
; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
184 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
185 |
return tid; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
186 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
187 |
|
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
188 |
void AddToVector1 (void) { |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
189 |
m_vector1.push_back (CreateObject<Derived> ()); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
190 |
} |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
191 |
void AddToVector2 (void) { |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
192 |
m_vector2.push_back (CreateObject<Derived> ()); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
193 |
} |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
194 |
|
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
195 |
void InvokeCb (double a, int b, float c) { |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
196 |
m_cb (a,b,c); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
197 |
} |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
198 |
|
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
199 |
void InvokeCbValue (int8_t a) { |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
200 |
if (!m_cbValue.IsNull ()) |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
201 |
{ |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
202 |
m_cbValue (a); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
203 |
} |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
204 |
} |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
205 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
206 |
private: |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
207 |
void DoSetTestB (bool v) { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
208 |
m_boolTestA = v; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
209 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
210 |
bool DoGetTestB (void) const { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
return m_boolTestA; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
212 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
213 |
int16_t DoGetInt16 (void) const { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
214 |
return m_int16SetGet; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
215 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
216 |
void DoSetInt16 (int16_t v) { |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
217 |
m_int16SetGet = v; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
} |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
219 |
uint32_t DoGetVectorN (void) const { |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
220 |
return m_vector2.size (); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
221 |
} |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
222 |
Ptr<Derived> DoGetVector (uint32_t i) const { |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
223 |
return m_vector2[i]; |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
224 |
} |
3527
1548d7e3604f
allow attribute setters to fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3190
diff
changeset
|
225 |
bool DoSetIntSrc (int8_t v) { |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
226 |
m_intSrc2 = v; |
3527
1548d7e3604f
allow attribute setters to fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3190
diff
changeset
|
227 |
return true; |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
228 |
} |
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
229 |
int8_t DoGetIntSrc (void) const { |
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
230 |
return m_intSrc2; |
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
231 |
} |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
232 |
bool m_boolTestA; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
233 |
bool m_boolTest; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
234 |
int16_t m_int16; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
235 |
int16_t m_int16WithBounds; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
236 |
int16_t m_int16SetGet; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
237 |
uint8_t m_uint8; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
238 |
float m_float; |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
239 |
enum Test_e m_enum; |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2381
diff
changeset
|
240 |
RandomVariable m_random; |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
241 |
std::vector<Ptr<Derived> > m_vector1; |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
242 |
std::vector<Ptr<Derived> > m_vector2; |
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
243 |
Callback<void,int8_t> m_cbValue; |
2482
adbc284a5849
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2469
diff
changeset
|
244 |
TracedValue<int8_t> m_intSrc1; |
adbc284a5849
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2469
diff
changeset
|
245 |
TracedValue<int8_t> m_intSrc2; |
adbc284a5849
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2469
diff
changeset
|
246 |
TracedCallback<double, int, float> m_cb; |
adbc284a5849
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2469
diff
changeset
|
247 |
TracedValue<ValueClassTest> m_valueSrc; |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
248 |
Ptr<Derived> m_ptr; |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
249 |
}; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
250 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
251 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
252 |
#define CHECK_GET_STR(p,name,value) \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
253 |
{ \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
254 |
std::string expected = value; \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
255 |
StringValue got; \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
256 |
bool ok = p->GetAttributeFailSafe (name, got); \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
257 |
NS_TEST_ASSERT (ok); \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
258 |
NS_TEST_ASSERT_EQUAL (got.Get (), expected); \ |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
259 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
260 |
#define CHECK_GET_PARAM(p,name,type,value) \ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
261 |
{ \ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
262 |
const type expected = value; \ |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
263 |
type got; \ |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
264 |
bool ok = p->GetAttributeFailSafe (name, got); \ |
2716
2319c4bde708
use FailSafe postfix in a more rigorous way.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2613
diff
changeset
|
265 |
NS_TEST_ASSERT (ok); \ |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
266 |
NS_TEST_ASSERT_EQUAL (got.Get (), expected.Get ()); \ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
267 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
268 |
|
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
269 |
NS_OBJECT_ENSURE_REGISTERED (AttributeObjectTest); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
270 |
|
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
271 |
AttributeTest::AttributeTest () |
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
272 |
: Test ("Attribute") |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
273 |
{} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
274 |
bool |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
275 |
AttributeTest::RunTests (void) |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
276 |
{ |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
277 |
bool result = true; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
278 |
|
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
279 |
AttributeList params; |
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
280 |
Ptr<AttributeObjectTest> p; |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
281 |
NS_TEST_ASSERT (params.SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("false"))); |
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3763
diff
changeset
|
282 |
p = CreateObjectWithAttributes<AttributeObjectTest> (params); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
283 |
CHECK_GET_STR (p, "TestBoolName", "false"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
284 |
CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, false); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
285 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
286 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", StringValue ("true"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
287 |
CHECK_GET_STR (p, "TestBoolName", "true"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
288 |
CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
289 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
290 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", BooleanValue (false))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
291 |
CHECK_GET_STR (p, "TestBoolName", "false"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
292 |
CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, false); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
293 |
|
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3763
diff
changeset
|
294 |
p = CreateObjectWithAttributes<AttributeObjectTest> ("TestBoolName", StringValue ("true")); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
295 |
CHECK_GET_STR (p, "TestBoolName", "true"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
296 |
CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
297 |
|
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3763
diff
changeset
|
298 |
p = CreateObjectWithAttributes<AttributeObjectTest> ("TestBoolName", BooleanValue (true)); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
299 |
CHECK_GET_STR (p, "TestBoolName", "true"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
300 |
CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
302 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", StringValue ("false"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
303 |
CHECK_GET_STR (p, "TestBoolA", "false"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
304 |
CHECK_GET_PARAM (p, "TestBoolA", BooleanValue, false); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
306 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", StringValue ("true"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
307 |
CHECK_GET_STR (p, "TestBoolA", "true"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
308 |
CHECK_GET_PARAM (p, "TestBoolA", BooleanValue, true); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
309 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
310 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
311 |
CHECK_GET_STR (p, "TestInt16", "-2"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
312 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -2); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
313 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
314 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", StringValue ("-5"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
315 |
CHECK_GET_STR (p, "TestInt16", "-5"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
316 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -5); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
317 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
318 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (+2))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
319 |
CHECK_GET_STR (p, "TestInt16", "2"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
320 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, +2); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
321 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
322 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (-32768))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
323 |
CHECK_GET_STR (p, "TestInt16", "-32768"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
324 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -32768); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
325 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
326 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", IntegerValue (-32769))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
327 |
CHECK_GET_STR (p, "TestInt16", "-32768"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
328 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -32768); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
329 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
330 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (32767))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
331 |
CHECK_GET_STR (p, "TestInt16", "32767"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
332 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, 32767); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
333 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
334 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", IntegerValue (32768))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
335 |
CHECK_GET_STR (p, "TestInt16", "32767"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
336 |
CHECK_GET_PARAM (p, "TestInt16", IntegerValue, 32767); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
337 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
338 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (10))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
339 |
CHECK_GET_STR (p, "TestInt16WithBounds", "10"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
340 |
CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, 10); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
341 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (11))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
342 |
CHECK_GET_STR (p, "TestInt16WithBounds", "10"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
343 |
CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, 10); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
344 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
345 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-5))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
346 |
CHECK_GET_STR (p, "TestInt16WithBounds", "-5"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
347 |
CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, -5); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
348 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-6))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
349 |
CHECK_GET_STR (p, "TestInt16WithBounds", "-5"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
350 |
CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, -5); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
351 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
352 |
CHECK_GET_STR (p, "TestInt16SetGet", "6"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
353 |
CHECK_GET_PARAM (p, "TestInt16SetGet", IntegerValue, 6); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
354 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16SetGet", IntegerValue (0))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
355 |
CHECK_GET_STR (p, "TestInt16SetGet", "0"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
356 |
CHECK_GET_PARAM (p, "TestInt16SetGet", IntegerValue, 0); |
2375
6f8733409b3b
add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2374
diff
changeset
|
357 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
358 |
CHECK_GET_STR (p, "TestUint8", "1"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
359 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 1); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
360 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", UintegerValue (0))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
361 |
CHECK_GET_STR (p, "TestUint8", "0"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
362 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 0); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
363 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", UintegerValue (255))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
364 |
CHECK_GET_STR (p, "TestUint8", "255"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
365 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
366 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", StringValue ("255"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
367 |
CHECK_GET_STR (p, "TestUint8", "255"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
368 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
369 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", StringValue ("256"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
370 |
CHECK_GET_STR (p, "TestUint8", "255"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
371 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
372 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", StringValue ("-1"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
373 |
CHECK_GET_STR (p, "TestUint8", "255"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
374 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
375 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", UintegerValue ((uint64_t)-1))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
376 |
CHECK_GET_STR (p, "TestUint8", "255"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
377 |
CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255); |
2385
ae4d6740d5a0
add back FpValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2384
diff
changeset
|
378 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
379 |
CHECK_GET_STR (p, "TestFloat", "-1.1"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
380 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestFloat", DoubleValue ((float)+2.3))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
381 |
CHECK_GET_PARAM (p, "TestFloat", DoubleValue, (float)+2.3); |
2385
ae4d6740d5a0
add back FpValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2384
diff
changeset
|
382 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
383 |
CHECK_GET_STR (p, "TestEnum", "TestA"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
384 |
CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_A); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
385 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", EnumValue (AttributeObjectTest::TEST_C))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
386 |
CHECK_GET_STR (p, "TestEnum", "TestC"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
387 |
CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_C); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
388 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", StringValue ("TestB"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
389 |
CHECK_GET_STR (p, "TestEnum", "TestB"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
390 |
CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
391 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", StringValue ("TestD"))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
392 |
CHECK_GET_STR (p, "TestEnum", "TestB"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
393 |
CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
394 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", EnumValue (5))); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
395 |
CHECK_GET_STR (p, "TestEnum", "TestB"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
396 |
CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
397 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
398 |
RandomVariableValue ran; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
399 |
p->GetAttribute ("TestRandom", ran); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
400 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", RandomVariableValue (UniformVariable (0.0, 1.0)))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
401 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", RandomVariableValue (ConstantVariable (10.0)))); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
402 |
|
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
403 |
{ |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
404 |
ObjectVectorValue vector; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
405 |
p->GetAttribute ("TestVector1", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
406 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
407 |
p->AddToVector1 (); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
408 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 0); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
409 |
p->GetAttribute ("TestVector1", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
410 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 1); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
411 |
Ptr<Object> a = vector.Get (0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
412 |
NS_TEST_ASSERT_UNEQUAL (a, 0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
413 |
p->AddToVector1 (); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
414 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 1); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
415 |
p->GetAttribute ("TestVector1", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
416 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 2); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
417 |
} |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
418 |
|
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
419 |
{ |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
420 |
ObjectVectorValue vector; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
421 |
p->GetAttribute ("TestVector2", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
422 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
423 |
p->AddToVector2 (); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
424 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 0); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
425 |
p->GetAttribute ("TestVector2", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
426 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 1); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
427 |
Ptr<Object> a = vector.Get (0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
428 |
NS_TEST_ASSERT_UNEQUAL (a, 0); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
429 |
p->AddToVector2 (); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
430 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 1); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
431 |
p->GetAttribute ("TestVector2", vector); |
2405
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
432 |
NS_TEST_ASSERT_EQUAL (vector.GetN (), 2); |
17f406c71505
add ObjectVector value support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2385
diff
changeset
|
433 |
} |
2384
500ada6a4874
add Value support to RandomVariable.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2381
diff
changeset
|
434 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
435 |
NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("true"))); |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
436 |
p = CreateObject<AttributeObjectTest> (); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
437 |
BooleanValue boolV; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
438 |
p->GetAttribute ("TestBoolName", boolV); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
439 |
NS_TEST_ASSERT_EQUAL (boolV.Get (), true); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
440 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
441 |
NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("false"))); |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
442 |
p = CreateObject<AttributeObjectTest> (); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
443 |
p->GetAttribute ("TestBoolName", boolV); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
444 |
NS_TEST_ASSERT_EQUAL (boolV.Get (), false); |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
445 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
446 |
IntegerValue i; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
447 |
p->GetAttribute ("IntegerTraceSource1", i); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
448 |
NS_TEST_ASSERT_EQUAL (i.Get (), -2); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
449 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (+5))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
450 |
p->GetAttribute ("IntegerTraceSource1", i); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
451 |
NS_TEST_ASSERT_EQUAL (i.Get (), +5); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
452 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (127))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
453 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (128))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
454 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-128))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
455 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-129))); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
456 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
457 |
p->GetAttribute ("IntegerTraceSource2", i); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
458 |
NS_TEST_ASSERT_EQUAL (i.Get (), -2); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
459 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (+5))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
460 |
p->GetAttribute ("IntegerTraceSource2", i); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
461 |
NS_TEST_ASSERT_EQUAL (i.Get (), +5); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
462 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (127))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
463 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (128))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
464 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-128))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
465 |
NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-129))); |
2462
93028d4474ba
add an IntegerTraceSource which behaves just like an Integer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
466 |
|
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
467 |
m_got1 = -2; |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
468 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-1))); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
469 |
NS_TEST_ASSERT (p->TraceConnectWithoutContext ("Source1", MakeCallback (&AttributeTest::NotifySource1, this))); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
470 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (0))); |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
471 |
NS_TEST_ASSERT_EQUAL (m_got1, 0); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
472 |
NS_TEST_ASSERT (p->TraceDisconnectWithoutContext ("Source1", MakeCallback (&AttributeTest::NotifySource1, this))); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
473 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (1))); |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
474 |
NS_TEST_ASSERT_EQUAL (m_got1, 0); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
475 |
|
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
476 |
m_got2 = 4.3; |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
477 |
p->InvokeCb (1.0, -5, 0.0); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
478 |
NS_TEST_ASSERT_EQUAL (m_got2, 4.3); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
479 |
NS_TEST_ASSERT (p->TraceConnectWithoutContext ("Source2", MakeCallback (&AttributeTest::NotifySource2, this))); |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
480 |
NS_TEST_ASSERT_EQUAL (m_got2, 4.3); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
481 |
p->InvokeCb (1.0, -5, 0.0); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
482 |
NS_TEST_ASSERT_EQUAL (m_got2, 1.0); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
483 |
NS_TEST_ASSERT (p->TraceDisconnectWithoutContext ("Source2", MakeCallback (&AttributeTest::NotifySource2, this))); |
2466
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
484 |
p->InvokeCb (-1.0, -5, 0.0); |
8e4ee14cc574
make EventTraceSource acceptable to the MakeTraceSourceAccessor function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2464
diff
changeset
|
485 |
NS_TEST_ASSERT_EQUAL (m_got2, 1.0); |
2469
181c6a5b14c1
test the ValueTraceSource with an arbitrary class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2468
diff
changeset
|
486 |
|
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
487 |
NS_TEST_ASSERT (p->TraceConnectWithoutContext ("ValueSource", MakeCallback (&AttributeTest::NotifySourceValue, this))); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
488 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
489 |
PointerValue ptr; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
490 |
p->GetAttribute ("Pointer", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
491 |
Ptr<Derived> derived = ptr.Get<Derived> (); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
492 |
NS_TEST_ASSERT (derived == 0); |
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
493 |
derived = Create<Derived> (); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
494 |
NS_TEST_ASSERT (p->SetAttributeFailSafe("Pointer", PointerValue (derived))); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
495 |
p->GetAttribute ("Pointer", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
496 |
Ptr<Derived> stored = ptr.Get<Derived> (); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
497 |
NS_TEST_ASSERT (stored == derived); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
498 |
p->GetAttribute ("Pointer", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
499 |
Ptr<Object> storedBase = ptr.Get<Object> (); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
500 |
NS_TEST_ASSERT (stored == storedBase); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
501 |
p->GetAttribute ("Pointer", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
502 |
Ptr<AttributeObjectTest> x = ptr.Get<AttributeObjectTest> (); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
503 |
NS_TEST_ASSERT (x == 0); |
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
504 |
|
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3763
diff
changeset
|
505 |
p = CreateObjectWithAttributes<AttributeObjectTest> ("Pointer", PointerValue (Create<Derived> ())); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
506 |
NS_TEST_ASSERT (p != 0); |
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
507 |
derived = 0; |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
508 |
p->GetAttribute ("Pointer", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
509 |
derived = ptr.Get<Derived> (); |
2926
96d1fc816681
Pointer class for primitive type pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2716
diff
changeset
|
510 |
NS_TEST_ASSERT (derived != 0); |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2462
diff
changeset
|
511 |
|
3763
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
512 |
p = CreateObject<AttributeObjectTest> (); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
513 |
NS_TEST_ASSERT (p != 0); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
514 |
m_gotCbValue = 1; |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
515 |
p->InvokeCbValue (2); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
516 |
CallbackValue cbValue = MakeCallback (&AttributeTest::NotifyCallbackValue, this); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
517 |
NS_TEST_ASSERT_EQUAL (m_gotCbValue, 1); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
518 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("Callback", |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
519 |
cbValue)); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
520 |
p->InvokeCbValue (2); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
521 |
NS_TEST_ASSERT_EQUAL (m_gotCbValue, 2); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
522 |
NS_TEST_ASSERT (p->SetAttributeFailSafe ("Callback", |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
523 |
CallbackValue (MakeNullCallback<void,int8_t> ()))); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
524 |
p->InvokeCbValue (3); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
525 |
NS_TEST_ASSERT_EQUAL (m_gotCbValue, 2); |
e46e361a4262
give attribute power to Callback.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3527
diff
changeset
|
526 |
|
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
527 |
return result; |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
528 |
} |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
529 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
530 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
531 |
|
2450
3ad8ebe70756
value-test.cc -> attribute-test.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2444
diff
changeset
|
532 |
static AttributeTest g_parameterTest; |
2374
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
533 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
534 |
} // namespace ns3 |
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
535 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
536 |
|
570f3c6c6142
make Ptr<T> convertible to a Value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
537 |
#endif /* RUN_SELF_TESTS */ |