1 /***********************************************************************
2 * AUTHOR: Marcus Overhagen
3 * FILE: TimedEventQueue.cpp
4 * DESCR: used by BMediaEventLooper
5 ***********************************************************************/
7 #include <TimedEventQueue.h>
9 #include "TimedEventQueuePrivate.h"
12 /*************************************************************
13 * struct media_timed_event
14 *************************************************************/
16 media_timed_event::media_timed_event()
19 memset(this, 0, sizeof(*this));
23 media_timed_event::media_timed_event(bigtime_t inTime
,
27 memset(this, 0, sizeof(*this));
33 media_timed_event::media_timed_event(bigtime_t inTime
,
39 memset(this, 0, sizeof(*this));
47 media_timed_event::media_timed_event(bigtime_t inTime
,
57 memset(this, 0, sizeof(*this));
64 memcpy(user_data
,inUserData
,min_c(sizeof(media_timed_event::user_data
),dataSize
));
68 media_timed_event::media_timed_event(const media_timed_event
&clone
)
76 media_timed_event::operator=(const media_timed_event
&clone
)
79 memcpy(this, &clone
, sizeof(*this));
83 media_timed_event::~media_timed_event()
88 /*************************************************************
90 *************************************************************/
92 bool operator==(const media_timed_event
& a
, const media_timed_event
& b
)
95 return (0 == memcmp(&a
,&b
,sizeof(media_timed_event
)));
98 bool operator!=(const media_timed_event
& a
, const media_timed_event
& b
)
101 return (0 != memcmp(&a
,&b
,sizeof(media_timed_event
)));
104 bool operator<(const media_timed_event
& a
, const media_timed_event
& b
)
107 return a
.event_time
< b
.event_time
;
110 bool operator>(const media_timed_event
& a
, const media_timed_event
&b
)
113 return a
.event_time
> b
.event_time
;
117 /*************************************************************
118 * public BTimedEventQueue
119 *************************************************************/
123 BTimedEventQueue::operator new(size_t s
)
126 return ::operator new(s
);
131 BTimedEventQueue::operator delete(void *p
, size_t s
)
134 return ::operator delete(p
);
138 BTimedEventQueue::BTimedEventQueue() :
139 fImp(new _event_queue_imp
)
145 BTimedEventQueue::~BTimedEventQueue()
153 BTimedEventQueue::AddEvent(const media_timed_event
&event
)
156 return fImp
->AddEvent(event
);
161 BTimedEventQueue::RemoveEvent(const media_timed_event
*event
)
164 return fImp
->RemoveEvent(event
);
169 BTimedEventQueue::RemoveFirstEvent(media_timed_event
*outEvent
)
172 return fImp
->RemoveFirstEvent(outEvent
);
177 BTimedEventQueue::HasEvents() const
180 return fImp
->HasEvents();
185 BTimedEventQueue::EventCount() const
188 return fImp
->EventCount();
192 const media_timed_event
*
193 BTimedEventQueue::FirstEvent() const
196 return fImp
->FirstEvent();
201 BTimedEventQueue::FirstEventTime() const
204 return fImp
->FirstEventTime();
208 const media_timed_event
*
209 BTimedEventQueue::LastEvent() const
212 return fImp
->LastEvent();
217 BTimedEventQueue::LastEventTime() const
220 return fImp
->LastEventTime();
224 const media_timed_event
*
225 BTimedEventQueue::FindFirstMatch(bigtime_t eventTime
,
226 time_direction direction
,
231 return fImp
->FindFirstMatch(eventTime
, direction
, inclusive
, eventType
);
236 BTimedEventQueue::DoForEach(for_each_hook hook
,
239 time_direction direction
,
244 return fImp
->DoForEach(hook
, context
, eventTime
, direction
, inclusive
, eventType
);
249 BTimedEventQueue::SetCleanupHook(cleanup_hook hook
,
253 fImp
->SetCleanupHook(hook
, context
);
258 BTimedEventQueue::FlushEvents(bigtime_t eventTime
,
259 time_direction direction
,
264 return fImp
->FlushEvents(eventTime
, direction
, inclusive
, eventType
);
267 /*************************************************************
268 * private BTimedEventQueue
269 *************************************************************/
273 BTimedEventQueue::BTimedEventQueue(const BTimedEventQueue &other)
274 BTimedEventQueue &BTimedEventQueue::operator=(const BTimedEventQueue &other)
277 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_0(void *, ...) { return B_ERROR
; }
278 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_1(void *, ...) { return B_ERROR
; }
279 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_2(void *, ...) { return B_ERROR
; }
280 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_3(void *, ...) { return B_ERROR
; }
281 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_4(void *, ...) { return B_ERROR
; }
282 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_5(void *, ...) { return B_ERROR
; }
283 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_6(void *, ...) { return B_ERROR
; }
284 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_7(void *, ...) { return B_ERROR
; }
285 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_8(void *, ...) { return B_ERROR
; }
286 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_9(void *, ...) { return B_ERROR
; }
287 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_10(void *, ...) { return B_ERROR
; }
288 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_11(void *, ...) { return B_ERROR
; }
289 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_12(void *, ...) { return B_ERROR
; }
290 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_13(void *, ...) { return B_ERROR
; }
291 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_14(void *, ...) { return B_ERROR
; }
292 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_15(void *, ...) { return B_ERROR
; }
293 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_16(void *, ...) { return B_ERROR
; }
294 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_17(void *, ...) { return B_ERROR
; }
295 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_18(void *, ...) { return B_ERROR
; }
296 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_19(void *, ...) { return B_ERROR
; }
297 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_20(void *, ...) { return B_ERROR
; }
298 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_21(void *, ...) { return B_ERROR
; }
299 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_22(void *, ...) { return B_ERROR
; }
300 status_t
BTimedEventQueue::_Reserved_BTimedEventQueue_23(void *, ...) { return B_ERROR
; }