Derived from: (none)
Declared in: be/media/TimedEventQueue.h
Library: libmedia.so
Allocation: Constructor only
The BEventIterator class provides functions for iterating over the events in a BTimedEventQueue.
Note that there's no way to go back to the beginning of the search and start over again; you'll have to start over with a new BEventIterator object.
Your node can use event queues to solve a number of complicated scheduling problems. Your control port can simply stuff received events into the queue. Your node's main thread can then simply use a BEventIterator to look for events that need to be processed, and dispatch them at the appropriate times.
<<<give sample code here>>>
BEventIterator(BTimedEventQueue *queue, bigtime_t time, BTimedEventQueue::time_direction direction, bool inclusive = true, int32 type = BTimedEventQueue::B_ANY_EVENT)
Prepares the BEventIterator to iterate over the specified queue. Iteration will begin at the specified time, and will progress in the given direction. If inclusive is true, the iteration will include events scheduled at the indicated time, otherwise the operation will begin just before or after that time. Only events of the specified type are considered. You can iterate over all events by specifying B_INFINITE_TIMEOUT for time, B_BEFORE_TIME as the direction, and BTimedEventQueue::B_ANY_EVENT for the type.
After instantiating a BEventIterator, you should call InitCheck() to determine if any errors occurred.
virtual ~BEventIterator()
Frees any memory used by the BEventIterator.
status_t Bump(bool removeCurrentEvent = false)
Moves on to the next event in the queue. If removeCurrentEvent is true, the current event is removed from the queue first (the queue's cleanup hook is called if necessary).
RETURN CODES
B_OK. The object is ready to use.
B_BAD_INDEX. There aren't any matching events left.
bigtime_t GetCurrentEvent(int32 *what, void **pointer, uint32 *pointerCleanup, int64 *data) const
Returns the time at which the current event is scheduled to occur. The what argument points to a buffer to receive the type of event, the pointer argument points to a buffer to receive the event's pointer, pointerCleanup points to a buffer to receive the cleanup flag for the event, and data points to a buffer to receive the event's data.
status_t InitCheck(void) const
Returns a status_t indicating whether or not the object was constructed successfully; if this returns anything but B_OK, you shouldn't use the BEventIterator.
RETURN CODES
B_OK. The object is ready to use.
B_NO_INIT. The object hasn't been initialized.
B_BAD_INDEX. There aren't any matching events.
Copyright © 1999 Be, Inc. All rights reserved.
Text last modified April 20, 1999.