/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ /** * @generated by Thrift */ #import #import #import #import #import #import #import #import #import #import #import "module.h" #import "includes.h" #import "service.h" @interface query_args : TBaseStruct { MyStruct * __thrift_s; Included * __thrift_i; BOOL __thrift_s_set; BOOL __thrift_i_set; } @property (nonatomic, retain) MyStruct * s; @property (nonatomic, retain) Included * i; - (id) init NS_DESIGNATED_INITIALIZER; - (id) initWithCoder:(NSCoder *)decoder NS_DESIGNATED_INITIALIZER; - (id) initWithS: (MyStruct *) s i: (Included *) i NS_DESIGNATED_INITIALIZER; - (void) read: (id ) inProtocol; - (void) write: (id ) outProtocol; - (void) validate; - (NSDictionary *) toDict; - (BOOL) sIsSet; - (BOOL) iIsSet; @end @implementation query_args - (instancetype) init { self = [super init]; return self; } - (id) initWithS: (MyStruct *) s i: (Included *) i { self = [super init]; __thrift_s = s; __thrift_s_set = YES; __thrift_i = i; __thrift_i_set = YES; return self; } - (id) initWithCoder: (NSCoder *) decoder { self = [super init]; if ([decoder containsValueForKey: @"s"]) { __thrift_s = [[decoder decodeObjectForKey: @"s"] retain_stub]; __thrift_s_set = YES; } if ([decoder containsValueForKey: @"i"]) { __thrift_i = [[decoder decodeObjectForKey: @"i"] retain_stub]; __thrift_i_set = YES; } return self; } - (void) encodeWithCoder: (NSCoder *) encoder { if (__thrift_s_set) { [encoder encodeObject: __thrift_s forKey: @"s"]; } if (__thrift_i_set) { [encoder encodeObject: __thrift_i forKey: @"i"]; } } - (MyStruct *) s { return __thrift_s; } - (void) setS: (MyStruct *) s { [self throwExceptionIfImmutable]; __thrift_s = s; __thrift_s_set = YES; } - (BOOL) sIsSet { return __thrift_s_set; } - (void) unsetS { __thrift_s = nil; __thrift_s_set = NO; } - (Included *) i { return __thrift_i; } - (void) setI: (Included *) i { [self throwExceptionIfImmutable]; __thrift_i = i; __thrift_i_set = YES; } - (BOOL) iIsSet { return __thrift_i_set; } - (void) unsetI { __thrift_i = nil; __thrift_i_set = NO; } - (void) read: (id ) inProtocol { NSString * fieldName; int fieldType; int fieldID; [inProtocol readStructBeginReturningName: NULL]; while (true) { [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID]; if (fieldType == TType_STOP) { break; } switch (fieldID) { case 1: if (fieldType == TType_STRUCT) { MyStruct *fieldValue = [[MyStruct alloc] init]; [fieldValue read: inProtocol]; [self setS: fieldValue]; [fieldValue release_stub]; } else { [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; } break; case 2: if (fieldType == TType_STRUCT) { Included *fieldValue = [[Included alloc] init]; [fieldValue read: inProtocol]; [self setI: fieldValue]; [fieldValue release_stub]; } else { [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; } break; default: [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; break; } [inProtocol readFieldEnd]; } [inProtocol readStructEnd]; } - (void) write: (id ) outProtocol { [outProtocol writeStructBeginWithName: @"query_args"]; if (__thrift_s_set) { if (__thrift_s != nil) { [outProtocol writeFieldBeginWithName: @"s" type: TType_STRUCT fieldID: 1]; [__thrift_s write: outProtocol]; [outProtocol writeFieldEnd]; } } if (__thrift_i_set) { if (__thrift_i != nil) { [outProtocol writeFieldBeginWithName: @"i" type: TType_STRUCT fieldID: 2]; [__thrift_i write: outProtocol]; [outProtocol writeFieldEnd]; } } [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; } - (void) validate { // check for required fields } - (NSString *) description { return [[self toDict] description]; } - (NSDictionary *) toDict { NSMutableDictionary *ret = [NSMutableDictionary dictionary]; ret[@"__thrift_struct_name"] = @"query_args"; if (__thrift_s) { ret[@"s"] = [__thrift_s toDict]; } if (__thrift_i) { ret[@"i"] = [__thrift_i toDict]; } return [ret copy]; } - (BOOL) makeImmutable { const BOOL wasImmutable = [self isImmutable]; if (!wasImmutable) { if (__thrift_s && ![__thrift_s isImmutable]) { [__thrift_s makeImmutable]; } if (__thrift_i && ![__thrift_i isImmutable]) { [__thrift_i makeImmutable]; } [super makeImmutable]; } return YES; } - (id) mutableCopyWithZone:(NSZone *)zone { query_args *newCopy = [[[self class] alloc] init];; if (__thrift_s) { newCopy->__thrift_s = [self->__thrift_s mutableCopyWithZone:zone]; } newCopy->__thrift_s_set = self->__thrift_s_set; if (__thrift_i) { newCopy->__thrift_i = [self->__thrift_i mutableCopyWithZone:zone]; } newCopy->__thrift_i_set = self->__thrift_i_set; return newCopy; } @end @interface Query_result : TBaseStruct { } - (id) init NS_DESIGNATED_INITIALIZER; - (id) initWithCoder:(NSCoder *)decoder NS_DESIGNATED_INITIALIZER; - (void) read: (id ) inProtocol; - (void) write: (id ) outProtocol; - (void) validate; - (NSDictionary *) toDict; @end @implementation Query_result - (instancetype) init { self = [super init]; return self; } - (id) initWithCoder: (NSCoder *) decoder { self = [super init]; return self; } - (void) encodeWithCoder: (NSCoder *) encoder { } - (void) read: (id ) inProtocol { NSString * fieldName; int fieldType; int fieldID; [inProtocol readStructBeginReturningName: NULL]; while (true) { [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID]; if (fieldType == TType_STOP) { break; } switch (fieldID) { default: [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; break; } [inProtocol readFieldEnd]; } [inProtocol readStructEnd]; } - (void) write: (id ) outProtocol { [outProtocol writeStructBeginWithName: @"Query_result"]; [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; } - (void) validate { // check for required fields } - (NSString *) description { return [[self toDict] description]; } - (NSDictionary *) toDict { NSMutableDictionary *ret = [NSMutableDictionary dictionary]; ret[@"__thrift_struct_name"] = @"Query_result"; return [ret copy]; } - (BOOL) makeImmutable { const BOOL wasImmutable = [self isImmutable]; if (!wasImmutable) { [super makeImmutable]; } return YES; } - (id) mutableCopyWithZone:(NSZone *)zone { Query_result *newCopy = [[[self class] alloc] init];; return newCopy; } @end @interface has_arg_docs_args : TBaseStruct { MyStruct * __thrift_s; Included * __thrift_i; BOOL __thrift_s_set; BOOL __thrift_i_set; } @property (nonatomic, retain) MyStruct * s; @property (nonatomic, retain) Included * i; - (id) init NS_DESIGNATED_INITIALIZER; - (id) initWithCoder:(NSCoder *)decoder NS_DESIGNATED_INITIALIZER; - (id) initWithS: (MyStruct *) s i: (Included *) i NS_DESIGNATED_INITIALIZER; - (void) read: (id ) inProtocol; - (void) write: (id ) outProtocol; - (void) validate; - (NSDictionary *) toDict; - (BOOL) sIsSet; - (BOOL) iIsSet; @end @implementation has_arg_docs_args - (instancetype) init { self = [super init]; return self; } - (id) initWithS: (MyStruct *) s i: (Included *) i { self = [super init]; __thrift_s = s; __thrift_s_set = YES; __thrift_i = i; __thrift_i_set = YES; return self; } - (id) initWithCoder: (NSCoder *) decoder { self = [super init]; if ([decoder containsValueForKey: @"s"]) { __thrift_s = [[decoder decodeObjectForKey: @"s"] retain_stub]; __thrift_s_set = YES; } if ([decoder containsValueForKey: @"i"]) { __thrift_i = [[decoder decodeObjectForKey: @"i"] retain_stub]; __thrift_i_set = YES; } return self; } - (void) encodeWithCoder: (NSCoder *) encoder { if (__thrift_s_set) { [encoder encodeObject: __thrift_s forKey: @"s"]; } if (__thrift_i_set) { [encoder encodeObject: __thrift_i forKey: @"i"]; } } - (MyStruct *) s { return __thrift_s; } - (void) setS: (MyStruct *) s { [self throwExceptionIfImmutable]; __thrift_s = s; __thrift_s_set = YES; } - (BOOL) sIsSet { return __thrift_s_set; } - (void) unsetS { __thrift_s = nil; __thrift_s_set = NO; } - (Included *) i { return __thrift_i; } - (void) setI: (Included *) i { [self throwExceptionIfImmutable]; __thrift_i = i; __thrift_i_set = YES; } - (BOOL) iIsSet { return __thrift_i_set; } - (void) unsetI { __thrift_i = nil; __thrift_i_set = NO; } - (void) read: (id ) inProtocol { NSString * fieldName; int fieldType; int fieldID; [inProtocol readStructBeginReturningName: NULL]; while (true) { [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID]; if (fieldType == TType_STOP) { break; } switch (fieldID) { case 1: if (fieldType == TType_STRUCT) { MyStruct *fieldValue = [[MyStruct alloc] init]; [fieldValue read: inProtocol]; [self setS: fieldValue]; [fieldValue release_stub]; } else { [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; } break; case 2: if (fieldType == TType_STRUCT) { Included *fieldValue = [[Included alloc] init]; [fieldValue read: inProtocol]; [self setI: fieldValue]; [fieldValue release_stub]; } else { [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; } break; default: [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; break; } [inProtocol readFieldEnd]; } [inProtocol readStructEnd]; } - (void) write: (id ) outProtocol { [outProtocol writeStructBeginWithName: @"has_arg_docs_args"]; if (__thrift_s_set) { if (__thrift_s != nil) { [outProtocol writeFieldBeginWithName: @"s" type: TType_STRUCT fieldID: 1]; [__thrift_s write: outProtocol]; [outProtocol writeFieldEnd]; } } if (__thrift_i_set) { if (__thrift_i != nil) { [outProtocol writeFieldBeginWithName: @"i" type: TType_STRUCT fieldID: 2]; [__thrift_i write: outProtocol]; [outProtocol writeFieldEnd]; } } [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; } - (void) validate { // check for required fields } - (NSString *) description { return [[self toDict] description]; } - (NSDictionary *) toDict { NSMutableDictionary *ret = [NSMutableDictionary dictionary]; ret[@"__thrift_struct_name"] = @"has_arg_docs_args"; if (__thrift_s) { ret[@"s"] = [__thrift_s toDict]; } if (__thrift_i) { ret[@"i"] = [__thrift_i toDict]; } return [ret copy]; } - (BOOL) makeImmutable { const BOOL wasImmutable = [self isImmutable]; if (!wasImmutable) { if (__thrift_s && ![__thrift_s isImmutable]) { [__thrift_s makeImmutable]; } if (__thrift_i && ![__thrift_i isImmutable]) { [__thrift_i makeImmutable]; } [super makeImmutable]; } return YES; } - (id) mutableCopyWithZone:(NSZone *)zone { has_arg_docs_args *newCopy = [[[self class] alloc] init];; if (__thrift_s) { newCopy->__thrift_s = [self->__thrift_s mutableCopyWithZone:zone]; } newCopy->__thrift_s_set = self->__thrift_s_set; if (__thrift_i) { newCopy->__thrift_i = [self->__thrift_i mutableCopyWithZone:zone]; } newCopy->__thrift_i_set = self->__thrift_i_set; return newCopy; } @end @interface Has_arg_docs_result : TBaseStruct { } - (id) init NS_DESIGNATED_INITIALIZER; - (id) initWithCoder:(NSCoder *)decoder NS_DESIGNATED_INITIALIZER; - (void) read: (id ) inProtocol; - (void) write: (id ) outProtocol; - (void) validate; - (NSDictionary *) toDict; @end @implementation Has_arg_docs_result - (instancetype) init { self = [super init]; return self; } - (id) initWithCoder: (NSCoder *) decoder { self = [super init]; return self; } - (void) encodeWithCoder: (NSCoder *) encoder { } - (void) read: (id ) inProtocol { NSString * fieldName; int fieldType; int fieldID; [inProtocol readStructBeginReturningName: NULL]; while (true) { [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID]; if (fieldType == TType_STOP) { break; } switch (fieldID) { default: [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; break; } [inProtocol readFieldEnd]; } [inProtocol readStructEnd]; } - (void) write: (id ) outProtocol { [outProtocol writeStructBeginWithName: @"Has_arg_docs_result"]; [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; } - (void) validate { // check for required fields } - (NSString *) description { return [[self toDict] description]; } - (NSDictionary *) toDict { NSMutableDictionary *ret = [NSMutableDictionary dictionary]; ret[@"__thrift_struct_name"] = @"Has_arg_docs_result"; return [ret copy]; } - (BOOL) makeImmutable { const BOOL wasImmutable = [self isImmutable]; if (!wasImmutable) { [super makeImmutable]; } return YES; } - (id) mutableCopyWithZone:(NSZone *)zone { Has_arg_docs_result *newCopy = [[[self class] alloc] init];; return newCopy; } @end @implementation MyServiceClient - (id) initWithProtocol: (id ) protocol { return [self initWithInProtocol: protocol outProtocol: protocol]; } - (id) initWithInProtocol: (id ) anInProtocol outProtocol: (id ) anOutProtocol { self = [super init]; inProtocol = [anInProtocol retain_stub]; outProtocol = [anOutProtocol retain_stub]; return self; } - (void) dealloc { [inProtocol release_stub]; [outProtocol release_stub]; [super dealloc_stub]; } - (void) send_query: (MyStruct *) s i: (Included *) i { [outProtocol writeMessageBeginWithName: @"query" type: TMessageType_CALL sequenceID: 0]; [outProtocol writeStructBeginWithName: @"query_args"]; if (s != nil) { [outProtocol writeFieldBeginWithName: @"s" type: TType_STRUCT fieldID: 1]; [s write: outProtocol]; [outProtocol writeFieldEnd]; } if (i != nil) { [outProtocol writeFieldBeginWithName: @"i" type: TType_STRUCT fieldID: 2]; [i write: outProtocol]; [outProtocol writeFieldEnd]; } [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; [outProtocol writeMessageEnd]; [[outProtocol transport] flush]; } - (void) recv_query { int msgType = 0; [inProtocol readMessageBeginReturningName: nil type: &msgType sequenceID: NULL]; if (msgType == TMessageType_EXCEPTION) { TApplicationException * x = [TApplicationException read: inProtocol]; [inProtocol readMessageEnd]; @throw x; } Query_result * result = [[[Query_result alloc] init] autorelease_stub]; [result read: inProtocol]; [inProtocol readMessageEnd]; return; } - (void) query: (MyStruct *) s i: (Included *) i { [self send_query : s i: i]; [self recv_query]; } - (void) send_has_arg_docs: (MyStruct *) s i: (Included *) i { [outProtocol writeMessageBeginWithName: @"has_arg_docs" type: TMessageType_CALL sequenceID: 0]; [outProtocol writeStructBeginWithName: @"has_arg_docs_args"]; if (s != nil) { [outProtocol writeFieldBeginWithName: @"s" type: TType_STRUCT fieldID: 1]; [s write: outProtocol]; [outProtocol writeFieldEnd]; } if (i != nil) { [outProtocol writeFieldBeginWithName: @"i" type: TType_STRUCT fieldID: 2]; [i write: outProtocol]; [outProtocol writeFieldEnd]; } [outProtocol writeFieldStop]; [outProtocol writeStructEnd]; [outProtocol writeMessageEnd]; [[outProtocol transport] flush]; } - (void) recv_has_arg_docs { int msgType = 0; [inProtocol readMessageBeginReturningName: nil type: &msgType sequenceID: NULL]; if (msgType == TMessageType_EXCEPTION) { TApplicationException * x = [TApplicationException read: inProtocol]; [inProtocol readMessageEnd]; @throw x; } Has_arg_docs_result * result = [[[Has_arg_docs_result alloc] init] autorelease_stub]; [result read: inProtocol]; [inProtocol readMessageEnd]; return; } - (void) has_arg_docs: (MyStruct *) s i: (Included *) i { [self send_has_arg_docs : s i: i]; [self recv_has_arg_docs]; } @end @implementation MyServiceProcessor - (id) initWithMyService: (id ) service { self = [super init]; if (!self) { return nil; } { SEL s = @selector(process_query_withSequenceID:inProtocol:outProtocol:); NSMethodSignature * sig = [self methodSignatureForSelector: s]; NSInvocation * invocation = [NSInvocation invocationWithMethodSignature: sig]; [invocation setSelector: s]; [invocation retainArguments]; [mMethodMap setValue: invocation forKey: @"query"]; } { SEL s = @selector(process_has_arg_docs_withSequenceID:inProtocol:outProtocol:); NSMethodSignature * sig = [self methodSignatureForSelector: s]; NSInvocation * invocation = [NSInvocation invocationWithMethodSignature: sig]; [invocation setSelector: s]; [invocation retainArguments]; [mMethodMap setValue: invocation forKey: @"has_arg_docs"]; } return self; } - (id) service { return [[mService retain_stub] autorelease_stub]; } - (BOOL) processOnInputProtocol: (id ) inProtocol outputProtocol: (id ) outProtocol { NSString * messageName; int messageType; int seqID; [inProtocol readMessageBeginReturningName: &messageName type: &messageType sequenceID: &seqID]; NSInvocation * invocation = [mMethodMap valueForKey: messageName]; if (invocation == nil) { [TProtocolUtil skipType: TType_STRUCT onProtocol: inProtocol]; [inProtocol readMessageEnd]; TApplicationException * x = [TApplicationException exceptionWithType: TApplicationException_UNKNOWN_METHOD reason: [NSString stringWithFormat: @"Invalid method name: '%@'", messageName]]; [outProtocol writeMessageBeginWithName: messageName type: TMessageType_EXCEPTION sequenceID: seqID]; [x write: outProtocol]; [outProtocol writeMessageEnd]; [[outProtocol transport] flush]; return YES; } // NSInvocation does not conform to NSCopying protocol NSInvocation * i = [NSInvocation invocationWithMethodSignature: [invocation methodSignature]]; [i setSelector: [invocation selector]]; [i setArgument: &seqID atIndex: 2]; [i setArgument: &inProtocol atIndex: 3]; [i setArgument: &outProtocol atIndex: 4]; [i setTarget: self]; [i invoke]; return YES; } - (void) process_query_withSequenceID: (int32_t) seqID inProtocol: (id) inProtocol outProtocol: (id) outProtocol { query_args * args = [[query_args alloc] init]; [args read: inProtocol]; [inProtocol readMessageEnd]; Query_result * result = [[Query_result alloc] init]; [mService query: [args s] i: [args i]]; [outProtocol writeMessageBeginWithName: @"query" type: TMessageType_REPLY sequenceID: seqID]; [result write: outProtocol]; [outProtocol writeMessageEnd]; [[outProtocol transport] flush]; [result release_stub]; [args release_stub]; } - (void) process_has_arg_docs_withSequenceID: (int32_t) seqID inProtocol: (id) inProtocol outProtocol: (id) outProtocol { has_arg_docs_args * args = [[has_arg_docs_args alloc] init]; [args read: inProtocol]; [inProtocol readMessageEnd]; Has_arg_docs_result * result = [[Has_arg_docs_result alloc] init]; [mService has_arg_docs: [args s] i: [args i]]; [outProtocol writeMessageBeginWithName: @"has_arg_docs" type: TMessageType_REPLY sequenceID: seqID]; [result write: outProtocol]; [outProtocol writeMessageEnd]; [[outProtocol transport] flush]; [result release_stub]; [args release_stub]; } - (void) dealloc { [mService release_stub]; [mMethodMap release_stub]; [super dealloc_stub]; } @end