The Ice run time defines APIs using Slice. These APIs are provided as part of the Ice run time library and cannot be invoked remotely. (Doing so would not make any sense.) Therefore, the Slice interfaces for the Ice run time are defined as local interfaces. The Objective-C mapping for local interfaces differs from the default mapping in two ways:
- Local interfaces do not adopt an
<interface-name>Prx
protocol. (Doing so would be misleading because proxies imply that the target object can be remote.) Instead, the protocol for local interfaces has the same name as the interface. For example, theIce::Communicator
interfaces is defined as:BecauseSlice["objc:prefix:ICE"] module Ice { local interface Communicator { // ... } };
Communicator
is a local interface, objects of typeICECommunicator
are passed asid<ICECommunicator>
(notICECommunicator*
orid<ICEComunicatorPrx>
).
- Types that come in mutable and immutable variants (strings, sequences, and dictionaries) are always passed as the immutable variant. For example, the
getName
operation on theObjectAdapter
interface is defined as:BecauseSlice["objc:prefix:ICE"] module Ice { local interface ObjectAdapter { string getName(); }; };
ObjectAdapter
is a local interface, thegetName
operation maps to:Note that the returned string is of typeObjective-C-(NSString *) getName;
NSString
instead ofNSMutableString
(as would be the case for an operation on a non-local interface).
For local interfaces, parameters are passed as the immutable version because their values are not meant to be modified by application code. In addition, passing the immutable version avoids an unnecessary data copy.