author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Fri, 11 Jul 2008 18:39:19 +0100 | |
changeset 3416 | 926ccb845111 |
parent 3033 | 5daf048843a6 |
child 3787 | 985324e2caaa |
permissions | -rw-r--r-- |
2586
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
2 |
/* |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
4 |
* |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
7 |
* published by the Free Software Foundation; |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
8 |
* |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
12 |
* GNU General Public License for more details. |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
13 |
* |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
17 |
* |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
18 |
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
50d78910a997
add missing copyright/license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
19 |
*/ |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#include "config.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#include "singleton.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#include "object.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
#include "global-value.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include "object-vector.h" |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
25 |
#include "pointer.h" |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "log.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
#include <sstream> |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
NS_LOG_COMPONENT_DEFINE ("Config"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
namespace ns3 { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
class ArrayMatcher |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
ArrayMatcher (std::string element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
bool Matches (uint32_t i) const; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
bool StringToUint32 (std::string str, uint32_t *value) const; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
std::string m_element; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
ArrayMatcher::ArrayMatcher (std::string element) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
: m_element (element) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
ArrayMatcher::Matches (uint32_t i) const |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
if (m_element == "*") |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
NS_LOG_DEBUG ("Array "<<i<<" matches *"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
std::string::size_type tmp; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
tmp = m_element.find ("|"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
if (tmp != std::string::npos) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
std::string left = m_element.substr (0, tmp-0); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
std::string right = m_element.substr (tmp+1, m_element.size () - (tmp + 1)); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
ArrayMatcher matcher = ArrayMatcher (left); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
if (matcher.Matches (i)) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
NS_LOG_DEBUG ("Array "<<i<<" matches "<<left); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
67 |
matcher = ArrayMatcher (right); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
if (matcher.Matches (i)) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
NS_LOG_DEBUG ("Array "<<i<<" matches "<<right); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
73 |
NS_LOG_DEBUG ("Array "<<i<<" does not match "<<m_element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
return false; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
std::string::size_type leftBracket = m_element.find ("["); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
std::string::size_type rightBracket = m_element.find ("]"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
std::string::size_type dash = m_element.find ("-"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
if (leftBracket == 0 && rightBracket == m_element.size () - 1 && |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
80 |
dash > leftBracket && dash < rightBracket) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
std::string lowerBound = m_element.substr (leftBracket + 1, dash - (leftBracket + 1)); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
std::string upperBound = m_element.substr (dash + 1, rightBracket - (dash + 1)); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
uint32_t min; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
uint32_t max; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
if (StringToUint32 (lowerBound, &min) && |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
StringToUint32 (upperBound, &max) && |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
i >= min && i <= max) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
NS_LOG_DEBUG ("Array "<<i<<" matches "<<m_element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
else |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
NS_LOG_DEBUG ("Array "<<i<<" does not "<<m_element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
return false; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
uint32_t value; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
if (StringToUint32 (m_element, &value) && |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
i == value) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
NS_LOG_DEBUG ("Array "<<i<<" matches "<<m_element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
NS_LOG_DEBUG ("Array "<<i<<" does not match "<<m_element); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
107 |
return false; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
109 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
110 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
ArrayMatcher::StringToUint32 (std::string str, uint32_t *value) const |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
std::istringstream iss; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
iss.str (str); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
iss >> (*value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
return !iss.bad () && !iss.fail (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
class Resolver |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
121 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
Resolver (std::string path); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
124 |
virtual ~Resolver (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
125 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
void Resolve (Ptr<Object> root); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
void DoResolve (std::string path, Ptr<Object> root); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
129 |
void DoArrayResolve (std::string path, const ObjectVectorValue &vector); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
void DoResolveOne (Ptr<Object> object, std::string name); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
std::string GetResolvedPath (std::string name) const; |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
132 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) = 0; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
std::vector<std::string> m_workStack; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
std::string m_path; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
135 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
Resolver::Resolver (std::string path) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
: m_path (path) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
Resolver::~Resolver () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
141 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
142 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
144 |
Resolver::Resolve (Ptr<Object> root) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
146 |
DoResolve (m_path, root); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
std::string |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
150 |
Resolver::GetResolvedPath (std::string name) const |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
151 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
std::string fullPath = ""; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
153 |
for (std::vector<std::string>::const_iterator i = m_workStack.begin (); i != m_workStack.end (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
154 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
155 |
fullPath += "/" + *i; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
156 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
157 |
fullPath += "/" + name; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
158 |
return fullPath; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
159 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
160 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
161 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
162 |
Resolver::DoResolveOne (Ptr<Object> object, std::string name) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
163 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
164 |
NS_LOG_DEBUG ("resolved="<<GetResolvedPath (name)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
165 |
DoOne (object, GetResolvedPath (name), name); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
166 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
167 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
169 |
Resolver::DoResolve (std::string path, Ptr<Object> root) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
171 |
NS_ASSERT (path != ""); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
172 |
std::string::size_type pos = path.find ("/"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
173 |
if (pos != 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
174 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
175 |
NS_FATAL_ERROR ("path does not start with a \"/\": \""<<path<<"\""); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
176 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
178 |
std::string::size_type next = path.find ("/", 1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
179 |
if (next == std::string::npos) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
180 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
181 |
std::string attributeName = path.substr (1, path.size ()-1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
182 |
NS_LOG_DEBUG ("handle attr="<<attributeName); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
183 |
DoOne (root, GetResolvedPath (attributeName), attributeName); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
184 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
185 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
186 |
std::string item = path.substr (1, next-1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
187 |
std::string pathLeft = path.substr (next, path.size ()-next); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
188 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
std::string::size_type dollarPos = item.find ("$"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
190 |
if (dollarPos == 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
191 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
192 |
// This is a call to GetObject |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
193 |
std::string tidString = item.substr (1, item.size () - 1); |
2903
ea31499ecbfb
Add support for TCP cwnd tracing
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2718
diff
changeset
|
194 |
NS_LOG_DEBUG ("GetObject="<<tidString<<" on path="<<GetResolvedPath ("")); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
195 |
TypeId tid = TypeId::LookupByName (tidString); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
196 |
Ptr<Object> object = root->GetObject<Object> (tid); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
197 |
if (object == 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
198 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
199 |
NS_LOG_DEBUG ("GetObject ("<<tidString<<") failed on path="<<GetResolvedPath ("")); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
200 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
201 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
202 |
m_workStack.push_back (item); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
203 |
DoResolve (pathLeft, object); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
204 |
m_workStack.pop_back (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
205 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
206 |
else |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
207 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
208 |
// this is a normal attribute. |
2634
44a92f1d3728
introduce ObjectBase::GetInstanceTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2594
diff
changeset
|
209 |
TypeId tid = root->GetInstanceTypeId (); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
210 |
struct TypeId::AttributeInfo info; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
if (!tid.LookupAttributeByName (item, &info)) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
212 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
213 |
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ("")); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
214 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
215 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
216 |
// attempt to cast to a pointer checker. |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
217 |
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker)); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
if (ptr != 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
219 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
220 |
NS_LOG_DEBUG ("GetAttribute(ptr)="<<item<<" on path="<<GetResolvedPath ("")); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
221 |
PointerValue ptr; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
222 |
root->GetAttribute (item, ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
223 |
Ptr<Object> object = ptr.Get<Object> (); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
224 |
if (object == 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
225 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
226 |
NS_LOG_ERROR ("Requested object name=\""<<item<< |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
227 |
"\" exists on path=\""<<GetResolvedPath ("")<<"\"" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
228 |
" but is null."); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
229 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
230 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
231 |
m_workStack.push_back (item); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
232 |
DoResolve (pathLeft, object); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
233 |
m_workStack.pop_back (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
234 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
235 |
// attempt to cast to an object vector. |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
236 |
const ObjectVectorChecker *vectorChecker = dynamic_cast<const ObjectVectorChecker *> (PeekPointer (info.checker)); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
237 |
if (vectorChecker != 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
238 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
239 |
NS_LOG_DEBUG ("GetAttribute(vector)="<<item<<" on path="<<GetResolvedPath ("")); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
240 |
ObjectVectorValue vector; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
241 |
root->GetAttribute (item, vector); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
242 |
m_workStack.push_back (item); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
243 |
DoArrayResolve (pathLeft, vector); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
244 |
m_workStack.pop_back (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
245 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
246 |
// this could be anything else and we don't know what to do with it. |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
247 |
// So, we just ignore it. |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
248 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
249 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
250 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
251 |
void |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
252 |
Resolver::DoArrayResolve (std::string path, const ObjectVectorValue &vector) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
253 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
254 |
NS_ASSERT (path != ""); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
255 |
std::string::size_type pos = path.find ("/"); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
256 |
if (pos != 0) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
257 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
258 |
NS_FATAL_ERROR ("path does not start with a \"/\": \""<<path<<"\""); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
259 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
260 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
261 |
std::string::size_type next = path.find ("/", 1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
262 |
if (next == std::string::npos) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
263 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
264 |
NS_LOG_DEBUG ("vector path includes no index data on path=\""<<path<<"\""); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
265 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
266 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
267 |
std::string item = path.substr (1, next-1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
268 |
std::string pathLeft = path.substr (next, path.size ()-next); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
269 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
270 |
ArrayMatcher matcher = ArrayMatcher (item); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
271 |
for (uint32_t i = 0; i < vector.GetN (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
272 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
273 |
if (matcher.Matches (i)) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
274 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
275 |
std::ostringstream oss; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
276 |
oss << i; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
277 |
m_workStack.push_back (oss.str ()); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
278 |
DoResolve (pathLeft, vector.Get (i)); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
279 |
m_workStack.pop_back (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
280 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
281 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
282 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
283 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
284 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
285 |
class ConfigImpl |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
286 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
287 |
public: |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
288 |
void Set (std::string path, const AttributeValue &value); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
289 |
void ConnectWithoutContext (std::string path, const CallbackBase &cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
290 |
void Connect (std::string path, const CallbackBase &cb); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
291 |
void DisconnectWithoutContext (std::string path, const CallbackBase &cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
292 |
void Disconnect (std::string path, const CallbackBase &cb); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
293 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
294 |
void RegisterRootNamespaceObject (Ptr<Object> obj); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
295 |
void UnregisterRootNamespaceObject (Ptr<Object> obj); |
2941
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
296 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
297 |
uint32_t GetRootNamespaceObjectN (void) const; |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
298 |
Ptr<Object> GetRootNamespaceObject (uint32_t i) const; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
299 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
300 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
typedef std::vector<Ptr<Object> > Roots; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
302 |
Roots m_roots; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
303 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
304 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
void |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
306 |
ConfigImpl::Set (std::string path, const AttributeValue &value) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
307 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
308 |
class SetResolver : public Resolver |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
309 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
310 |
public: |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
311 |
SetResolver (std::string path, const AttributeValue &value) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
312 |
: Resolver (path), |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
313 |
m_value (value.Copy ()) {} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
314 |
private: |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
315 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) { |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
316 |
object->SetAttribute (name, *m_value); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
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:
2941
diff
changeset
|
318 |
Ptr<const AttributeValue> m_value; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
319 |
} resolver = SetResolver (path, value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
320 |
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
321 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
322 |
resolver.Resolve (*i); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
323 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
324 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
325 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
326 |
ConfigImpl::ConnectWithoutContext (std::string path, const CallbackBase &cb) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
327 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
328 |
class ConnectResolver : public Resolver |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
329 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
330 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
331 |
ConnectResolver (std::string path, const CallbackBase &cb) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
332 |
: Resolver (path), |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
333 |
m_cb (cb) {} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
334 |
private: |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
335 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) { |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
336 |
object->TraceConnectWithoutContext (name, m_cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
337 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
338 |
CallbackBase m_cb; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
339 |
} resolver = ConnectResolver (path, cb); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
340 |
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
341 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
342 |
resolver.Resolve (*i); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
343 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
344 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
345 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
346 |
ConfigImpl::DisconnectWithoutContext (std::string path, const CallbackBase &cb) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
347 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
348 |
class DisconnectResolver : public Resolver |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
349 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
350 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
351 |
DisconnectResolver (std::string path, const CallbackBase &cb) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
352 |
: Resolver (path), |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
353 |
m_cb (cb) {} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
354 |
private: |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
355 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) { |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
356 |
object->TraceDisconnectWithoutContext (name, m_cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
357 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
358 |
CallbackBase m_cb; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
359 |
} resolver = DisconnectResolver (path, cb); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
360 |
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
361 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
362 |
resolver.Resolve (*i); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
363 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
364 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
365 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
366 |
ConfigImpl::Connect (std::string path, const CallbackBase &cb) |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
367 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
368 |
class ConnectWithContextResolver : public Resolver |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
369 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
370 |
public: |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
371 |
ConnectWithContextResolver (std::string path, const CallbackBase &cb) |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
372 |
: Resolver (path), |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
373 |
m_cb (cb) {} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
374 |
private: |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
375 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) { |
2718 | 376 |
object->TraceConnect (name, path, m_cb); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
377 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
378 |
CallbackBase m_cb; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
379 |
} resolver = ConnectWithContextResolver (path, cb); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
380 |
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++) |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
381 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
382 |
resolver.Resolve (*i); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
383 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
384 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
385 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
386 |
ConfigImpl::Disconnect (std::string path, const CallbackBase &cb) |
2569
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
387 |
{ |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
388 |
class DisconnectWithContextResolver : public Resolver |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
389 |
{ |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
390 |
public: |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
391 |
DisconnectWithContextResolver (std::string path, const CallbackBase &cb) |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
392 |
: Resolver (path), |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
393 |
m_cb (cb) {} |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
394 |
private: |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
395 |
virtual void DoOne (Ptr<Object> object, std::string path, std::string name) { |
2718 | 396 |
object->TraceDisconnect (name, path, m_cb); |
2569
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
397 |
} |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
398 |
CallbackBase m_cb; |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
399 |
} resolver = DisconnectWithContextResolver (path, cb); |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
400 |
for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++) |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
401 |
{ |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
402 |
resolver.Resolve (*i); |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
403 |
} |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
404 |
} |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
405 |
void |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
406 |
ConfigImpl::RegisterRootNamespaceObject (Ptr<Object> obj) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
407 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
408 |
m_roots.push_back (obj); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
409 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
410 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
411 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
412 |
ConfigImpl::UnregisterRootNamespaceObject (Ptr<Object> obj) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
413 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
414 |
for (std::vector<Ptr<Object> >::iterator i = m_roots.begin (); i != m_roots.end (); i++) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
415 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
416 |
if (*i == obj) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
417 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
418 |
m_roots.erase (i); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
419 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
420 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
421 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
422 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
423 |
|
2941
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
424 |
uint32_t |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
425 |
ConfigImpl::GetRootNamespaceObjectN (void) const |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
426 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
427 |
return m_roots.size (); |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
428 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
429 |
Ptr<Object> |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
430 |
ConfigImpl::GetRootNamespaceObject (uint32_t i) const |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
431 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
432 |
return m_roots[i]; |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
433 |
} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
434 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
435 |
namespace Config { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
436 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
437 |
void Set (std::string path, const AttributeValue &value) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
438 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
439 |
Singleton<ConfigImpl>::Get ()->Set (path, value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
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:
2941
diff
changeset
|
441 |
void SetDefault (std::string name, const AttributeValue &value) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
442 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
443 |
AttributeList::GetGlobal ()->Set (name, value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
444 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
445 |
bool SetDefaultFailSafe (std::string name, const AttributeValue &value) |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
446 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
447 |
return AttributeList::GetGlobal ()->SetFailSafe (name, value); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
448 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
449 |
void SetGlobal (std::string name, const AttributeValue &value) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
450 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
451 |
GlobalValue::Bind (name, value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
452 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
453 |
bool SetGlobalFailSafe (std::string name, const AttributeValue &value) |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
454 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
455 |
return GlobalValue::BindFailSafe (name, value); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
456 |
} |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
457 |
void ConnectWithoutContext (std::string path, const CallbackBase &cb) |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
458 |
{ |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
459 |
Singleton<ConfigImpl>::Get ()->ConnectWithoutContext (path, cb); |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
460 |
} |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
461 |
void DisconnectWithoutContext (std::string path, const CallbackBase &cb) |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
462 |
{ |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
463 |
Singleton<ConfigImpl>::Get ()->DisconnectWithoutContext (path, cb); |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
464 |
} |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
465 |
void |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
466 |
Connect (std::string path, const CallbackBase &cb) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
467 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
468 |
Singleton<ConfigImpl>::Get ()->Connect (path, cb); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
469 |
} |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
470 |
void |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
471 |
Disconnect (std::string path, const CallbackBase &cb) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
472 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
473 |
Singleton<ConfigImpl>::Get ()->Disconnect (path, cb); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
474 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
475 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
476 |
void RegisterRootNamespaceObject (Ptr<Object> obj) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
477 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
478 |
Singleton<ConfigImpl>::Get ()->RegisterRootNamespaceObject (obj); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
479 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
480 |
|
2532
86a40c7cbfe9
register and unregister the NodeList as a config root namespace
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2531
diff
changeset
|
481 |
void UnregisterRootNamespaceObject (Ptr<Object> obj) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
482 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
483 |
Singleton<ConfigImpl>::Get ()->UnregisterRootNamespaceObject (obj); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
484 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
485 |
|
2941
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
486 |
uint32_t GetRootNamespaceObjectN (void) |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
487 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
488 |
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObjectN (); |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
489 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
490 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
491 |
Ptr<Object> GetRootNamespaceObject (uint32_t i) |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
492 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
493 |
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i); |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
494 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
495 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
496 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
497 |
} // namespace Config |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
498 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
499 |
} // namespace ns3 |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
500 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
501 |
#ifdef RUN_SELF_TESTS |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
502 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
503 |
#include "test.h" |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
504 |
#include "integer.h" |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
505 |
#include "traced-value.h" |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
506 |
#include "trace-source-accessor.h" |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
507 |
#include "callback.h" |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
508 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
509 |
namespace ns3 { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
510 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
511 |
class MyNode : public Object |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
512 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
513 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
514 |
static TypeId GetTypeId (void); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
515 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
516 |
void AddNodeA (Ptr<MyNode> a); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
517 |
void AddNodeB (Ptr<MyNode> b); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
518 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
519 |
void SetNodeA (Ptr<MyNode> a); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
520 |
void SetNodeB (Ptr<MyNode> b); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
521 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
522 |
int8_t GetA (void) const; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
523 |
int8_t GetB (void) const; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
524 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
525 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
526 |
std::vector<Ptr<MyNode> > m_nodesA; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
527 |
std::vector<Ptr<MyNode> > m_nodesB; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
528 |
Ptr<MyNode> m_nodeA; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
529 |
Ptr<MyNode> m_nodeB; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
530 |
int8_t m_a; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
531 |
int8_t m_b; |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
532 |
TracedValue<int16_t> m_trace; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
533 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
534 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
535 |
TypeId MyNode::GetTypeId (void) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
536 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
537 |
static TypeId tid = TypeId ("MyNode") |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
538 |
.SetParent<Object> () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
539 |
.AddAttribute ("NodesA", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
540 |
ObjectVectorValue (), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
541 |
MakeObjectVectorAccessor (&MyNode::m_nodesA), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
542 |
MakeObjectVectorChecker<MyNode> ()) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
543 |
.AddAttribute ("NodesB", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
544 |
ObjectVectorValue (), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
545 |
MakeObjectVectorAccessor (&MyNode::m_nodesB), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
546 |
MakeObjectVectorChecker<MyNode> ()) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
547 |
.AddAttribute ("NodeA", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
548 |
PointerValue (), |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
549 |
MakePointerAccessor (&MyNode::m_nodeA), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
550 |
MakePointerChecker<MyNode> ()) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
551 |
.AddAttribute ("NodeB", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
552 |
PointerValue (), |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
553 |
MakePointerAccessor (&MyNode::m_nodeB), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2718
diff
changeset
|
554 |
MakePointerChecker<MyNode> ()) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
555 |
.AddAttribute ("A", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
556 |
IntegerValue (10), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
557 |
MakeIntegerAccessor (&MyNode::m_a), |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
558 |
MakeIntegerChecker<int8_t> ()) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
559 |
.AddAttribute ("B", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
560 |
IntegerValue (9), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
561 |
MakeIntegerAccessor (&MyNode::m_b), |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
562 |
MakeIntegerChecker<int8_t> ()) |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
563 |
.AddAttribute ("Source", "XX", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
564 |
IntegerValue (-1), |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
565 |
MakeIntegerAccessor (&MyNode::m_trace), |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
566 |
MakeIntegerChecker<int16_t> ()) |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
567 |
.AddTraceSource ("Source", "XX", |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
568 |
MakeTraceSourceAccessor (&MyNode::m_trace)) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
569 |
; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
570 |
return tid; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
571 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
572 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
573 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
574 |
MyNode::SetNodeA (Ptr<MyNode> a) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
575 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
576 |
m_nodeA = a; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
577 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
578 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
579 |
MyNode::SetNodeB (Ptr<MyNode> b) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
580 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
581 |
m_nodeB = b; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
582 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
583 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
584 |
MyNode::AddNodeA (Ptr<MyNode> a) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
585 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
586 |
m_nodesA.push_back (a); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
587 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
588 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
589 |
MyNode::AddNodeB (Ptr<MyNode> b) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
590 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
591 |
m_nodesB.push_back (b); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
592 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
593 |
int8_t |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
594 |
MyNode::GetA (void) const |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
595 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
596 |
return m_a; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
597 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
598 |
int8_t |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
599 |
MyNode::GetB (void) const |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
600 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
601 |
return m_b; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
602 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
603 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
604 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
605 |
class ConfigTest : public Test |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
606 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
607 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
608 |
ConfigTest (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
609 |
virtual bool RunTests (void); |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
610 |
private: |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
611 |
void ChangeNotification (int16_t old, int16_t newValue); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
612 |
void ChangeNotificationWithPath (std::string path, int16_t old, int16_t newValue); |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
613 |
int16_t m_traceNotification; |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
614 |
std::string m_tracePath; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
615 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
616 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
617 |
static ConfigTest g_configTestUnique; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
618 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
619 |
ConfigTest::ConfigTest () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
620 |
: Test ("Config") |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
621 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
622 |
|
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
623 |
void |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
624 |
ConfigTest::ChangeNotification (int16_t oldValue, int16_t newValue) |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
625 |
{ |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
626 |
m_traceNotification = newValue; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
627 |
} |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
628 |
|
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
629 |
void |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
630 |
ConfigTest::ChangeNotificationWithPath (std::string path, int16_t old, int16_t newValue) |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
631 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
632 |
m_traceNotification = newValue; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
633 |
m_tracePath = path; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
634 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
635 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
636 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
637 |
ConfigTest::RunTests (void) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
638 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
639 |
bool result = true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
640 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
641 |
Ptr<MyNode> root = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
642 |
Config::RegisterRootNamespaceObject (root); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
643 |
Config::Set ("/A", IntegerValue (1)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
644 |
Config::Set ("/B", IntegerValue (-1)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
645 |
IntegerValue v; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
646 |
root->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
647 |
NS_TEST_ASSERT_EQUAL (v.Get (), 1); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
648 |
root->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
649 |
NS_TEST_ASSERT_EQUAL (v.Get (), -1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
650 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
651 |
Ptr<MyNode> a = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
652 |
root->SetNodeA (a); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
653 |
Config::Set ("/NodeA/A", IntegerValue (2)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
654 |
Config::Set ("/NodeA/B", IntegerValue (-2)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
655 |
a->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
656 |
NS_TEST_ASSERT_EQUAL (v.Get (), 2); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
657 |
a->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
658 |
NS_TEST_ASSERT_EQUAL (v.Get (), -2); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
659 |
Config::Set ("/NodeB/A", IntegerValue (3)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
660 |
Config::Set ("/NodeB/B", IntegerValue (-3)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
661 |
a->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
662 |
NS_TEST_ASSERT_EQUAL (v.Get (), 2); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
663 |
a->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
664 |
NS_TEST_ASSERT_EQUAL (v.Get (), -2); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
665 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
666 |
Ptr<MyNode> b = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
667 |
a->SetNodeB (b); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
668 |
Config::Set ("/NodeA/NodeB/A", IntegerValue (4)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
669 |
Config::Set ("/NodeA/NodeB/B", IntegerValue (-4)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
670 |
b->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
671 |
NS_TEST_ASSERT_EQUAL (v.Get (), 4); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
672 |
b->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
673 |
NS_TEST_ASSERT_EQUAL (v.Get (), -4); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
674 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
675 |
Ptr<MyNode> c = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
676 |
root->SetNodeB (c); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
677 |
Config::Set ("/NodeB/A", IntegerValue (5)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
678 |
Config::Set ("/NodeB/B", IntegerValue (-5)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
679 |
c->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
680 |
NS_TEST_ASSERT_EQUAL (v.Get (), 5); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
681 |
c->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
682 |
NS_TEST_ASSERT_EQUAL (v.Get (), -5); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
683 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
684 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
685 |
Ptr<MyNode> d0 = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
686 |
Ptr<MyNode> d1 = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
687 |
Ptr<MyNode> d2 = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
688 |
Ptr<MyNode> d3 = CreateObject<MyNode> (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
689 |
b->AddNodeB (d0); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
690 |
b->AddNodeB (d1); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
691 |
b->AddNodeB (d2); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
692 |
b->AddNodeB (d3); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
693 |
Config::Set ("/NodeA/NodeB/NodesB/0/A", IntegerValue (-11)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
694 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
695 |
NS_TEST_ASSERT_EQUAL (v.Get (), -11); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
696 |
d0->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
697 |
NS_TEST_ASSERT_EQUAL (v.Get (), 9); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
698 |
d1->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
699 |
NS_TEST_ASSERT_EQUAL (v.Get (), 10); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
700 |
d1->GetAttribute ("B", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
701 |
NS_TEST_ASSERT_EQUAL (v.Get (), 9); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
702 |
Config::Set ("/NodeA/NodeB/NodesB/0|1/A", IntegerValue (-12)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
703 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
704 |
NS_TEST_ASSERT_EQUAL (v.Get (), -12); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
705 |
d1->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
706 |
NS_TEST_ASSERT_EQUAL (v.Get (), -12); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
707 |
Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue (-13)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
708 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
709 |
NS_TEST_ASSERT_EQUAL (v.Get (), -13); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
710 |
d1->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
711 |
NS_TEST_ASSERT_EQUAL (v.Get (), -13); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
712 |
Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue (-14)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
713 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
714 |
NS_TEST_ASSERT_EQUAL (v.Get (), -14); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
715 |
d1->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
716 |
NS_TEST_ASSERT_EQUAL (v.Get (), -14); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
717 |
d2->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
718 |
NS_TEST_ASSERT_EQUAL (v.Get (), -14); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
719 |
Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue (-15)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
720 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
721 |
NS_TEST_ASSERT_EQUAL (v.Get (), -14); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
722 |
d1->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
723 |
NS_TEST_ASSERT_EQUAL (v.Get (), -15); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
724 |
d2->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
725 |
NS_TEST_ASSERT_EQUAL (v.Get (), -15); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
726 |
d3->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
727 |
NS_TEST_ASSERT_EQUAL (v.Get (), -15); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
728 |
Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue (-16)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
729 |
d0->GetAttribute ("A", v); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
730 |
NS_TEST_ASSERT_EQUAL (v.Get (), -16); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
731 |
d1->GetAttribute ("A", v); |
2479 | 732 |
NS_TEST_ASSERT_EQUAL (v.Get (), -16); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
733 |
d2->GetAttribute ("A", v); |
2475 | 734 |
NS_TEST_ASSERT_EQUAL (v.Get (), -15); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
735 |
d3->GetAttribute ("A", v); |
2475 | 736 |
NS_TEST_ASSERT_EQUAL (v.Get (), -16); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
737 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
738 |
|
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
739 |
Config::ConnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source", |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
740 |
MakeCallback (&ConfigTest::ChangeNotification, this)); |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
741 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
742 |
// this should trigger no notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
743 |
d2->SetAttribute ("Source", IntegerValue (-2)); |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
744 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
745 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
746 |
// this should trigger a notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
747 |
d1->SetAttribute ("Source", IntegerValue (-3)); |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
748 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, -3); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
749 |
Config::DisconnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source", |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
750 |
MakeCallback (&ConfigTest::ChangeNotification, this)); |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
751 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
752 |
// this should _not_ trigger a notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
753 |
d1->SetAttribute ("Source", IntegerValue (-4)); |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
754 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
755 |
|
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
756 |
|
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
757 |
Config::Connect ("/NodeA/NodeB/NodesB/[0-1]|3/Source", |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
758 |
MakeCallback (&ConfigTest::ChangeNotificationWithPath, this)); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
759 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
760 |
// this should trigger no notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
761 |
d2->SetAttribute ("Source", IntegerValue (-2)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
762 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
763 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
764 |
m_tracePath = ""; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
765 |
// this should trigger a notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
766 |
d1->SetAttribute ("Source", IntegerValue (-3)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
767 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, -3); |
3033
5daf048843a6
add a couple of helper test macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2972
diff
changeset
|
768 |
NS_TEST_ASSERT_EQUAL (m_tracePath, "/NodeA/NodeB/NodesB/1/Source"); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
769 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
770 |
m_tracePath = ""; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
771 |
// this should trigger a notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
772 |
d3->SetAttribute ("Source", IntegerValue (-3)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
773 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, -3); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
774 |
NS_TEST_ASSERT_EQUAL (m_tracePath, "/NodeA/NodeB/NodesB/3/Source"); |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
775 |
Config::Disconnect ("/NodeA/NodeB/NodesB/[0-1]|3/Source", |
2569
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
776 |
MakeCallback (&ConfigTest::ChangeNotificationWithPath, this)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
777 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
778 |
// this should _not_ trigger a notification |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
779 |
d1->SetAttribute ("Source", IntegerValue (-4)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
780 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
781 |
|
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
782 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
783 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
784 |
return result; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
785 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
786 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
787 |
} // namespace ns3 |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
788 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
789 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
790 |
#endif /* RUN_SELF_TEST */ |