HP-UX Event ManagerProgrammer's Guide
4 Sample EVM Programming Operations
This chapter describes how to write programs for performing EVM operations.
This chapter addresses the following topics:
• “Performing Simple Event Manipulations” (page 37)
• “Using Variable-Length Argument Lists” (page 38)
• “Adding and Retrieving Variables” (page 39)
• “Posting Events” (page 41)
• “Reading and Writing Events” (page 42)
• “Subscribing Event Notifications” (page 43)
• “Handling Multiple I/O Sources” (page 47)
• “Using Filter Evaluators” (page 48)
• “Matching Event Names” (page 50)
• “Dealing with Missed Events” (page 51)
• “Adding an Event Channel to EVM” (page 52)
Performing Simple Event Manipulations
All EVM clients must work with the EVM event, an opaque binary structure that can hold
standard data items and variables. Example 4-1 illustrates how to create an event, add items to
it, and retrieve the items from it.
Example 4-1 introduces the following functions:
• EvmEventCreate — Creates an empty event. For more information about this function,
see EvmEventCreate(3).
• EvmEventDestroy — Destroys a previously created event, freeing its memory. This function
must be used if it is necessary to free an event. Although the event reference points to a
structure allocated from the heap, that structure contains references to other structures, and
hence using free directly on the event reference results in lost memory. For more information
about this function, see EvmEventDestroy(3).
• EvmItemSet — Sets data item values in the event. The list of items and variables supplied
to this function is the same as the list of items and variables supplied for
theEvmEventCreateVa function. For more information about this function, see
EvmItemSet(3).
• EvmItemGet — Supplies the value of a specified event data item. For more information
about this function, see EvmItemGet(3).
• EvmItemRelease — Releases any memory that was allocated when a specified data item
was retrieved from an event by EvmItemGet(). For more information about this function,
see EvmItemRelease(3).
Performing Simple Event Manipulations 37