OMTimeout 類別

逾時是用於通知指定時間間隔過期的事件(即它會實作 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 - 識別來自使用者程式碼的延遲要求
巨集摘要
DECLARE_MEMORY_ALLOCATOR - 指定一組方法,來宣告逾時的記憶體儲存區
建構摘要
OMTimeout
建構 OMTimeout 物件
~OMTimeout
毀損 OMTimeout 物件
方法摘要
運算子 ==
判定 destinationTimeout 的現行值是否與指定逾時的那些值相同
operator>
判定 Timeout 的現行值是否大於指定逾時的到期時間
~OMCollection
判定 Timeout 的現行值是否小於指定逾時的到期時間
刪除
從資料堆刪除逾時
getDelay
傳回 delayTime 的現行值
getDueTime
傳回資料堆中儲存之逾時要求的到期時間
getTimeoutId
傳回 timeoutId 的現行值
isNotDelay
判定逾時事件是否為逾時延遲
新建
配置其他記憶體
setDelay
設定 Timeout 的值
setDueTime
指定 Timeout 屬性的值
setRelativeDueTime
根據現行系統時間及所要求的延遲時間,計算並設定逾時的到期時間
setState
由架構用於設定現行狀態
setTimeoutId
指定 timeoutId 的值
屬性

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));

回饋