List of commits:
Subject Hash Author Date (UTC)
hook_once e800fa98f37b99f456e0f474d2a95eac87dbe020 mucbuc 2020-01-20 17:22:05
twice_size => circuit 07e34c75c67aa4ccaed56d26357bb29f75914005 mucbuc 2020-01-20 12:09:43
reset agent and check before callback 9ce516c3b921eb0e853b17119a4960fdf3936dcf mucbuc 2020-01-19 06:57:31
include statement 2c33dfbb947f7aafd05413b78dea3a0c036cf91b mucbuc 2020-01-17 10:29:01
formating 99ddddbf993037c4bdc573c149b28db242ac0862 mucbuc 2020-01-17 05:30:56
invoke_once b6ee37d690063e31b0300fdef0319d26293f0532 mucbuc 2020-01-17 05:29:52
remove agent 31359a9da855067033433f4310d172dadc813f28 mucbuc 2020-01-16 12:55:13
formati 13721c73e8d359eab3f32a030a35a42b83a341f0 mucbuc 2020-01-16 12:40:00
fix tests 343e081bf929c31592f835b279e5e4cd2c149539 mucbuc 2020-01-16 12:37:58
strip interface 991fc85aa55fc6f1d08fe94673840c14f2087ea8 mucbuc 2020-01-16 05:44:55
*break* circuit poc 26840f5e3ecca09bc113cb42fff5275c9213e0ae mucbuc 2020-01-14 11:32:23
add circuit 0cc2be277c7c0bdd4026e056292cc2d6f4150195 mucbuc 2020-01-14 11:30:23
formating d0c058639d2aec3f3e8f94da64e03e316d1c0914 mucbuc 2020-01-14 11:04:33
documentation f9e40f305cb18e274187ca4a6d5337d074d1ff30 mucbuc 2020-01-12 15:38:09
fixed test ea8fe3cc68d22f66233227333ca7e5e5ba5bf61b Ubuntu 2020-01-05 10:03:01
fix test 3000b9771071dad410993acf8a3fca2cae11c47b Ubuntu 2019-12-29 14:41:59
cleanup/ / /\ \\ 2318e095c0bc6cbc7831c56c0d60b7895534af37 mucbuc 2019-12-25 01:04:28
test for dead object removal 293a4ecb0c1b37e3f6de4c382c544f858e591b5d Ubuntu 2019-12-24 12:22:51
listener type 17dbf951b9f1c9d5597eec229bbb1493b7b7f9c0 Ubuntu 2019-12-24 11:50:57
impl folder 40a4b7b8898954a4c23ccbaa89e6f8b153a7aa7f Ubuntu 2019-12-24 07:28:25
Commit e800fa98f37b99f456e0f474d2a95eac87dbe020 - hook_once
Author: mucbuc
Author date (UTC): 2020-01-20 17:22
Committer name: mucbuc
Committer date (UTC): 2020-01-20 17:22
Parent(s): 3eec937440f6386921238c4114a52a7cbd864594
Signing key:
Tree: cfc07013ae6e496d158be1b17dab6c5d1459b71c
File Lines added Lines deleted
src/impl/batch.h 3 2
src/impl/batch.hxx 11 20
src/interface.h 1 1
File src/impl/batch.h changed (mode: 100644) (index f4bf54c..ca98a2f)
... ... namespace control {
19 19
20 20 ~BatchImpl() override = default; ~BatchImpl() override = default;
21 21 agent_type hook(function_type) override; agent_type hook(function_type) override;
22 agent_type hook_once(function_type) override;
22 23 void invoke(T...) override; void invoke(T...) override;
23 void invoke_once(T...) override;
24 24
25 25 typedef std::weak_ptr<typename agent_type::element_type> pointer_type; typedef std::weak_ptr<typename agent_type::element_type> pointer_type;
26 typedef circuit::CircuitQueue<pointer_type> batch_type;
26 typedef std::tuple<pointer_type, bool> tuple_type;
27 typedef circuit::CircuitQueue<tuple_type> batch_type;
27 28 batch_type& elements(); batch_type& elements();
28 29 const batch_type& elements() const; const batch_type& elements() const;
29 30
File src/impl/batch.hxx changed (mode: 100644) (index d2e3af4..3bac54b)
... ... namespace control {
5 5 auto BatchImpl<T...>::hook(function_type callback) -> agent_type auto BatchImpl<T...>::hook(function_type callback) -> agent_type
6 6 { {
7 7 auto agent(std::make_shared<function_type>(callback)); auto agent(std::make_shared<function_type>(callback));
8 m_elements.push(agent);
8 m_elements.push(std::make_tuple<pointer_type, bool>(agent, true));
9 9 return agent; return agent;
10 10 } }
11 11
12 12 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
13 13 template <typename... T> template <typename... T>
14 void BatchImpl<T...>::invoke(T... arg)
14 auto BatchImpl<T...>::hook_once(function_type callback) -> agent_type
15 15 { {
16 invoke([this](agent_type s) {
17 elements().push(s);
18 },
19 arg...);
20 }
21
22 /////////////////////////////////////////////////////////////////////////////////////
23 template <typename... T>
24 void BatchImpl<T...>::invoke_once(T... arg)
25 {
26 invoke([](agent_type) {}, arg...);
16 auto agent(std::make_shared<function_type>(callback));
17 m_elements.push(std::make_tuple<pointer_type, bool>(agent, false));
18 return agent;
27 19 } }
28 20
29 21 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
30 22 template <typename... T> template <typename... T>
31 template <typename U>
32 void BatchImpl<T...>::invoke(U cb, T... arg)
23 void BatchImpl<T...>::invoke(T... arg)
33 24 { {
34 25 batch_type traverse; batch_type traverse;
35 26 traverse.swap(elements()); traverse.swap(elements());
36 pointer_type agent;
27 tuple_type agent;
37 28 while (traverse.check_pop(agent)) { while (traverse.check_pop(agent)) {
38 agent_type s(agent.lock());
29 agent_type s(std::get<0>(agent).lock());
39 30 if (s) { if (s) {
40 31 (*s)(arg...); (*s)(arg...);
41 32 } }
42 s = agent.lock();
43 if (s) {
44 cb(s);
33 s = std::get<0>(agent).lock();
34 if (s && std::get<1>(agent)) {
35 elements().push(std::move(agent));
45 36 } }
46 37 } }
47 38 } }
File src/interface.h changed (mode: 100644) (index d8deeeb..7c7a13a)
... ... namespace control {
15 15
16 16 virtual ~Batch() = default; virtual ~Batch() = default;
17 17 virtual agent_type hook(function_type) = 0; virtual agent_type hook(function_type) = 0;
18 virtual agent_type hook_once(function_type) = 0;
18 19 virtual void invoke(T...) = 0; virtual void invoke(T...) = 0;
19 virtual void invoke_once(T...) = 0;
20 20 }; };
21 21
22 22 } // control } // control
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mucbuc/dynamo

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mucbuc/dynamo

Clone this repository using git:
git clone git://git.rocketgit.com/user/mucbuc/dynamo

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main