1 // This file was automatically generated by protocompiler
3 // Compiled from C2Metric.proto
5 #import "SECC2MPMetric.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #import "SECC2MPCloudKitInfo.h"
11 #import "SECC2MPDeviceInfo.h"
12 #import "SECC2MPGenericEvent.h"
13 #import "SECC2MPNetworkEvent.h"
14 #import "SECC2MPServerInfo.h"
16 #if !__has_feature(objc_arc)
17 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
20 @implementation SECC2MPMetric
22 @synthesize metricType = _metricType;
23 - (SECC2MPMetric_Type)metricType
25 return _has.metricType ? _metricType : SECC2MPMetric_Type_none_type;
27 - (void)setMetricType:(SECC2MPMetric_Type)v
29 _has.metricType = YES;
32 - (void)setHasMetricType:(BOOL)f
38 return _has.metricType;
40 - (NSString *)metricTypeAsString:(SECC2MPMetric_Type)value
42 return SECC2MPMetric_TypeAsString(value);
44 - (SECC2MPMetric_Type)StringAsMetricType:(NSString *)str
46 return StringAsSECC2MPMetric_Type(str);
50 return _deviceInfo != nil;
52 @synthesize deviceInfo = _deviceInfo;
53 - (BOOL)hasCloudkitInfo
55 return _cloudkitInfo != nil;
57 @synthesize cloudkitInfo = _cloudkitInfo;
60 return _serverInfo != nil;
62 @synthesize serverInfo = _serverInfo;
63 @synthesize triggers = _triggers;
64 - (void)setTriggers:(uint64_t)v
69 - (void)setHasTriggers:(BOOL)f
77 @synthesize reportFrequency = _reportFrequency;
78 - (void)setReportFrequency:(uint64_t)v
80 _has.reportFrequency = YES;
83 - (void)setHasReportFrequency:(BOOL)f
85 _has.reportFrequency = f;
87 - (BOOL)hasReportFrequency
89 return _has.reportFrequency;
91 @synthesize reportFrequencyBase = _reportFrequencyBase;
92 - (void)setReportFrequencyBase:(uint64_t)v
94 _has.reportFrequencyBase = YES;
95 _reportFrequencyBase = v;
97 - (void)setHasReportFrequencyBase:(BOOL)f
99 _has.reportFrequencyBase = f;
101 - (BOOL)hasReportFrequencyBase
103 return _has.reportFrequencyBase;
105 - (BOOL)hasNetworkEvent
107 return _networkEvent != nil;
109 @synthesize networkEvent = _networkEvent;
110 - (BOOL)hasGenericEvent
112 return _genericEvent != nil;
114 @synthesize genericEvent = _genericEvent;
116 - (NSString *)description
118 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
121 - (NSDictionary *)dictionaryRepresentation
123 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
124 if (self->_has.metricType)
126 [dict setObject:SECC2MPMetric_TypeAsString(self->_metricType) forKey:@"metric_type"];
128 if (self->_deviceInfo)
130 [dict setObject:[_deviceInfo dictionaryRepresentation] forKey:@"device_info"];
132 if (self->_cloudkitInfo)
134 [dict setObject:[_cloudkitInfo dictionaryRepresentation] forKey:@"cloudkit_info"];
136 if (self->_serverInfo)
138 [dict setObject:[_serverInfo dictionaryRepresentation] forKey:@"server_info"];
140 if (self->_has.triggers)
142 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_triggers] forKey:@"triggers"];
144 if (self->_has.reportFrequency)
146 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportFrequency] forKey:@"report_frequency"];
148 if (self->_has.reportFrequencyBase)
150 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportFrequencyBase] forKey:@"report_frequency_base"];
152 if (self->_networkEvent)
154 [dict setObject:[_networkEvent dictionaryRepresentation] forKey:@"network_event"];
156 if (self->_genericEvent)
158 [dict setObject:[_genericEvent dictionaryRepresentation] forKey:@"generic_event"];
163 BOOL SECC2MPMetricReadFrom(__unsafe_unretained SECC2MPMetric *self, __unsafe_unretained PBDataReader *reader) {
164 while (PBReaderHasMoreData(reader)) {
168 PBReaderReadTag32AndType(reader, &tag, &aType);
170 if (PBReaderHasError(reader))
173 if (aType == TYPE_END_GROUP) {
179 case 1 /* metricType */:
181 self->_has.metricType = YES;
182 self->_metricType = PBReaderReadInt32(reader);
185 case 2 /* deviceInfo */:
187 SECC2MPDeviceInfo *new_deviceInfo = [[SECC2MPDeviceInfo alloc] init];
188 self->_deviceInfo = new_deviceInfo;
189 PBDataReaderMark mark_deviceInfo;
190 BOOL markError = !PBReaderPlaceMark(reader, &mark_deviceInfo);
195 BOOL inError = !SECC2MPDeviceInfoReadFrom(new_deviceInfo, reader);
200 PBReaderRecallMark(reader, &mark_deviceInfo);
203 case 3 /* cloudkitInfo */:
205 SECC2MPCloudKitInfo *new_cloudkitInfo = [[SECC2MPCloudKitInfo alloc] init];
206 self->_cloudkitInfo = new_cloudkitInfo;
207 PBDataReaderMark mark_cloudkitInfo;
208 BOOL markError = !PBReaderPlaceMark(reader, &mark_cloudkitInfo);
213 BOOL inError = !SECC2MPCloudKitInfoReadFrom(new_cloudkitInfo, reader);
218 PBReaderRecallMark(reader, &mark_cloudkitInfo);
221 case 4 /* serverInfo */:
223 SECC2MPServerInfo *new_serverInfo = [[SECC2MPServerInfo alloc] init];
224 self->_serverInfo = new_serverInfo;
225 PBDataReaderMark mark_serverInfo;
226 BOOL markError = !PBReaderPlaceMark(reader, &mark_serverInfo);
231 BOOL inError = !SECC2MPServerInfoReadFrom(new_serverInfo, reader);
236 PBReaderRecallMark(reader, &mark_serverInfo);
239 case 100 /* triggers */:
241 self->_has.triggers = YES;
242 self->_triggers = PBReaderReadUint64(reader);
245 case 101 /* reportFrequency */:
247 self->_has.reportFrequency = YES;
248 self->_reportFrequency = PBReaderReadUint64(reader);
251 case 102 /* reportFrequencyBase */:
253 self->_has.reportFrequencyBase = YES;
254 self->_reportFrequencyBase = PBReaderReadUint64(reader);
257 case 200 /* networkEvent */:
259 SECC2MPNetworkEvent *new_networkEvent = [[SECC2MPNetworkEvent alloc] init];
260 self->_networkEvent = new_networkEvent;
261 PBDataReaderMark mark_networkEvent;
262 BOOL markError = !PBReaderPlaceMark(reader, &mark_networkEvent);
267 BOOL inError = !SECC2MPNetworkEventReadFrom(new_networkEvent, reader);
272 PBReaderRecallMark(reader, &mark_networkEvent);
275 case 201 /* genericEvent */:
277 SECC2MPGenericEvent *new_genericEvent = [[SECC2MPGenericEvent alloc] init];
278 self->_genericEvent = new_genericEvent;
279 PBDataReaderMark mark_genericEvent;
280 BOOL markError = !PBReaderPlaceMark(reader, &mark_genericEvent);
285 BOOL inError = !SECC2MPGenericEventReadFrom(new_genericEvent, reader);
290 PBReaderRecallMark(reader, &mark_genericEvent);
294 if (!PBReaderSkipValueWithTag(reader, tag, aType))
299 return !PBReaderHasError(reader);
302 - (BOOL)readFrom:(PBDataReader *)reader
304 return SECC2MPMetricReadFrom(self, reader);
306 - (void)writeTo:(PBDataWriter *)writer
310 if (self->_has.metricType)
312 PBDataWriterWriteInt32Field(writer, self->_metricType, 1);
317 if (self->_deviceInfo != nil)
319 PBDataWriterWriteSubmessage(writer, self->_deviceInfo, 2);
324 if (self->_cloudkitInfo != nil)
326 PBDataWriterWriteSubmessage(writer, self->_cloudkitInfo, 3);
331 if (self->_serverInfo != nil)
333 PBDataWriterWriteSubmessage(writer, self->_serverInfo, 4);
338 if (self->_has.triggers)
340 PBDataWriterWriteUint64Field(writer, self->_triggers, 100);
343 /* reportFrequency */
345 if (self->_has.reportFrequency)
347 PBDataWriterWriteUint64Field(writer, self->_reportFrequency, 101);
350 /* reportFrequencyBase */
352 if (self->_has.reportFrequencyBase)
354 PBDataWriterWriteUint64Field(writer, self->_reportFrequencyBase, 102);
359 if (self->_networkEvent != nil)
361 PBDataWriterWriteSubmessage(writer, self->_networkEvent, 200);
366 if (self->_genericEvent != nil)
368 PBDataWriterWriteSubmessage(writer, self->_genericEvent, 201);
373 - (void)copyTo:(SECC2MPMetric *)other
375 if (self->_has.metricType)
377 other->_metricType = _metricType;
378 other->_has.metricType = YES;
382 other.deviceInfo = _deviceInfo;
386 other.cloudkitInfo = _cloudkitInfo;
390 other.serverInfo = _serverInfo;
392 if (self->_has.triggers)
394 other->_triggers = _triggers;
395 other->_has.triggers = YES;
397 if (self->_has.reportFrequency)
399 other->_reportFrequency = _reportFrequency;
400 other->_has.reportFrequency = YES;
402 if (self->_has.reportFrequencyBase)
404 other->_reportFrequencyBase = _reportFrequencyBase;
405 other->_has.reportFrequencyBase = YES;
409 other.networkEvent = _networkEvent;
413 other.genericEvent = _genericEvent;
417 - (id)copyWithZone:(NSZone *)zone
419 SECC2MPMetric *copy = [[[self class] allocWithZone:zone] init];
420 if (self->_has.metricType)
422 copy->_metricType = _metricType;
423 copy->_has.metricType = YES;
425 copy->_deviceInfo = [_deviceInfo copyWithZone:zone];
426 copy->_cloudkitInfo = [_cloudkitInfo copyWithZone:zone];
427 copy->_serverInfo = [_serverInfo copyWithZone:zone];
428 if (self->_has.triggers)
430 copy->_triggers = _triggers;
431 copy->_has.triggers = YES;
433 if (self->_has.reportFrequency)
435 copy->_reportFrequency = _reportFrequency;
436 copy->_has.reportFrequency = YES;
438 if (self->_has.reportFrequencyBase)
440 copy->_reportFrequencyBase = _reportFrequencyBase;
441 copy->_has.reportFrequencyBase = YES;
443 copy->_networkEvent = [_networkEvent copyWithZone:zone];
444 copy->_genericEvent = [_genericEvent copyWithZone:zone];
448 - (BOOL)isEqual:(id)object
450 SECC2MPMetric *other = (SECC2MPMetric *)object;
451 return [other isMemberOfClass:[self class]]
453 ((self->_has.metricType && other->_has.metricType && self->_metricType == other->_metricType) || (!self->_has.metricType && !other->_has.metricType))
455 ((!self->_deviceInfo && !other->_deviceInfo) || [self->_deviceInfo isEqual:other->_deviceInfo])
457 ((!self->_cloudkitInfo && !other->_cloudkitInfo) || [self->_cloudkitInfo isEqual:other->_cloudkitInfo])
459 ((!self->_serverInfo && !other->_serverInfo) || [self->_serverInfo isEqual:other->_serverInfo])
461 ((self->_has.triggers && other->_has.triggers && self->_triggers == other->_triggers) || (!self->_has.triggers && !other->_has.triggers))
463 ((self->_has.reportFrequency && other->_has.reportFrequency && self->_reportFrequency == other->_reportFrequency) || (!self->_has.reportFrequency && !other->_has.reportFrequency))
465 ((self->_has.reportFrequencyBase && other->_has.reportFrequencyBase && self->_reportFrequencyBase == other->_reportFrequencyBase) || (!self->_has.reportFrequencyBase && !other->_has.reportFrequencyBase))
467 ((!self->_networkEvent && !other->_networkEvent) || [self->_networkEvent isEqual:other->_networkEvent])
469 ((!self->_genericEvent && !other->_genericEvent) || [self->_genericEvent isEqual:other->_genericEvent])
477 (self->_has.metricType ? PBHashInt((NSUInteger)self->_metricType) : 0)
479 [self->_deviceInfo hash]
481 [self->_cloudkitInfo hash]
483 [self->_serverInfo hash]
485 (self->_has.triggers ? PBHashInt((NSUInteger)self->_triggers) : 0)
487 (self->_has.reportFrequency ? PBHashInt((NSUInteger)self->_reportFrequency) : 0)
489 (self->_has.reportFrequencyBase ? PBHashInt((NSUInteger)self->_reportFrequencyBase) : 0)
491 [self->_networkEvent hash]
493 [self->_genericEvent hash]
497 - (void)mergeFrom:(SECC2MPMetric *)other
499 if (other->_has.metricType)
501 self->_metricType = other->_metricType;
502 self->_has.metricType = YES;
504 if (self->_deviceInfo && other->_deviceInfo)
506 [self->_deviceInfo mergeFrom:other->_deviceInfo];
508 else if (!self->_deviceInfo && other->_deviceInfo)
510 [self setDeviceInfo:other->_deviceInfo];
512 if (self->_cloudkitInfo && other->_cloudkitInfo)
514 [self->_cloudkitInfo mergeFrom:other->_cloudkitInfo];
516 else if (!self->_cloudkitInfo && other->_cloudkitInfo)
518 [self setCloudkitInfo:other->_cloudkitInfo];
520 if (self->_serverInfo && other->_serverInfo)
522 [self->_serverInfo mergeFrom:other->_serverInfo];
524 else if (!self->_serverInfo && other->_serverInfo)
526 [self setServerInfo:other->_serverInfo];
528 if (other->_has.triggers)
530 self->_triggers = other->_triggers;
531 self->_has.triggers = YES;
533 if (other->_has.reportFrequency)
535 self->_reportFrequency = other->_reportFrequency;
536 self->_has.reportFrequency = YES;
538 if (other->_has.reportFrequencyBase)
540 self->_reportFrequencyBase = other->_reportFrequencyBase;
541 self->_has.reportFrequencyBase = YES;
543 if (self->_networkEvent && other->_networkEvent)
545 [self->_networkEvent mergeFrom:other->_networkEvent];
547 else if (!self->_networkEvent && other->_networkEvent)
549 [self setNetworkEvent:other->_networkEvent];
551 if (self->_genericEvent && other->_genericEvent)
553 [self->_genericEvent mergeFrom:other->_genericEvent];
555 else if (!self->_genericEvent && other->_genericEvent)
557 [self setGenericEvent:other->_genericEvent];