comparison base/EventSeries.h @ 1635:e8e51f3ca120 single-point

Add getEventsWithin
author Chris Cannam
date Wed, 13 Mar 2019 10:01:02 +0000
parents 6ac92836cd86
children b57a75aa5ae3
comparison
equal deleted inserted replaced
1634:687a2453cc15 1635:e8e51f3ca120
59 bool contains(const Event &e) const; 59 bool contains(const Event &e) const;
60 bool isEmpty() const; 60 bool isEmpty() const;
61 int count() const; 61 int count() const;
62 62
63 /** 63 /**
64 * Retrieve all events any part of which falls within the span in 64 * Retrieve all events any part of which falls within the range in
65 * frames defined by the given frame f and duration d. 65 * frames defined by the given frame f and duration d.
66 * 66 *
67 * - An event without duration is within the span if its own frame 67 * - An event without duration is spanned by the range if its own
68 * is greater than or equal to f and less than f + d. 68 * frame is greater than or equal to f and less than f + d.
69 * 69 *
70 * - An event with duration is within the span if its start frame 70 * - An event with duration is spanned by the range if its start
71 * is less than f + d and its start frame plus its duration is 71 * frame is less than f + d and its start frame plus its duration
72 * greater than f. 72 * is greater than f.
73 * 73 *
74 * Note: Passing a duration of zero is seldom useful here; you 74 * Note: Passing a duration of zero is seldom useful here; you
75 * probably want getEventsCovering instead. getEventsSpanning(f, 75 * probably want getEventsCovering instead. getEventsSpanning(f,
76 * 0) is not equivalent to getEventsCovering(f). The latter 76 * 0) is not equivalent to getEventsCovering(f). The latter
77 * includes durationless events at f and events starting at f, 77 * includes durationless events at f and events starting at f,
79 */ 79 */
80 EventVector getEventsSpanning(sv_frame_t frame, 80 EventVector getEventsSpanning(sv_frame_t frame,
81 sv_frame_t duration) const; 81 sv_frame_t duration) const;
82 82
83 /** 83 /**
84 * Retrieve all events falling wholly within the range in frames
85 * defined by the given frame f and duration d.
86 *
87 * - An event without duration is within the range if its own
88 * frame is greater than or equal to f and less than f + d.
89 *
90 * - An event with duration is within the range if its start frame
91 * is greater than or equal to f and its start frame plus its
92 * duration is less than or equal to f + d.
93 */
94 EventVector getEventsWithin(sv_frame_t frame,
95 sv_frame_t duration) const;
96
97 /**
84 * Retrieve all events that cover the given frame. An event without 98 * Retrieve all events that cover the given frame. An event without
85 * duration covers a frame if its own frame is equal to it. An event 99 * duration covers a frame if its own frame is equal to it. An event
86 * with duration covers a frame if its start frame is less than or 100 * with duration covers a frame if its start frame is less than or
87 * equal to it and its end frame (start + duration) is greater 101 * equal to it and its end frame (start + duration) is greater
88 * than it. 102 * than it.
89 */ 103 */
90 EventVector getEventsCovering(sv_frame_t frame) const; 104 EventVector getEventsCovering(sv_frame_t frame) const;
91 105
92 /** 106 /**
93 * If e is in the series and is not the first event in it, set 107 * If e is in the series and is not the first event in it, set
94 * preceding to the event immediate preceding it according to the 108 * preceding to the event immediate preceding it according to the
95 * standard event ordering and return true. Otherwise leave 109 * standard event ordering and return true. Otherwise leave
96 * preceding unchanged and return false. 110 * preceding unchanged and return false.