author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 29 Aug 2007 16:42:55 +0200 | |
changeset 1396 | 105d16b9bf04 |
parent 766 | aa1dff7879c8 |
child 1504 | 36ecc970ba96 |
permissions | -rw-r--r-- |
766
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
/* |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 University of Washington |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
* Authors: Tom Henderson, Craig Dowell |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
* |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
* |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
* |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
*/ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
#include "ns3/debug.h" |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
#include "ns3/object.h" |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
#include "ns3/component-manager.h" |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
using namespace ns3; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
25 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
27 |
// This sample file shows examples of how to use QueryInterface. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
28 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
// QueryInterface is a templated method of class Object, defined in |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
30 |
// src/core/object.h. ns-3 objects that derive from class Object |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
31 |
// can have QueryInterface invoked on them. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
32 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
33 |
// QueryInterface is a type-safe way to ask an object, at run-time, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
34 |
// "Do you support the interface identified by the given InterfaceId?" |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
35 |
// It avoids deprecated techniques of having to downcast pointers to |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
36 |
// an object to ask questions about its type. One or more interfaces |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
37 |
// may be associated with a given object. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
38 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
39 |
// QueryInterface is of most use when working with base class |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
// pointers of objects that may be subclassed. For instance, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
// one may have a pointer to a Node, but not know whether it has |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
// an IPv4 stack. Another example might be to determine whether |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
43 |
// a Node has an EnergyModel, to which calls to decrement energy |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
44 |
// from the node's battery might be made. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
45 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
46 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
47 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
48 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
49 |
// Object is the base class for ns-3 node-related objects used at |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
50 |
// the public API. Object provides reference counting implementations |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
51 |
// and the QueryInterface. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
52 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
53 |
// A common design paradigm for an ns-3 node object, such as a Queue, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
54 |
// is that we provide an abstract base class that inherits from |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
55 |
// Object. This class is assigned an interface ID (iid) and |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
56 |
// contains the basic API for objects in this class and subclasses. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
57 |
// This base class is specialized to provide implementations of |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
58 |
// the object in question (such as a DropTailQueue). |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
59 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
60 |
// The design pattern commonly used is known as the "non-virtual |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
61 |
// public interface" pattern, whereby the public API for this |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
62 |
// object is a set of public non-virtual functions that forward |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
63 |
// to private virtual functions. The forwarding functions can |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
64 |
// impose pre- and post-conditions on the forwarding call at |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
65 |
// the base class level. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
66 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
67 |
// We'll call this base class "AnInterface" in the example below. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
68 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
69 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
70 |
class AnInterface : public Object |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
71 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
72 |
public: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
73 |
static const InterfaceId iid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
74 |
void methodA (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
75 |
private: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
76 |
virtual void domethodA (void) = 0; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
77 |
}; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
78 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
79 |
void |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
80 |
AnInterface::methodA (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
81 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
82 |
// pre-dispatch asserts |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
83 |
NS_DEBUG_UNCOND("AnInterface pre-condition::methodA"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
84 |
domethodA (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
85 |
NS_DEBUG_UNCOND("AnInterface post-condition::methodA\n"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
86 |
// post-dispatch asserts |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
87 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
88 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
89 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
90 |
// The below assignment assigns the InterfaceId of the class AnInterface, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
91 |
// and declares that the parent iid is that of class Object. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
92 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
93 |
const InterfaceId AnInterface::iid = MakeInterfaceId ("AnInterface", Object::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
94 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
95 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
96 |
// AnImplementation is an implementation of the abstract base class |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
97 |
// defined above. It provides implementation for the virtual functions |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
98 |
// in the base class. It defines one ClassId for each constructor, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
99 |
// and can also provide an interface itself (in this example, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
100 |
// a methodImpl is available) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
101 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
102 |
class AnImplementation : public AnInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
103 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
104 |
public: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
105 |
static const InterfaceId iid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
106 |
static const ClassId cid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
107 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
108 |
AnImplementation (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
109 |
void methodImpl (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
110 |
private: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
111 |
virtual void domethodA (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
112 |
}; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
113 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
114 |
void |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
115 |
AnImplementation::methodImpl (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
116 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
117 |
NS_DEBUG_UNCOND("AnImplementation::methodImpl\n"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
118 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
119 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
120 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
121 |
AnImplementation::AnImplementation (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
122 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
// enable our interface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
124 |
SetInterfaceId (AnImplementation::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
125 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
126 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
127 |
void |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
128 |
AnImplementation::domethodA () |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
129 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
130 |
NS_DEBUG_UNCOND("AnImplementation::domethodA"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
131 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
132 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
133 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
134 |
// The below assignment assigns the InterfaceId of the class AnImplementation, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
135 |
// and declares that the parent iid is that of class Object. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
136 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
137 |
const InterfaceId AnImplementation::iid = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
138 |
MakeInterfaceId ("AnImplementation", AnInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
139 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
140 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
141 |
// The next few lines are used by the component manager. They |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
142 |
// state that the component manager can create a new object |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
143 |
// AnImplementation and return an interface corresponding to |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
144 |
// the AnImplementation iid. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
145 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
146 |
const ClassId AnImplementation::cid = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
147 |
MakeClassId<AnImplementation> |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
148 |
("AnImplementation", AnImplementation::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
149 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
150 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
151 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
152 |
// Extending interfaces |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
153 |
// ================== |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
154 |
// What if AnInterface doesn't provide enough API for your |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
155 |
// object type? |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
156 |
// - if you aren't concerned about backward compatibility and |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
157 |
// don't mind recompiling, you just add new methods to AnInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
158 |
// and recompile. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
159 |
// - if you want to address backward compatibiliy, or allow part |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
160 |
// of the system to use the old interface, you have to do more. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
161 |
// You have to declare a new interface with the new functionality. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
162 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
163 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
164 |
class AnExtendedInterface : public AnInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
165 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
166 |
public: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
167 |
static const InterfaceId iid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
168 |
void methodB (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
169 |
private: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
170 |
virtual void domethodB (void) = 0; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
171 |
}; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
172 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
173 |
const InterfaceId AnExtendedInterface::iid = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
174 |
MakeInterfaceId ("AnExtendedInterface", AnInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
175 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
176 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
177 |
// Then you need provide an implementation for the virtual |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
178 |
// methods. If you are providing a new implementation for |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
179 |
// everything, the answer is straightforward |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
180 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
181 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
182 |
class ANewImplementation : public AnExtendedInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
183 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
184 |
public: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
185 |
static const InterfaceId iid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
186 |
static const ClassId cid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
187 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
188 |
ANewImplementation (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
189 |
void methodImpl (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
190 |
private: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
191 |
virtual void domethodA (void) { /* new-implementation-behavior (); */} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
192 |
virtual void domethodB (void) { /* new-implementation-behavior (); */} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
193 |
}; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
194 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
195 |
ANewImplementation::ANewImplementation (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
196 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
197 |
// enable our interface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
198 |
SetInterfaceId (ANewImplementation::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
199 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
200 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
201 |
void |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
202 |
ANewImplementation::methodImpl (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
203 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
204 |
NS_DEBUG_UNCOND("ANewImplementation::methodImpl\n"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
205 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
206 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
207 |
const InterfaceId ANewImplementation::iid = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
208 |
MakeInterfaceId ("ANewImplementation", AnExtendedInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
209 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
210 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
211 |
// If you want to extend an existing implementation, you can use |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
212 |
// the existing class to instantiate an implementation of its |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
213 |
// methods (hasa) and do the following if you can use stuff from |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
214 |
// the existing class. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
215 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
216 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
217 |
class AnExtendedImplementation : public AnExtendedInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
218 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
219 |
public: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
220 |
static const InterfaceId iid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
221 |
static const ClassId cid; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
222 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
223 |
AnExtendedImplementation (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
224 |
void methodImpl (void) { /* pImpl->methodImpl (); */ } |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
225 |
void methodExtendedImpl (void); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
226 |
private: |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
227 |
virtual void domethodA (void) { /* new-implementation-behavior (); */} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
228 |
virtual void domethodB (void) { /* new-implementation-behavior (); */} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
229 |
Ptr<AnImplementation> pImpl; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
230 |
}; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
231 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
232 |
AnExtendedImplementation::AnExtendedImplementation (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
233 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
234 |
pImpl = Create<AnImplementation> (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
235 |
SetInterfaceId (AnExtendedImplementation::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
236 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
237 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
238 |
void |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
239 |
AnExtendedImplementation::methodExtendedImpl (void) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
240 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
241 |
NS_DEBUG_UNCOND("AnExtendedImplementation::methodExtendedImpl\n"); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
242 |
} |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
243 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
244 |
const InterfaceId AnExtendedImplementation::iid = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
245 |
MakeInterfaceId ("AnExtendedImplementation", AnExtendedInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
246 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
247 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
248 |
// Inheriting from an existing implementation (isa) and an extended |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
249 |
// interface is tricky, because of the diamond multiple inheritance |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
250 |
// problem. If the pImpl method above is not desirable, it may |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
251 |
// be that the implementation extension could be aggregated. |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
252 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
253 |
// The extension will not have access to the base implementation, |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
254 |
// so this design pattern may be more appropriate if the extension |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
255 |
// is very modular (e.g., add an EnergyModel to a wireless interface) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
256 |
// |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
257 |
// EXAMPLE NOT YET PROVIDED |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
258 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
259 |
int main (int argc, char *argv[]) |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
260 |
{ |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
261 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
262 |
Ptr<AnInterface> aBase = ComponentManager::Create<AnImplementation> |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
263 |
(AnImplementation::cid, AnInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
264 |
NS_ASSERT (aBase != 0); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
265 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
266 |
aBase->methodA (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
267 |
//aBase->methodImpl (); // XXX won't compile, aBase not right ptr type |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
268 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
269 |
Ptr<AnImplementation> aBaseImplPtr = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
270 |
aBase-> QueryInterface<AnImplementation> (AnImplementation::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
271 |
aBaseImplPtr->methodImpl (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
272 |
aBaseImplPtr->methodA(); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
273 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
274 |
// Test symmetric property of QueryInterface |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
275 |
Ptr<AnInterface> aBase2 = |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
276 |
aBaseImplPtr-> QueryInterface<AnInterface> (AnInterface::iid); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
277 |
aBase2->methodA (); |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
278 |
|
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
279 |
return 0; |
aa1dff7879c8
Add main-query-interface.cc sample file
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
280 |
} |