제한시간은 지정한 시간 간격이 만기되었음을 알리는 데 사용됩니다. 즉, 제한시간은 UML 시간 이벤트를 구현합니다.
제한시간은
제한시간 상태 전이와 함께 상태로 전환된 인스턴스 또는 사용자 코드의
지연 요청에 따라 작성됩니다. 후자의 경우 이 이벤트의 timeoutDelayId는
다음과 같습니다.
const short timeoutDelayId
= -1;
OMTimeout 클래스는 헤더 파일인 event.h에 선언되어 있습니다.
OMTimeout은 다음 비교 함수를 사용하여
힙 구조를 조작합니다.
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;}
timeoutDelayId
이러한 글로벌 속성은 사용자 코드에서 지연 요청을 식별합니다. 이는 다음과 같이 정의합니다.
const short timeoutDelayId = -1;
DECLARE_MEMORY_ALLOCATOR
이러한 공용 매크로는 제한시간에 대한 메모리 풀을 선언하는 메소드 세트를 지정합니다. 제한시간의 기본값은 100입니다.
DECLARE_MEMORY_ALLOCATOR 매크로는 다음과 같이 MemAlloc.h에 정의되어 있습니다.
#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));