summaryrefslogtreecommitdiff
path: root/objective-c/src/Ice/CurrentI.mm
blob: 3577c5c0d6a46ab0c42e9f1afa625b5b8f494775 (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
// **********************************************************************
//
// Copyright (c) 2003-2017 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 <CurrentI.h>
#import <VersionI.h>
#import <ObjectAdapterI.h>
#import <ConnectionI.h>
#import <IdentityI.h>
#import <Util.h>
#import <LocalObjectI.h>

@implementation ICECurrent (ICEInternal)

-(ICECurrent*) initWithCurrent:(const Ice::Current&)current
{
    self = [super init];
    if(!self)
    {
        return nil;
    }

    //
    // TODO: Optimize: the servant blobject should cache an ICECurrent object to
    // avoid re-creating the wrappers for each dispatched invocation.
    //
    adapter = [ICEObjectAdapter localObjectWithCxxObjectNoAutoRelease:current.adapter.get()];
    con = [ICEConnection localObjectWithCxxObjectNoAutoRelease:current.con.get()];
    id_ = [[ICEIdentity alloc] initWithIdentity:current.id];
    facet = [[NSString alloc] initWithUTF8String:current.facet.c_str()];
    operation = [[NSString alloc] initWithUTF8String:current.operation.c_str()];
    mode = (ICEOperationMode)current.mode;
    ctx = toNSDictionary(current.ctx);
    requestId = current.requestId;
    encoding = [[ICEEncodingVersion encodingVersionWithEncodingVersion:current.encoding] retain];
    return self;
}
@end