OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 106 matching lines...) Loading... | |
117 } | 117 } |
118 | 118 |
119 template <typename U = T, | 119 template <typename U = T, |
120 typename std::enable_if< | 120 typename std::enable_if< |
121 internal::BufferCompat<T, U>::value>::type* = nullptr> | 121 internal::BufferCompat<T, U>::value>::type* = nullptr> |
122 U* data() { | 122 U* data() { |
123 RTC_DCHECK(IsConsistent()); | 123 RTC_DCHECK(IsConsistent()); |
124 return reinterpret_cast<U*>(data_.get()); | 124 return reinterpret_cast<U*>(data_.get()); |
125 } | 125 } |
126 | 126 |
127 bool empty() const { return size_ == 0; } | |
kwiberg-webrtc
2016/08/30 15:34:12
Since I'm paranoid, I'd like to see an
RTC_DCHE
ossu
2016/08/30 15:45:55
Done.
| |
128 | |
127 size_t size() const { | 129 size_t size() const { |
128 RTC_DCHECK(IsConsistent()); | 130 RTC_DCHECK(IsConsistent()); |
129 return size_; | 131 return size_; |
130 } | 132 } |
131 | 133 |
132 size_t capacity() const { | 134 size_t capacity() const { |
133 RTC_DCHECK(IsConsistent()); | 135 RTC_DCHECK(IsConsistent()); |
134 return capacity_; | 136 return capacity_; |
135 } | 137 } |
136 | 138 |
(...skipping 212 matching lines...) Loading... | |
349 size_t capacity_; | 351 size_t capacity_; |
350 std::unique_ptr<T[]> data_; | 352 std::unique_ptr<T[]> data_; |
351 }; | 353 }; |
352 | 354 |
353 // By far the most common sort of buffer. | 355 // By far the most common sort of buffer. |
354 using Buffer = BufferT<uint8_t>; | 356 using Buffer = BufferT<uint8_t>; |
355 | 357 |
356 } // namespace rtc | 358 } // namespace rtc |
357 | 359 |
358 #endif // WEBRTC_BASE_BUFFER_H_ | 360 #endif // WEBRTC_BASE_BUFFER_H_ |
OLD | NEW |