author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 21 Mar 2008 13:41:16 -0700 | |
changeset 2693 | 56e28e34e109 |
parent 2637 | ac94e4889027 |
child 2716 | 2319c4bde708 |
permissions | -rw-r--r-- |
2370
5f7ad186b798
introduce ObjectBase
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
#include "object-base.h" |
2637
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
2 |
#include "log.h" |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
3 |
#include "trace-source-accessor.h" |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
4 |
#include "string.h" |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
5 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
6 |
NS_LOG_COMPONENT_DEFINE ("ObjectBase"); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
7 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
8 |
namespace ns3 { |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
9 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
10 |
static TypeId |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
11 |
GetObjectIid (void) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
12 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
13 |
TypeId tid = TypeId ("ns3::ObjectBase"); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
14 |
tid.SetParent (tid); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
15 |
return tid; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
16 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
17 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
18 |
TypeId |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
19 |
ObjectBase::GetTypeId (void) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
20 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
21 |
static TypeId tid = GetObjectIid (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
22 |
return tid; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
23 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
24 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
25 |
ObjectBase::~ObjectBase () |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
26 |
{} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
27 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
28 |
void |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
29 |
ObjectBase::NotifyConstructionCompleted (void) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
30 |
{} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
31 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
32 |
void |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
33 |
ObjectBase::ConstructSelf (const AttributeList &attributes) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
34 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
35 |
// loop over the inheritance tree back to the Object base class. |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
36 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
37 |
do { |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
38 |
// loop over all attributes in object type |
2693
56e28e34e109
TypeId::GetAttributeListN -> TypeId::GetAttributeN
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2637
diff
changeset
|
39 |
NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributeN ()); |
56e28e34e109
TypeId::GetAttributeListN -> TypeId::GetAttributeN
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2637
diff
changeset
|
40 |
for (uint32_t i = 0; i < tid.GetAttributeN (); i++) |
2637
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
41 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
42 |
Ptr<const AttributeAccessor> paramSpec = tid.GetAttributeAccessor (i); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
43 |
Attribute initial = tid.GetAttributeInitialValue (i); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
44 |
Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
45 |
NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<< |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
46 |
tid.GetAttributeName (i)<<"\""); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
47 |
if (!(tid.GetAttributeFlags (i) & TypeId::ATTR_CONSTRUCT)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
48 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
49 |
continue; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
50 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
51 |
bool found = false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
52 |
// is this attribute stored in this AttributeList instance ? |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
53 |
for (AttributeList::Attrs::const_iterator j = attributes.m_attributes.begin (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
54 |
j != attributes.m_attributes.end (); j++) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
55 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
56 |
if (j->checker == checker) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
57 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
58 |
// We have a matching attribute value. |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
59 |
DoSet (paramSpec, initial, checker, j->value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
60 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
61 |
tid.GetAttributeName (i)<<"\""); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
62 |
found = true; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
63 |
break; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
64 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
65 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
66 |
if (!found) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
67 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
68 |
// is this attribute stored in the global instance instance ? |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
69 |
for (AttributeList::Attrs::const_iterator j = AttributeList::GetGlobal ()->m_attributes.begin (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
70 |
j != AttributeList::GetGlobal ()->m_attributes.end (); j++) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
71 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
72 |
if (j->checker == checker) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
73 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
74 |
// We have a matching attribute value. |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
75 |
DoSet (paramSpec, initial, checker, j->value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
76 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
77 |
tid.GetAttributeName (i)<<"\" from global"); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
78 |
found = true; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
79 |
break; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
80 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
81 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
82 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
83 |
if (!found) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
84 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
85 |
// No matching attribute value so we set the default value. |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
86 |
paramSpec->Set (this, initial); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
87 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
88 |
tid.GetAttributeName (i)<<"\" from initial value."); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
89 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
90 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
91 |
tid = tid.GetParent (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
92 |
} while (tid != ObjectBase::GetTypeId ()); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
93 |
NotifyConstructionCompleted (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
94 |
} |
2370
5f7ad186b798
introduce ObjectBase
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
|
2637
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
96 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
97 |
ObjectBase::DoSet (Ptr<const AttributeAccessor> spec, Attribute initialValue, |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
98 |
Ptr<const AttributeChecker> checker, Attribute value) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
99 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
100 |
bool ok = checker->Check (value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
101 |
if (!ok) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
102 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
103 |
// attempt to convert to string |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
104 |
const StringValue *str = value.DynCast<const StringValue *> (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
105 |
if (str == 0) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
106 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
107 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
108 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
109 |
// attempt to convert back from string. |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
110 |
Attribute v = checker->Create (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
111 |
ok = v.DeserializeFromString (str->Get ().Get (), checker); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
112 |
if (!ok) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
113 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
114 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
115 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
116 |
ok = checker->Check (v); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
117 |
if (!ok) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
118 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
119 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
120 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
121 |
value = v; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
122 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
123 |
ok = spec->Set (this, value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
124 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
125 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
126 |
void |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
127 |
ObjectBase::SetAttribute (std::string name, Attribute value) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
128 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
129 |
struct TypeId::AttributeInfo info; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
130 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
131 |
if (!tid.LookupAttributeByName (name, &info)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
132 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
133 |
NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<tid.GetName ()); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
134 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
135 |
if (!(info.flags & TypeId::ATTR_SET)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
136 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
137 |
NS_FATAL_ERROR ("Attribute name="<<name<<" is not settable for this object: tid="<<tid.GetName ()); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
138 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
139 |
if (!DoSet (info.accessor, info.initialValue, info.checker, value)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
140 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
141 |
NS_FATAL_ERROR ("Attribute name="<<name<<" could not be set for this object: tid="<<tid.GetName ()); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
142 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
143 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
144 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
145 |
ObjectBase::SetAttributeFailSafe (std::string name, Attribute value) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
146 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
147 |
struct TypeId::AttributeInfo info; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
148 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
149 |
if (!tid.LookupAttributeByName (name, &info)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
150 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
151 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
152 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
153 |
if (!(info.flags & TypeId::ATTR_SET)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
154 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
155 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
156 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
157 |
return DoSet (info.accessor, info.initialValue, info.checker, value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
158 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
159 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
160 |
ObjectBase::GetAttribute (std::string name, std::string &value) const |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
161 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
162 |
struct TypeId::AttributeInfo info; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
163 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
164 |
if (!tid.LookupAttributeByName (name, &info)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
165 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
166 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
167 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
168 |
if (!(info.flags & TypeId::ATTR_GET)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
169 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
170 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
171 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
172 |
Attribute v = info.checker->Create (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
173 |
bool ok = info.accessor->Get (this, v); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
174 |
if (ok) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
175 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
176 |
value = v.SerializeToString (info.checker); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
177 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
178 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
179 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
180 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
181 |
Attribute |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
182 |
ObjectBase::GetAttribute (std::string name) const |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
183 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
184 |
struct TypeId::AttributeInfo info; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
185 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
186 |
if (!tid.LookupAttributeByName (name, &info)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
187 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
188 |
return Attribute (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
189 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
190 |
if (!(info.flags & TypeId::ATTR_GET)) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
191 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
192 |
return Attribute (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
193 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
194 |
Attribute value = info.checker->Create (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
195 |
bool ok = info.accessor->Get (this, value); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
196 |
if (!ok) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
197 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
198 |
return Attribute (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
199 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
200 |
return value; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
201 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
202 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
203 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
204 |
ObjectBase::TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
205 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
206 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
207 |
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
208 |
if (accessor == 0) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
209 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
210 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
211 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
212 |
bool ok = accessor->ConnectWithoutContext (this, cb); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
213 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
214 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
215 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
216 |
ObjectBase::TraceConnectWithoutContext (std::string name, std::string context, const CallbackBase &cb) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
217 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
218 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
219 |
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
220 |
if (accessor == 0) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
221 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
222 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
223 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
224 |
bool ok = accessor->Connect (this, context, cb); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
225 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
226 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
227 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
228 |
ObjectBase::TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
229 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
230 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
231 |
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
232 |
if (accessor == 0) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
233 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
234 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
235 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
236 |
bool ok = accessor->DisconnectWithoutContext (this, cb); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
237 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
238 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
239 |
bool |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
240 |
ObjectBase::TraceDisconnectWithoutContext (std::string name, std::string context, const CallbackBase &cb) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
241 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
242 |
TypeId tid = GetInstanceTypeId (); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
243 |
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
244 |
if (accessor == 0) |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
245 |
{ |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
246 |
return false; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
247 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
248 |
bool ok = accessor->Disconnect (this, context, cb); |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
249 |
return ok; |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
250 |
} |
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
251 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
252 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
253 |
|
ac94e4889027
move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2370
diff
changeset
|
254 |
} // namespace ns3 |