Luky/Comm/LLDOReceiver.m

00001 //
00002 //  LLDOReceiver.m
00003 //  MacTrek
00004 //
00005 //  Created by Aqua on 27/04/2006.
00006 //  Copyright 2006 Luky Soft. All rights reserved.
00007 //
00008 
00009 #import "LLDOReceiver.h"
00010 
00011 
00012 @implementation LLDOReceiver
00013 
00014 NSConnection *theConnection;
00015 
00016 - (id) init {
00017     self = [super init];
00018     if (self != nil) {
00019         target = nil;
00020         selector = nil;
00021         theConnection = [NSConnection defaultConnection];
00022         [theConnection setRootObject:self];
00023         // we are the receiver, thus objects can call us.
00024         // to do this, we register as a server DO object
00025         if ([theConnection registerName:@"LLDOServer"] == NO) {
00026                 NSLog(@"LLDOReceiver.init failed, cannot obtain the default connection for this thread ");
00027                 theConnection = nil;
00028                 return nil;
00029         }
00030         // nothing more to do,
00031         // the sender will declare a protocol and try to use it.
00032         // we support only the LLDOProxy Protocol.
00033     }
00034     return self;
00035 }
00036 
00037 - (void) setTarget:(id)newTarget withSelector:(SEL)newSelector {
00038         target = newTarget;
00039         selector = newSelector;
00040 }
00041 
00042 - (void) invokeWithUserData:(id)data {
00043         if ((target != nil) && (selector != nil)) {
00044                 //NSLog(@"LLDOReceiver.invokeWithUserData called");
00045         [target performSelector:selector withObject:data];
00046         } else {
00047                 NSLog(@"LLDOReceiver.invokeWithUserData called but have no target or selector");
00048         }
00049 }
00050 
00051 @end

Generated on Sat Aug 26 21:14:15 2006 for MacTrek by  doxygen 1.4.7