OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #import "RTCMetricsSampleInfo+Private.h" |
| 12 |
| 13 #import "NSString+StdString.h" |
| 14 |
| 15 @implementation RTCMetricsSampleInfo |
| 16 |
| 17 @synthesize name = _name; |
| 18 @synthesize min = _min; |
| 19 @synthesize max = _max; |
| 20 @synthesize bucketCount = _bucketCount; |
| 21 @synthesize samples = _samples; |
| 22 |
| 23 #pragma mark - Private |
| 24 |
| 25 - (instancetype)initWithNativeSampleInfo: |
| 26 (const webrtc::metrics::SampleInfo &)info { |
| 27 if (self = [super init]) { |
| 28 _name = [NSString stringForStdString:info.name]; |
| 29 _min = info.min; |
| 30 _max = info.max; |
| 31 _bucketCount = info.bucket_count; |
| 32 |
| 33 NSMutableDictionary *samples = |
| 34 [NSMutableDictionary dictionaryWithCapacity:info.samples.size()]; |
| 35 for (auto const &sample : info.samples) { |
| 36 [samples setObject:@(sample.second) forKey:@(sample.first)]; |
| 37 } |
| 38 _samples = samples; |
| 39 } |
| 40 return self; |
| 41 } |
| 42 |
| 43 @end |
OLD | NEW |