Event Queue in Plug-ins

5 views
Skip to first unread message

Zack Pitts

unread,
May 10, 2008, 12:30:43 PM5/10/08
to mach-ii-for...@googlegroups.com

I’m working on a project that requires dynamic announcing of Events, which I am handling in a pre-process plug-in point.  I am a bit a confused about the EventContext methods for accessing Events in the queue: getNextEvent(), getPreviousEvent(), and getCurrentEvent().  What is the significance of each of these methods when called from the preProcess() and postProcess() plug-in points?

 

Does getNextEvent() return the same Event as getCurrentEvent() when called from preProcess()?  Likewise, does getPreviousEvent() return the same Event as getCurrentEvent() when called from postProcess()?

 

Also, is there a way to target a specific Event in the queue -- not just current, previous and next -- from these plug-in points?  For example, how could I reference the very first Event or the last?  Or even the second in a chain?

 

Thanks,

 

Zack

 

Peter J. Farrell

unread,
May 10, 2008, 8:29:38 PM5/10/08
to mach-ii-for...@googlegroups.com
Zack Pitts said the following on 5/10/2008 11:30 AM:

I’m working on a project that requires dynamic announcing of Events, which I am handling in a pre-process plug-in point.  I am a bit a confused about the EventContext methods for accessing Events in the queue: getNextEvent(), getPreviousEvent(), and getCurrentEvent().  What is the significance of each of these methods when called from the preProcess() and postProcess() plug-in points?

Well, in the preProcess() point the event queue has not started to process yet.  You recommend using getNextEvent() to get the first event in the queue.  In other points, the significance is obvious.  In the postProcess() point, use the getCurrentEvent().

Does getNextEvent() return the same Event as getCurrentEvent() when called from preProcess()? 

Yes they are the same Events.  This behavior did change in Mach-II 1.5.  In versions before 1.5, you had to use getNextEvent() in the preProcess().  I would use getNextEvent as getCurrentEvent the preProcess is a defect and will get fixed in 1.6

Likewise, does getPreviousEvent() return the same Event as getCurrentEvent() when called from postProcess()?

Yes.


Also, is there a way to target a specific Event in the queue -- not just current, previous and next -- from these plug-in points?  For example, how could I reference the very first Event or the last?  Or even the second in a chain?


No.  If you need to do this, something is wrong with the application design.  Mach-II is designed to peek at the next event only -- since the queue is dynamic in nature we do not allow people to peek at events in a random order as they may or may not be there depending on the runtime.

.pjf
Reply all
Reply to author
Forward
0 new messages