An Event may be created at the top-level under the Listener object, as a subordinate of a Container object, or subordinate to another Event object (a sub-Event). In the first two cases, the programmer must specify the event class of the Event, while in the latter case, the class must be the same as the parent Event object's class.
This function will create an Event object only when that object does not already exist. If the object already exists, the existing object is returned.
When using the Listener object or a Container object to create an Event, the
event class must be specified using the EventClass
enumeration object, which includes the constants RPC
and USER
.
When creating an Event subordinate to another Event (sub-Event), the event class
is not specified because sub-Events must have the same class as their parent
Event object.
CAUTION The application should not call delete on any objects returned by this function.
Event *lookupEvent(EventClass eventClass, const char
*eventName, [optional] bool includeParent);
Event *lookupEvent(EventClass eventClass, const wchar_t *eventName,
[optional] bool includeParent);
Event *lookupEvent(EventClass eventClass, const char
*eventName, [optional] bool includeParent);
Event *lookupEvent(EventClass eventClass, const wchar_t *eventName,
[optional] bool includeParent);
Event *lookupEvent(const char *eventName, [optional] bool
includeParent);
Event *lookupEvent(const wchar_t *eventName, [optional] bool
includeParent);
RPC
or USER
. This parameter is not
specified when creating a sub-Event because the event class of the sub-Event
must be the same as that employed by the parent Event object.Listener *listener = new Listener("sampleApp", "4.0",
NULL, false);
Event *creations = listener->lookupEvent(USER, "document creations");
- or -
Event *creations = new Event(USER, "document creations");
Accumulator *numCreations = creations->numCreations("number of document creations");
...
delete creations;
creations = NULL;
- or -
Listener *listener = new Listener("sampleApp", "4.0",
NULL, false);
Container *store = listener->lookupContainer("storeName");
Event *creations = store->lookupEvent("document creations", false);
Event *subCreations = creations->lookupEvent("document sub-creations");
Meter *creationSize = creations->lookupMeter("creation size");
Accumulator *numCreations = creations->numCreations("number of document creations");
...