diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2010-04-17 19:37:03 +0400 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2010-04-17 19:37:03 +0400 |
commit | 4481edb713c780ef6969764083aa4f842e40d58f (patch) | |
tree | 7f243b4f2b60db5ae206d5841cdab6b87ed32a61 /src/MulticastDelegate.h | |
parent | f6d1a38392e8c27dd8105a1d07f415923f76a0f0 (diff) |
Implement more MKMessageHandler methods in MKServerModel, also add multicast delegation.
Diffstat (limited to 'src/MulticastDelegate.h')
-rw-r--r-- | src/MulticastDelegate.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/MulticastDelegate.h b/src/MulticastDelegate.h new file mode 100644 index 0000000..67dea4c --- /dev/null +++ b/src/MulticastDelegate.h @@ -0,0 +1,69 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2007, Deusty Designs, LLC + * All rights reserved. + * + * Redistribution and use of this software in source and binary forms, + * with or without modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * Neither the name of Desuty Designs nor the names of its + * contributors may be used to endorse or promote products + * derived from this software without specific prior + * written permission of Deusty Designs, LLC. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@class MulticastDelegateEnumerator; + +struct MulticastDelegateListNode { + id delegate; + struct MulticastDelegateListNode * prev; + struct MulticastDelegateListNode * next; + NSUInteger retainCount; +}; +typedef struct MulticastDelegateListNode MulticastDelegateListNode; + + +@interface MulticastDelegate : NSObject +{ + MulticastDelegateListNode *delegateList; +} + +- (void)addDelegate:(id)delegate; +- (void)removeDelegate:(id)delegate; + +- (void)removeAllDelegates; + +- (NSUInteger)count; + +- (MulticastDelegateEnumerator *)delegateEnumerator; + +@end + +@interface MulticastDelegateEnumerator : NSObject +{ + NSUInteger numDelegates; + NSUInteger currentDelegateIndex; + MulticastDelegateListNode **delegates; +} + +- (id)nextDelegate; +- (id)nextDelegateOfClass:(Class)aClass; +- (id)nextDelegateForSelector:(SEL)aSelector; + +@end |