Up

NSPortCoder class reference

Authors

Andrew Kachites McCallum (mccallum@gnu.ai.mit.edu)

Version: 36510

Date: 2013-04-12 12:06:28 +0100 (Fri, 12 Apr 2013)

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


Contents -

  1. Software documentation for the NSPortCoder class
  2. Software documentation for the NSObject(NSPortCoder) category

Software documentation for the NSPortCoder class

NSPortCoder : NSCoder

Declared in:
Foundation/NSPortCoder.h
Availability: OpenStep

This class is an NSCoder implementation specialized for sending objects over network connections for immediate use (as opposed to the archivers which persist objects for reconstitution after an indefinite term). It is used to help implement the distributed objects framework by the NSConnection class. Even for highly specialized applications, you probably do not need to use this class directly.
Method summary

portCoderWithReceivePort: sendPort: components: 

+ (NSPortCoder*) portCoderWithReceivePort: (NSPort*)recv sendPort: (NSPort*)send components: (NSArray*)comp;
Availability: OpenStep

Create a new instance for communications over send and recv, and send an initial message through send as specified by comp.

connection 

- (NSConnection*) connection;
Availability: OpenStep

Returns the NSConnection using this instance.

decodePortObject 

- (NSPort*) decodePortObject;
Availability: OpenStep

Return port object previously encoded by this instance. Mainly for use by the ports themselves.

dispatch 

- (void) dispatch;
Availability: OpenStep

Processes and acts upon the initial message the receiver was initialized with..

encodePortObject: 

- (void) encodePortObject: (NSPort*)aPort;
Availability: OpenStep

Encodes aPort so it can be sent to the receiving side of the connection. Mainly for use by the ports themselves.

initWithReceivePort: sendPort: components: 

- (id) initWithReceivePort: (NSPort*)recv sendPort: (NSPort*)send components: (NSArray*)comp;
Availability: OpenStep

Initialize a new instance for communications over send and recv, and send an initial message through send as specified by comp.

isBycopy 

- (BOOL) isBycopy;
Availability: OpenStep

Returns YES if receiver is in the process of encoding objects by copying them (rather than substituting a proxy). This method is mainly needed internally and by subclasses.

isByref 

- (BOOL) isByref;
Availability: OpenStep

Returns YES if receiver will substitute a proxy when encoding objects rather than by copying them. This method is mainly needed internally and by subclasses.

Software documentation for the NSObject(NSPortCoder) category

NSObject(NSPortCoder)

Declared in:
Foundation/NSPortCoder.h
Availability: OpenStep

This informal protocol allows an object to control the details of how an object is sent over the wire in distributed objects Port communications.
Method summary

classForPortCoder 

- (Class) classForPortCoder;
Availability: OpenStep

Must return the class that will be created on the remote side of the connection. If the class to be created is not the same as that of the object returned by replacementObjectForPortCoder: then the class must be capable of recognising the object it actually gets in its initWithCoder: method. The default operation is to return NSDistantObject unless the object is being sent bycopy, in which case the objects actual class is returned. To force bycopy operation the object should return its own class.
Override to substitute class when an instance is being serialized by an NSPortCoder . Default implementation returns -classForCoder .

replacementObjectForPortCoder: 

- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder;
Availability: OpenStep

This message is sent to an object about to be encoded for sending over the wire. The default action is to return an NSDistantObject which is a local proxy for the object unless the object is being sent bycopy, in which case the actual object is returned. To force bycopy, an object should return itself.
Returns the actual object to be encoded for sending over the network on a Distributed Objects connection.
The default implementation returns self if the receiver is being sent bycopy and returns a proxy otherwise.
Subclasses may override this method to change this behavior, eg. to ensure that they are always copied.


Up