diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/fixed_size_queue.h | 70 |
2 files changed, 0 insertions, 71 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 868fda55e..3a82f5b80 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -38,7 +38,6 @@ set(HEADERS | |||
| 38 | fifo_queue.h | 38 | fifo_queue.h |
| 39 | file_search.h | 39 | file_search.h |
| 40 | file_util.h | 40 | file_util.h |
| 41 | fixed_size_queue.h | ||
| 42 | hash.h | 41 | hash.h |
| 43 | linear_disk_cache.h | 42 | linear_disk_cache.h |
| 44 | log.h | 43 | log.h |
diff --git a/src/common/fixed_size_queue.h b/src/common/fixed_size_queue.h deleted file mode 100644 index 1e3a5dea6..000000000 --- a/src/common/fixed_size_queue.h +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | // STL-look-a-like interface, but name is mixed case to distinguish it clearly from the | ||
| 8 | // real STL classes. | ||
| 9 | |||
| 10 | // Not fully featured, no safety checking yet. Add features as needed. | ||
| 11 | |||
| 12 | // TODO: "inline" storage? | ||
| 13 | |||
| 14 | template <class T, int N> | ||
| 15 | class fixed_size_queue.h | ||
| 16 | { | ||
| 17 | T *storage; | ||
| 18 | int head; | ||
| 19 | int tail; | ||
| 20 | int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future. | ||
| 21 | |||
| 22 | // Make copy constructor private for now. | ||
| 23 | fixed_size_queue.h(fixed_size_queue.h &other) { } | ||
| 24 | |||
| 25 | public: | ||
| 26 | fixed_size_queue.h() | ||
| 27 | { | ||
| 28 | storage = new T[N]; | ||
| 29 | clear(); | ||
| 30 | } | ||
| 31 | |||
| 32 | ~fixed_size_queue.h() | ||
| 33 | { | ||
| 34 | delete [] storage; | ||
| 35 | } | ||
| 36 | |||
| 37 | void clear() { | ||
| 38 | head = 0; | ||
| 39 | tail = 0; | ||
| 40 | count = 0; | ||
| 41 | } | ||
| 42 | |||
| 43 | void push(T t) { | ||
| 44 | storage[tail] = t; | ||
| 45 | tail++; | ||
| 46 | if (tail == N) | ||
| 47 | tail = 0; | ||
| 48 | count++; | ||
| 49 | } | ||
| 50 | |||
| 51 | void pop() { | ||
| 52 | head++; | ||
| 53 | if (head == N) | ||
| 54 | head = 0; | ||
| 55 | count--; | ||
| 56 | } | ||
| 57 | |||
| 58 | T pop_front() { | ||
| 59 | const T &temp = storage[head]; | ||
| 60 | pop(); | ||
| 61 | return temp; | ||
| 62 | } | ||
| 63 | |||
| 64 | T &front() { return storage[head]; } | ||
| 65 | const T &front() const { return storage[head]; } | ||
| 66 | |||
| 67 | size_t size() const { | ||
| 68 | return count; | ||
| 69 | } | ||
| 70 | }; | ||