author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 02 Jan 2008 12:24:25 +0100 | |
changeset 2235 | fb93067a3c2e |
parent 2234 | c1af59565992 |
child 2237 | 7745a8c76396 |
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 |
#ifndef OBJECT_H |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
22 |
#define OBJECT_H |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include <stdint.h> |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <string> |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "ptr.h" |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
27 |
#include "trace-resolver.h" |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
1340
a8d774560c2b
remove const keyword and add a TraceConnect method which takes a TraceContext argument
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1336
diff
changeset
|
31 |
class TraceContext; |
1336
de5a133ece8a
add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1330
diff
changeset
|
32 |
class CallbackBase; |
de5a133ece8a
add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1330
diff
changeset
|
33 |
|
718 | 34 |
/** |
35 |
* \brief a unique identifier for an interface. |
|
36 |
* |
|
37 |
* Instances of this class can be created only through |
|
38 |
* calls to ns3::MakeInterfaceId. |
|
39 |
* |
|
40 |
* Note: This class is quite similar to COM's UUIDs. |
|
41 |
*/ |
|
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
42 |
class InterfaceId |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
public: |
718 | 45 |
/** |
46 |
* \param name the name of the requested interface |
|
47 |
* \returns the unique id associated with the requested |
|
48 |
* name. |
|
49 |
* |
|
50 |
* This method cannot fail: it will crash if the input |
|
51 |
* name is not a valid interface name. |
|
52 |
*/ |
|
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
53 |
static InterfaceId LookupByName (std::string name); |
718 | 54 |
/** |
55 |
* \param iid a unique id |
|
56 |
* \returns the parent of the requested id, as registered |
|
57 |
* by ns3::MakeInterfaceId. |
|
58 |
* |
|
59 |
* This method cannot fail: it will crash if the input |
|
60 |
* id is not a valid interface id. |
|
61 |
*/ |
|
2235
fb93067a3c2e
rewrite interface id metadata
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2234
diff
changeset
|
62 |
InterfaceId GetParent (void) const; |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
63 |
|
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
64 |
/** |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
65 |
* \returns the name of this interface. |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
66 |
*/ |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
67 |
std::string GetName (void) const; |
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
68 |
~InterfaceId (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
private: |
712
0708bee3dbf3
use a 16 bit interface id
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
709
diff
changeset
|
70 |
InterfaceId (uint16_t iid); |
2234
c1af59565992
remove some remnants from the iid-a-variable era.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
71 |
friend InterfaceId MakeInterfaceId (std::string name, InterfaceId parent); |
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
72 |
friend InterfaceId MakeObjectInterfaceId (void); |
2234
c1af59565992
remove some remnants from the iid-a-variable era.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
73 |
friend bool operator == (InterfaceId a, InterfaceId b); |
c1af59565992
remove some remnants from the iid-a-variable era.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
74 |
friend bool operator != (InterfaceId a, InterfaceId b); |
712
0708bee3dbf3
use a 16 bit interface id
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
709
diff
changeset
|
75 |
uint16_t m_iid; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
|
718 | 78 |
/** |
79 |
* \param name of the new InterfaceId to create. |
|
80 |
* \param parent the "parent" of the InterfaceId to create. |
|
81 |
* \returns a new InterfaceId |
|
82 |
* \relates InterfaceId |
|
83 |
* |
|
84 |
* Every InterfaceId is a child of another InterfaceId. The |
|
85 |
* top-most InterfaceId is Object::iid and its parent is |
|
86 |
* itself. |
|
87 |
*/ |
|
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
88 |
InterfaceId |
2234
c1af59565992
remove some remnants from the iid-a-variable era.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2232
diff
changeset
|
89 |
MakeInterfaceId (std::string name, InterfaceId parent); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
|
718 | 91 |
/** |
92 |
* \brief a base class which provides memory management and object aggregation |
|
93 |
* |
|
94 |
* Note: This base class is quite similar in spirit to IUnknown in COM or |
|
95 |
* BonoboObject in Bonobo: it provides three main methods: Ref, Unref and |
|
96 |
* QueryInterface. |
|
97 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
98 |
class Object |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
public: |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
101 |
static InterfaceId iid (void); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
103 |
Object (); |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
104 |
virtual ~Object (); |
718 | 105 |
/** |
106 |
* Increment the reference count. This method should not be called |
|
107 |
* by user code. Object instances are expected to be used in conjunction |
|
108 |
* of the Ptr template which would make calling Ref unecessary and |
|
109 |
* dangerous. |
|
110 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
111 |
inline void Ref (void) const; |
718 | 112 |
/** |
113 |
* Decrement the reference count. This method should not be called |
|
114 |
* by user code. Object instances are expected to be used in conjunction |
|
115 |
* of the Ptr template which would make calling Ref unecessary and |
|
116 |
* dangerous. |
|
117 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
118 |
inline void Unref (void) const; |
718 | 119 |
/** |
120 |
* \returns a pointer to the requested interface or zero if it could not be found. |
|
2231
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
121 |
*/ |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
122 |
template <typename T> |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
123 |
Ptr<T> QueryInterface (void) const; |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
124 |
/** |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
125 |
* \param iid the interface id of the requested interface |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
126 |
* \returns a pointer to the requested interface or zero if it could not be found. |
718 | 127 |
*/ |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
template <typename T> |
709
b5c7825babf3
make QueryInterface const
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
708
diff
changeset
|
129 |
Ptr<T> QueryInterface (InterfaceId iid) const; |
718 | 130 |
/** |
131 |
* Run the DoDispose methods of this object and all the |
|
132 |
* objects aggregated to it. |
|
133 |
* After calling this method, the object is expected to be |
|
134 |
* totally unusable except for the Ref and Unref methods. |
|
135 |
* It is an error to call Dispose twice on the same object |
|
136 |
* instance |
|
137 |
*/ |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
void Dispose (void); |
718 | 139 |
/** |
140 |
* \param other another object pointer |
|
141 |
* |
|
142 |
* This method aggregates the two objects together: after this |
|
143 |
* method returns, it becomes possible to call QueryInterface |
|
144 |
* on one to get the other, and vice-versa. |
|
145 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
146 |
void AddInterface (Ptr<Object> other); |
1330
d67fce6d56f8
add refcounting to TraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
718
diff
changeset
|
147 |
|
1380
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
148 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
149 |
* \param path the path to match for the callback |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
150 |
* \param cb callback to connect |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
151 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
152 |
* Connect the input callback to all trace sources which |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
153 |
* match the input path. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
154 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
155 |
*/ |
1383 | 156 |
void TraceConnect (std::string path, const CallbackBase &cb) const; |
1380
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
157 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
158 |
* \param path the path to match for the callback |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
159 |
* \param cb callback to disconnect |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
160 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
161 |
* Disconnect the input callback from all trace sources which |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
162 |
* match the input path. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
163 |
*/ |
1383 | 164 |
void TraceDisconnect (std::string path, const CallbackBase &cb) const; |
1380
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
165 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
166 |
* \returns the trace resolver associated to this object. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
167 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
168 |
* This method should be rarely called by users. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
169 |
*/ |
1383 | 170 |
virtual Ptr<TraceResolver> GetTraceResolver (void) const; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
171 |
protected: |
718 | 172 |
/** |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
173 |
* This method is called by Object::Dispose. |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
174 |
* Subclasses are expected to override this method and chain |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
175 |
* up to their parent's implementation once they are done. |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
176 |
*/ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
177 |
virtual void DoDispose (void); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
178 |
private: |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
179 |
friend class InterfaceIdTraceResolver; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
180 |
template <typename T> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
181 |
friend Ptr<T> CreateObject (void); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
182 |
template <typename T, typename T1> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
183 |
friend Ptr<T> CreateObject (T1 a1); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
184 |
template <typename T, typename T1, typename T2> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
185 |
friend Ptr<T> CreateObject (T1 a1, T2 a2); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
186 |
template <typename T, typename T1, typename T2, typename T3> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
187 |
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
188 |
template <typename T, typename T1, typename T2, typename T3, typename T4> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
189 |
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
190 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
191 |
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
192 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
193 |
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
194 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
195 |
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
196 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
197 |
Ptr<Object> DoQueryInterface (InterfaceId iid) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
198 |
void DoCollectSources (std::string path, const TraceContext &context, |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
199 |
TraceResolver::SourceCollection *collection) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
200 |
void DoTraceAll (std::ostream &os, const TraceContext &context) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
201 |
bool Check (void) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
202 |
bool CheckLoose (void) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
203 |
void MaybeDelete (void) const; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
204 |
/** |
718 | 205 |
* \param iid an InterfaceId |
206 |
* |
|
207 |
* Every subclass which defines a new InterfaceId for itself |
|
208 |
* should register this InterfaceId by calling this method |
|
209 |
* from its constructor. |
|
210 |
*/ |
|
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
211 |
void SetInterfaceId (InterfaceId iid); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
212 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
213 |
mutable uint32_t m_count; |
708
e8cac905d541
port ComponentManager to Object from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
706
diff
changeset
|
214 |
InterfaceId m_iid; |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
215 |
bool m_disposed; |
1383 | 216 |
mutable bool m_collecting; |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
217 |
Object *m_next; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
219 |
|
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
220 |
template <typename T> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
221 |
Ptr<T> CreateObject (void); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
222 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
223 |
template <typename T, typename T1> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
224 |
Ptr<T> CreateObject (T1 a1); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
225 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
226 |
template <typename T, typename T1, typename T2> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
227 |
Ptr<T> CreateObject (T1 a1, T2 a2); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
228 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
229 |
template <typename T, typename T1, typename T2, typename T3> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
230 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
231 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
232 |
template <typename T, typename T1, typename T2, typename T3, typename T4> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
233 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
234 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
235 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
236 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
237 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
238 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
239 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
240 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
241 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
242 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7); |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
243 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
244 |
} // namespace ns3 |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
245 |
|
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
246 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
247 |
|
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
248 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
249 |
Object::Ref (void) const |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
250 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
251 |
m_count++; |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
252 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
253 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
254 |
Object::Unref (void) const |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
255 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
256 |
NS_ASSERT (Check ()); |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
257 |
m_count--; |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
258 |
if (m_count == 0) |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
259 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
260 |
MaybeDelete (); |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
261 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
262 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
263 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
264 |
template <typename T> |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
265 |
Ptr<T> |
2231
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
266 |
Object::QueryInterface () const |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
267 |
{ |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
268 |
Ptr<Object> found = DoQueryInterface (T::iid ()); |
2231
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
269 |
if (found != 0) |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
270 |
{ |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
271 |
return Ptr<T> (dynamic_cast<T *> (PeekPointer (found))); |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
272 |
} |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
273 |
return 0; |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
274 |
} |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
275 |
|
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
276 |
template <typename T> |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
277 |
Ptr<T> |
709
b5c7825babf3
make QueryInterface const
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
708
diff
changeset
|
278 |
Object::QueryInterface (InterfaceId iid) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
279 |
{ |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
280 |
Ptr<Object> found = DoQueryInterface (iid); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
281 |
if (found != 0) |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
282 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
283 |
return Ptr<T> (dynamic_cast<T *> (PeekPointer (found))); |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
284 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
285 |
return 0; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
286 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
287 |
|
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
288 |
template <typename T> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
289 |
Ptr<T> CreateObject (void) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
290 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
291 |
Ptr<T> p = Ptr<T> (new T (), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
292 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
293 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
294 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
295 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
296 |
template <typename T, typename T1> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
297 |
Ptr<T> CreateObject (T1 a1) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
298 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
299 |
Ptr<T> p = Ptr<T> (new T (a1), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
300 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
301 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
302 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
303 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
304 |
template <typename T, typename T1, typename T2> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
305 |
Ptr<T> CreateObject (T1 a1, T2 a2) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
306 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
307 |
Ptr<T> p = Ptr<T> (new T (a1, a2), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
308 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
309 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
310 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
311 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
312 |
template <typename T, typename T1, typename T2, typename T3> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
313 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
314 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
315 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
316 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
317 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
318 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
319 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
320 |
template <typename T, typename T1, typename T2, typename T3, typename T4> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
321 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
322 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
323 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
324 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
325 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
326 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
327 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
328 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
329 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
330 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
331 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
332 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
333 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
334 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
335 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
336 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
337 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
338 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
339 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
340 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
341 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
342 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
343 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
344 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
345 |
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
346 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
347 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false); |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
348 |
p->SetInterfaceId (T::iid ()); |
2230
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
349 |
return p; |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
350 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
351 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
352 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
353 |
} // namespace ns3 |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
354 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
355 |
#endif /* OBJECT_H */ |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
356 |