blob: 9d07f6f6d81f8e0e0ee3037413c46e576a41081b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#import <objc/Ice.h>
#import <objects/TestI.h>
@implementation TestObjectsBI
-(void) ice_preMarshal
{
preMarshalInvoked = YES;
}
-(void) ice_postUnmarshal
{
postUnmarshalInvoked = YES;
}
@end
@implementation TestObjectsCI
-(void) ice_preMarshal
{
preMarshalInvoked = YES;
}
-(void) ice_postUnmarshal
{
postUnmarshalInvoked = YES;
}
@end
@implementation TestObjectsDI
-(void) ice_preMarshal
{
preMarshalInvoked = YES;
}
-(void) ice_postUnmarshal
{
postUnmarshalInvoked = YES;
}
@end
@implementation TestObjectsEI
-(id) init
{
return [super init:1 s:@"hello"];
}
@end
@implementation TestObjectsFI
-(id) init:(TestObjectsE*)e1_ e2:(TestObjectsE*)e2_
{
self = [super init:e1_ e2:e2_];
if(!self)
{
return nil;
}
return self;
}
-(BOOL) checkValues:(ICECurrent*)current
{
return e1 && e1 == e2;
}
@end
@implementation TestObjectsHI
@end
/*@implementation TestObjectsII
-(void) dealloc
{
printf("Deallocating Object");
}
@end*/
@implementation TestObjectsJI
@end
@implementation TestObjectsInitialI
-(id) init
{
self = [super init];
if(!self)
{
return nil;
}
_b1 = [[TestObjectsBI alloc] init];
_b2 = [[TestObjectsBI alloc] init];
_c = [[TestObjectsCI alloc] init];
_d = [[TestObjectsDI alloc] init];
_e = [[TestObjectsEI alloc] init];
_f = [[TestObjectsFI alloc] init:_e e2:_e];
_b1.theA = _b2; // Cyclic reference to another B
_b1.theB = _b1; // Self reference.
_b1.theC = nil; // Null reference.
_b2.theA = _b2; // Self reference, using base.
_b2.theB = _b1; // Cyclic reference to another B
_b2.theC = _c; // Cyclic reference to a C.
_c.theB = _b2; // Cyclic reference to a B.
_d.theA = _b1; // Reference to a B.
_d.theB = _b2; // Reference to a B.
_d.theC = nil; // Reference to a C.
return self;
}
#if defined(__clang__) && !__has_feature(objc_arc)
-(void) dealloc
{
[_b1 release];
[_b2 release];
[_c release];
[_d release];
[_e release];
[_f release];
[super dealloc];
}
#endif
-(void) shutdown:(ICECurrent*)current
{
_b1.theA = nil; // Break cyclic reference.
_b1.theB = nil; // Break cyclic reference.
_b2.theA = nil; // Break cyclic reference.
_b2.theB = nil; // Break cyclic reference.
_b2.theC = nil; // Break cyclic reference.
_c.theB = nil; // Break cyclic reference.
_d.theA = nil; // Break cyclic reference.
_d.theB = nil; // Break cyclic reference.
_d.theC = nil; // Break cyclic reference.
[[current.adapter getCommunicator] shutdown];
}
-(TestObjectsB*) getB1:(ICECurrent*)current
{
_b1.preMarshalInvoked = NO;
_b2.preMarshalInvoked = NO;
_c.preMarshalInvoked = NO;
return _b1;
}
-(TestObjectsB*) getB2:(ICECurrent*)current
{
_b1.preMarshalInvoked = NO;
_b2.preMarshalInvoked = NO;
_c.preMarshalInvoked = NO;
return _b2;
}
-(TestObjectsC*) getC:(ICECurrent*)current
{
_b1.preMarshalInvoked = NO;
_b2.preMarshalInvoked = NO;
_c.preMarshalInvoked = NO;
return _c;
}
-(TestObjectsD*) getD:(ICECurrent*)current
{
_b1.preMarshalInvoked = NO;
_b2.preMarshalInvoked = NO;
_c.preMarshalInvoked = NO;
_d.preMarshalInvoked = NO;
return _d;
}
-(TestObjectsE*) getE:(ICECurrent*)current
{
return _e;
}
-(TestObjectsF*) getF:(ICECurrent*)current
{
return _f;
}
-(TestObjectsB*) getMB:(ICECurrent*)current
{
return _b1;
}
-(TestObjectsB*) getAMDMB:(ICECurrent*)current
{
return _b1;
}
-(void) getAll:(TestObjectsB **)b1 b2:(TestObjectsB **)b2 theC:(TestObjectsC **)theC theD:(TestObjectsD **)theD current:(ICECurrent *)current;
{
_b1.preMarshalInvoked = NO;
_b2.preMarshalInvoked = NO;
_c.preMarshalInvoked = NO;
_d.preMarshalInvoked = NO;
*b1 = _b1;
*b2 = _b2;
*theC = _c;
*theD = _d;
}
-(TestObjectsI*) getI:(ICECurrent*)current
{
return [TestObjectsI i];
}
-(TestObjectsI*) getJ:(ICECurrent*)current
{
return (TestObjectsI*)[TestObjectsJ j];
}
-(TestObjectsI*) getH:(ICECurrent*)current
{
return (TestObjectsI*)[TestObjectsH h];
}
-(TestObjectsI*) getD1:(TestObjectsI*)d1 current:(ICECurrent*)current
{
return d1;
}
-(void) throwEDerived:(ICECurrent*)current
{
@throw [TestObjectsEDerived eDerived:[TestObjectsA1 a1:@"a1"]
a2:[TestObjectsA1 a1:@"a2"]
a3:[TestObjectsA1 a1:@"a3"]
a4:[TestObjectsA1 a1:@"a4"]];
}
-(TestObjectsBaseSeq*) opBaseSeq:(TestObjectsMutableBaseSeq*)inSeq outSeq:(TestObjectsBaseSeq**)outSeq
current:(ICECurrent*)current
{
*outSeq = inSeq;
return inSeq;
}
-(TestObjectsCompact*) getCompact:(ICECurrent*)current
{
return (TestObjectsCompact*)[TestObjectsCompactExt compactExt];
}
-(TestInnerA*) getInnerA:(ICECurrent *)current
{
return [TestInnerA a:_b1];
}
-(TestInnerSubA*) getInnerSubA:(ICECurrent *)current
{
return [TestInnerSubA a:[TestInnerA a:_b1]];
}
-(void) throwInnerEx:(ICECurrent *)current
{
@throw [TestInnerEx ex:@"Inner::Ex"];
}
-(void) throwInnerSubEx:(ICECurrent *)current
{
@throw [TestInnerSubEx ex:@"Inner::Sub::Ex"];
}
-(void) setI:(TestObjectsI*)i current:(ICECurrent*)current
{
}
-(TestObjectsObjectSeq *) getObjectSeq:(TestObjectsMutableObjectSeq *)s current:(ICECurrent*)current
{
return s;
}
-(TestObjectsObjectPrxSeq *) getObjectPrxSeq:(TestObjectsMutableObjectPrxSeq *)s current:(ICECurrent*)current
{
return s;
}
-(TestObjectsBaseSeq *) getBaseSeq:(TestObjectsMutableBaseSeq *)s current:(ICECurrent*)current
{
return s;
}
-(TestObjectsBasePrxSeq *) getBasePrxSeq:(TestObjectsMutableBasePrxSeq *)s current:(ICECurrent*)current
{
return s;
}
-(TestObjectsObjectDict *) getObjectDict:(TestObjectsMutableObjectDict *)d current:(ICECurrent*)current
{
return d;
}
-(TestObjectsObjectPrxDict *) getObjectPrxDict:(TestObjectsMutableObjectPrxDict *)d current:(ICECurrent*)current
{
return d;
}
-(TestObjectsBaseDict *) getBaseDict:(TestObjectsMutableBaseDict *)d current:(ICECurrent*)current
{
return d;
}
-(TestObjectsBasePrxDict *) getBasePrxDict:(TestObjectsMutableBasePrxDict *)d current:(ICECurrent*)current
{
return d;
}
@end
@implementation UnexpectedObjectExceptionTestI
-(BOOL)ice_invoke:(NSData*)inEncaps outEncaps:(NSMutableData**)outEncaps current:(ICECurrent*)current
{
id<ICECommunicator> communicator = [current.adapter getCommunicator];
id<ICEOutputStream> o = [ICEUtil createOutputStream:communicator];
[o startEncapsulation];
TestObjectsAlsoEmpty* ae = [TestObjectsAlsoEmpty alsoEmpty];
[o writeValue:ae];
[o writePendingValues];
[o endEncapsulation];
*outEncaps = [o finished];
return YES;
}
@end
|