Subject | Hash | Author | Date (UTC) |
---|---|---|---|
abstraction complete | 210e60e6a600a1a1565a5eba52c9cceb7fc2d108 | Ubuntu | 2019-12-23 05:48:13 |
batch is now abstract | 681a77dad6a0af7d2b053bdb1f24eda94158828d | Ubuntu | 2019-12-23 04:23:05 |
some cleanup | 67af884f30b760e6dfeb16866faf180c2f419f3e | mucbuc | 2019-12-23 02:37:58 |
tests passing | 227d2a97ddcc62abf13835ff77ed2abb55e304ee | mucbuc | 2019-12-22 21:32:38 |
some cleanup | 32f6958b242ade546d396db1ad593b1b1e864533 | mucbuc | 2019-12-22 20:02:55 |
agent | 8714f1b8e69d8037fb634fefefa2166cc0d73cc8 | mucbuc | 2019-12-22 19:56:03 |
shared_agent | b647e38e4bb58096f6c58756dfa2718cacc30e64 | mucbuc | 2019-12-22 18:56:17 |
fix compile time error | fbc1c35e2389d9fffebe94808385ded809b4061a | mucbuc | 2019-11-03 00:30:41 |
cleanup template stuff | 4ebc0945d2e8cf2c7a1f75d3dab125b83f76078d | mucbuc | 2019-11-02 21:09:51 |
more cleanup | bfbe00170ae67ea7e8e1cb23e4e352b18188b5a9 | mucbuc | 2019-11-02 21:01:10 |
delete explicit template stuff | 1a43665b79bb3df8e28cb7be2d460cbec6cd6a0f | mucbuc | 2019-11-02 20:55:26 |
use parameter pack | aaff690514d7543a66c285cf9214ebad55c6876e | mucbuc | 2019-11-02 20:49:43 |
builds | d8412e21c450b8da35dc1f248cb713859bb40c26 | mucbuc | 2019-11-02 20:26:54 |
ignore test tmp | 0c68fe48a97a80098e224875f1f7aa948a7c6a59 | Ubuntu | 2018-10-07 09:50:49 |
plusify | 5521f5f65b89bdb2a848d3e497b1c591fe39c15e | Ubuntu | 2018-10-06 12:18:21 |
Uni test (#2) | 9b73df9337debfea1a000811645609bdd2d8a5ea | Mark Busenitz | 2018-06-25 10:46:04 |
license | 8e6ee3e912b6273862fbecc34777ef8268ddd5dd | mbusenitz | 2017-11-21 04:38:04 |
doc hook (#1) | 2d744d1ce1deb15ed20f1d5819de7e2d9230e2c7 | Mark Busenitz | 2017-03-25 20:27:28 |
package.json | a4c059735b1201b5749b10f758fcfe3561d9ead6 | mbusenitz | 2017-03-21 04:20:38 |
Update README.md | 2218a3a0dd2103de11dff6b15e670ad3874f4266 | Mark Busenitz | 2017-03-21 04:19:16 |
File | Lines added | Lines deleted |
---|---|---|
src/batch.h | 2 | 2 |
src/batch_impl.h | 8 | 2 |
src/batch_impl.hxx | 4 | 5 |
test/src/batch.h | 4 | 9 |
File src/batch.h changed (mode: 100644) (index 9f931f2..e2bceee) | |||
... | ... | namespace control { | |
11 | 11 | class Batch { | class Batch { |
12 | 12 | public: | public: |
13 | 13 | typedef Agent<T...> agent_type; | typedef Agent<T...> agent_type; |
14 | typedef std::weak_ptr<agent_type> pointer_type; | ||
15 | 14 | ||
16 | 15 | virtual ~Batch() = default; | virtual ~Batch() = default; |
17 | virtual void unhook() = 0; | ||
16 | virtual std::shared_ptr<agent_type> hook(std::function<void(T...)>) = 0; | ||
17 | virtual void unhook() = 0; | ||
18 | 18 | virtual void traverse(T ...) = 0; | virtual void traverse(T ...) = 0; |
19 | 19 | virtual void traverse_destructive(T ...) = 0; | virtual void traverse_destructive(T ...) = 0; |
20 | 20 | }; | }; |
File src/batch_impl.h changed (mode: 100644) (index f7480de..ada1aee) | |||
... | ... | namespace control { | |
14 | 14 | class BatchImpl : public Batch<T...> | class BatchImpl : public Batch<T...> |
15 | 15 | { | { |
16 | 16 | public: | public: |
17 | |||
18 | 17 | typedef Batch<T...> base_type; | typedef Batch<T...> base_type; |
19 | using typename base_type::pointer_type; | ||
18 | using typename base_type::agent_type; | ||
20 | 19 | ||
21 | 20 | BatchImpl() = default; | BatchImpl() = default; |
22 | 21 | ~BatchImpl() override = default; | ~BatchImpl() override = default; |
23 | 22 | ||
23 | std::shared_ptr<agent_type> hook(std::function<void(T...)>) override; | ||
24 | 24 | void unhook() override; | void unhook() override; |
25 | 25 | void traverse(T ...) override; | void traverse(T ...) override; |
26 | 26 | void traverse_destructive(T ...) override; | void traverse_destructive(T ...) override; |
... | ... | namespace control { | |
29 | 29 | std::shared_ptr<U> hook(V); | std::shared_ptr<U> hook(V); |
30 | 30 | ||
31 | 31 | private: | private: |
32 | typedef std::weak_ptr<agent_type> pointer_type; | ||
32 | 33 | typedef std::vector<pointer_type> batch_type; | typedef std::vector<pointer_type> batch_type; |
33 | 34 | batch_type& elements(); | batch_type& elements(); |
34 | 35 | const batch_type& elements() const; | const batch_type& elements() const; |
... | ... | namespace control { | |
49 | 50 | ||
50 | 51 | template <typename T> | template <typename T> |
51 | 52 | void kill_all(T&); | void kill_all(T&); |
53 | |||
54 | struct empty_base | ||
55 | { | ||
56 | virtual ~empty_base() = default; | ||
57 | }; | ||
52 | 58 | } | } |
53 | 59 | ||
54 | 60 | } //control | } //control |
File src/batch_impl.hxx changed (mode: 100644) (index 53c34e7..1942583) | |||
... | ... | namespace om636 { | |
2 | 2 | namespace control { | namespace control { |
3 | 3 | ///////////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////////// |
4 | 4 | template <typename ...T> | template <typename ...T> |
5 | template <typename U, typename V> | ||
6 | auto BatchImpl<T...>::hook(V callback) -> std::shared_ptr<U> | ||
5 | auto BatchImpl<T...>::hook(std::function<void(T...)> callback) -> std::shared_ptr<agent_type> | ||
7 | 6 | { | { |
8 | auto listener( std::make_shared<shared_agent<U, T...>>(callback) ); | ||
9 | m_elements_add.push_back(listener); | ||
10 | return listener; | ||
7 | auto agent( std::make_shared<shared_agent<utils::empty_base, T...>>(callback) ); | ||
8 | m_elements_add.push_back(agent); | ||
9 | return agent; | ||
11 | 10 | } | } |
12 | 11 | ||
13 | 12 | ///////////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////////// |
File test/src/batch.h changed (mode: 100644) (index b0bf5ab..fe9db02) | |||
... | ... | using namespace std; | |
3 | 3 | ||
4 | 4 | typedef control::BatchImpl<> batch_type; | typedef control::BatchImpl<> batch_type; |
5 | 5 | ||
6 | struct empty_base | ||
7 | { | ||
8 | virtual ~empty_base() = default; | ||
9 | }; | ||
10 | |||
11 | 6 | void check_traverse_with_arg() | void check_traverse_with_arg() |
12 | 7 | { | { |
13 | 8 | typedef control::BatchImpl<int> batch_type; | typedef control::BatchImpl<int> batch_type; |
... | ... | void check_traverse_with_arg() | |
15 | 10 | unsigned test_passed(0); | unsigned test_passed(0); |
16 | 11 | batch_type batch; | batch_type batch; |
17 | 12 | ||
18 | auto p(batch.hook<empty_base>([&](int i) { | ||
13 | auto p(batch.hook([&](int i) { | ||
19 | 14 | ASSERT(i == 99); | ASSERT(i == 99); |
20 | 15 | ++test_passed; | ++test_passed; |
21 | 16 | })); | })); |
... | ... | void check_traverse_with_args() | |
33 | 28 | unsigned test_passed(0); | unsigned test_passed(0); |
34 | 29 | batch_type batch; | batch_type batch; |
35 | 30 | ||
36 | auto p(batch.hook<empty_base>([&](int i, int j) { | ||
31 | auto p(batch.hook([&](int i, int j) { | ||
37 | 32 | ASSERT(i == 99); | ASSERT(i == 99); |
38 | 33 | ASSERT(j == 3); | ASSERT(j == 3); |
39 | 34 | ++test_passed; | ++test_passed; |
... | ... | void check_traverse_while_traverse() | |
50 | 45 | batch_type batch; | batch_type batch; |
51 | 46 | unsigned passed(0); | unsigned passed(0); |
52 | 47 | ||
53 | auto p(batch.hook<empty_base>([&]() { | ||
48 | auto p(batch.hook([&]() { | ||
54 | 49 | ++passed; | ++passed; |
55 | 50 | batch.traverse(); | batch.traverse(); |
56 | 51 | })); | })); |
... | ... | void check_traverse() | |
66 | 61 | batch_type batch; | batch_type batch; |
67 | 62 | unsigned passed(0); | unsigned passed(0); |
68 | 63 | ||
69 | auto temp(batch.hook<empty_base>([&]() { | ||
64 | auto temp(batch.hook([&]() { | ||
70 | 65 | ++passed; | ++passed; |
71 | 66 | })); | })); |
72 | 67 |