Re: Problems with Distributed Objects
Re: Problems with Distributed Objects
- Subject: Re: Problems with Distributed Objects
- From: Philippe Mougin <email@hidden>
- Date: Thu, 26 Feb 2004 18:02:03 +0100
Am 26.02.2004 um 15:44 schrieb Philippe Mougin:
>
> Have you implemented the replacementObjectForPortCoder: method as
>
> described at
>
>
http://developer.apple.com/documentation/Cocoa/Conceptual/DistrObjects/
>
> index.html ?
>
>
No.
>
>
I don't want to "allow an object to encode itself as an instance of
>
another class or to replace another object for itself". So how would
>
that help?
It would allow you to prevent your object to substitute an
NSDistantObject to itself as it does now (since this the default
implementation provided at the NSObject level).
According to the doc:
"The generic replacementObjectForCoder: method offers a standard way to
substitute a different instance at encoding time.
replacementObjectForPortCoder: specifically allows for the substitution
of proxies over a distributed objects connection. The receiver of a
replacementObjectForPortCoder: message can ask the NSPortCoder whether
it should be encoded bycopy or not, and return itself or a proxy as
appropriate. NSObjects implementation always returns a proxy, so
subclasses that allow bycopy encoding should override
replacementObjectForPortCoder: to perform at least as this sample does:
- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
{
if ([encoder isBycopy]) return self;
return [super replacementObjectForPortCoder:encoder];
}
If the NSPortCoder returns YES when sent an isBycopy message, this
example method returns self, which results in the receiver being sent
an encodeWithCoder: message. If the NSPortCoder returns NO, this method
invokes the superclasss implementation, which typically returns an
NSDistantObject."
Best,
Philippe Mougin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.