common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / nsframework / framework_unified / client / NS_FrameworkCore / include / statemachine / frameworkunified_sm_framework_core.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup  tag_StateMachine
19 /// \brief
20 ///
21 /// This File has public Macro definition that simplifies the statemachine implementation
22 ///
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24
25 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
26 #define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
27 /// Include files
28 #include <native_service/frameworkunified_framework_types.h>
29 #include <vector>
30 #include <utility>
31
32 /// connect child state to parent state and sets it as default state
33 #define CONNECT_DEFAULTSTATE(parent, child) \
34     FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
35
36 /// connect child state to parent state
37 #define CONNECT_STATE(parent, child) \
38     FrameworkunifiedConnect(l_p## parent, l_p## child);
39
40 /// connect the deferred  event and reactions and associate them with the state
41 #define CONNECT_DEFERREDEVENT(state, eventid) \
42     FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE); \
43
44 /// connect the event and reactions and associate them with the state
45 #define CONNECT_EVENT(state, eventid, reaction) \
46     FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
47
48 /// connect the event and reactions and associate them with the state
49 #define CONNECT_LOCAL_EVENT(state, eventid, reaction) \
50     FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid);
51
52 /// Sets the state as root state in the statemachine
53 #define CONNECTROOT(state) \
54     FrameworkunifiedConnect(l_p## state);
55
56 /// Creates the state
57 #define CREATE_STATE(class_name) \
58     CHKNULL(m_pFrameworkunifiedStateList) \
59     C## class_name *l_p## class_name = new C## class_name(#class_name); \
60     CHKNULL(l_p## class_name) \
61     m_pFrameworkunifiedStateList->insert(std::pair<UI_32, CFrameworkunifiedState*>(e## class_name, l_p## class_name));
62
63 // create a new shallow history state and add it in parent state
64 #define ADD_SHALLOWHISTORYSTATE(parent) \
65     CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\
66     FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\
67     l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory();
68
69 // create a new shallow history state and add it in parent state
70 #define ADD_DEEPHISTORYSTATE(parent) \
71     CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\
72     FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\
73     l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory();
74
75 /// connect deep history event to reaction and add to state
76 #define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \
77     FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid);
78
79 /// connect shallow history event to reaction and add to state
80 #define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \
81     FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid);
82
83 typedef struct _HSMConfigOptions {
84   EUserChangeOptions eUserChange;
85   BOOL bAutoPublishServiceAvaialble;
86   BOOL bWaitInStoppingState;
87 } HSMConfigOptions;
88
89 #endif  // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_