#import "Activator.h"

/*
    may be able to use _Generic to send activate message
    only to objects that implement Receiver protocol,
    Activator protocol, or has an activate method.
*/

@implementation Activator

//send activate message to receivers
-(void) activate {

    int i = 0;

    //Objective-C 1.0 does not support fast enumeration
    for (i; i < receivers->count; i++) {
        [receivers->array[i] activate];
    }
}

//register a receiver
-(void) registerObject: (id) receiver {
    [receivers addObject: receiver];
}

@end