List of commits:
Subject Hash Author Date (UTC)
master rework batch 6f96134102be0e5a3dc2d9745640b98edc5d4e4d mbusenitz 2015-02-28 23:09:16
fix traverse destructive 2c3839ec7a709d3412e7f5b3e5acc3ed5d900e97 mbusenitz 2015-02-28 18:25:42
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 6f96134102be0e5a3dc2d9745640b98edc5d4e4d - master rework batch
Author: mbusenitz
Author date (UTC): 2015-02-28 23:09
Committer name: mbusenitz
Committer date (UTC): 2015-02-28 23:09
Parent(s): 2c3839ec7a709d3412e7f5b3e5acc3ed5d900e97
Signer:
Signing key:
Signing status: N
Tree: 704256e2c3c9eed3e6752b392ef74aad2199090b
File Lines added Lines deleted
src/batch.h 34 22
src/batch.hxx 107 111
File src/batch.h changed (mode: 100644) (index 3cece2a..0772dc7)
... ... namespace om636
45 45
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
49 static void process_and_kill( batch_type & );
50
51 template<typename V>
52 static void process_and_kill( batch_type &, V );
53
54 template<typename V, typename W>
55 static void process_and_kill( batch_type &, V, W );
56
57 static batch_type process( batch_type );
58
59 template<typename V>
60 static batch_type process( batch_type, V );
61
62 template<typename V, typename W>
63 static batch_type process( batch_type, V, W );
64
65 static void kill_all(batch_type &);
66
67 batch_type & elements();
48
49 batch_type & elements();
68 50 const batch_type & elements() const; const batch_type & elements() const;
69 51
52 void merge_added_elements();
53
70 54 private: private:
71 55
72 void merge_new_elements();
73
74 56 batch_type m_elements; batch_type m_elements;
75 57 batch_type m_elements_add; batch_type m_elements_add;
76 58 }; };
59
60 namespace utils
61 {
62
63 template<typename T>
64 void process_and_kill( batch_type & );
65
66 template<typename T>
67 template<typename V>
68 void process_and_kill( batch_type &, V );
69
70 template<typename T>
71 template<typename V, typename W>
72 void process_and_kill( batch_type &, V, W );
73
74 template<typename T>
75 void process( batch_type & );
76
77 template<typename T>
78 template<typename V>
79 void process( batch_type &, V );
80
81 template<typename T>
82 template<typename V, typename W>
83 void process( batch_type &, V, W );
84
85 template<typename T>
86 void kill_all(batch_type &);
87 }
88
77 89 } //control } //control
78 90 } // om636 } // om636
79 91
File src/batch.hxx changed (mode: 100644) (index 3a27a82..ce650c1)
... ... namespace om636
15 15 template<typename T> template<typename T>
16 16 void Batch<T>::unhook() void Batch<T>::unhook()
17 17 { {
18 kill_all( elements() );
19 kill_all( m_elements_add );
18 utils::kill_all( elements() );
19 utils::kill_all( m_elements_add );
20 20 } }
21 21
22 22 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
23 23 template<typename T> template<typename T>
24 24 void Batch<T>::traverse() void Batch<T>::traverse()
25 25 { {
26 merge_new_elements();
26 merge_added_elements();
27 27
28 const batch_type & sub( process( elements() ) );
29 elements().erase( sub.begin(), sub.end() );
28 utils::process( elements() );
30 29 } }
31 30
32 31 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
34 33 template<class V> template<class V>
35 34 void Batch<T>::traverse(V arg) void Batch<T>::traverse(V arg)
36 35 { {
37 merge_new_elements();
36 merge_added_elements();
38 37
39 const batch_type & sub( process( elements(), arg ) );
40 elements().erase( sub.begin(), sub.end() );
38 utils::process( elements(), arg );
41 39 } }
42 40
43 41 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
45 43 template<typename V, typename W> template<typename V, typename W>
46 44 void Batch<T>::traverse(V first_arg, W second_arg ) void Batch<T>::traverse(V first_arg, W second_arg )
47 45 { {
48 merge_new_elements();
46 merge_added_elements();
49 47
50 const batch_type & sub( process( elements(), first_arg, second_arg ) );
51 elements().erase( sub.begin(), sub.end() );
48 utils::process( elements(), first_arg, second_arg );
52 49 } }
53 50
54 51 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
55 52 template<typename T> template<typename T>
56 53 void Batch<T>::traverse_destructive() void Batch<T>::traverse_destructive()
57 54 { {
58 merge_new_elements();
55 merge_added_elements();
59 56
60 process_and_kill( elements() );
57 utils::process_and_kill( elements() );
61 58 } }
62 59
63 60 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
65 62 template<class V> template<class V>
66 63 void Batch<T>::traverse_destructive(V arg) void Batch<T>::traverse_destructive(V arg)
67 64 { {
68 merge_new_elements();
65 merge_added_elements();
69 66
70 process_and_kill( elements(), arg );
67 utils::process_and_kill( elements(), arg );
71 68 } }
72 69
73 70 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
 
