X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=service%2Fnative%2Fframework_unified%2Fclient%2FNS_FrameworkCore%2Finclude%2Fstatemachine%2Fframeworkunified_sm_framework_core.h;fp=service%2Fnative%2Fframework_unified%2Fclient%2FNS_FrameworkCore%2Finclude%2Fstatemachine%2Fframeworkunified_sm_framework_core.h;h=ea564df743928dfd951b330b7f6d2a8d94c2190f;hb=17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d;hp=0000000000000000000000000000000000000000;hpb=9e86046cdb356913ae026f616e5bf17f6f238aa5;p=staging%2Fbasesystem.git diff --git a/service/native/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h b/service/native/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h new file mode 100755 index 0000000..ea564df --- /dev/null +++ b/service/native/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h @@ -0,0 +1,89 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_StateMachine +/// \brief +/// +/// This File has public Macro definition that simplifies the statemachine implementation +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_ +/// Include files +#include +#include +#include + +/// connect child state to parent state and sets it as default state +#define CONNECT_DEFAULTSTATE(parent, child) \ + FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE); + +/// connect child state to parent state +#define CONNECT_STATE(parent, child) \ + FrameworkunifiedConnect(l_p## parent, l_p## child); + +/// connect the deferred event and reactions and associate them with the state +#define CONNECT_DEFERREDEVENT(state, eventid) \ + FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE); \ + +/// connect the event and reactions and associate them with the state +#define CONNECT_EVENT(state, eventid, reaction) \ + FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid); + +/// connect the event and reactions and associate them with the state +#define CONNECT_LOCAL_EVENT(state, eventid, reaction) \ + FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid); + +/// Sets the state as root state in the statemachine +#define CONNECTROOT(state) \ + FrameworkunifiedConnect(l_p## state); + +/// Creates the state +#define CREATE_STATE(class_name) \ + CHKNULL(m_pFrameworkunifiedStateList) \ + C## class_name *l_p## class_name = new C## class_name(#class_name); \ + CHKNULL(l_p## class_name) \ + m_pFrameworkunifiedStateList->insert(std::pair(e## class_name, l_p## class_name)); + +// create a new shallow history state and add it in parent state +#define ADD_SHALLOWHISTORYSTATE(parent) \ + CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\ + FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\ + l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory(); + +// create a new shallow history state and add it in parent state +#define ADD_DEEPHISTORYSTATE(parent) \ + CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\ + FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\ + l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory(); + +/// connect deep history event to reaction and add to state +#define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \ + FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid); + +/// connect shallow history event to reaction and add to state +#define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \ + FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid); + +typedef struct _HSMConfigOptions { + EUserChangeOptions eUserChange; + BOOL bAutoPublishServiceAvaialble; + BOOL bWaitInStoppingState; +} HSMConfigOptions; + +#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_