List of commits:
Subject Hash Author Date (UTC)
master rework bfd068cc2513e275bfe31ca4a4075b64858d98b2 mbusenitz 2015-02-28 13:15:49
cleanup 243f014fbc1cf0e0b88dadc69daec250406e219c mbusenitz 2015-02-28 11:53:29
cleanup 849260db25b72640b9b8cb35c3170e4ef14fe9bb mbusenitz 2015-02-28 11:44:40
master rework process interface" 6bd50518b575f162486d7252bd1f29d628325f26 mbusenitz 2015-02-28 11:43:46
test args 523b7174ede20ae385ccc131738a32d6de3a412e mbusenitz 2015-02-27 05:31:55
check_traverse_while_traverse 13fd698a0986a46dbde2f886435cf0313679640f mbusenitz 2015-02-27 05:17:49
fix test 0d8478c8650285983253d655b5254701a6d9302b mbusenitz 2015-02-26 21:03:12
batch test e6f780a6e37191ea0ed22fe35fff421a770860bc mbusenitz 2015-02-26 20:39:03
Squashed 'test/plank/' changes from 09a9867..3962f58 f2f24b430e4b39687cbbc6f0ffcce4d5e08f96de mbusenitz 2015-02-26 20:36:05
master rough pass 8e41bfcd72b69abe79d69e73a1d13f1e2e9b1e39 mbusenitz 2015-02-26 19:42:41
master rename 0822dbbdba16f539d088d3b60320da32f688ebce mbusenitz 2015-02-26 06:11:15
master first pass a15417f304e070121e34272eaedf1e51fce5f1fd mbusenitz 2015-02-26 06:00:11
Squashed 'test/plank/' content from commit 09a9867 486e835d9a925e450abfb6dfce9437e808b5cf0f mbusenitz 2015-02-26 05:29:41
init 4d1b6b27cb5dc364239073fa755a549b817031b9 mbusenitz 2015-02-26 05:29:35
Commit bfd068cc2513e275bfe31ca4a4075b64858d98b2 - master rework
Author: mbusenitz
Author date (UTC): 2015-02-28 13:15
Committer name: mbusenitz
Committer date (UTC): 2015-02-28 13:15
Parent(s): 243f014fbc1cf0e0b88dadc69daec250406e219c
Signer:
Signing key:
Signing status: N
Tree: 2989d66cc3b2f75ee8417b9ed096b25f4133a682
File Lines added Lines deleted
src/batch.h 10 6
src/batch.hxx 34 31
File src/batch.h changed (mode: 100644) (index aebf5d5..93bc372)
... ... namespace om636
46 46 template<typename V, typename W> template<typename V, typename W>
47 47 void traverse_destructive( V, W ); void traverse_destructive( V, W );
48 48
49 static void process_and_kill( const batch_type & );
49 static void process_and_kill( batch_type );
50 50
51 51 template<typename V> template<typename V>
52 static void process_and_kill( const batch_type &, V );
52 static void process_and_kill( batch_type, V );
53 53
54 54 template<typename V, typename W> template<typename V, typename W>
55 static void process_and_kill( const batch_type &, V, W );
55 static void process_and_kill( batch_type, V, W );
56 56
57 static batch_type process( const batch_type & );
57 static batch_type process( batch_type );
58 58
59 59 template<typename V> template<typename V>
60 static batch_type process( const batch_type &, V );
60 static batch_type process( batch_type, V );
61 61
62 62 template<typename V, typename W> template<typename V, typename W>
63 static batch_type process( const batch_type &, V, W );
63 static batch_type process( batch_type, V, W );
64 64
65 65 static void kill_all(batch_type &); static void kill_all(batch_type &);
66 66
 
... ... namespace om636
68 68 const batch_type & elements() const; const batch_type & elements() const;
69 69
70 70 private: private:
71
72 void merge_new_elements();
73
71 74 batch_type m_elements; batch_type m_elements;
75 batch_type m_elements_add;
72 76 }; };
73 77 } //control } //control
74 78 } // om636 } // om636
File src/batch.hxx changed (mode: 100644) (index 9929d20..0d4b7bd)
... ... namespace om636
7 7 auto Batch<T>::hook( callback_type c ) -> listener_type auto Batch<T>::hook( callback_type c ) -> listener_type
8 8 { {
9 9 pointer_type agent( new agent_type( c ) ); pointer_type agent( new agent_type( c ) );
10 elements().insert( agent );
10 m_elements_add.insert( agent );
11 11 return listener_type( agent ); return listener_type( agent );
12 12 } }
13 13
 