... ... namespace om636
75 72 template<typename V, typename W> template<typename V, typename W>
76 73 void Batch<T>::traverse_destructive(V first_arg, W second_arg ) void Batch<T>::traverse_destructive(V first_arg, W second_arg )
77 74 { {
78 merge_new_elements();
75 merge_added_elements();
79 76
80 process_and_kill( elements(), first_arg, second_arg );
77 utils::process_and_kill( elements(), first_arg, second_arg );
81 78 } }
82 79
83 /////////////////////////////////////////////////////////////////////////////////////
84 template<typename T>
85 auto Batch<T>::process( batch_type batch ) -> batch_type
86 {
87 batch_type result;
88 for_each( batch.begin(), batch.end(), [&](pointer_type p) {
89 if (!p->is_dead())
90 p->invoke();
91 else
92 result.insert(p);
93 } );
94 return result;
95 }
96
97 /////////////////////////////////////////////////////////////////////////////////////
98 template<typename T>
99 template<typename V>
100 auto Batch<T>::process( batch_type batch, V v ) -> batch_type
101 {
102 batch_type result;
103 for_each( batch.begin(), batch.end(), [&](pointer_type p) {
104 if (!p->is_dead())
105 p->invoke(v);
106 else
107 result.insert(p);
108 } );
109 return result;
110 }
111
112 /////////////////////////////////////////////////////////////////////////////////////
113 template<typename T>
114 template<typename V, typename W>
115 auto Batch<T>::process( batch_type batch, V v, W w ) -> batch_type
116 {
117 batch_type result;
118 for_each( batch.begin(), batch.end(), [&](pointer_type p) {
119 if (!p->is_dead())
120 p->invoke(v, w);
121 else
122 result.insert(p);
123 } );
124 return result;
125 }
126
127 /////////////////////////////////////////////////////////////////////////////////////
128 template<typename T>
129 void Batch<T>::process_and_kill( batch_type & batch )
130 {
131 batch_type copy(batch);
132 for_each( copy.begin(), copy.end(), [](pointer_type p) {
133 if (!p->is_dead())
134 p->kill_invoke();
135 } );
136 batch.clear();
137 }
138
139 /////////////////////////////////////////////////////////////////////////////////////
140 template<typename T>
141 template<typename V>
142 void Batch<T>::process_and_kill( batch_type & batch, V v )
143 {
144 batch_type copy(batch);
145 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
146 if (!p->is_dead())
147 p->kill_invoke(v);
148 } );
149 batch.clear();
150 }
151
152 /////////////////////////////////////////////////////////////////////////////////////
153 template<typename T>
154 template<typename V, typename W>
155 void Batch<T>::process_and_kill( batch_type & batch, V v, W w )
156 {
157 batch_type copy(batch);
158 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
159 if (!p->is_dead())
160 p->kill_invoke(v, w);
161 } );
162 batch.clear();
163 }
164
165 80 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
166 81 template<typename T> template<typename T>
167 82 auto Batch<T>::elements() -> batch_type & auto Batch<T>::elements() -> batch_type &
 
... ... namespace om636
178 93
179 94 ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
180 95 template<typename T> template<typename T>
181 void Batch<T>::kill_all(batch_type & batch)
182 {
183 for_each( batch.begin(), batch.end(), [](pointer_type p) {
184 p->kill();
185 } );
186 batch.clear();
187 }
188
189 /////////////////////////////////////////////////////////////////////////////////////
190 template<typename T>
191 void Batch<T>::merge_new_elements()
96 void Batch<T>::merge_added_elements()
192 97 { {
193 98 elements().insert(m_elements_add.begin(), m_elements_add.end() ); elements().insert(m_elements_add.begin(), m_elements_add.end() );
194 99 m_elements_add.clear(); m_elements_add.clear();
195 100 } }
196
101
102 namespace utils
103 {
104 /////////////////////////////////////////////////////////////////////////////////////
105 template<typename T>
106 void process( T & elements )
107 {
108 batch_type copy(elements);
109 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
110 if (!p->is_dead())
111 p->invoke();
112 else
113 elements.erase(p);
114 } );
115 }
116
117 /////////////////////////////////////////////////////////////////////////////////////
118 template<typename T>
119 template<typename V>
120 void process( T & elements, V v )
121 {
122 batch_type copy(elements);
123 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
124 if (!p->is_dead())
125 p->invoke(v);
126 else
127 elements.erase(p);
128 } );
129 }
130
131 /////////////////////////////////////////////////////////////////////////////////////
132 template<typename T>
133 template<typename V, typename W>
134 void process( T & elements, V v, W w )
135 {
136 batch_type copy(elements);
137 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
138 if (!p->is_dead())
139 p->invoke(v, w);
140 else
141 elements.erase(p);
142 } );
143 }
144
145 /////////////////////////////////////////////////////////////////////////////////////
146 template<typename T>
147 void process_and_kill( T & elements )
148 {
149 batch_type copy(elements);
150 for_each( copy.begin(), copy.end(), [](pointer_type p) {
151 if (!p->is_dead())
152 p->kill_invoke();
153 } );
154 elements.clear();
155 }
156
157 /////////////////////////////////////////////////////////////////////////////////////
158 template<typename T>
159 template<typename V>
160 void process_and_kill( T & elements, V v )
161 {
162 batch_type copy(elements);
163 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
164 if (!p->is_dead())
165 p->kill_invoke(v);
166 } );
167 elements.clear();
168 }
169
170 /////////////////////////////////////////////////////////////////////////////////////
171 template<typename T>
172 template<typename V, typename W>
173 void process_and_kill( T & elements, V v, W w )
174 {
175 batch_type copy(elements);
176 for_each( copy.begin(), copy.end(), [&](pointer_type p) {
177 if (!p->is_dead())
178 p->kill_invoke(v, w);
179 } );
180 elements.clear();
181 }
182
183 /////////////////////////////////////////////////////////////////////////////////////
184 template<typename T>
185 void kill_all(T & elements)
186 {
187 for_each( elements.begin(), elements.end(), [](pointer_type p) {
188 p->kill();
189 } );
190 elements.clear();
191 }
192 } // utils
197 193 } // control } // control
198 194 } // 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