91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.39MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-15
  • 語言: 其他
  • 標簽:

資源簡介

FSM參考代碼 通訊協議狀態機實現的代碼參考實例 對學習狀態機很有幫助 www.zmemb.com

資源截圖

代碼片段和文件信息

//
//?FiniteStateMachine.cpp
//
//?This?software?was?developed?by?U.S.?Government?employees?as?part?of
//?their?official?duties?and?is?not?subject?to?copyright.?No?warranty?implied?
//?or?intended.

//????Green?Table?Row
//???????Red?Table?Row

#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif?
#include?“stdAfx.h“


#include?“FiniteStateMachine.h“
#include?
#include?“Logging.h“


using?namespace?std;
//?Extension?to?varags.

#define?va_arg_noupdate(apt)????(?*(t?*)(ap)?)
IMPLEMENT_DYNAMIC(CFiniteStateMachine?Cobject?)

int?CFiniteStateMachine::gdebug?=?0;



//public?String?[]?startupEvents?=?{?“init“?“start“?};?//?This?is?an?error
//public?String?[]?startupEvents?=?{?“init“?“start“?“enable“?};
//?public?String?[]?shutdownEvents?=?{?“disable“?“shutdown“?};
/**?
*?Default?constructor.?Nulls?out?current?history?event?state?and?FSM.
*?Sets?default?name?to?CFiniteStateMchine?and?type?to?FSM.?this
*/
CFiniteStateMachine::CFiniteStateMachine()
{
#ifdef?FSMDEBUG
strcpy(classname?“CFiniteStateMachine“);
// RegisterItem((MyRefListCallback)?&CFiniteStateMachine::GetMyRefList);
#endif
type?=?CFSMState::FSM;
owner=this;?//?replaced?if?used?by?other
setName(“CFiniteStateMachine“);
debug=0;
currentEvent=NULL;
currentState=NULL;
currentFSM?=?this;??
lastEvent=NULL;
lastState=NULL;
lastFSM?=?this;
m_doneFlag=false;
m_doEvent=?new?CFSMEvent(“do“);
history=NULL;
// CFiniteStateMachine::collection[getName()]=this;?
firstState.Load(“bogus?-?check?to?make?sure?you?set?the?first?state“);
m_updating=false;
m_HMutex?=?::CreateMutex(?NULL?FALSE?NULL);
m_pID=0;
m_count=0;
m_hThread=NULL;
m_exitFlag=0;
//?CreateEventA(????LPSECURITY_ATTRIBUTES?lpEventAttributes??BOOL?bManualReset?BOOL?bInitialState????LPCSTR?lpName????);
m_hThreadKilled =?::CreateEvent(NULL?FALSE?FALSE?NULL);?//?auto?reset?initially?reset
m_hTimerExpired=NULL;
m_hTimer=NULL;
m_policy=new?CFSMPolicy();?//?no?sharing?of?universal?policy.?Must?manually?do?this.
m_transitionlog.SetMax(100);
m_snapshotlog.SetMax(100);
m_bBreakonerror=false;
m_cyclenum=0;

}

/**?FIXME:?this?should?really?handle?errors
*?If?error?string?is?emtpy?or?null?return?S_OK.?And?skip?setting?error.
*/
HRESULT?CFiniteStateMachine::SetError(String?str)
{
if(str.IsEmpty()?||?str.IsNull())?
return?S_OK;

m_errmsg=str;
if(m_bBreakonerror)
{
_asm?int?3;

}
return?E_FAIL;
}

/**
Virtual?function?to?overload.?Default?is?to?return?object?type
i.e.?FiniteStateMachine?but?overloaded?will?return?instance?name.
*/
HRESULT?CFiniteStateMachine::GetName(BSTR?*?name)?
{
*name??=?SysAllocString((BSTR)?this->name);
return?S_OK;
};

void?CFiniteStateMachine::AddError(String?errmsg)
{
m_errmsg+=errmsg;
}

void?CFiniteStateMachine::ResetError()
{
m_errmsg=L““;
}


HRESULT?CFiniteStateMachine::HandleErr

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????28709??2002-10-28?16:15??Samples\Calculator.cpp
?????文件????????6403??2002-10-28?16:16??Samples\calculator.html
?????文件????????3412??2002-10-28?16:16??Samples\calculatorTiming.html
?????文件???????13554??2002-10-28?16:16??Samples\CDPlayer?Logging
?????文件????????6898??2002-04-26?07:20??Samples\CDPlayer.h
?????文件??????249813??2002-10-28?16:16??Samples\debug.txt
?????文件????????6421??2002-10-28?16:16??Samples\failedCalculatorHTML.html
?????文件????????2536??2000-09-15?08:48??Samples\MYSTACK.h
?????文件????????2722??2002-10-28?16:16??Samples\playerFSMLogic.html
?????文件????????2221??2002-10-28?16:16??Samples\playerTiming.html
?????文件???????11928??2002-10-28?16:15??Samples\RCSExample.h
?????文件????????1612??2000-10-19?07:26??Samples\ReadMe.txt
?????文件?????????448??2000-10-19?07:26??Samples\Resource.h
?????文件?????????244??2000-10-19?07:26??Samples\Samples.clw
?????文件?????????969??2000-10-19?07:36??Samples\Samples.cpp
?????文件????????7096??2002-04-26?08:02??Samples\Samples.dsp
?????文件?????????537??2000-10-19?07:26??Samples\Samples.dsw
?????文件?????????398??2000-10-19?07:33??Samples\Samples.h
?????文件??????287744??2002-10-28?16:17??Samples\Samples.ncb
?????文件???????53760??2002-10-28?16:17??Samples\Samples.opt
?????文件????????2735??2002-10-28?16:16??Samples\Samples.plg
?????文件????????1458??2000-10-19?07:26??Samples\Samples.rc
?????文件?????????294??2000-10-19?07:26??Samples\StdAfx.cpp
?????文件????????1161??2002-10-28?16:10??Samples\StdAfx.h
?????文件???????11427??2002-10-28?16:15??Samples\Stripper.cpp
?????文件????????2063??2000-09-28?13:32??Samples\TestProgram.cpp
?????文件????????5449??2000-09-27?14:32??Samples\WINDOW.CPP
?????文件????????1403??2000-09-27?14:25??Samples\WINDOW.H
?????目錄???????????0??2002-10-28?16:18??Samples\
?????文件?????????947??2000-07-07?16:29??fsmlib.dsw
?????文件????????7357??2002-04-26?07:39??fsmlib.dsp
............此處省略275個文件信息

評論

共有 條評論

相關資源