OMTimeout class

A timeout is an event used for notification that a specified time interval has expired (that is, it implements a UML time event).

Timeouts are either created by instances entering states with timeout transitions, or delay requests from user code. In the latter case, the timeoutDelayId of this event is as follows:
const short timeoutDelayId = -1;

The OMTimeout class is declared in the header file event.h.

OMTimeout uses the following comparison functions to manipulate its heap structure:
int operator==(OMTimeout& tn)
{OMBoolean matchDest = getDestination() ==
tn.getDestination();
OMBoolean matchId = ((getTimeoutId() ==
tn.getTimeoutId()) || (getTimeoutId() ==
OMEventAnyEventId) ||
(OMEventAnyEventId == tn.getTimeoutId()));
return (matchDest && matchId);
}
int operator>(OMTimeout& tn) {return dueTime >
tn.dueTime;}
int operator<(OMTimeout& tn) {return dueTime <
tn.dueTime;}

Attribute summary
timeoutDelayId - identifies a delay request from user code
Macro summary
DECLARE_MEMORY_ALLOCATOR - specifies a set of methods that declare the memory pool for timeouts
Construction summary
OMTimeout
Constructs an OMTimeout object
~OMTimeout
Destroys the OMTimeout object
Method summary
operator ==
Determines whether the current values of destination and Timeout are the same as those of the specified timeout
operator >
Determines whether the current value of Timeout is greater than the due time of the specified timeout
~OMCollection
Determines whether the current value of Timeout is less than the due time of the specified timeout
Delete
Deletes a timeout from the heap
getDelay
Returns the current value of delayTime
getDueTime
Returns the due time of a timeout request stored in the heap
getTimeoutId
Returns the current value for timeoutId
isNotDelay
Determines whether a timeout event is a timeout delay
new
Allocates additional memory
setDelay
Sets the value of Timeout
setDueTime
Specifies the value for the Timeout attribute
setRelativeDueTime
Calculates and sets the due time for a timeout based on the current system time and the requested delay time
setState
Used by the framework to set the current state
setTimeoutId
Specifies the value for timeoutId
Attribute

timeoutDelayId

This global attribute identifies a delay request from user code. It is defined as follows:

const short timeoutDelayId = -1;
Macro

DECLARE_MEMORY_ALLOCATOR

This public macro specifies a set of methods that declare the memory pool for timeouts. The default number of timeouts is 100.

The DECLARE_MEMORY_ALLOCATOR macro is defined in MemAlloc.h as follows:

#define DECLARE_MEMORY_ALLOCATOR (CLASSNAME)
   
   public:
   
   CLASSNAME * OMMemoryPoolNextChunk;
   DECLARE_ALLOCATION_OPERATORS
      static void OMMemoryPoolIsEmpty();
      static void OMMemoryPoolSetIncrement(int value);
      static void OMCallMemoryPoolIsEmpty(
         OMBoolean flagValue);
      static void OMSetMemoryAllocator(
         CLASSNAME*(*newAllocator)(int));

Feedback