tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / kits / media / TimedEventQueuePrivate.h
blob70030101f2dee22340698ad7f5c8a8cd69162e4d
1 /***********************************************************************
2 * AUTHOR: Marcus Overhagen
3 * FILE: TimedEventQueuePrivate.cpp
4 * DESCR: implements _event_queue_imp used by BTimedEventQueue,
5 * not thread save!
6 ***********************************************************************/
8 #ifndef _TIMED_EVENT_QUEUE_PRIVATE_H
9 #define _TIMED_EVENT_QUEUE_PRIVATE_H
11 #include <MediaDefs.h>
12 #include <Locker.h>
13 #include "debug.h"
15 struct _event_queue_imp
17 _event_queue_imp();
18 ~_event_queue_imp();
20 status_t AddEvent(const media_timed_event &event);
21 status_t RemoveEvent(const media_timed_event *event);
22 status_t RemoveFirstEvent(media_timed_event * outEvent);
24 bool HasEvents() const;
25 int32 EventCount() const;
27 const media_timed_event * FirstEvent() const;
28 bigtime_t FirstEventTime() const;
29 const media_timed_event * LastEvent() const;
30 bigtime_t LastEventTime() const;
32 const media_timed_event * FindFirstMatch(
33 bigtime_t eventTime,
34 BTimedEventQueue::time_direction direction,
35 bool inclusive,
36 int32 eventType);
38 status_t DoForEach(
39 BTimedEventQueue::for_each_hook hook,
40 void *context,
41 bigtime_t eventTime,
42 BTimedEventQueue::time_direction direction,
43 bool inclusive,
44 int32 eventType);
46 void SetCleanupHook(BTimedEventQueue::cleanup_hook hook, void *context);
47 status_t FlushEvents(
48 bigtime_t eventTime,
49 BTimedEventQueue::time_direction direction,
50 bool inclusive,
51 int32 eventType);
53 #if DEBUG > 1
54 void Dump() const;
55 #endif
57 private:
58 struct event_queue_entry
60 struct event_queue_entry *prev;
61 struct event_queue_entry *next;
62 media_timed_event event;
65 void RemoveEntry(event_queue_entry *entry);
66 void CleanupEvent(media_timed_event *event);
68 event_queue_entry *GetEnd_BeforeTime(bigtime_t eventTime, bool inclusive);
69 event_queue_entry *GetStart_AfterTime(bigtime_t eventTime, bool inclusive);
71 BLocker * fLock;
72 int32 fEventCount;
73 event_queue_entry *fFirstEntry;
74 event_queue_entry *fLastEntry;
75 void * fCleanupHookContext;
76 BTimedEventQueue::cleanup_hook fCleanupHook;
79 #endif //_TIMED_EVENT_QUEUE_PRIVATE_H