... ... namespace om636
16 16 void Batch<T>::unhook() void Batch<T>::unhook()
17 17 { {
18 18 kill_all( elements() ); kill_all( elements() );
19 kill_all( m_elements_add );
19 20 } }
20 21
21 22 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
22 23 template<typename T> template<typename T>
23 24 void Batch<T>::traverse() void Batch<T>::traverse()
24 25 { {
25 batch_type copy;
26 copy.swap( elements() );
27 elements() = process( copy );
26 merge_new_elements();
27
28 const batch_type & sub( process( elements() ) );
29 elements().erase( sub.begin(), sub.end() );
28 30 } }
29 31
30 32 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
32 34 template<class V> template<class V>
33 35 void Batch<T>::traverse(V arg) void Batch<T>::traverse(V arg)
34 36 { {
35 batch_type copy;
36 copy.swap( elements() );
37 elements() = process( copy, arg );
37 merge_new_elements();
38
39 const batch_type & sub( process( elements(), arg ) );
40 elements().erase( sub.begin(), sub.end() );
38 41 } }
39 42
40 43 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
42 45 template<typename V, typename W> template<typename V, typename W>
43 46 void Batch<T>::traverse(V first_arg, W second_arg ) void Batch<T>::traverse(V first_arg, W second_arg )
44 47 { {
45 batch_type copy;
46 copy.swap( elements() );
47 elements() = process( copy, first_arg, second_arg );
48 merge_new_elements();
49
50 const batch_type & sub( process( elements(), first_arg, second_arg ) );
51 elements().erase( sub.begin(), sub.end() );
48 52 } }
49 53
50 54 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
51 55 template<typename T> template<typename T>
52 56 void Batch<T>::traverse_destructive() void Batch<T>::traverse_destructive()
53 57 { {
54 batch_type copy;
55 copy.swap( elements() );
56 process_and_kill( copy );
58 process_and_kill( elements() );
57 59 } }
58 60
59 61 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
61 63 template<class V> template<class V>
62 64 void Batch<T>::traverse_destructive(V arg) void Batch<T>::traverse_destructive(V arg)
63 65 { {
64 batch_type copy;
65 copy.swap( elements() );
66 process_and_kill( copy, arg );
66 process_and_kill( elements(), arg );
67 67 } }
68 68
69 69 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
71 71 template<typename V, typename W> template<typename V, typename W>
72 72 void Batch<T>::traverse_destructive(V first_arg, W second_arg ) void Batch<T>::traverse_destructive(V first_arg, W second_arg )
73 73 { {
74 batch_type copy;
75 copy.swap( elements() );
76 process_and_kill( copy, first_arg, second_arg );
74 process_and_kill( elements(), first_arg, second_arg );
77 75 } }
78 76
79 77 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
80 78 template<typename T> template<typename T>
81 auto Batch<T>::process( const batch_type & batch ) -> batch_type
79 auto Batch<T>::process( batch_type batch ) -> batch_type
82 80 { {
83 81 batch_type result; batch_type result;
84 82 for_each( batch.begin(), batch.end(), [&](pointer_type p) { for_each( batch.begin(), batch.end(), [&](pointer_type p) {
85 83 if (!p->is_dead()) if (!p->is_dead())
86 {
87 84 p->invoke(); p->invoke();
85 else
88 86 result.insert(p); result.insert(p);
89 }
90 87 } ); } );
91 88 return result; return result;
92 89 } }
 
... ... namespace om636
94 91 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
95 92 template<typename T> template<typename T>
96 93 template<typename V> template<typename V>
97 auto Batch<T>::process( const batch_type & batch, V v ) -> batch_type
94 auto Batch<T>::process( batch_type batch, V v ) -> batch_type
98 95 { {
99 96 batch_type result; batch_type result;
100 97 for_each( batch.begin(), batch.end(), [&](pointer_type p) { for_each( batch.begin(), batch.end(), [&](pointer_type p) {
101 98 if (!p->is_dead()) if (!p->is_dead())
102 {
103 99 p->invoke(v); p->invoke(v);
100 else
104 101 result.insert(p); result.insert(p);
105 }
106 102 } ); } );
107 103 return result; return result;
108 104 } }
 
... ... namespace om636
110 106 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
111 107 template<typename T> template<typename T>
112 108 template<typename V, typename W> template<typename V, typename W>
113 auto Batch<T>::process( const batch_type & batch, V v, W w ) -> batch_type
109 auto Batch<T>::process( batch_type batch, V v, W w ) -> batch_type
114 110 { {
115 111 batch_type result; batch_type result;
116 112 for_each( batch.begin(), batch.end(), [&](pointer_type p) { for_each( batch.begin(), batch.end(), [&](pointer_type p) {
117 113 if (!p->is_dead()) if (!p->is_dead())
118 {
119 114 p->invoke(v, w); p->invoke(v, w);
115 else
120 116 result.insert(p); result.insert(p);
121 }
122 117 } ); } );
123 118 return result; return result;
124 119 } }
125 120
126 121 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
127 122 template<typename T> template<typename T>
128 void Batch<T>::process_and_kill( const batch_type & batch )
123 void Batch<T>::process_and_kill( batch_type batch )
129 124 { {
130 125 for_each( batch.begin(), batch.end(), [](pointer_type p) { for_each( batch.begin(), batch.end(), [](pointer_type p) {
131 126 if (!p->is_dead()) if (!p->is_dead())
 
... ... namespace om636
136 131 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
137 132 template<typename T> template<typename T>
138 133 template<typename V> template<typename V>
139 void Batch<T>::process_and_kill( const batch_type & batch, V v )
134 void Batch<T>::process_and_kill( batch_type batch, V v )
140 135 { {
141 136 for_each( batch.begin(), batch.end(), [&](pointer_type p) { for_each( batch.begin(), batch.end(), [&](pointer_type p) {
142 137 if (!p->is_dead()) if (!p->is_dead())
 
... ... namespace om636
147 142 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
148 143 template<typename T> template<typename T>
149 144 template<typename V, typename W> template<typename V, typename W>
150 void Batch<T>::process_and_kill( const batch_type & batch, V v, W w )
145 void Batch<T>::process_and_kill( batch_type batch, V v, W w )
151 146 { {
152 147 for_each( batch.begin(), batch.end(), [&](pointer_type p) { for_each( batch.begin(), batch.end(), [&](pointer_type p) {
153 148 if (!p->is_dead()) if (!p->is_dead())
 
... ... namespace om636
178 173 } ); } );
179 174 batch.clear(); batch.clear();
180 175 } }
176
177 /////////////////////////////////////////////////////////////////////////////////////
178 template<typename T>
179 void Batch<T>::merge_new_elements()
180 {
181 elements().insert(m_elements_add.begin(), m_elements_add.end() );
182 m_elements_add.clear();
183 }
181 184
182 185 } // control } // control
183 186 } // om636 } // 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