Cocoa Port:

- Add new IPC utility method - messageSendOneWayWithMessageComponents:msgID:array:
This commit is contained in:
rogerman 2012-01-19 04:45:37 +00:00
parent 46958e2bb5
commit 67aabb5fbc
2 changed files with 10 additions and 4 deletions

View File

@ -29,6 +29,7 @@
}
+ (void) messageSendOneWay:(NSPort *)sendPort msgID:(NSInteger)msgID;
+ (void) messageSendOneWayWithMessageComponents:(NSPort *)sendPort msgID:(NSInteger)msgID array:(NSArray *)msgDataArray;
+ (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData;
+ (void) messageSendOneWayWithInteger:(NSPort *)sendPort msgID:(NSInteger)msgID integerValue:(NSInteger)integerValue;
+ (void) messageSendOneWayWithFloat:(NSPort *)sendPort msgID:(NSInteger)msgID floatValue:(float)floatValue;

View File

@ -37,18 +37,23 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
[message release];
}
+ (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData
+ (void) messageSendOneWayWithMessageComponents:(NSPort *)sendPort msgID:(NSInteger)msgID array:(NSArray *)msgDataArray
{
NSArray *messageComponents = [[NSArray alloc] initWithObjects:msgData, nil];
NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:messageComponents];
NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:msgDataArray];
[message setMsgid:msgID];
NSDate *sendDate = [[NSDate alloc] init];
[message sendBeforeDate:distantFutureDate];
[sendDate release];
[messageComponents release];
[message release];
}
+ (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData
{
NSArray *messageComponents = [[NSArray alloc] initWithObjects:msgData, nil];
[CocoaDSUtil messageSendOneWayWithMessageComponents:sendPort msgID:msgID array:messageComponents];
[messageComponents release];
}
+ (void) messageSendOneWayWithInteger:(NSPort *)sendPort msgID:(NSInteger)msgID integerValue:(NSInteger)integerValue
{
NSData *messageData = [[NSData alloc] initWithBytes:&integerValue length:sizeof(NSInteger)];