main
1//
2// KWFutureObject.m
3// iOSFalconCore
4//
5// Created by Luke Redpath on 13/01/2011.
6// Copyright 2011 LJR Software Limited. All rights reserved.
7//
8
9#import "KWFutureObject.h"
10
11
12@implementation KWFutureObject
13
14+ (id)objectWithObjectPointer:(id *)pointer;
15{
16 return [self futureObjectWithBlock:^{ return *pointer; }];
17}
18
19+ (id)futureObjectWithBlock:(KWFutureObjectBlock)block;
20{
21 return [[[self alloc] initWithBlock:block] autorelease];
22}
23
24- (id)initWithBlock:(KWFutureObjectBlock)aBlock;
25{
26 if ((self = [super init])) {
27 block = [aBlock copy];
28 }
29 return self;
30}
31
32- (id)object;
33{
34 return block();
35}
36
37- (void)dealloc
38{
39 [block release];
40 [super dealloc];
41}
42
43@end