author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 10 Mar 2008 13:09:32 -0700 | |
changeset 2583 | c09faa6c90bf |
parent 2582 | 3e28107b870f |
child 2589 | 38274d42d73b |
permissions | -rw-r--r-- |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA, Gustavo Carneiro |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Authors: Gustavo Carneiro <gjcarneiro@gmail.com>, |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
*/ |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
21 |
#include "object.h" |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#include "assert.h" |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
#include "singleton.h" |
2438
e2ac9f9aeeb9
value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2436
diff
changeset
|
24 |
#include "attribute.h" |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
25 |
#include "trace-source-accessor.h" |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1420
diff
changeset
|
26 |
#include "log.h" |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2489
diff
changeset
|
27 |
#include "string.h" |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
#include <vector> |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
29 |
#include <sstream> |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1420
diff
changeset
|
31 |
NS_LOG_COMPONENT_DEFINE ("Object"); |
1374
77468496f7e0
avoid problems with recursive use of Object::DoCollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1372
diff
changeset
|
32 |
|
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
33 |
/********************************************************************* |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
34 |
* Helper code |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
35 |
*********************************************************************/ |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
36 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
namespace { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
|
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
39 |
class IidManager |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
public: |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
42 |
IidManager (); |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
43 |
uint16_t AllocateUid (std::string name); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
44 |
void SetParent (uint16_t uid, uint16_t parent); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
45 |
void SetTypeName (uint16_t uid, std::string typeName); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
46 |
void SetGroupName (uint16_t uid, std::string groupName); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
47 |
void AddConstructor (uint16_t uid, ns3::CallbackBase callback, uint32_t nArguments); |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
48 |
uint16_t GetUid (std::string name) const; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
49 |
std::string GetName (uint16_t uid) const; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
50 |
uint16_t GetParent (uint16_t uid) const; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
51 |
std::string GetTypeName (uint16_t uid) const; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
52 |
std::string GetGroupName (uint16_t uid) const; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
53 |
ns3::CallbackBase GetConstructor (uint16_t uid, uint32_t nArguments); |
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
54 |
bool HasConstructor (uint16_t uid); |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
55 |
uint32_t GetRegisteredN (void); |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
56 |
uint16_t GetRegistered (uint32_t i); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
57 |
void AddAttribute (uint16_t uid, |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
58 |
std::string name, |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
59 |
std::string help, |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
60 |
uint32_t flags, |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
61 |
ns3::Attribute initialValue, |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
62 |
ns3::Ptr<const ns3::AttributeAccessor> spec, |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
63 |
ns3::Ptr<const ns3::AttributeChecker> checker); |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
64 |
uint32_t GetAttributeListN (uint16_t uid) const; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
65 |
std::string GetAttributeName (uint16_t uid, uint32_t i) const; |
2573
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
66 |
std::string GetAttributeHelp (uint16_t uid, uint32_t i) const; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
67 |
uint32_t GetAttributeFlags (uint16_t uid, uint32_t i) const; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
68 |
ns3::Attribute GetAttributeInitialValue (uint16_t uid, uint32_t i) const; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
69 |
ns3::Ptr<const ns3::AttributeAccessor> GetAttributeAccessor (uint16_t uid, uint32_t i) const; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
70 |
ns3::Ptr<const ns3::AttributeChecker> GetAttributeChecker (uint16_t uid, uint32_t i) const; |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
71 |
void AddTraceSource (uint16_t uid, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
72 |
std::string name, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
73 |
std::string help, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
74 |
ns3::Ptr<const ns3::TraceSourceAccessor> accessor); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
75 |
uint32_t GetTraceSourceN (uint16_t uid) const; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
76 |
std::string GetTraceSourceName (uint16_t uid, uint32_t i) const; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
77 |
std::string GetTraceSourceHelp (uint16_t uid, uint32_t i) const; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
78 |
ns3::Ptr<const ns3::TraceSourceAccessor> GetTraceSourceAccessor (uint16_t uid, uint32_t i) const; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
79 |
|
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
80 |
private: |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
81 |
struct ConstructorInformation { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
82 |
ns3::CallbackBase cb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
83 |
uint32_t nArguments; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
84 |
}; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
85 |
struct AttributeInformation { |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
86 |
std::string name; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
87 |
std::string help; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
88 |
uint32_t flags; |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
89 |
ns3::Attribute initialValue; |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
90 |
ns3::Ptr<const ns3::AttributeAccessor> param; |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
91 |
ns3::Ptr<const ns3::AttributeChecker> checker; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
92 |
}; |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
93 |
struct TraceSourceInformation { |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
94 |
std::string name; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
95 |
std::string help; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
96 |
ns3::Ptr<const ns3::TraceSourceAccessor> accessor; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
97 |
}; |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
98 |
struct IidInformation { |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
99 |
std::string name; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
100 |
uint16_t parent; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
101 |
std::string typeName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
102 |
std::string groupName; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
103 |
std::vector<struct ConstructorInformation> constructors; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
104 |
std::vector<struct AttributeInformation> attributes; |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
105 |
std::vector<struct TraceSourceInformation> traceSources; |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
106 |
}; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
107 |
typedef std::vector<struct IidInformation>::const_iterator Iterator; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
108 |
|
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
109 |
struct IidManager::IidInformation *LookupInformation (uint16_t uid) const; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
110 |
|
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
111 |
std::vector<struct IidInformation> m_information; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
112 |
}; |
1346
47de68729c86
an untested interface id trace resolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1340
diff
changeset
|
113 |
|
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
114 |
IidManager::IidManager () |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
115 |
{} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
116 |
|
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
117 |
uint16_t |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
118 |
IidManager::AllocateUid (std::string name) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
119 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
120 |
uint16_t j = 1; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
121 |
for (Iterator i = m_information.begin (); i != m_information.end (); i++) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
122 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
123 |
if (i->name == name) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
124 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
125 |
NS_FATAL_ERROR ("Trying to allocate twice the same uid: " << name); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
126 |
return 0; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
127 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
128 |
j++; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
129 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
130 |
struct IidInformation information; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
131 |
information.name = name; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
132 |
information.parent = 0; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
133 |
information.typeName = ""; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
134 |
information.groupName = ""; |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
135 |
m_information.push_back (information); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
136 |
uint32_t uid = m_information.size (); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
137 |
NS_ASSERT (uid <= 0xffff); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
138 |
return uid; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
139 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
140 |
|
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
141 |
struct IidManager::IidInformation * |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
142 |
IidManager::LookupInformation (uint16_t uid) const |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
143 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
144 |
NS_ASSERT (uid <= m_information.size ()); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
145 |
return const_cast<struct IidInformation *> (&m_information[uid-1]); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
146 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
void |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
149 |
IidManager::SetParent (uint16_t uid, uint16_t parent) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
150 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
151 |
NS_ASSERT (parent <= m_information.size ()); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
152 |
struct IidInformation *information = LookupInformation (uid); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
153 |
information->parent = parent; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
154 |
} |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
155 |
void |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
156 |
IidManager::SetTypeName (uint16_t uid, std::string typeName) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
157 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
158 |
struct IidInformation *information = LookupInformation (uid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
159 |
information->typeName = typeName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
160 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
161 |
void |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
162 |
IidManager::SetGroupName (uint16_t uid, std::string groupName) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
163 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
164 |
struct IidInformation *information = LookupInformation (uid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
165 |
information->groupName = groupName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
166 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
167 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
168 |
void |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
169 |
IidManager::AddConstructor (uint16_t uid, ns3::CallbackBase callback, uint32_t nArguments) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
170 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
171 |
struct IidInformation *information = LookupInformation (uid); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
172 |
struct ConstructorInformation constructor; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
173 |
constructor.cb = callback; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
174 |
constructor.nArguments = nArguments; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
175 |
for (std::vector<struct ConstructorInformation>::const_iterator i = information->constructors.begin (); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
176 |
i != information->constructors.end (); i++) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
177 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
178 |
if (i->nArguments == nArguments) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
179 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
180 |
NS_FATAL_ERROR ("registered two constructors on the same type with the same number of arguments."); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
181 |
break; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
182 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
183 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
184 |
information->constructors.push_back (constructor); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
185 |
} |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
186 |
|
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
187 |
uint16_t |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
188 |
IidManager::GetUid (std::string name) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
{ |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
190 |
uint32_t j = 1; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
191 |
for (Iterator i = m_information.begin (); i != m_information.end (); i++) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
192 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
193 |
if (i->name == name) |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
194 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
195 |
NS_ASSERT (j <= 0xffff); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
196 |
return j; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
197 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
198 |
j++; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
199 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
200 |
return 0; |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
201 |
} |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
202 |
std::string |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
203 |
IidManager::GetName (uint16_t uid) const |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
204 |
{ |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
205 |
struct IidInformation *information = LookupInformation (uid); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
206 |
return information->name; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
207 |
} |
712
0708bee3dbf3
use a 16 bit interface id
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
711
diff
changeset
|
208 |
uint16_t |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
209 |
IidManager::GetParent (uint16_t uid) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
210 |
{ |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
211 |
struct IidInformation *information = LookupInformation (uid); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
212 |
return information->parent; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
213 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
214 |
std::string |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
215 |
IidManager::GetTypeName (uint16_t uid) const |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
216 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
217 |
struct IidInformation *information = LookupInformation (uid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
218 |
return information->typeName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
219 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
220 |
std::string |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
221 |
IidManager::GetGroupName (uint16_t uid) const |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
222 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
223 |
struct IidInformation *information = LookupInformation (uid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
224 |
return information->groupName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
225 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
226 |
|
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
227 |
ns3::CallbackBase |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
228 |
IidManager::GetConstructor (uint16_t uid, uint32_t nArguments) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
229 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
230 |
struct IidInformation *information = LookupInformation (uid); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
231 |
for (std::vector<struct ConstructorInformation>::const_iterator i = information->constructors.begin (); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
232 |
i != information->constructors.end (); i++) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
233 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
234 |
if (i->nArguments == nArguments) |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
235 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
236 |
return i->cb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
237 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
238 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
239 |
NS_FATAL_ERROR ("Requested constructor with "<<nArguments<<" arguments not found"); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
240 |
return ns3::CallbackBase (); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
241 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
242 |
|
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
243 |
bool |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
244 |
IidManager::HasConstructor (uint16_t uid) |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
245 |
{ |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
246 |
struct IidInformation *information = LookupInformation (uid); |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
247 |
return !information->constructors.empty (); |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
248 |
} |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
249 |
|
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
250 |
uint32_t |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
251 |
IidManager::GetRegisteredN (void) |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
252 |
{ |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
253 |
return m_information.size (); |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
254 |
} |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
255 |
uint16_t |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
256 |
IidManager::GetRegistered (uint32_t i) |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
257 |
{ |
2247
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
258 |
return i + 1; |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
259 |
} |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
260 |
|
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
261 |
void |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
262 |
IidManager::AddAttribute (uint16_t uid, |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
263 |
std::string name, |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
264 |
std::string help, |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
265 |
uint32_t flags, |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
266 |
ns3::Attribute initialValue, |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
267 |
ns3::Ptr<const ns3::AttributeAccessor> spec, |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
268 |
ns3::Ptr<const ns3::AttributeChecker> checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
269 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
270 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
271 |
for (std::vector<struct AttributeInformation>::const_iterator j = information->attributes.begin (); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
272 |
j != information->attributes.end (); j++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
273 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
274 |
if (j->name == name) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
275 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
276 |
NS_FATAL_ERROR ("Registered the same attribute twice name=\""<<name<<"\" in TypeId=\""<<information->name<<"\""); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
277 |
return; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
278 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
279 |
} |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
280 |
struct AttributeInformation param; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
281 |
param.name = name; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
282 |
param.help = help; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
283 |
param.flags = flags; |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
284 |
param.initialValue = initialValue; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
285 |
param.param = spec; |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
286 |
param.checker = checker; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
287 |
information->attributes.push_back (param); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
288 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
289 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
290 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
291 |
uint32_t |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
292 |
IidManager::GetAttributeListN (uint16_t uid) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
293 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
294 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
295 |
return information->attributes.size (); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
296 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
297 |
std::string |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
298 |
IidManager::GetAttributeName (uint16_t uid, uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
299 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
300 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
301 |
NS_ASSERT (i < information->attributes.size ()); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
302 |
return information->attributes[i].name; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
303 |
} |
2573
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
304 |
std::string |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
305 |
IidManager::GetAttributeHelp (uint16_t uid, uint32_t i) const |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
306 |
{ |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
307 |
struct IidInformation *information = LookupInformation (uid); |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
308 |
NS_ASSERT (i < information->attributes.size ()); |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
309 |
return information->attributes[i].help; |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
310 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
311 |
uint32_t |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
312 |
IidManager::GetAttributeFlags (uint16_t uid, uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
313 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
314 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
315 |
NS_ASSERT (i < information->attributes.size ()); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
316 |
return information->attributes[i].flags; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
317 |
} |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
318 |
ns3::Attribute |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
319 |
IidManager::GetAttributeInitialValue (uint16_t uid, uint32_t i) const |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
320 |
{ |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
321 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
322 |
NS_ASSERT (i < information->attributes.size ()); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
323 |
return information->attributes[i].initialValue; |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
324 |
} |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
325 |
ns3::Ptr<const ns3::AttributeAccessor> |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
326 |
IidManager::GetAttributeAccessor (uint16_t uid, uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
327 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
328 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
329 |
NS_ASSERT (i < information->attributes.size ()); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
330 |
return information->attributes[i].param; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
331 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
332 |
ns3::Ptr<const ns3::AttributeChecker> |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
333 |
IidManager::GetAttributeChecker (uint16_t uid, uint32_t i) const |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
334 |
{ |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
335 |
struct IidInformation *information = LookupInformation (uid); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
336 |
NS_ASSERT (i < information->attributes.size ()); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
337 |
return information->attributes[i].checker; |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
338 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
339 |
|
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
340 |
void |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
341 |
IidManager::AddTraceSource (uint16_t uid, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
342 |
std::string name, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
343 |
std::string help, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
344 |
ns3::Ptr<const ns3::TraceSourceAccessor> accessor) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
345 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
346 |
struct IidInformation *information = LookupInformation (uid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
347 |
struct TraceSourceInformation source; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
348 |
source.name = name; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
349 |
source.help = help; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
350 |
source.accessor = accessor; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
351 |
information->traceSources.push_back (source); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
352 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
353 |
uint32_t |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
354 |
IidManager::GetTraceSourceN (uint16_t uid) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
355 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
356 |
struct IidInformation *information = LookupInformation (uid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
357 |
return information->traceSources.size (); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
358 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
359 |
std::string |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
360 |
IidManager::GetTraceSourceName (uint16_t uid, uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
361 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
362 |
struct IidInformation *information = LookupInformation (uid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
363 |
NS_ASSERT (i < information->traceSources.size ()); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
364 |
return information->traceSources[i].name; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
365 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
366 |
std::string |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
367 |
IidManager::GetTraceSourceHelp (uint16_t uid, uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
368 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
369 |
struct IidInformation *information = LookupInformation (uid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
370 |
NS_ASSERT (i < information->traceSources.size ()); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
371 |
return information->traceSources[i].help; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
372 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
373 |
ns3::Ptr<const ns3::TraceSourceAccessor> |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
374 |
IidManager::GetTraceSourceAccessor (uint16_t uid, uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
375 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
376 |
struct IidInformation *information = LookupInformation (uid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
377 |
NS_ASSERT (i < information->traceSources.size ()); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
378 |
return information->traceSources[i].accessor; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
379 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
380 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
381 |
} // anonymous namespace |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
382 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
383 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
384 |
|
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
385 |
/********************************************************************* |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
386 |
* The TypeId class |
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
387 |
*********************************************************************/ |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
388 |
|
2394
bc7abfdb0748
add a default constructor for the TypeId class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2382
diff
changeset
|
389 |
TypeId::TypeId () |
bc7abfdb0748
add a default constructor for the TypeId class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2382
diff
changeset
|
390 |
: m_tid (0) |
bc7abfdb0748
add a default constructor for the TypeId class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2382
diff
changeset
|
391 |
{} |
bc7abfdb0748
add a default constructor for the TypeId class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2382
diff
changeset
|
392 |
|
2583
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
393 |
TypeId::TypeId (const char *name) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
394 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
395 |
uint16_t uid = Singleton<IidManager>::Get ()->AllocateUid (name); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
396 |
NS_ASSERT (uid != 0); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
397 |
m_tid = uid; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
398 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
399 |
|
1346
47de68729c86
an untested interface id trace resolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1340
diff
changeset
|
400 |
|
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
401 |
TypeId::TypeId (uint16_t tid) |
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
402 |
: m_tid (tid) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
403 |
{} |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
404 |
TypeId::~TypeId () |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
405 |
{} |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
406 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
407 |
TypeId::LookupByName (std::string name) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
408 |
{ |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
409 |
uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name); |
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
410 |
NS_ASSERT (uid != 0); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
411 |
return TypeId (uid); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
412 |
} |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
413 |
bool |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
414 |
TypeId::LookupByNameFailSafe (std::string name, TypeId *tid) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
415 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
416 |
uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
417 |
if (uid == 0) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
418 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
419 |
return false; |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
420 |
} |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
421 |
*tid = TypeId (uid); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
422 |
return true; |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
423 |
} |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
424 |
|
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
425 |
bool |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
426 |
TypeId::LookupAttributeByFullName (std::string fullName, struct TypeId::AttributeInfo *info) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
427 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
428 |
std::string::size_type pos = fullName.find ("::"); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
429 |
if (pos == std::string::npos) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
430 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
431 |
return 0; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
432 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
433 |
std::string tidName = fullName.substr (0, pos); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
434 |
std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2)); |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
435 |
TypeId tid; |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
436 |
bool ok = LookupByNameFailSafe (tidName, &tid); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
437 |
if (!ok) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
438 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
439 |
return false; |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
440 |
} |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
441 |
return tid.LookupAttributeByName (paramName, info); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
442 |
} |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
443 |
uint32_t |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
444 |
TypeId::GetRegisteredN (void) |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
445 |
{ |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
446 |
return Singleton<IidManager>::Get ()->GetRegisteredN (); |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
447 |
} |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
448 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
449 |
TypeId::GetRegistered (uint32_t i) |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
450 |
{ |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
451 |
return TypeId (Singleton<IidManager>::Get ()->GetRegistered (i)); |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
452 |
} |
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
453 |
|
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
454 |
bool |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
455 |
TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInfo *info) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
456 |
{ |
2489
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
457 |
TypeId tid; |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
458 |
TypeId nextTid = *this; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
459 |
do { |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
460 |
tid = nextTid; |
2465
2c3c870a5f3c
invoke getters on tid temp variable to allow proper iteration over tid list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
461 |
for (uint32_t i = 0; i < tid.GetAttributeListN (); i++) |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
462 |
{ |
2465
2c3c870a5f3c
invoke getters on tid temp variable to allow proper iteration over tid list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
463 |
std::string paramName = tid.GetAttributeName (i); |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
464 |
if (paramName == name) |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
465 |
{ |
2465
2c3c870a5f3c
invoke getters on tid temp variable to allow proper iteration over tid list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
466 |
info->accessor = tid.GetAttributeAccessor (i); |
2c3c870a5f3c
invoke getters on tid temp variable to allow proper iteration over tid list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2463
diff
changeset
|
467 |
info->flags = tid.GetAttributeFlags (i); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
468 |
info->initialValue = tid.GetAttributeInitialValue (i); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
469 |
info->checker = tid.GetAttributeChecker (i); |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
470 |
return true; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
471 |
} |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
472 |
} |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
473 |
nextTid = tid.GetParent (); |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
474 |
} while (nextTid != tid); |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
475 |
return false; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
476 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
477 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
478 |
TypeId |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
479 |
TypeId::SetParent (TypeId tid) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
480 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
481 |
Singleton<IidManager>::Get ()->SetParent (m_tid, tid.m_tid); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
482 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
483 |
} |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
484 |
TypeId |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
485 |
TypeId::SetGroupName (std::string groupName) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
486 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
487 |
Singleton<IidManager>::Get ()->SetGroupName (m_tid, groupName); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
488 |
return *this; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
489 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
490 |
TypeId |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
491 |
TypeId::SetTypeName (std::string typeName) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
492 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
493 |
Singleton<IidManager>::Get ()->SetTypeName (m_tid, typeName); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
494 |
return *this; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
495 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
496 |
TypeId |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
497 |
TypeId::GetParent (void) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
498 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
499 |
uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
500 |
return TypeId (parent); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
501 |
} |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
502 |
std::string |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
503 |
TypeId::GetGroupName (void) const |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
504 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
505 |
std::string groupName = Singleton<IidManager>::Get ()->GetGroupName (m_tid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
506 |
return groupName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
507 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
508 |
std::string |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
509 |
TypeId::GetTypeName (void) const |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
510 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
511 |
std::string typeName = Singleton<IidManager>::Get ()->GetTypeName (m_tid); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
512 |
return typeName; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
513 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
514 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
515 |
std::string |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
516 |
TypeId::GetName (void) const |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
517 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
518 |
std::string name = Singleton<IidManager>::Get ()->GetName (m_tid); |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
519 |
return name; |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
520 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
521 |
|
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
522 |
bool |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
523 |
TypeId::HasConstructor (void) const |
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
524 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
525 |
bool hasConstructor = Singleton<IidManager>::Get ()->HasConstructor (m_tid); |
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
526 |
return hasConstructor; |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
527 |
} |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
528 |
|
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
529 |
void |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
530 |
TypeId::DoAddConstructor (CallbackBase cb, uint32_t nArguments) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
531 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
532 |
Singleton<IidManager>::Get ()->AddConstructor (m_tid, cb, nArguments); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
533 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
534 |
|
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
535 |
TypeId |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
536 |
TypeId::AddAttribute (std::string name, |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
537 |
std::string help, |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
538 |
Attribute initialValue, |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
539 |
Ptr<const AttributeAccessor> param, |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
540 |
Ptr<const AttributeChecker> checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
541 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
542 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue, param, checker); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
543 |
return *this; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
544 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
545 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
546 |
TypeId |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
547 |
TypeId::AddAttribute (std::string name, |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
548 |
std::string help, |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
549 |
uint32_t flags, |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
550 |
Attribute initialValue, |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
551 |
Ptr<const AttributeAccessor> param, |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
552 |
Ptr<const AttributeChecker> checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
553 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
554 |
Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue, param, checker); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
555 |
return *this; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
556 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
557 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
558 |
|
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
559 |
CallbackBase |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
560 |
TypeId::LookupConstructor (uint32_t nArguments) const |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
561 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
562 |
CallbackBase constructor = Singleton<IidManager>::Get ()->GetConstructor (m_tid, nArguments); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
563 |
return constructor; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
564 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
565 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
566 |
Ptr<Object> |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
567 |
TypeId::CreateObject (void) const |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
568 |
{ |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
569 |
return CreateObject (AttributeList ()); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
570 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
571 |
Ptr<Object> |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
572 |
TypeId::CreateObject (const AttributeList &attributes) const |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
573 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
574 |
CallbackBase cb = LookupConstructor (0); |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
575 |
Callback<Ptr<Object>,const AttributeList &> realCb; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
576 |
realCb.Assign (cb); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
577 |
Ptr<Object> object = realCb (attributes); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
578 |
return object; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
579 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
580 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
581 |
uint32_t |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
582 |
TypeId::GetAttributeListN (void) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
583 |
{ |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
584 |
uint32_t n = Singleton<IidManager>::Get ()->GetAttributeListN (m_tid); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
585 |
return n; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
586 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
587 |
std::string |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
588 |
TypeId::GetAttributeName (uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
589 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
590 |
std::string name = Singleton<IidManager>::Get ()->GetAttributeName (m_tid, i); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
591 |
return name; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
592 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
593 |
std::string |
2573
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
594 |
TypeId::GetAttributeHelp (uint32_t i) const |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
595 |
{ |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
596 |
std::string help = Singleton<IidManager>::Get ()->GetAttributeHelp (m_tid, i); |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
597 |
return help; |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
598 |
} |
b45af20ffe2b
make GetAttributeFlags and GetAttributeChecker public. add GetAttributeHelp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2572
diff
changeset
|
599 |
std::string |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
600 |
TypeId::GetAttributeFullName (uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
601 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
602 |
return GetName () + "::" + GetAttributeName (i); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
603 |
} |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
604 |
Attribute |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
605 |
TypeId::GetAttributeInitialValue (uint32_t i) const |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
606 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
607 |
Attribute value = Singleton<IidManager>::Get ()->GetAttributeInitialValue (m_tid, i); |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
608 |
return value; |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
609 |
} |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
610 |
Ptr<const AttributeAccessor> |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
611 |
TypeId::GetAttributeAccessor (uint32_t i) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
612 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
613 |
// Used exclusively by the Object class. |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
614 |
Ptr<const AttributeAccessor> param = Singleton<IidManager>::Get ()->GetAttributeAccessor (m_tid, i); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
615 |
return param; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
616 |
} |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
617 |
uint32_t |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
618 |
TypeId::GetAttributeFlags (uint32_t i) const |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
619 |
{ |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
620 |
// Used exclusively by the Object class. |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
621 |
uint32_t flags = Singleton<IidManager>::Get ()->GetAttributeFlags (m_tid, i); |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
622 |
return flags; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
623 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
624 |
Ptr<const AttributeChecker> |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
625 |
TypeId::GetAttributeChecker (uint32_t i) const |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
626 |
{ |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
627 |
// Used exclusively by the Object class. |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
628 |
Ptr<const AttributeChecker> checker = Singleton<IidManager>::Get ()->GetAttributeChecker (m_tid, i); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
629 |
return checker; |
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
630 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
631 |
|
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
632 |
uint32_t |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
633 |
TypeId::GetTraceSourceN (void) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
634 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
635 |
return Singleton<IidManager>::Get ()->GetTraceSourceN (m_tid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
636 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
637 |
std::string |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
638 |
TypeId::GetTraceSourceName (uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
639 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
640 |
return Singleton<IidManager>::Get ()->GetTraceSourceName (m_tid, i); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
641 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
642 |
std::string |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
643 |
TypeId::GetTraceSourceHelp (uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
644 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
645 |
return Singleton<IidManager>::Get ()->GetTraceSourceHelp (m_tid, i); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
646 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
647 |
Ptr<const TraceSourceAccessor> |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
648 |
TypeId::GetTraceSourceAccessor (uint32_t i) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
649 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
650 |
return Singleton<IidManager>::Get ()->GetTraceSourceAccessor (m_tid, i); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
651 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
652 |
|
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
653 |
TypeId |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
654 |
TypeId::AddTraceSource (std::string name, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
655 |
std::string help, |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
656 |
Ptr<const TraceSourceAccessor> accessor) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
657 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
658 |
Singleton<IidManager>::Get ()->AddTraceSource (m_tid, name, help, accessor); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
659 |
return *this; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
660 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
661 |
|
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
662 |
|
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
663 |
Ptr<const TraceSourceAccessor> |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
664 |
TypeId::LookupTraceSourceByName (std::string name) const |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
665 |
{ |
2489
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
666 |
TypeId tid; |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
667 |
TypeId nextTid = *this; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
668 |
do { |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
669 |
tid = nextTid; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
670 |
for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
671 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
672 |
std::string srcName = tid.GetTraceSourceName (i); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
673 |
if (srcName == name) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
674 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
675 |
return tid.GetTraceSourceAccessor (i); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
676 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
677 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
678 |
nextTid = tid.GetParent (); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
679 |
} while (nextTid != tid); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
680 |
return 0; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
681 |
} |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
682 |
|
2489
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
683 |
std::ostream & operator << (std::ostream &os, TypeId tid) |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
684 |
{ |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
685 |
os << tid.GetName (); |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
686 |
return os; |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
687 |
} |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
688 |
std::istream & operator >> (std::istream &is, TypeId &tid) |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
689 |
{ |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
690 |
std::string tidString; |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
691 |
is >> tidString; |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
692 |
bool ok = TypeId::LookupByNameFailSafe (tidString, &tid); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
693 |
if (!ok) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
694 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
695 |
is.setstate (std::ios_base::badbit); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
696 |
} |
2489
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
697 |
return is; |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
698 |
} |
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
699 |
|
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
700 |
|
2582
3e28107b870f
rename old VALUE leftovers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2573
diff
changeset
|
701 |
ATTRIBUTE_HELPER_CPP (TypeId); |
2489
c3341ba4cbf8
do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2471
diff
changeset
|
702 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
703 |
bool operator == (TypeId a, TypeId b) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
704 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
705 |
return a.m_tid == b.m_tid; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
706 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
707 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
708 |
bool operator != (TypeId a, TypeId b) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
709 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
710 |
return a.m_tid != b.m_tid; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
711 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
712 |
|
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
713 |
/********************************************************************* |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
714 |
* The AttributeList container implementation |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
715 |
*********************************************************************/ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
716 |
|
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
717 |
AttributeList::AttributeList () |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
718 |
{} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
719 |
|
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
720 |
AttributeList::AttributeList (const AttributeList &o) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
721 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
722 |
for (Attrs::const_iterator i = o.m_attributes.begin (); i != o.m_attributes.end (); i++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
723 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
724 |
struct Attr attr; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
725 |
attr.checker = i->checker; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
726 |
attr.value = i->value.Copy (); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
727 |
m_attributes.push_back (attr); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
728 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
729 |
} |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
730 |
AttributeList & |
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
731 |
AttributeList::operator = (const AttributeList &o) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
732 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
733 |
Reset (); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
734 |
for (Attrs::const_iterator i = o.m_attributes.begin (); i != o.m_attributes.end (); i++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
735 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
736 |
struct Attr attr; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
737 |
attr.checker = i->checker; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
738 |
attr.value = i->value.Copy (); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
739 |
m_attributes.push_back (attr); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
740 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
741 |
return *this; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
742 |
} |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
743 |
AttributeList::~AttributeList () |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
744 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
745 |
Reset (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
746 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
747 |
|
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
748 |
void |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
749 |
AttributeList::Set (std::string name, Attribute value) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
750 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
751 |
struct TypeId::AttributeInfo info; |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
752 |
bool ok = TypeId::LookupAttributeByFullName (name, &info); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
753 |
if (!ok) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
754 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
755 |
NS_FATAL_ERROR ("Could not find attribute "<<name); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
756 |
} |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
757 |
ok = DoSet (&info, value); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
758 |
if (!ok) |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
759 |
{ |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
760 |
NS_FATAL_ERROR ("Could not set value for attribute "<<name); |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
761 |
} |
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
762 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
763 |
bool |
2570
15d5421022a1
add FailSafe versions of setters which could fail.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2569
diff
changeset
|
764 |
AttributeList::SetFailSafe (std::string name, Attribute value) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
765 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
766 |
struct TypeId::AttributeInfo info; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
767 |
TypeId::LookupAttributeByFullName (name, &info); |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
768 |
bool ok = DoSet (&info, value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
769 |
return ok; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
770 |
} |
2583
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
771 |
void |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
772 |
AttributeList::SetWithTid (TypeId tid, std::string name, Attribute value) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
773 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
774 |
struct TypeId::AttributeInfo info; |
2583
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
775 |
bool ok = tid.LookupAttributeByName (name, &info); |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
776 |
if (!ok) |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
777 |
{ |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
778 |
NS_FATAL_ERROR ("Could not find attribute "<<tid.GetName ()<<"::"<<name); |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
779 |
} |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
780 |
ok = DoSet (&info, value); |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
781 |
if (!ok) |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
782 |
{ |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
783 |
NS_FATAL_ERROR ("Could not set value for attribute "<<tid.GetName ()<<"::"<<name); |
c09faa6c90bf
doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2582
diff
changeset
|
784 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
785 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
786 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
787 |
void |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
788 |
AttributeList::DoSetOne (Ptr<const AttributeChecker> checker, Attribute value) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
789 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
790 |
// get rid of any previous value stored in this |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
791 |
// vector of values. |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
792 |
for (Attrs::iterator k = m_attributes.begin (); k != m_attributes.end (); k++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
793 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
794 |
if (k->checker == checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
795 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
796 |
m_attributes.erase (k); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
797 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
798 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
799 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
800 |
// store the new value. |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
801 |
struct Attr attr; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
802 |
attr.checker = checker; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
803 |
attr.value = value.Copy (); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
804 |
m_attributes.push_back (attr); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
805 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
806 |
bool |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
807 |
AttributeList::DoSet (struct TypeId::AttributeInfo *info, Attribute value) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
808 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
809 |
if (info->checker == 0) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
810 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
811 |
return false; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
812 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
813 |
bool ok = info->checker->Check (value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
814 |
if (!ok) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
815 |
{ |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
816 |
// attempt to convert to string. |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
817 |
const StringValue *str = value.DynCast<const StringValue *> (); |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
818 |
if (str == 0) |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
819 |
{ |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
820 |
return false; |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
821 |
} |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
822 |
// attempt to convert back to value. |
2520
a4896ebf6e1d
introduce AttributeChecker::Create and use it instead of AttributeValue::Copy.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
823 |
Attribute v = info->checker->Create (); |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2489
diff
changeset
|
824 |
ok = v.DeserializeFromString (str->Get ().Get (), info->checker); |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
825 |
if (!ok) |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
826 |
{ |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
827 |
return false; |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
828 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
829 |
ok = info->checker->Check (v); |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
830 |
if (!ok) |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
831 |
{ |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
832 |
return false; |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
833 |
} |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
834 |
value = v; |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
835 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
836 |
DoSetOne (info->checker, value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
837 |
return true; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
838 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
839 |
void |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
840 |
AttributeList::Reset (void) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
841 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
842 |
m_attributes.clear (); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
843 |
} |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
844 |
AttributeList * |
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
845 |
AttributeList::GetGlobal (void) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
846 |
{ |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
847 |
return Singleton<AttributeList>::Get (); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
848 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
849 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
850 |
std::string |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
851 |
AttributeList::LookupAttributeFullNameByChecker (Ptr<const AttributeChecker> checker) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
852 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
853 |
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
854 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
855 |
TypeId tid = TypeId::GetRegistered (i); |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
856 |
for (uint32_t j = 0; j < tid.GetAttributeListN (); j++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
857 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
858 |
if (checker == tid.GetAttributeChecker (j)) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
859 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
860 |
return tid.GetAttributeFullName (j); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
861 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
862 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
863 |
} |
2435
3128175f5866
ParamSpec -> Accessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
864 |
NS_FATAL_ERROR ("Could not find requested Accessor."); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
865 |
// quiet compiler. |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
866 |
return ""; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
867 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
868 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
869 |
std::string |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
870 |
AttributeList::SerializeToString (void) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
871 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
872 |
std::ostringstream oss; |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
873 |
for (Attrs::const_iterator i = m_attributes.begin (); i != m_attributes.end (); i++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
874 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
875 |
std::string name = LookupAttributeFullNameByChecker (i->checker); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
876 |
oss << name << "=" << i->value.SerializeToString (i->checker); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
877 |
if (i != m_attributes.end ()) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
878 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
879 |
oss << "|"; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
880 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
881 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
882 |
return oss.str (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
883 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
884 |
bool |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
885 |
AttributeList::DeserializeFromString (std::string str) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
886 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
887 |
Reset (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
888 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
889 |
std::string::size_type cur; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
890 |
cur = 0; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
891 |
do { |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
892 |
std::string::size_type equal = str.find ("=", cur); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
893 |
if (equal == std::string::npos) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
894 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
895 |
// XXX: invalid attribute. |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
896 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
897 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
898 |
else |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
899 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
900 |
std::string name = str.substr (cur, equal-cur); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
901 |
struct TypeId::AttributeInfo info; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
902 |
if (!TypeId::LookupAttributeByFullName (name, &info)) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
903 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
904 |
// XXX invalid name. |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
905 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
906 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
907 |
else |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
908 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
909 |
std::string::size_type next = str.find ("|", cur); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
910 |
std::string value; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
911 |
if (next == std::string::npos) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
912 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
913 |
value = str.substr (equal+1, str.size () - (equal+1)); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
914 |
cur = str.size (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
915 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
916 |
else |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
917 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
918 |
value = str.substr (equal+1, next - (equal+1)); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
919 |
cur++; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
920 |
} |
2520
a4896ebf6e1d
introduce AttributeChecker::Create and use it instead of AttributeValue::Copy.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
921 |
Attribute val = info.checker->Create (); |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
922 |
bool ok = val.DeserializeFromString (value, info.checker); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
923 |
if (!ok) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
924 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
925 |
// XXX invalid value |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
926 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
927 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
928 |
else |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
929 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
930 |
DoSetOne (info.checker, val); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
931 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
932 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
933 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
934 |
} while (cur != str.size ()); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
935 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
936 |
return true; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
937 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
938 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
939 |
|
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
940 |
/********************************************************************* |
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
941 |
* The Object implementation |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
942 |
*********************************************************************/ |
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
943 |
|
2247
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
944 |
NS_OBJECT_ENSURE_REGISTERED (Object); |
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
945 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
946 |
static TypeId |
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
947 |
GetObjectIid (void) |
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
948 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
949 |
TypeId tid = TypeId ("Object"); |
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
950 |
tid.SetParent (tid); |
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
951 |
return tid; |
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
952 |
} |
2233
b359c83c5fbe
add some separation markers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
953 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
954 |
TypeId |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
955 |
Object::GetTypeId (void) |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
956 |
{ |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
957 |
static TypeId tid = GetObjectIid (); |
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
958 |
return tid; |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
959 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
960 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
961 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
962 |
Object::Object () |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
963 |
: m_count (1), |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
964 |
m_tid (Object::GetTypeId ()), |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
965 |
m_disposed (false), |
1374
77468496f7e0
avoid problems with recursive use of Object::DoCollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1372
diff
changeset
|
966 |
m_collecting (false), |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
967 |
m_next (this) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
968 |
{} |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
969 |
Object::~Object () |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
970 |
{ |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
971 |
m_next = 0; |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
972 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
973 |
void |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
974 |
Object::Construct (const AttributeList &attributes) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
975 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
976 |
// loop over the inheritance tree back to the Object base class. |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
977 |
TypeId tid = m_tid; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
978 |
do { |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
979 |
// loop over all attributes in object type |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
980 |
NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributeListN ()); |
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
981 |
for (uint32_t i = 0; i < tid.GetAttributeListN (); i++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
982 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
983 |
Ptr<const AttributeAccessor> paramSpec = tid.GetAttributeAccessor (i); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
984 |
Attribute initial = tid.GetAttributeInitialValue (i); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
985 |
Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
986 |
NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<< |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
987 |
tid.GetAttributeName (i)<<"\""); |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
988 |
if (!(tid.GetAttributeFlags (i) & TypeId::ATTR_CONSTRUCT)) |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
989 |
{ |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
990 |
continue; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
991 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
992 |
bool found = false; |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
993 |
// is this attribute stored in this AttributeList instance ? |
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
994 |
for (AttributeList::Attrs::const_iterator j = attributes.m_attributes.begin (); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
995 |
j != attributes.m_attributes.end (); j++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
996 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
997 |
if (j->checker == checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
998 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
999 |
// We have a matching attribute value. |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1000 |
DoSet (paramSpec, initial, checker, j->value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1001 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1002 |
tid.GetAttributeName (i)<<"\""); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1003 |
found = true; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1004 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1005 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1006 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1007 |
if (!found) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1008 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1009 |
// is this attribute stored in the global instance instance ? |
2459
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
1010 |
for (AttributeList::Attrs::const_iterator j = AttributeList::GetGlobal ()->m_attributes.begin (); |
91662d921a83
Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2458
diff
changeset
|
1011 |
j != AttributeList::GetGlobal ()->m_attributes.end (); j++) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1012 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1013 |
if (j->checker == checker) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1014 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1015 |
// We have a matching attribute value. |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1016 |
DoSet (paramSpec, initial, checker, j->value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1017 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1018 |
tid.GetAttributeName (i)<<"\" from global"); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1019 |
found = true; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1020 |
break; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1021 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1022 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1023 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1024 |
if (!found) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1025 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1026 |
// No matching attribute value so we set the default value. |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1027 |
paramSpec->Set (this, initial); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1028 |
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< |
2523
58182a1561cc
improve debugging output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2522
diff
changeset
|
1029 |
tid.GetAttributeName (i)<<"\" from initial value."); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1030 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1031 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1032 |
tid = tid.GetParent (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1033 |
} while (tid != Object::GetTypeId ()); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1034 |
NotifyConstructionCompleted (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1035 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1036 |
bool |
2436
23415bac7eaf
Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2435
diff
changeset
|
1037 |
Object::DoSet (Ptr<const AttributeAccessor> spec, Attribute initialValue, |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
1038 |
Ptr<const AttributeChecker> checker, Attribute value) |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1039 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1040 |
bool ok = checker->Check (value); |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1041 |
if (!ok) |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1042 |
{ |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1043 |
// attempt to convert to string |
2424
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
1044 |
const StringValue *str = value.DynCast<const StringValue *> (); |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
1045 |
if (str == 0) |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
1046 |
{ |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
1047 |
return false; |
217a447122a6
split initial value from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2423
diff
changeset
|
1048 |
} |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1049 |
// attempt to convert back from string. |
2520
a4896ebf6e1d
introduce AttributeChecker::Create and use it instead of AttributeValue::Copy.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
1050 |
Attribute v = checker->Create (); |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2489
diff
changeset
|
1051 |
ok = v.DeserializeFromString (str->Get ().Get (), checker); |
2421
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1052 |
if (!ok) |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1053 |
{ |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1054 |
return false; |
00ef5829bbe8
get rid of Value::ConvertFrom method.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2420
diff
changeset
|
1055 |
} |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1056 |
ok = checker->Check (v); |
2397
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1057 |
if (!ok) |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1058 |
{ |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1059 |
return false; |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1060 |
} |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1061 |
value = v; |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1062 |
} |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1063 |
ok = spec->Set (this, value); |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1064 |
return ok; |
45cd59c6ddf8
add automatic conversion from string to PValue.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2394
diff
changeset
|
1065 |
} |
2572
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1066 |
void |
2460
7f5679184b79
Object::Set/Get -> Object::SetAttribute/GetAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2459
diff
changeset
|
1067 |
Object::SetAttribute (std::string name, Attribute value) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1068 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1069 |
struct TypeId::AttributeInfo info; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1070 |
if (!m_tid.LookupAttributeByName (name, &info)) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1071 |
{ |
2572
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1072 |
NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<m_tid.GetName ()); |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1073 |
} |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1074 |
if (!(info.flags & TypeId::ATTR_SET)) |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1075 |
{ |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1076 |
NS_FATAL_ERROR ("Attribute name="<<name<<" is not settable for this object: tid="<<m_tid.GetName ()); |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1077 |
} |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1078 |
if (!DoSet (info.accessor, info.initialValue, info.checker, value)) |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1079 |
{ |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1080 |
NS_FATAL_ERROR ("Attribute name="<<name<<" could not be set for this object: tid="<<m_tid.GetName ()); |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1081 |
} |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1082 |
} |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1083 |
bool |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1084 |
Object::SetAttributeFailSafe (std::string name, Attribute value) |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1085 |
{ |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1086 |
struct TypeId::AttributeInfo info; |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1087 |
if (!m_tid.LookupAttributeByName (name, &info)) |
5f3bdaf2a77c
more FailSafe methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2570
diff
changeset
|
1088 |
{ |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1089 |
return false; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1090 |
} |
2432
b946f13bc8cb
PARAM -> ATTR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
1091 |
if (!(info.flags & TypeId::ATTR_SET)) |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1092 |
{ |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1093 |
return false; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1094 |
} |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1095 |
return DoSet (info.accessor, info.initialValue, info.checker, value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1096 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1097 |
bool |
2460
7f5679184b79
Object::Set/Get -> Object::SetAttribute/GetAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2459
diff
changeset
|
1098 |
Object::GetAttribute (std::string name, std::string &value) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1099 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1100 |
struct TypeId::AttributeInfo info; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1101 |
if (!m_tid.LookupAttributeByName (name, &info)) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1102 |
{ |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1103 |
return false; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1104 |
} |
2432
b946f13bc8cb
PARAM -> ATTR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
1105 |
if (!(info.flags & TypeId::ATTR_GET)) |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1106 |
{ |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1107 |
return false; |
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1108 |
} |
2520
a4896ebf6e1d
introduce AttributeChecker::Create and use it instead of AttributeValue::Copy.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
1109 |
Attribute v = info.checker->Create (); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1110 |
bool ok = info.accessor->Get (this, v); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1111 |
if (ok) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1112 |
{ |
2427
9245ec163111
split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2426
diff
changeset
|
1113 |
value = v.SerializeToString (info.checker); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1114 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1115 |
return ok; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1116 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1117 |
|
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
1118 |
Attribute |
2460
7f5679184b79
Object::Set/Get -> Object::SetAttribute/GetAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2459
diff
changeset
|
1119 |
Object::GetAttribute (std::string name) const |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1120 |
{ |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1121 |
struct TypeId::AttributeInfo info; |
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1122 |
if (!m_tid.LookupAttributeByName (name, &info)) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1123 |
{ |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
1124 |
return Attribute (); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1125 |
} |
2432
b946f13bc8cb
PARAM -> ATTR
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2427
diff
changeset
|
1126 |
if (!(info.flags & TypeId::ATTR_GET)) |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1127 |
{ |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
1128 |
return Attribute (); |
2382
b05c2d0bcd23
enforce TypeId::PARAM_* flags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2380
diff
changeset
|
1129 |
} |
2520
a4896ebf6e1d
introduce AttributeChecker::Create and use it instead of AttributeValue::Copy.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
1130 |
Attribute value = info.checker->Create (); |
2458
e8f7c4960576
AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2438
diff
changeset
|
1131 |
bool ok = info.accessor->Get (this, value); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1132 |
if (!ok) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1133 |
{ |
2433
3a98e1db7f80
PValue -> Attribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2432
diff
changeset
|
1134 |
return Attribute (); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1135 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1136 |
return value; |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1137 |
} |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1138 |
|
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1139 |
bool |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1140 |
Object::TraceSourceConnect (std::string name, const CallbackBase &cb) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1141 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1142 |
Ptr<const TraceSourceAccessor> accessor = m_tid.LookupTraceSourceByName (name); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1143 |
if (accessor == 0) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1144 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1145 |
return false; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1146 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1147 |
bool ok = accessor->Connect (this, cb); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1148 |
return ok; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1149 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1150 |
bool |
2531
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1151 |
Object::TraceSourceConnectWithContext (std::string name, std::string context, const CallbackBase &cb) |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1152 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1153 |
Ptr<const TraceSourceAccessor> accessor = m_tid.LookupTraceSourceByName (name); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1154 |
if (accessor == 0) |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1155 |
{ |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1156 |
return false; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1157 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1158 |
bool ok = accessor->ConnectWithContext (this, context, cb); |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1159 |
return ok; |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1160 |
} |
b451b5fc8b57
implement context-based trace connection
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2529
diff
changeset
|
1161 |
bool |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1162 |
Object::TraceSourceDisconnect (std::string name, const CallbackBase &cb) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1163 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1164 |
Ptr<const TraceSourceAccessor> accessor = m_tid.LookupTraceSourceByName (name); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1165 |
if (accessor == 0) |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1166 |
{ |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1167 |
return false; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1168 |
} |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1169 |
bool ok = accessor->Disconnect (this, cb); |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1170 |
return ok; |
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1171 |
} |
2569
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1172 |
bool |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1173 |
Object::TraceSourceDisconnectWithContext (std::string name, std::string context, const CallbackBase &cb) |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1174 |
{ |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1175 |
Ptr<const TraceSourceAccessor> accessor = m_tid.LookupTraceSourceByName (name); |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1176 |
if (accessor == 0) |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1177 |
{ |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1178 |
return false; |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1179 |
} |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1180 |
bool ok = accessor->DisconnectWithContext (this, context, cb); |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1181 |
return ok; |
d5cff2968984
make Disconnect work with trace contexts.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
1182 |
} |
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1183 |
|
2471
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1184 |
TypeId |
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1185 |
Object::GetRealTypeId (void) const |
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1186 |
{ |
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1187 |
return m_tid; |
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1188 |
} |
86f7ea794e83
add a few public methods for the Config code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2465
diff
changeset
|
1189 |
|
2463
c77e43117673
actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2460
diff
changeset
|
1190 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1191 |
Ptr<Object> |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1192 |
Object::DoGetObject (TypeId tid) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1193 |
{ |
1534
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1194 |
NS_ASSERT (CheckLoose ()); |
709
b5c7825babf3
make QueryInterface const
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
708
diff
changeset
|
1195 |
const Object *currentObject = this; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1196 |
do { |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1197 |
NS_ASSERT (currentObject != 0); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1198 |
TypeId cur = currentObject->m_tid; |
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1199 |
while (cur != tid && cur != Object::GetTypeId ()) |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1200 |
{ |
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
1201 |
cur = cur.GetParent (); |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1202 |
} |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1203 |
if (cur == tid) |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1204 |
{ |
709
b5c7825babf3
make QueryInterface const
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
708
diff
changeset
|
1205 |
return const_cast<Object *> (currentObject); |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1206 |
} |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1207 |
currentObject = currentObject->m_next; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1208 |
} while (currentObject != this); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1209 |
return 0; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1210 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1211 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1212 |
Object::Dispose (void) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1213 |
{ |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1214 |
Object *current = this; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1215 |
do { |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1216 |
NS_ASSERT (current != 0); |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
1217 |
NS_ASSERT (!current->m_disposed); |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1218 |
current->DoDispose (); |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
1219 |
current->m_disposed = true; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1220 |
current = current->m_next; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1221 |
} while (current != this); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1222 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1223 |
void |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1224 |
Object::NotifyConstructionCompleted (void) |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1225 |
{} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1226 |
void |
2258
666099a753e0
AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
1227 |
Object::AggregateObject (Ptr<Object> o) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1228 |
{ |
718 | 1229 |
NS_ASSERT (!m_disposed); |
1230 |
NS_ASSERT (!o->m_disposed); |
|
1534
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1231 |
NS_ASSERT (CheckLoose ()); |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1232 |
NS_ASSERT (o->CheckLoose ()); |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1233 |
Object *other = PeekPointer (o); |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1234 |
Object *next = m_next; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1235 |
m_next = other->m_next; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1236 |
other->m_next = next; |
1534
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1237 |
NS_ASSERT (CheckLoose ()); |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1238 |
NS_ASSERT (o->CheckLoose ()); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1239 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1240 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1241 |
void |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1242 |
Object::SetTypeId (TypeId tid) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1243 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1244 |
NS_ASSERT (Check ()); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1245 |
m_tid = tid; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1246 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1247 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1248 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1249 |
Object::DoDispose (void) |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
1250 |
{ |
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
1251 |
NS_ASSERT (!m_disposed); |
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
1252 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1253 |
|
1336
de5a133ece8a
add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
732
diff
changeset
|
1254 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1255 |
bool |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1256 |
Object::Check (void) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1257 |
{ |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1258 |
return (m_count > 0); |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1259 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1260 |
|
1534
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1261 |
/* In some cases, when an event is scheduled against a subclass of |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1262 |
* Object, and if no one owns a reference directly to this object, the |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1263 |
* object is alive, has a refcount of zero and the method ran when the |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1264 |
* event expires runs against the raw pointer which means that we are |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1265 |
* manipulating an object with a refcount of zero. So, instead we |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1266 |
* check the aggregate reference count. |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1267 |
*/ |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1268 |
bool |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1269 |
Object::CheckLoose (void) const |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1270 |
{ |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1271 |
uint32_t refcount = 0; |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1272 |
const Object *current = this; |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1273 |
do |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1274 |
{ |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1275 |
refcount += current->m_count; |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1276 |
current = current->m_next; |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1277 |
} |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1278 |
while (current != this); |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1279 |
|
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1280 |
return (refcount > 0); |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1281 |
} |
6b7a4e88c422
Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1504
diff
changeset
|
1282 |
|
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1283 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1284 |
Object::MaybeDelete (void) const |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1285 |
{ |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1286 |
// First, check if any of the attached |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1287 |
// Object has a non-zero count. |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1288 |
const Object *current = this; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1289 |
do { |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1290 |
NS_ASSERT (current != 0); |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1291 |
if (current->m_count != 0) |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1292 |
{ |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1293 |
return; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1294 |
} |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1295 |
current = current->m_next; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1296 |
} while (current != this); |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1297 |
|
2529
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1298 |
// Ensure we are disposed. |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1299 |
Object *tmp = const_cast<Object *> (this); |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1300 |
const Object *end = this; |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1301 |
do { |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1302 |
NS_ASSERT (current != 0); |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1303 |
Object *next = tmp->m_next; |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1304 |
if (!tmp->m_disposed) |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1305 |
{ |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1306 |
tmp->DoDispose (); |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1307 |
} |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1308 |
tmp = next; |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1309 |
} while (tmp != end); |
d5f8bee5fcbd
ensure that Dispose is invoked at one point.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2523
diff
changeset
|
1310 |
|
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1311 |
// all attached objects have a zero count so, |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1312 |
// we can delete all attached objects. |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1313 |
current = this; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1314 |
do { |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1315 |
NS_ASSERT (current != 0); |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1316 |
Object *next = current->m_next; |
702
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1317 |
delete current; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1318 |
current = next; |
829df6703988
yet another optimization to cut even more on memory allocations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
701
diff
changeset
|
1319 |
} while (current != end); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1320 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1321 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1322 |
} // namespace ns3 |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1323 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1324 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1325 |
#ifdef RUN_SELF_TESTS |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1326 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1327 |
#include "test.h" |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1328 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1329 |
namespace { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1330 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1331 |
class BaseA : public ns3::Object |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1332 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1333 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1334 |
static ns3::TypeId GetTypeId (void) { |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1335 |
static ns3::TypeId tid = ns3::TypeId ("BaseA") |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1336 |
.SetParent (Object::GetTypeId ()) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
1337 |
.AddConstructor<BaseA> (); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1338 |
return tid; |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
1339 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1340 |
BaseA () |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1341 |
{} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1342 |
virtual void Dispose (void) {} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1343 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1344 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1345 |
class DerivedA : public BaseA |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1346 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1347 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1348 |
static ns3::TypeId GetTypeId (void) { |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1349 |
static ns3::TypeId tid = ns3::TypeId ("DerivedA") |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1350 |
.SetParent (BaseA::GetTypeId ()) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1351 |
.AddConstructor<DerivedA> (); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1352 |
return tid; |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
1353 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1354 |
DerivedA () |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1355 |
{} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1356 |
virtual void Dispose (void) { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1357 |
BaseA::Dispose (); |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1358 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1359 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1360 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1361 |
class BaseB : public ns3::Object |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1362 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1363 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1364 |
static ns3::TypeId GetTypeId (void) { |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1365 |
static ns3::TypeId tid = ns3::TypeId ("BaseB") |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1366 |
.SetParent (Object::GetTypeId ()) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
1367 |
.AddConstructor<BaseB> (); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1368 |
return tid; |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
1369 |
} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1370 |
BaseB () |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1371 |
{} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1372 |
virtual void Dispose (void) {} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1373 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1374 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1375 |
class DerivedB : public BaseB |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1376 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1377 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1378 |
static ns3::TypeId GetTypeId (void) { |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1379 |
static ns3::TypeId tid = ns3::TypeId ("DerivedB") |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1380 |
.SetParent (BaseB::GetTypeId ()) |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1381 |
.AddConstructor<DerivedB> (); |
2252
80595448707a
iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
1382 |
return tid; |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
1383 |
} |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1384 |
DerivedB () |
2243
9573a034177a
check constructor with reference arguments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
1385 |
{} |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1386 |
virtual void Dispose (void) { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1387 |
BaseB::Dispose (); |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1388 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1389 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1390 |
|
2247
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
1391 |
NS_OBJECT_ENSURE_REGISTERED (BaseA); |
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
1392 |
NS_OBJECT_ENSURE_REGISTERED (DerivedA); |
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
1393 |
NS_OBJECT_ENSURE_REGISTERED (BaseB); |
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
1394 |
NS_OBJECT_ENSURE_REGISTERED (DerivedB); |
56b3591fa3b0
use NS_OBJECT_ENSURE_REGISTERED and fix off-by-one in IidManager::GetRegistered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2243
diff
changeset
|
1395 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1396 |
} // namespace anonymous |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1397 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1398 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1399 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1400 |
class ObjectTest : public Test |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1401 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1402 |
public: |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1403 |
ObjectTest (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1404 |
virtual bool RunTests (void); |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1405 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1406 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1407 |
ObjectTest::ObjectTest () |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1408 |
: Test ("Object") |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1409 |
{} |
1351
0a6aaa6acbd3
test object-based tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1349
diff
changeset
|
1410 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1411 |
bool |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1412 |
ObjectTest::RunTests (void) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1413 |
{ |
1349
11562f6b73aa
rewrite Object tests with test.h macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1346
diff
changeset
|
1414 |
bool result = true; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1415 |
|
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1416 |
Ptr<BaseA> baseA = CreateObject<BaseA> (); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1417 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (), baseA); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1418 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1419 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedA> (), 0); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1420 |
baseA = CreateObject<DerivedA> (); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1421 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (), baseA); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1422 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), baseA); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1423 |
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<DerivedA> (), 0); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1424 |
|
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1425 |
baseA = CreateObject<BaseA> (); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1426 |
Ptr<BaseB> baseB = CreateObject<BaseB> (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1427 |
Ptr<BaseB> baseBCopy = baseB; |
2258
666099a753e0
AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
1428 |
baseA->AggregateObject (baseB); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1429 |
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1430 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1431 |
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1432 |
NS_TEST_ASSERT_EQUAL (baseA->GetObject<DerivedB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1433 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1434 |
NS_TEST_ASSERT_EQUAL (baseB->GetObject<DerivedB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1435 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1436 |
NS_TEST_ASSERT_EQUAL (baseB->GetObject<DerivedA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1437 |
NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<BaseA> (), 0); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1438 |
|
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1439 |
baseA = CreateObject<DerivedA> (); |
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1440 |
baseB = CreateObject<DerivedB> (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1441 |
baseBCopy = baseB; |
2258
666099a753e0
AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
1442 |
baseA->AggregateObject (baseB); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1443 |
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<DerivedB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1444 |
NS_TEST_ASSERT_UNEQUAL (baseA->GetObject<BaseB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1445 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<DerivedA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1446 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1447 |
NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<DerivedA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1448 |
NS_TEST_ASSERT_UNEQUAL (baseBCopy->GetObject<BaseA> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1449 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<DerivedB> (), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1450 |
NS_TEST_ASSERT_UNEQUAL (baseB->GetObject<BaseB> (), 0) |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1451 |
|
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1452 |
baseA = CreateObject<BaseA> (); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1781
diff
changeset
|
1453 |
baseB = CreateObject<BaseB> (); |
2258
666099a753e0
AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
1454 |
baseA->AggregateObject (baseB); |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
1455 |
baseA = 0; |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1456 |
baseA = baseB->GetObject<BaseA> (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1457 |
|
1351
0a6aaa6acbd3
test object-based tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1349
diff
changeset
|
1458 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2247
diff
changeset
|
1459 |
// Test the object creation code of TypeId |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
1460 |
Ptr<Object> a = BaseA::GetTypeId ().CreateObject (); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1461 |
NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (), a); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1462 |
NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (DerivedA::GetTypeId ()), 0); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1463 |
NS_TEST_ASSERT_EQUAL (a->GetObject<DerivedA> (), 0); |
2372
bf4efb9359c6
attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1464 |
a = DerivedA::GetTypeId ().CreateObject (); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1465 |
NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (), a); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1466 |
NS_TEST_ASSERT_EQUAL (a->GetObject<BaseA> (DerivedA::GetTypeId ()), a); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
1467 |
NS_TEST_ASSERT_UNEQUAL (a->GetObject<DerivedA> (), 0); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
1468 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
1469 |
|
1349
11562f6b73aa
rewrite Object tests with test.h macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1346
diff
changeset
|
1470 |
return result; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1471 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1472 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
1473 |
static ObjectTest g_interfaceObjectTests; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1474 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1475 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1476 |
} // namespace ns3 |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1477 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1478 |
#endif /* RUN_SELF_TESTS */ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1479 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1480 |