Subject | Hash | Author | Date (UTC) |
---|---|---|---|
index.h | 74aafab338206a3d3c02b7448852dbde831692dc | mucbuc | 2020-01-12 04:42:02 |
factory returns shared_ptr | 0d8ff1b381e3c7e275ebd99705853f54b100cdf9 | mucbuc | 2020-01-12 04:05:15 |
init | 01daaea5899ac77acb8ec0c15583573d78eb9f31 | mucbuc | 2020-01-12 03:10:36 |
File | Lines added | Lines deleted |
---|---|---|
src/index.h | 18 | 0 |
test/src/main.cpp | 3 | 4 |
File src/index.h added (mode: 100644) (index 0000000..f370ad5) | |||
1 | #pragma once | ||
2 | |||
3 | #include "impl/circuit_host.h" | ||
4 | #include "impl/stack.h" | ||
5 | #include "impl/queue.h" | ||
6 | |||
7 | namespace om636 { | ||
8 | namespace twice_size { | ||
9 | |||
10 | template<typename T> | ||
11 | using CircuitStack = CircuitHost<T, StackPolicy>; | ||
12 | |||
13 | template<typename T> | ||
14 | using CircuitQueue = CircuitHost<T, QueuePolicy>; | ||
15 | |||
16 | } // twice_size | ||
17 | } // om636 | ||
18 |
File test/src/main.cpp changed (mode: 100644) (index 9752dd4..78bd44c) | |||
3 | 3 | ||
4 | 4 | #include <tmp/src/test.h> | #include <tmp/src/test.h> |
5 | 5 | ||
6 | #include <lib/circuit/src/factory.h> | ||
6 | #include <lib/circuit/src/index.h> | ||
7 | 7 | ||
8 | 8 | template <class T> | template <class T> |
9 | 9 | void test_wait_pop(T s) | void test_wait_pop(T s) |
10 | 10 | { | { |
11 | |||
12 | 11 | auto tmp = std::thread([=]() { | auto tmp = std::thread([=]() { |
13 | 12 | int i(0); | int i(0); |
14 | 13 | s->wait_pop(i); | s->wait_pop(i); |
... | ... | int main() | |
23 | 22 | { | { |
24 | 23 | using namespace om636::twice_size; | using namespace om636::twice_size; |
25 | 24 | ||
26 | test_wait_pop(make_stack<int>()); | ||
27 | test_wait_pop(make_queue<int>()); | ||
25 | test_wait_pop(std::make_shared<CircuitStack<int>>()); | ||
26 | test_wait_pop(std::make_shared<CircuitQueue<int>>()); | ||
28 | 27 | ||
29 | 28 | return 0; | return 0; |
30 | 29 | } | } |