List of commits:
Subject Hash Author Date (UTC)
emit with arg passes 1b2288e8472b749c513120c441397a77298ab0b7 mucbuc 2020-01-17 10:58:28
dynamo update 7082792be9aa3ccb56b0afbddf58bdf468d56030 mucbuc 2020-01-17 05:32:03
circuit 9877e777b93a54d396248ad449f6ba5abf324733 mucbuc 2020-01-17 04:22:05
dynamo v2dev 15f474b5a627558c230b2fe96c40fb5c68a176d0 mucbuc 2020-01-17 04:21:40
research 47ce3a71d001f2aea7af852673b42b83f20be4dd Ubuntu 2019-12-22 17:19:57
working on test b646f535e229ff57b421f0bee0570c8a4bda76a9 Ubuntu 2019-12-21 13:20:34
emit with args 81cc2a4373cb92a07ba7acbab65ebabceb826dc0 Ubuntu 2019-12-21 06:40:24
format 1192aea1b3bf9b400e02a11152a38e5dfc6b7ad6 Ubuntu 2019-12-21 06:27:42
todo ce69f800504f9e5c643115b9ca887705dafafde3 Ubuntu 2019-12-18 07:43:15
format e59b4ae5d0286ba6766e66427996f8ccab4eff0e Ubuntu 2019-12-18 07:38:21
redo interface 3dd5822c6288ad004d1ec45e37a6f63d361aff39 Ubuntu 2019-12-18 07:38:11
temp test 54800db7dbd02d7070f5018abd27bea261bd9097 Ubuntu 2019-12-18 07:07:07
cleanup test 58f12d14f6db17e0916b115f470f87393e1ebce6 Ubuntu 2019-12-15 14:52:15
fix build error 51fcd8e612a8e89cf6ef2c94cfb82b664b532313 mucbuc 2019-11-29 06:49:34
moved impl back e536719eb2c090e49e1f389deed19dbdcd582275 mucbuc 2019-11-27 15:17:35
emitter_impl 4d41cb0eb6ee37a66b9c8d3b02824ec2020bca31 mucbuc 2019-11-26 10:58:35
using template parameter packs b01b5f9568215ccfd5c7c30cfb68ccc8a3c720da mucbuc 2019-11-14 14:21:50
cleanup 0403bb7332d11797467282d58735cefb518e8407 mucbuc 2019-11-12 05:13:03
rm emitter 55ae1aa2ce377d75e47d18a2ed29b44b7e24f93f mucbuc 2019-11-12 04:49:21
once while emit recursive 172a4d72599206575d18b2055e5a0231646d9274 mucbuc 2019-11-12 04:44:22
Commit 1b2288e8472b749c513120c441397a77298ab0b7 - emit with arg passes
Author: mucbuc
Author date (UTC): 2020-01-17 10:58
Committer name: mucbuc
Committer date (UTC): 2020-01-17 10:58
Parent(s): 7082792be9aa3ccb56b0afbddf58bdf468d56030
Signer:
Signing key:
Signing status: N
Tree: 7862b30a20d452297c6dde5f4e6ac59649e3a8fc
File Lines added Lines deleted
src/emitter_impl.h 6 7
src/emitter_impl.hxx 2 31
src/interface.h 1 7
test/lib/dynamo/src/interface.h 1 0
File src/emitter_impl.h changed (mode: 100644) (index ae5d6f7..865c00d)
6 6 #include <set> #include <set>
7 7
8 8 #include "interface.h" #include "interface.h"
9 #include <lib/dynamo/src/impl/batch.h>
10
9 11
10 12 namespace om636 { namespace om636 {
11 13 namespace control { namespace control {
 
... ... namespace control {
13 15 class EmitterImpl : Emitter<T, U...> { class EmitterImpl : Emitter<T, U...> {
14 16 public: public:
15 17 typedef T event_type; typedef T event_type;
16 typedef std::function<void(U...)> callback_type;
17 typedef Batch<callback_type> batch_type;
18 typedef typename batch_type::listener_type listener_type;
18 typedef Emitter<event_type, U...> base_type;
19 using typename base_type::callback_type;
20 using typename base_type::listener_type;
19 21
20 22 listener_type on(event_type, callback_type) override; listener_type on(event_type, callback_type) override;
21 23 listener_type once(event_type, callback_type) override; listener_type once(event_type, callback_type) override;
22 24
23 void removeListeners(event_type) override;
24 void removeAllListeners() override;
25
26 25 void interupt(event_type, U...) override; void interupt(event_type, U...) override;
27 26
28 27 private: private:
28 typedef BatchImpl<U...> batch_type;
29 29 typedef std::map<event_type, batch_type> map_type; typedef std::map<event_type, batch_type> map_type;
30 void kill_all(map_type&);
31 30
32 31 map_type m_repeat; map_type m_repeat;
33 32 map_type m_once; map_type m_once;
File src/emitter_impl.hxx changed (mode: 100644) (index 8b1bc11..dfa9d36)
... ... namespace control {
15 15 return m_once[e].hook(c); return m_once[e].hook(c);
16 16 } }
17 17
18 /////////////////////////////////////////////////////////////////////////////////////
19 template <typename T, typename... U>
20 void EmitterImpl<T, U...>::removeListeners(event_type e)
21 {
22 m_once[e].unhook();
23 m_repeat[e].unhook();
24 }
25
26 /////////////////////////////////////////////////////////////////////////////////////
27 template <typename T, typename... U>
28 void EmitterImpl<T, U...>::removeAllListeners()
29 {
30 kill_all(m_once);
31 kill_all(m_repeat);
32 }
33
34 18 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
35 19 template <typename T, typename... U> template <typename T, typename... U>
36 20 void EmitterImpl<T, U...>::interupt(event_type e, U... arg) void EmitterImpl<T, U...>::interupt(event_type e, U... arg)
37 21 { {
38 m_once[e].merge_added_elements();
39 m_repeat[e].merge_added_elements();
40
41 utils::process_and_kill(m_once[e].elements(), arg...);
42 utils::process(m_repeat[e].elements(), arg...);
43 }
44
45 /////////////////////////////////////////////////////////////////////////////////////
46 template <typename T, typename... U>
47 void EmitterImpl<T, U...>::kill_all(map_type& map)
48 {
49 for_each(map.begin(), map.end(), [](typename map_type::value_type& p) {
50 p.second.unhook();
51 });
52 map.clear();
22 m_once[e].invoke_once(arg...);
23 m_repeat[e].invoke(arg...);
53 24 } }
54 25
55 26 } // control } // control
File src/interface.h changed (mode: 100644) (index be31d9d..026c834)
6 6 #include <memory> #include <memory>
7 7 #include <set> #include <set>
8 8
9 #include <lib/dynamo/src/batch.h>
10
11 9 namespace om636 { namespace om636 {
12 10 namespace control { namespace control {
13 11
 
... ... namespace control {
16 14 public: public:
17 15 typedef T event_type; typedef T event_type;
18 16 typedef std::function<void(U...)> callback_type; typedef std::function<void(U...)> callback_type;
19 typedef Batch<callback_type> batch_type;
20 typedef typename batch_type::listener_type listener_type;
17 typedef std::shared_ptr<callback_type> listener_type;
21 18
22 19 virtual ~Emitter() = default; virtual ~Emitter() = default;
23 20
24 21 virtual listener_type on(event_type, callback_type) = 0; virtual listener_type on(event_type, callback_type) = 0;
25 22 virtual listener_type once(event_type, callback_type) = 0; virtual listener_type once(event_type, callback_type) = 0;
26 23
27 virtual void removeListeners(event_type) = 0;
28 virtual void removeAllListeners() = 0;
29
30 24 virtual void interupt(event_type, U...) = 0; virtual void interupt(event_type, U...) = 0;
31 25 }; };
32 26
File test/lib/dynamo/src/interface.h changed (mode: 100644) (index b7643b0..d8deeeb)
1 1 #pragma once #pragma once
2 2
3 #include <functional>
3 4 #include <memory> #include <memory>
4 5
5 6 namespace om636 { namespace om636 {
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/ohm

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

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

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