author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Tue, 15 Jan 2008 12:36:22 +0100 | |
changeset 2250 | 18f432098389 |
parent 2246 | 3645f5e344a4 |
child 2251 | 04963d8cca51 |
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" |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
28 |
#include "callback.h" |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
29 |
#include "empty.h" |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
2246
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
31 |
#define NS_OBJECT_ENSURE_REGISTERED(type) \ |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
32 |
static struct X##type##RegistrationClass \ |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
33 |
{ \ |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
34 |
X##type##RegistrationClass () { \ |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
35 |
ns3::TypeId iid = type::iid (); \ |
2246
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
36 |
iid.GetParent (); \ |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
37 |
} \ |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
38 |
} x_##type##RegistrationVariable |
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
39 |
|
3645f5e344a4
add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2244
diff
changeset
|
40 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
|
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
|
43 |
class TraceContext; |
1336
de5a133ece8a
add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1330
diff
changeset
|
44 |
class CallbackBase; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
45 |
class Object; |
1336
de5a133ece8a
add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1330
diff
changeset
|
46 |
|
718 | 47 |
/** |
48 |
* \brief a unique identifier for an interface. |
|
49 |
* |
|
50 |
*/ |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
51 |
class TypeId |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
public: |
718 | 54 |
/** |
55 |
* \param name the name of the requested interface |
|
56 |
* \returns the unique id associated with the requested |
|
57 |
* name. |
|
58 |
* |
|
59 |
* This method cannot fail: it will crash if the input |
|
60 |
* name is not a valid interface name. |
|
61 |
*/ |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
62 |
static TypeId LookupByName (std::string name); |
2239
b500773d7eae
add support to browse the list of existing InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2238
diff
changeset
|
63 |
static uint32_t GetRegisteredN (void); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
64 |
static TypeId GetRegistered (uint32_t i); |
718 | 65 |
/** |
66 |
* \param iid a unique id |
|
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
67 |
* \returns the parent of the requested id |
718 | 68 |
* |
69 |
* This method cannot fail: it will crash if the input |
|
70 |
* id is not a valid interface id. |
|
71 |
*/ |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
72 |
TypeId GetParent (void) const; |
1371
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
73 |
|
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
74 |
/** |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
75 |
* \returns the name of this interface. |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
76 |
*/ |
bebf690257c9
replace TraceResolver::PrintAvailable with TraceResolver::CollectSources
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1368
diff
changeset
|
77 |
std::string GetName (void) const; |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
78 |
|
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
79 |
/** |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
80 |
* \returns true if this TypeId has a constructor |
2241
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
81 |
*/ |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
82 |
bool HasConstructor (void) const; |
daef67e18b79
add InterfaceId::HasConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2240
diff
changeset
|
83 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
84 |
TypeId (std::string); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
85 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
86 |
TypeId SetParent (TypeId iid); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
87 |
template <typename T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
88 |
TypeId SetParent (void); |
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
89 |
|
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
90 |
template <typename T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
91 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
92 |
template <typename T, typename T1> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
93 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
94 |
template <typename T, typename T1, typename T2> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
95 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
96 |
template <typename T, typename T1, typename T2, typename T3> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
97 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
98 |
template <typename T, typename T1, typename T2, typename T3, typename T4> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
99 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
100 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
101 |
TypeId AddConstructor (void); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
102 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
103 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
104 |
Ptr<Object> CreateObject (void); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
105 |
template <typename T1> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
106 |
Ptr<Object> CreateObject (T1 a1); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
107 |
template <typename T1, typename T2> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
108 |
Ptr<Object> CreateObject (T1 a1, T2 a2); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
109 |
template <typename T1, typename T2, typename T3> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
110 |
Ptr<Object> CreateObject (T1 a1, T2 a2, T3 a3); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
111 |
template <typename T1, typename T2, typename T3, typename T4> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
112 |
Ptr<Object> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
113 |
template <typename T1, typename T2, typename T3, typename T4, typename T5> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
114 |
Ptr<Object> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
115 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
116 |
~TypeId (); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
private: |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
118 |
friend bool operator == (TypeId a, TypeId b); |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
119 |
friend bool operator != (TypeId a, TypeId b); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
120 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
121 |
explicit TypeId (uint16_t iid); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
122 |
void DoAddConstructor (CallbackBase callback, uint32_t nArguments); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
123 |
CallbackBase LookupConstructor (uint32_t nArguments); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
124 |
|
712
0708bee3dbf3
use a 16 bit interface id
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
709
diff
changeset
|
125 |
uint16_t m_iid; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
|
718 | 128 |
/** |
129 |
* \brief a base class which provides memory management and object aggregation |
|
130 |
* |
|
131 |
* Note: This base class is quite similar in spirit to IUnknown in COM or |
|
132 |
* BonoboObject in Bonobo: it provides three main methods: Ref, Unref and |
|
133 |
* QueryInterface. |
|
134 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
135 |
class Object |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
public: |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
138 |
static TypeId iid (void); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
140 |
Object (); |
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
141 |
virtual ~Object (); |
718 | 142 |
/** |
143 |
* Increment the reference count. This method should not be called |
|
144 |
* by user code. Object instances are expected to be used in conjunction |
|
145 |
* of the Ptr template which would make calling Ref unecessary and |
|
146 |
* dangerous. |
|
147 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
148 |
inline void Ref (void) const; |
718 | 149 |
/** |
150 |
* Decrement the reference count. This method should not be called |
|
151 |
* by user code. Object instances are expected to be used in conjunction |
|
152 |
* of the Ptr template which would make calling Ref unecessary and |
|
153 |
* dangerous. |
|
154 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
155 |
inline void Unref (void) const; |
718 | 156 |
/** |
157 |
* \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
|
158 |
*/ |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
159 |
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
|
160 |
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
|
161 |
/** |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
162 |
* \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
|
163 |
* \returns a pointer to the requested interface or zero if it could not be found. |
718 | 164 |
*/ |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
165 |
template <typename T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
166 |
Ptr<T> QueryInterface (TypeId iid) const; |
718 | 167 |
/** |
168 |
* Run the DoDispose methods of this object and all the |
|
169 |
* objects aggregated to it. |
|
170 |
* After calling this method, the object is expected to be |
|
171 |
* totally unusable except for the Ref and Unref methods. |
|
172 |
* It is an error to call Dispose twice on the same object |
|
173 |
* instance |
|
174 |
*/ |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
175 |
void Dispose (void); |
718 | 176 |
/** |
177 |
* \param other another object pointer |
|
178 |
* |
|
179 |
* This method aggregates the two objects together: after this |
|
180 |
* method returns, it becomes possible to call QueryInterface |
|
181 |
* on one to get the other, and vice-versa. |
|
182 |
*/ |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
183 |
void AddInterface (Ptr<Object> other); |
1330
d67fce6d56f8
add refcounting to TraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
718
diff
changeset
|
184 |
|
1380
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
185 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
186 |
* \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
|
187 |
* \param cb callback to connect |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
188 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
189 |
* 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
|
190 |
* match the input path. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
191 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
192 |
*/ |
1383 | 193 |
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
|
194 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
195 |
* \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
|
196 |
* \param cb callback to disconnect |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
197 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
198 |
* 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
|
199 |
* match the input path. |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
200 |
*/ |
1383 | 201 |
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
|
202 |
/** |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
203 |
* \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
|
204 |
* |
799617173a45
api doxygen for Object base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1374
diff
changeset
|
205 |
* 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
|
206 |
*/ |
1383 | 207 |
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
|
208 |
protected: |
718 | 209 |
/** |
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
|
210 |
* 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
|
211 |
* 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
|
212 |
* 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
|
213 |
*/ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
214 |
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
|
215 |
private: |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
216 |
friend class TypeIdTraceResolver; |
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
|
217 |
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
|
218 |
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
|
219 |
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
|
220 |
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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
234 |
Ptr<Object> DoQueryInterface (TypeId iid) const; |
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
|
235 |
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
|
236 |
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
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
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
|
241 |
/** |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
242 |
* \param iid an TypeId |
718 | 243 |
* |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
244 |
* Every subclass which defines a new TypeId for itself |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
245 |
* should register this TypeId by calling this method |
718 | 246 |
* from its constructor. |
247 |
*/ |
|
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
248 |
void SetTypeId (TypeId 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
|
249 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
250 |
mutable uint32_t m_count; |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
251 |
TypeId m_iid; |
713
c3c745a80610
add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
712
diff
changeset
|
252 |
bool m_disposed; |
1383 | 253 |
mutable bool m_collecting; |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
254 |
Object *m_next; |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
255 |
}; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
256 |
|
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
|
257 |
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
|
258 |
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
|
259 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
260 |
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
|
261 |
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
|
262 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
266 |
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
|
267 |
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
|
268 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
269 |
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
|
270 |
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
|
271 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
272 |
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
|
273 |
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
|
274 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
275 |
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
|
276 |
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
|
277 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
278 |
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
|
279 |
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
|
280 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
281 |
} // namespace ns3 |
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 |
namespace ns3 { |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
284 |
|
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
285 |
template <typename T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
286 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
287 |
TypeId::SetParent (void) |
2238
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
288 |
{ |
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
289 |
return SetParent (T::iid ()); |
05affd9d0dc1
get rid of MakeInterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2237
diff
changeset
|
290 |
} |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
291 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
292 |
template <typename T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
293 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
294 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
295 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
296 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
297 |
static Ptr<Object> Create (void) { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
298 |
return ns3::CreateObject<T> (); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
299 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
300 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
301 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
302 |
DoAddConstructor (cb, 0); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
303 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
304 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
305 |
template <typename T, typename T1> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
306 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
307 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
308 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
309 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
310 |
static Ptr<Object> Create (T1 a1) { |
2244
614282ded8ba
work around weird compiler warning/error.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
311 |
return ns3::CreateObject<T,T1> (a1); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
312 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
313 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
314 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
315 |
DoAddConstructor (cb, 1); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
316 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
317 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
318 |
template <typename T, typename T1, typename T2> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
319 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
320 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
321 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
322 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
323 |
static Ptr<Object> Create (T1 a1, T2 a2) { |
2244
614282ded8ba
work around weird compiler warning/error.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
324 |
return ns3::CreateObject<T,T1,T2> (a1, a2); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
325 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
326 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
327 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
328 |
DoAddConstructor (cb, 2); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
329 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
330 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
331 |
template <typename T, typename T1, typename T2, typename T3> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
332 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
333 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
334 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
335 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
336 |
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3) { |
2244
614282ded8ba
work around weird compiler warning/error.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
337 |
return ns3::CreateObject<T,T1,T2,T3> (a1, a2, a3); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
338 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
339 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
340 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
341 |
DoAddConstructor (cb, 3); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
342 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
343 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
344 |
template <typename T, typename T1, typename T2, typename T3, typename T4> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
345 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
346 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
347 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
348 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
349 |
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3, T4 a4) { |
2244
614282ded8ba
work around weird compiler warning/error.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
350 |
return ns3::CreateObject<T,T1,T2,T3,T4> (a1, a2, a3, a4); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
351 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
352 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
353 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
354 |
DoAddConstructor (cb, 4); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
355 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
356 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
357 |
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
358 |
TypeId |
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
359 |
TypeId::AddConstructor (void) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
360 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
361 |
struct Maker { |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
362 |
static Ptr<Object> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { |
2244
614282ded8ba
work around weird compiler warning/error.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2241
diff
changeset
|
363 |
return ns3::CreateObject<T,T1,T2,T3,T4,T5> (a1, a2, a3, a4, a5); |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
364 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
365 |
}; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
366 |
CallbackBase cb = MakeCallback (&Maker::Create); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
367 |
DoAddConstructor (cb, 5); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
368 |
return *this; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
369 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
370 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
371 |
template <typename T1> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
372 |
Ptr<Object> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
373 |
TypeId::CreateObject (T1 a1) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
374 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
375 |
CallbackBase cb = LookupConstructor (1); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
376 |
Callback<Ptr<Object>,T1> realCb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
377 |
realCb.Assign (cb); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
378 |
Ptr<Object> object = realCb (a1); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
379 |
return object; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
380 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
381 |
template <typename T1, typename T2> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
382 |
Ptr<Object> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
383 |
TypeId::CreateObject (T1 a1, T2 a2) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
384 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
385 |
CallbackBase cb = LookupConstructor (2); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
386 |
Callback<Ptr<Object>,T1,T2> realCb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
387 |
realCb.Assign (cb); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
388 |
Ptr<Object> object = realCb (a1,a2); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
389 |
return object; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
390 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
391 |
template <typename T1, typename T2, typename T3> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
392 |
Ptr<Object> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
393 |
TypeId::CreateObject (T1 a1, T2 a2, T3 a3) |
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 |
CallbackBase cb = LookupConstructor (3); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
396 |
Callback<Ptr<Object>,T1,T2,T3> realCb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
397 |
realCb.Assign (cb); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
398 |
Ptr<Object> object = realCb (a1,a2,a3); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
399 |
return object; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
400 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
401 |
template <typename T1, typename T2, typename T3, typename T4> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
402 |
Ptr<Object> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
403 |
TypeId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
404 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
405 |
CallbackBase cb = LookupConstructor (4); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
406 |
Callback<Ptr<Object>,T1,T2,T3,T4> realCb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
407 |
realCb.Assign (cb); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
408 |
Ptr<Object> object = realCb (a1,a2,a3,a4); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
409 |
return object; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
410 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
411 |
template <typename T1, typename T2, typename T3, typename T4, typename T5> |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
412 |
Ptr<Object> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
413 |
TypeId::CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) |
2237
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
414 |
{ |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
415 |
CallbackBase cb = LookupConstructor (5); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
416 |
Callback<Ptr<Object>,T1,T2,T3,T4,T5> realCb; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
417 |
realCb.Assign (cb); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
418 |
Ptr<Object> object = realCb (a1,a2,a3,a4,a5); |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
419 |
return object; |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
420 |
} |
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
421 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
422 |
|
7745a8c76396
add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2235
diff
changeset
|
423 |
|
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
424 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
425 |
Object::Ref (void) const |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
426 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
427 |
m_count++; |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
428 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
429 |
void |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
430 |
Object::Unref (void) const |
701
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
431 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
432 |
NS_ASSERT (Check ()); |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
433 |
m_count--; |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
434 |
if (m_count == 0) |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
435 |
{ |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
436 |
MaybeDelete (); |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
437 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
438 |
} |
aa179c876b22
optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
699
diff
changeset
|
439 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
440 |
template <typename T> |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
441 |
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
|
442 |
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
|
443 |
{ |
2232
9abd038ee588
replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
444 |
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
|
445 |
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
|
446 |
{ |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
447 |
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
|
448 |
} |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
449 |
return 0; |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
450 |
} |
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
451 |
|
a5b898c1ee2c
fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2230
diff
changeset
|
452 |
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
|
453 |
Ptr<T> |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
454 |
Object::QueryInterface (TypeId iid) const |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
455 |
{ |
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
456 |
Ptr<Object> found = DoQueryInterface (iid); |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
457 |
if (found != 0) |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
458 |
{ |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
459 |
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
|
460 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
461 |
return 0; |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
462 |
} |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
463 |
|
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
|
464 |
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
|
465 |
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
|
466 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
467 |
Ptr<T> p = Ptr<T> (new T (), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
468 |
p->SetTypeId (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
|
469 |
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
|
470 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
471 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
472 |
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
|
473 |
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
|
474 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
475 |
Ptr<T> p = Ptr<T> (new T (a1), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
476 |
p->SetTypeId (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
|
477 |
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
|
478 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
479 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
480 |
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
|
481 |
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
|
482 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
483 |
Ptr<T> p = Ptr<T> (new T (a1, a2), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
484 |
p->SetTypeId (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
|
485 |
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
|
486 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
487 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
488 |
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
|
489 |
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
|
490 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
491 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
492 |
p->SetTypeId (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
|
493 |
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
|
494 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
495 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
496 |
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
|
497 |
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
|
498 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
499 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
500 |
p->SetTypeId (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
|
501 |
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
|
502 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
503 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
504 |
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
|
505 |
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
|
506 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
507 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
508 |
p->SetTypeId (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
|
509 |
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
|
510 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
511 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
512 |
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
|
513 |
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
|
514 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
515 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
516 |
p->SetTypeId (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
|
517 |
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
|
518 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
519 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
520 |
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
|
521 |
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
|
522 |
{ |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
523 |
Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false); |
2250
18f432098389
InterfaceId -> TypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2246
diff
changeset
|
524 |
p->SetTypeId (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
|
525 |
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
|
526 |
} |
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
527 |
|
9f13ac3291e0
add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1534
diff
changeset
|
528 |
|
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
529 |
} // namespace ns3 |
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
530 |
|
706
8b0bf4623c9d
rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
703
diff
changeset
|
531 |
#endif /* OBJECT_H */ |
699
956a76f5fd56
a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
532 |