SDK Event/Callback Context (Wishlist)

SDK Event/Callback Context // Wishlist

1  |  

grimble

Jun 21, 2006, 6:28am
I'd (REALLY) like to see a new attribute to link solicited events (e.g.
AW_EVENT_CELL_BEGIN, AW_EVENT_CELL_OBJECT and AW_EVENT_CELL_END where the
events are effectively requested by the SDK application calling aw_query,
etc.) and callbacks to the original method call that caused them, like a
"group id".

In order for this to work for both synchronous and asynchronous calls, the
new attribute would need to be set by the application before calling the
method. This would be hugely useful when you have multiple activity streams
going on in a single instance that may conflict. All asynchronous-compatible
methods would be effected (to cater for callbacks).

For example (AW_CONTEXT_ID used as the new attribute) - in the (very
simplistic) code below, the aw_cell_next calls would be throwing
AW_EVENT_CELL_OBJECT events into those resulting from the aw_query call. To
"manage" this at present, I would need to handle the events very intimately,
effectively tracking what cells have been handled for which calls. Having
said that, AW_EVENT_CELL_END has no identification on it whatsoever, and I
don't believe there's anything I can do about that one.

----- 8< -------------------------

// Global Stores
int NextApplicationContextId = 1;
int QueryContextId = 0;
int CellNextContextIdA = 0;
int CellNextContextIdB = 0;

// Program body
QueryContextId = ++ApplicationContextId;
aw_int_set(AW_CONTEXT_ID, QueryContextId);
aw_query(0, 0, CellSequences);

CellNextContextIdA = ++ApplicationContextId;
aw_int_set(AW_CONTEXT_ID, CellNextContextIdA)
aw_int_set(AW_CELL_ITERATOR, 0);
aw_cell_next();

CellNextContextIdB = ++ApplicationContextId;
aw_int_set(AW_CONTEXT_ID, CellNextContextIdB)
aw_int_set(AW_CELL_ITERATOR, 10);
aw_cell_next();

// Event Handler - AW_EVENT_CELL_OBJECT
int ContextId = aw_int(AW_CONTEXT_ID)
if (ContextId == QueryContextId)
// Handle event for aw_query

else if (ContextId == CellNextContextIdA)
// Handle event for first aw_cell_next

else if (ContextId == CellNextContextIdB)
// Handle event for second aw_cell_next

// Callback Handler - AW_CALLBACK_CELL_RESULT
int ContextId = aw_int(AW_CONTEXT_ID)
if (ContextId == CellNextContextIdA)
// Handle callback for first aw_cell_next

else if (ContextId == CellNextContextIdB)
// Handle callback for second aw_cell_next

----- 8< -------------------------

On the subject if event/callback attributes, something that would suit me
would be additional attributes that identify the event or callback that has
been raised, so that I could attach more than one callback/event to a single
handler proc. Its more of a preference thing than a need, so I expect I may
be on my own on that one.

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn