Mercurial > hg > svcore
comparison base/EventSeries.h @ 1653:eaad70939848 single-point
Add nearest-event-matching search
author | Chris Cannam |
---|---|
date | Tue, 19 Mar 2019 14:24:05 +0000 |
parents | 513192aa9b03 |
children | 26aa42fd60e9 |
comparison
equal
deleted
inserted
replaced
1652:08bed13d3a26 | 1653:eaad70939848 |
---|---|
159 * | 159 * |
160 * It is acceptable for following to alias e when this is called. | 160 * It is acceptable for following to alias e when this is called. |
161 */ | 161 */ |
162 bool getEventFollowing(const Event &e, Event &following) const; | 162 bool getEventFollowing(const Event &e, Event &following) const; |
163 | 163 |
164 enum Direction { | |
165 Forward, | |
166 Backward | |
167 }; | |
168 | |
169 /** | |
170 * Return the first event for which the given predicate returns | |
171 * true, searching events with start frames increasingly far from | |
172 * the given frame in the given direction. If the direction is | |
173 * Forward then the search includes events starting at the given | |
174 * frame, otherwise it does not. | |
175 */ | |
176 bool getNearestEventMatching(sv_frame_t startSearchAt, | |
177 std::function<bool(const Event &)> predicate, | |
178 Direction direction, | |
179 Event &found) const; | |
180 | |
164 /** | 181 /** |
165 * Return the event at the given numerical index in the series, | 182 * Return the event at the given numerical index in the series, |
166 * where 0 = the first event and count()-1 = the last. | 183 * where 0 = the first event and count()-1 = the last. |
167 */ | 184 */ |
168 Event getEventByIndex(int index) const; | 185 Event getEventByIndex(int index) const; |
171 * Return the index of the first event in the series that does not | 188 * Return the index of the first event in the series that does not |
172 * compare inferior to the given event. If there is no such event, | 189 * compare inferior to the given event. If there is no such event, |
173 * return count(). | 190 * return count(). |
174 */ | 191 */ |
175 int getIndexForEvent(const Event &e) const; | 192 int getIndexForEvent(const Event &e) const; |
176 | 193 |
177 /** | 194 /** |
178 * Emit to XML as a dataset element. | 195 * Emit to XML as a dataset element. |
179 */ | 196 */ |
180 void toXml(QTextStream &out, | 197 void toXml(QTextStream &out, |
181 QString indent, | 198 QString indent, |