Up

NSDistantObject class reference

Authors

Richard Frith-Macdonald (richard@brainstorm.co.uk)
Andrew Kachites McCallum (mccallum@gnu.ai.mit.edu)

Date: Generated at 2023-12-20 19:35:39 -0500

Copyright: (C) 1997 Free Software Foundation, Inc.

Software documentation for the NSDistantObject class

NSDistantObject : NSProxy

Declared in:
Foundation/NSDistantObject.h
Conforms to:
NSCoding
Availability: OpenStep

Instances of this class act as proxies to remote objects using the Distributed Objects system. They also hold references to local objects which are vended to remote processes.

Instance Variables

Method summary

proxyWithLocal: connection: 

+ (NSDistantObject*) proxyWithLocal: (id)anObject connection: (NSConnection*)aConnection;
Availability: OpenStep

Creates and returns a proxy associated with aConnection which will hold a reference to the local object anObject.

proxyWithTarget: connection: 

+ (NSDistantObject*) proxyWithTarget: (unsigned)anObject connection: (NSConnection*)aConnection;
Availability: OpenStep

Creates and returns a proxy associated with aConnection which will provide a link to a remote object whose reference locally is anObject.

connectionForProxy 

- (NSConnection*) connectionForProxy;
Availability: OpenStep

Returns the NSConnection instance with which the receiver is associated.

initWithLocal: connection: 

- (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
Availability: OpenStep

Initialises and returns a proxy associated with aConnection which will hold a reference to the local object anObject.

initWithTarget: connection: 

- (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;
Availability: OpenStep

Initialises and returns a proxy associated with aConnection which will provide a link to a remote object whose reference locally is target.

methodSignatureForSelector: 

- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector;
Availability: OpenStep

Returns the method signature describing the arguments and return types of the method in the object referred to by the receiver which implements the aSelector message.

This method may need to refer to another process (causing relatively slow network communication) and approximately double the time taken for sending a distributed objects message, so you are advised to use the -setProtocolForProxy: method to avoid this occurring.


setProtocolForProxy: 

- (void) setProtocolForProxy: (Protocol*)aProtocol;
Availability: OpenStep

A key method for Distributed Objects performance. This sets the a protocol that the distant object referred to by the proxy should conform to. When messages in that protocol are sent to the proxy, the proxy knows that it does not need to ask the remote object for the method signature in order to send the message to it, but can send the message straight away based on the local method signature information obtained from the protocol.

   if ([anObj isProxy] == YES)
     {
       [anObj setProtocolForProxy: @protocol(MyProtocol)];
     }
 

It is highly recommended that you make use of this facility, but you must beware that versions of the compiler prior to 3.3 suffer a serious bug with respect to the @protocol directive. If the protocol referred to is not declared and implemented in the file where @protocol is used to refer to the protocol by name, a runtime error will occur when you try to use it.

Beware, if you don't use this method to set the protocol, the system might well ask the remote process for method signature information, and the remote process might get it wrong. This is because the class of the remote object needs to have been declared to conform to the protocol in order for it to know about any protocol qualifiers (the keywords bycopy, byref, in, out, inout, and oneway). If the author of the server process forgot to do this, the type information returned from that process may not be what you are expecting.

The class of the server object should be declared like this...

 @interface MyServerClass : NSObject <MyProtocol>
 ...
 @end
 



Instance Variables for NSDistantObject Class

_connection

@public NSConnection* _connection;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_counter

@public unsigned int _counter;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_handle

@public unsigned int _handle;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_object

@public id _object;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_protocol

@public Protocol* _protocol;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_sigs

@public void* _sigs;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.





Up