author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Sat, 04 Jul 2009 08:15:48 +0200 | |
changeset 4654 | 2eaebe77d66b |
parent 4158 | 2b6dba4062e1 |
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" |
4147
5d8530130930
rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents:
4145
diff
changeset
|
25 |
#include "names.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
|
26 |
#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
|
27 |
#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
|
28 |
#include <sstream> |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
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
|
31 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
namespace ns3 { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
34 |
namespace Config { |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
35 |
|
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
36 |
MatchContainer::MatchContainer () |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
37 |
{} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
38 |
MatchContainer::MatchContainer (const std::vector<Ptr<Object> > &objects, |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
39 |
const std::vector<std::string> &contexts, |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
40 |
std::string path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
41 |
: m_objects (objects), |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
42 |
m_contexts (contexts), |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
43 |
m_path (path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
44 |
{} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
45 |
MatchContainer::Iterator |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
46 |
MatchContainer::Begin (void) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
47 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
48 |
return m_objects.begin (); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
49 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
50 |
MatchContainer::Iterator |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
51 |
MatchContainer::End (void) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
52 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
53 |
return m_objects.end (); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
54 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
55 |
uint32_t |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
56 |
MatchContainer::GetN (void) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
57 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
58 |
return m_objects.size (); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
59 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
60 |
Ptr<Object> |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
61 |
MatchContainer::Get (uint32_t i) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
62 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
63 |
return m_objects[i]; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
64 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
65 |
std::string |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
66 |
MatchContainer::GetMatchedPath (uint32_t i) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
67 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
68 |
return m_contexts[i]; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
69 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
70 |
std::string |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
71 |
MatchContainer::GetPath (void) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
72 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
73 |
return m_path; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
74 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
75 |
|
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
76 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
77 |
MatchContainer::Set (std::string name, const AttributeValue &value) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
78 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
79 |
for (Iterator tmp = Begin (); tmp != End (); ++tmp) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
80 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
81 |
Ptr<Object> object = *tmp; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
82 |
object->SetAttribute (name, value); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
83 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
84 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
85 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
86 |
MatchContainer::Connect (std::string name, const CallbackBase &cb) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
87 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
88 |
NS_ASSERT (m_objects.size () == m_contexts.size ()); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
89 |
for (uint32_t i = 0; i < m_objects.size (); ++i) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
90 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
91 |
Ptr<Object> object = m_objects[i]; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
92 |
std::string ctx = m_contexts[i] + name; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
93 |
object->TraceConnect (name, ctx, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
94 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
95 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
96 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
97 |
MatchContainer::ConnectWithoutContext (std::string name, const CallbackBase &cb) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
98 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
99 |
for (Iterator tmp = Begin (); tmp != End (); ++tmp) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
100 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
101 |
Ptr<Object> object = *tmp; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
102 |
object->TraceConnectWithoutContext (name, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
103 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
104 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
105 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
106 |
MatchContainer::Disconnect (std::string name, const CallbackBase &cb) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
107 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
108 |
NS_ASSERT (m_objects.size () == m_contexts.size ()); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
109 |
for (uint32_t i = 0; i < m_objects.size (); ++i) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
110 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
111 |
Ptr<Object> object = m_objects[i]; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
112 |
std::string ctx = m_contexts[i] + name; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
113 |
object->TraceDisconnect (name, ctx, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
114 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
115 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
116 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
117 |
MatchContainer::DisconnectWithoutContext (std::string name, const CallbackBase &cb) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
118 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
119 |
for (Iterator tmp = Begin (); tmp != End (); ++tmp) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
120 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
121 |
Ptr<Object> object = *tmp; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
122 |
object->TraceDisconnectWithoutContext (name, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
123 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
124 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
125 |
|
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
126 |
} // namespace Config |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
127 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
class ArrayMatcher |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
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
|
132 |
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
|
133 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
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
|
135 |
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
|
136 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
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
|
140 |
: 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
|
141 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
142 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
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
|
144 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
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
|
146 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
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
|
148 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
150 |
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
|
151 |
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
|
152 |
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
|
153 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
154 |
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
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
159 |
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
|
160 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
161 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
162 |
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
|
163 |
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
|
164 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
165 |
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
|
166 |
return true; |
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 |
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
|
169 |
return false; |
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 |
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
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
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
|
178 |
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
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
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
|
183 |
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
|
184 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
185 |
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
|
186 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
187 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
188 |
else |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
190 |
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
|
191 |
return false; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
192 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
193 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
194 |
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
|
195 |
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
|
196 |
i == value) |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
197 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
198 |
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
|
199 |
return true; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
200 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
201 |
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
|
202 |
return false; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
203 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
204 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
205 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
206 |
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
|
207 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
208 |
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
|
209 |
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
|
210 |
iss >> (*value); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
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
|
212 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
213 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
214 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
215 |
class Resolver |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
216 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
217 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
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
|
219 |
virtual ~Resolver (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
220 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
221 |
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
|
222 |
private: |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
223 |
void Canonicalize (void); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
224 |
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
|
225 |
void DoArrayResolve (std::string path, const ObjectVectorValue &vector); |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
226 |
void DoResolveOne (Ptr<Object> object); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
227 |
std::string GetResolvedPath (void) const; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
228 |
virtual void DoOne (Ptr<Object> object, std::string path) = 0; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
229 |
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
|
230 |
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
|
231 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
232 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
233 |
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
|
234 |
: m_path (path) |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
235 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
236 |
Canonicalize (); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
237 |
} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
238 |
Resolver::~Resolver () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
239 |
{} |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
240 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
241 |
Resolver::Canonicalize (void) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
242 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
243 |
// ensure that we start and end with a '/' |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
244 |
std::string::size_type tmp = m_path.find ("/"); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
245 |
if (tmp != 0) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
246 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
247 |
// no slash at start |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
248 |
m_path = "/" + m_path; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
249 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
250 |
tmp = m_path.find_last_of ("/"); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
251 |
if (tmp != (m_path.size () - 1)) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
252 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
253 |
// no slash at end |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
254 |
m_path = m_path + "/"; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
255 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
256 |
} |
2474
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 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
259 |
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
|
260 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
261 |
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
|
262 |
} |
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 |
std::string |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
265 |
Resolver::GetResolvedPath (void) const |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
266 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
267 |
std::string fullPath = "/"; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
268 |
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
|
269 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
270 |
fullPath += *i + "/"; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
271 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
272 |
return fullPath; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
273 |
} |
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 |
void |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
276 |
Resolver::DoResolveOne (Ptr<Object> object) |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
277 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
278 |
NS_LOG_DEBUG ("resolved="<<GetResolvedPath ()); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
279 |
DoOne (object, GetResolvedPath ()); |
2474
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 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
283 |
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
|
284 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
285 |
NS_LOG_FUNCTION (path << root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
286 |
std::string::size_type tmp; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
287 |
tmp = path.find ("/"); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
288 |
NS_ASSERT (tmp == 0); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
289 |
std::string::size_type next = path.find ("/", 1); |
4143
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
290 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
291 |
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
|
292 |
{ |
4143
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
293 |
// |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
294 |
// If root is zero, we're beginning to see if we can use the object name |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
295 |
// service to resolve this path. It is impossible to have a object name |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
296 |
// associated with the root of the object name service since that root |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
297 |
// is not an object. This path must be referring to something in another |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
298 |
// namespace and it will have been found already since the name service |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
299 |
// is always consulted last. |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
300 |
// |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
301 |
if (root) |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
302 |
{ |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
303 |
DoResolveOne (root); |
7f7823a31f77
fix crasher in config unit tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
4142
diff
changeset
|
304 |
} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
306 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
307 |
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
|
308 |
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
|
309 |
|
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
310 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
311 |
// If root is zero, we're beginning to see if we can use the object name |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
312 |
// service to resolve this path. In this case, we must see the name space |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
313 |
// "/Names" on the front of this path. There is no object associated with |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
314 |
// the root of the "/Names" namespace, so we just ignore it and move on to |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
315 |
// the next segment. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
316 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
317 |
if (root == 0) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
318 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
319 |
std::string::size_type offset = path.find ("/Names"); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
320 |
if (offset == 0) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
321 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
322 |
m_workStack.push_back (item); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
323 |
DoResolve (pathLeft, root); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
324 |
m_workStack.pop_back (); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
325 |
return; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
326 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
327 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
328 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
329 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
330 |
// We have an item (possibly a segment of a namespace path. Check to see if |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
331 |
// we can determine that this segment refers to a named object. If root is |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
332 |
// zero, this means to look in the root of the "/Names" name space, otherwise |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
333 |
// it refers to a name space context (level). |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
334 |
// |
4158
2b6dba4062e1
some naming changes suggested by Gustavo
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
335 |
Ptr<Object> namedObject = Names::Find<Object> (root, item); |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
336 |
if (namedObject) |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
337 |
{ |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
338 |
NS_LOG_DEBUG ("Name system resolved item = " << item << " to " << namedObject); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
339 |
m_workStack.push_back (item); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
340 |
DoResolve (pathLeft, namedObject); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
341 |
m_workStack.pop_back (); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
342 |
return; |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
343 |
} |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
344 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
345 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
346 |
// We're done with the object name service hooks, so proceed down the path |
4142
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
347 |
// of types and attributes; but only if root is nonzero. If root is zero |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
348 |
// and we find ourselves here, we are trying to check in the namespace for |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
349 |
// a path that is not in the "/Names" namespace. We will have previously |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
350 |
// found any matches, so we just bail out. |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
351 |
// |
4142
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
352 |
if (root == 0) |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
353 |
{ |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
354 |
return; |
59f784af5db6
fix crasher in config
Craig Dowell <craigdo@ee.washington.edu>
parents:
4139
diff
changeset
|
355 |
} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
356 |
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
|
357 |
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
|
358 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
359 |
// 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
|
360 |
std::string tidString = item.substr (1, item.size () - 1); |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
361 |
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
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
366 |
NS_LOG_DEBUG ("GetObject ("<<tidString<<") failed 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
|
367 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
368 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
373 |
else |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
374 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
375 |
// this is a normal attribute. |
2634
44a92f1d3728
introduce ObjectBase::GetInstanceTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2594
diff
changeset
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
380 |
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist 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
|
381 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
382 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
383 |
// 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
|
384 |
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
|
385 |
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
|
386 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
387 |
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
|
388 |
PointerValue ptr; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
393 |
NS_LOG_ERROR ("Requested object name=\""<<item<< |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
394 |
"\" exists 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
|
395 |
" 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
|
396 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
397 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
398 |
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
|
399 |
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
|
400 |
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
|
401 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
402 |
// 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
|
403 |
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
|
404 |
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
|
405 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
406 |
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
|
407 |
ObjectVectorValue vector; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
408 |
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
|
409 |
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
|
410 |
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
|
411 |
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
|
412 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
413 |
// 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
|
414 |
// 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
|
415 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
416 |
} |
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 |
void |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
419 |
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
|
420 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
421 |
NS_ASSERT (path != ""); |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
422 |
std::string::size_type tmp; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
423 |
tmp = path.find ("/"); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
424 |
NS_ASSERT (tmp == 0); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
425 |
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
|
426 |
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
|
427 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
428 |
NS_FATAL_ERROR ("vector path includes no index data on path=\""<<path<<"\""); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
429 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
430 |
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
|
431 |
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
|
432 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
433 |
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
|
434 |
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
|
435 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
436 |
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
|
437 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
438 |
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
|
439 |
oss << i; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
444 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
445 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
446 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
447 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
448 |
class ConfigImpl |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
449 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
450 |
public: |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
451 |
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
|
452 |
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
|
453 |
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
|
454 |
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
|
455 |
void Disconnect (std::string path, const CallbackBase &cb); |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
456 |
Config::MatchContainer LookupMatches (std::string path); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
457 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
458 |
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
|
459 |
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
|
460 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
461 |
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
|
462 |
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
|
463 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
464 |
private: |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
465 |
void ParsePath (std::string path, std::string *root, std::string *leaf) const; |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
466 |
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
|
467 |
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
|
468 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
469 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
470 |
void |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
471 |
ConfigImpl::ParsePath (std::string path, std::string *root, std::string *leaf) const |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
472 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
473 |
std::string::size_type slash = path.find_last_of ("/"); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
474 |
NS_ASSERT (slash != std::string::npos); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
475 |
*root = path.substr (0, slash); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
476 |
*leaf = path.substr (slash+1, path.size ()-(slash+1)); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
477 |
NS_LOG_FUNCTION (path << *root << *leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
478 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
479 |
|
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
480 |
void |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
481 |
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
|
482 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
483 |
std::string root, leaf; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
484 |
ParsePath (path, &root, &leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
485 |
Config::MatchContainer container = LookupMatches (root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
486 |
container.Set (leaf, value); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
487 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
488 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
489 |
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
|
490 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
491 |
std::string root, leaf; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
492 |
ParsePath (path, &root, &leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
493 |
Config::MatchContainer container = LookupMatches (root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
494 |
container.ConnectWithoutContext (leaf, cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
495 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
496 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
497 |
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
|
498 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
499 |
std::string root, leaf; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
500 |
ParsePath (path, &root, &leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
501 |
Config::MatchContainer container = LookupMatches (root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
502 |
container.DisconnectWithoutContext (leaf, cb); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
503 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
504 |
void |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
505 |
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
|
506 |
{ |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
507 |
std::string root, leaf; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
508 |
ParsePath (path, &root, &leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
509 |
Config::MatchContainer container = LookupMatches (root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
510 |
container.Connect (leaf, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
511 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
512 |
void |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
513 |
ConfigImpl::Disconnect (std::string path, const CallbackBase &cb) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
514 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
515 |
std::string root, leaf; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
516 |
ParsePath (path, &root, &leaf); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
517 |
Config::MatchContainer container = LookupMatches (root); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
518 |
container.Disconnect (leaf, cb); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
519 |
} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
520 |
|
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
521 |
Config::MatchContainer |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
522 |
ConfigImpl::LookupMatches (std::string path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
523 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
524 |
NS_LOG_FUNCTION (path); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
525 |
class LookupMatchesResolver : public Resolver |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
526 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
527 |
public: |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
528 |
LookupMatchesResolver (std::string path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
529 |
: Resolver (path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
530 |
{} |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
531 |
virtual void DoOne (Ptr<Object> object, std::string path) { |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
532 |
m_objects.push_back (object); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
533 |
m_contexts.push_back (path); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
534 |
} |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
535 |
std::vector<Ptr<Object> > m_objects; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
536 |
std::vector<std::string> m_contexts; |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
537 |
} resolver = LookupMatchesResolver (path); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
538 |
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
|
539 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
540 |
resolver.Resolve (*i); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
541 |
} |
4139
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
542 |
|
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
543 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
544 |
// See if we can do something with the object name service. Starting with |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
545 |
// the root pointer zeroed indicates to the resolver that it should start |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
546 |
// looking at the root of the "/Names" namespace during this go. |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
547 |
// |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
548 |
resolver.Resolve (0); |
d45e62c78504
add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3787
diff
changeset
|
549 |
|
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
550 |
return Config::MatchContainer (resolver.m_objects, resolver.m_contexts, path); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
551 |
} |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
552 |
|
2569
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2532
diff
changeset
|
553 |
void |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
554 |
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
|
555 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
556 |
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
|
557 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
558 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
559 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
560 |
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
|
561 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
562 |
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
|
563 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
564 |
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
|
565 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
566 |
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
|
567 |
return; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
568 |
} |
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 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
571 |
|
2941
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
572 |
uint32_t |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
573 |
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
|
574 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
575 |
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
|
576 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
577 |
Ptr<Object> |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
578 |
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
|
579 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
580 |
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
|
581 |
} |
2474
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 |
namespace Config { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
584 |
|
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
585 |
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
|
586 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
587 |
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
|
588 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
589 |
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
|
590 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
591 |
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
|
592 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
593 |
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
|
594 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
595 |
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
|
596 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
597 |
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
|
598 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
599 |
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
|
600 |
} |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
601 |
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
|
602 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
603 |
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
|
604 |
} |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
605 |
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
|
606 |
{ |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
607 |
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
|
608 |
} |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
609 |
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
|
610 |
{ |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
611 |
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
|
612 |
} |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
613 |
void |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
614 |
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
|
615 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
616 |
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
|
617 |
} |
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
618 |
void |
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
619 |
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
|
620 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
621 |
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
|
622 |
} |
3787
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
623 |
Config::MatchContainer LookupMatches (std::string path) |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
624 |
{ |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
625 |
return Singleton<ConfigImpl>::Get ()->LookupMatches (path); |
985324e2caaa
bug 284: cannot use config paths to get a handle on an object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3033
diff
changeset
|
626 |
} |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
627 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
628 |
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
|
629 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
630 |
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
|
631 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
632 |
|
2532
86a40c7cbfe9
register and unregister the NodeList as a config root namespace
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2531
diff
changeset
|
633 |
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
|
634 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
635 |
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
|
636 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
637 |
|
2941
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
638 |
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
|
639 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
640 |
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
|
641 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
642 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
643 |
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
|
644 |
{ |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
645 |
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
|
646 |
} |
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
647 |
|
e1ff74674f87
add functions to access list of root namespace objects
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2933
diff
changeset
|
648 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
649 |
} // namespace Config |
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 |
} // namespace ns3 |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
652 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
653 |
#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
|
654 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
655 |
#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
|
656 |
#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
|
657 |
#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
|
658 |
#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
|
659 |
#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
|
660 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
661 |
namespace ns3 { |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
662 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
663 |
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
|
664 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
665 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
666 |
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
|
667 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
668 |
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
|
669 |
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
|
670 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
671 |
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
|
672 |
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
|
673 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
674 |
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
|
675 |
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
|
676 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
677 |
private: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
678 |
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
|
679 |
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
|
680 |
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
|
681 |
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
|
682 |
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
|
683 |
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
|
684 |
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
|
685 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
686 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
687 |
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
|
688 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
689 |
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
|
690 |
.SetParent<Object> () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
691 |
.AddAttribute ("NodesA", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
692 |
ObjectVectorValue (), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
693 |
MakeObjectVectorAccessor (&MyNode::m_nodesA), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
694 |
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
|
695 |
.AddAttribute ("NodesB", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
696 |
ObjectVectorValue (), |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
697 |
MakeObjectVectorAccessor (&MyNode::m_nodesB), |
2933
c7983cfa2cb3
add ObjectVector::GetItemTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
698 |
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
|
699 |
.AddAttribute ("NodeA", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
700 |
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
|
701 |
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
|
702 |
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
|
703 |
.AddAttribute ("NodeB", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
704 |
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
|
705 |
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
|
706 |
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
|
707 |
.AddAttribute ("A", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
708 |
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
|
709 |
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
|
710 |
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
|
711 |
.AddAttribute ("B", "", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
712 |
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
|
713 |
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
|
714 |
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
|
715 |
.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
|
716 |
IntegerValue (-1), |
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
717 |
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
|
718 |
MakeIntegerChecker<int16_t> ()) |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
719 |
.AddTraceSource ("Source", "XX", |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
720 |
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
|
721 |
; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
722 |
return tid; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
723 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
724 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
725 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
726 |
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
|
727 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
728 |
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
|
729 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
730 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
731 |
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
|
732 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
733 |
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
|
734 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
735 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
736 |
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
|
737 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
738 |
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
|
739 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
740 |
void |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
741 |
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
|
742 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
743 |
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
|
744 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
745 |
int8_t |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
746 |
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
|
747 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
748 |
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
|
749 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
750 |
int8_t |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
751 |
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
|
752 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
753 |
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
|
754 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
755 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
756 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
757 |
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
|
758 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
759 |
public: |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
760 |
ConfigTest (); |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
761 |
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
|
762 |
private: |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
763 |
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
|
764 |
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
|
765 |
int16_t m_traceNotification; |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
766 |
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
|
767 |
}; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
768 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
769 |
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
|
770 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
771 |
ConfigTest::ConfigTest () |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
772 |
: Test ("Config") |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
773 |
{} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
774 |
|
2504
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
775 |
void |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
776 |
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
|
777 |
{ |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
778 |
m_traceNotification = newValue; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
779 |
} |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
780 |
|
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
781 |
void |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
782 |
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
|
783 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
784 |
m_traceNotification = newValue; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
785 |
m_tracePath = path; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
786 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
787 |
|
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
788 |
bool |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
789 |
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
|
790 |
{ |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
791 |
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
|
792 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
793 |
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
|
794 |
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
|
795 |
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
|
796 |
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
|
797 |
IntegerValue v; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2941
diff
changeset
|
798 |
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
|
799 |
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
|
800 |
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
|
801 |
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
|
802 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
803 |
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
|
804 |
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
|
805 |
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
|
806 |
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
|
807 |
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
|
808 |
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
|
809 |
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
|
810 |
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
|
811 |
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
|
812 |
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
|
813 |
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
|
814 |
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
|
815 |
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
|
816 |
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
|
817 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
818 |
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
|
819 |
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
|
820 |
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
|
821 |
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
|
822 |
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
|
823 |
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
|
824 |
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
|
825 |
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
|
826 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
827 |
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
|
828 |
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
|
829 |
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
|
830 |
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
|
831 |
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
|
832 |
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
|
833 |
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
|
834 |
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
|
835 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
836 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
837 |
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
|
838 |
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
|
839 |
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
|
840 |
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
|
841 |
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
|
842 |
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
|
843 |
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
|
844 |
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
|
845 |
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
|
846 |
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
|
847 |
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
|
848 |
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
|
849 |
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
|
850 |
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
|
851 |
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
|
852 |
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
|
853 |
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
|
854 |
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
|
855 |
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
|
856 |
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
|
857 |
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
|
858 |
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
|
859 |
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
|
860 |
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
|
861 |
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
|
862 |
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
|
863 |
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
|
864 |
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
|
865 |
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
|
866 |
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
|
867 |
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
|
868 |
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
|
869 |
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
|
870 |
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
|
871 |
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
|
872 |
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
|
873 |
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
|
874 |
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
|
875 |
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
|
876 |
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
|
877 |
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
|
878 |
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
|
879 |
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
|
880 |
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
|
881 |
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
|
882 |
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
|
883 |
d1->GetAttribute ("A", v); |
2479 | 884 |
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
|
885 |
d2->GetAttribute ("A", v); |
2475 | 886 |
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
|
887 |
d3->GetAttribute ("A", v); |
2475 | 888 |
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
|
889 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
890 |
|
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
891 |
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
|
892 |
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
|
893 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
894 |
// 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
|
895 |
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
|
896 |
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
|
897 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
898 |
// 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
|
899 |
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
|
900 |
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
|
901 |
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
|
902 |
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
|
903 |
m_traceNotification = 0; |
da3ec9cc3ba3
add example for trace connect/disconnection with trace paths
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2479
diff
changeset
|
904 |
// 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
|
905 |
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
|
906 |
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
|
907 |
|
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
908 |
|
2594
a8f89acd17a1
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2593
diff
changeset
|
909 |
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
|
910 |
MakeCallback (&ConfigTest::ChangeNotificationWithPath, this)); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
911 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
912 |
// 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
|
913 |
d2->SetAttribute ("Source", IntegerValue (-2)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
914 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
915 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
916 |
m_tracePath = ""; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
917 |
// 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
|
918 |
d1->SetAttribute ("Source", IntegerValue (-3)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
919 |
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
|
920 |
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
|
921 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
922 |
m_tracePath = ""; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
923 |
// 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
|
924 |
d3->SetAttribute ("Source", IntegerValue (-3)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
925 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, -3); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
926 |
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
|
927 |
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
|
928 |
MakeCallback (&ConfigTest::ChangeNotificationWithPath, this)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
929 |
m_traceNotification = 0; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
930 |
// 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
|
931 |
d1->SetAttribute ("Source", IntegerValue (-4)); |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
932 |
NS_TEST_ASSERT_EQUAL (m_traceNotification, 0); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2504
diff
changeset
|
933 |
|
4145
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
934 |
// |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
935 |
// The Config system is intertwined with the Names system. In the process |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
936 |
// of parsing the paths above, we also created a NamesPriv singleton. In |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
937 |
// order to get a valgrind-clean run we need to clean up that singleton. |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
938 |
// |
bb930262e55c
add NamesPriv cleanup for code that doesn't use simulator -- for valgrind-clean runs
Craig Dowell <craigdo@ee.washington.edu>
parents:
4143
diff
changeset
|
939 |
Names::Delete (); |
2474
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
940 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
941 |
return result; |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
942 |
} |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
943 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
944 |
} // namespace ns3 |
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
945 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
946 |
|
1d1f77782138
A Config class which hooks into the Object Attribute/Tracing system.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
947 |
#endif /* RUN_SELF_TEST */ |