OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 */ |
11 | 11 |
12 #ifndef WEBRTC_CALL_RINGBUFFER_H_ | 12 #ifndef WEBRTC_CALL_RINGBUFFER_H_ |
13 #define WEBRTC_CALL_RINGBUFFER_H_ | 13 #define WEBRTC_CALL_RINGBUFFER_H_ |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 #include <utility> | 16 #include <utility> |
17 | 17 |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/constructormagic.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 // A RingBuffer works like a fixed size queue which starts discarding | 23 // A RingBuffer works like a fixed size queue which starts discarding |
23 // the oldest elements when it becomes full. | 24 // the oldest elements when it becomes full. |
24 template <typename T> | 25 template <typename T> |
25 class RingBuffer { | 26 class RingBuffer { |
26 public: | 27 public: |
27 // Creates a RingBuffer with space for |capacity| elements. | 28 // Creates a RingBuffer with space for |capacity| elements. |
28 explicit RingBuffer(size_t capacity) | 29 explicit RingBuffer(size_t capacity) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 T* end_; | 91 T* end_; |
91 T* front_; | 92 T* front_; |
92 T* back_; | 93 T* back_; |
93 | 94 |
94 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); | 95 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); |
95 }; | 96 }; |
96 | 97 |
97 } // namespace webrtc | 98 } // namespace webrtc |
98 | 99 |
99 #endif // WEBRTC_CALL_RINGBUFFER_H_ | 100 #endif // WEBRTC_CALL_RINGBUFFER_H_ |
OLD | NEW |