Event statements are used to define the database events for a class.
For example:
class MyClass { unsigned<4> u4; event <new> newEvent; event <update> updateEvent; event <delete> deleteEvent; event <checkpoint> checkpointEvent; }Database event types must be one of the following:
new- called when an object of this class is created.delete- called when an object of this class is deleted.checkpoint- called when a checkpoint is called for an object of this class.update- called when an object of this class is modified.Update events
An
updateevent can be defined for the entire class or for a specific field of the class. The example above defines a class update event that will call the specified handler any time an existing object of this class is modified. However, if a field is specified, the specified handler will be called only when that field of an existing object is modified. For example, the following defines a field update event handler for fieldu4:class MyClass { unsigned<4> u4; event <u4 update> update_u4_Event; }Note that it is not possible to define a field update event for a class that also has a class update event defined.
Events can be managed either synchronously or asynchronously. (Please refer to SDK samples
10 events synchand10 events asynchfor implementation details.)