2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_StateMachine
21 /// This file has the declaration of CFrameworkunifiedHistoryState interface.
22 /// CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
23 ///////////////////////////////////////////////////////////////////////////////
26 * @file frameworkunified_sm_historystate.h
27 * @brief \~english This file has the declaration of CFrameworkunifiedHistoryState interface.
28 * CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
30 /** @addtogroup BaseSystem
33 /** @addtogroup native_service
37 /** @addtogroup framework_unified
38 * @ingroup native_service
41 /** @addtogroup framework
42 * @ingroup framework_unified
45 /** @addtogroup statemachine
49 #ifndef _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)
50 #define _FRAMEWORKUNIFIEDHISTORYSTATE_H
52 #include <native_service/frameworkunified_types.h>
53 #include <native_service/frameworkunified_sm_state.h>
57 * @class CFrameworkunifiedHistoryState
58 * \~english @brief this file has the CFrameworkunifiedHistoryState class definitions
59 * \~english @par Brief Introduction
60 * This class implements the additional functionality supported by HSM History state.
63 class CFrameworkunifiedHistoryState : public CFrameworkunifiedState {
66 ///////////////////////////////////////////////////////////////////////////////////////////
67 /// \ingroup CFrameworkunifiedHistoryState
68 /// \~english @par Brief
69 /// -Constructor of CFrameworkunifiedHistoryState.
70 /// \~english @param [in] f_pName
71 /// std::string - Name of the state
72 /// \~english @retval None
73 /// \~english @par Preconditons
75 /// \~english @par Change of internal status
77 /// \~english @par Conditions of processing failure
79 /// \~english @par Detail
80 /// - This class inherits from CFrameworkunifiedState, which is the base class of state machine.
81 /// This class implements the additional functionality supported by HSM History state.
82 /// This function creates an object of CFrameworkunifiedHistoryState class.
83 /// \~english @par Classification
85 /// \~english @see ~CFrameworkunifiedHistoryState
86 ///////////////////////////////////////////////////////////////////////////////////////////
87 /// CFrameworkunifiedHistoryState
88 /// Parameterized constructor
89 /// \param [in] f_pName
90 /// string - Name of the state
93 CFrameworkunifiedHistoryState(std::string f_pName); // NOLINT (readability/nolint)
95 ///////////////////////////////////////////////////////////////////////////////////////////
96 /// \ingroup CFrameworkunifiedHistoryState
97 /// \~english @par Brief
98 /// -Destructor of CFrameworkunifiedHistoryState.
99 /// \~english @param None
100 /// \~english @retval None
101 /// \~english @par Preconditons
102 /// -Calls constructor to successfully create object.
103 /// \~english @par Change of internal status
105 /// \~english @par Conditions of processing failure
107 /// \~english @par Detail
108 /// -Destruct the object of this class.
109 /// \~english @par Classification
111 /// \~english @see CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState
112 ///////////////////////////////////////////////////////////////////////////////////////////
113 /// ~CFrameworkunifiedHistoryState
117 virtual ~CFrameworkunifiedHistoryState();
119 ///////////////////////////////////////////////////////////////////////////////////////////
120 /// \ingroup CFrameworkunifiedHistoryState
121 /// \~english @par Brief
122 /// - Gets the pointor of this class.
123 /// \~english @param None
124 /// \~english @retval None
125 /// \~english @par Preconditons
126 /// - Calls constructor to successfully create object.
127 /// \~english @par Change of internal status
129 /// \~english @par Conditions of processing failure
131 /// \~english @par Detail
132 /// - Gets the pointor of this class.The pointor of this class's base class will get it.
133 /// \~english @par Classification
135 /// \~english @see None
136 ///////////////////////////////////////////////////////////////////////////////////////////
137 virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
139 ///////////////////////////////////////////////////////////////////////////////////////////
140 /// \ingroup CFrameworkunifiedHistoryState
141 /// \~english @par Brief
142 /// - This function stores the last active state.
143 /// \~english @param None
144 /// \~english @retval EFrameworkunifiedStatus - Returns status of operation
145 /// \~english @par Preconditons
147 /// \~english @par Change of internal status
149 /// \~english @par Conditions of processing failure
151 /// \~english @par Detail
152 /// - This function stores the last active state.
153 /// \~english @par Classification
155 /// \~english @see None
156 ///////////////////////////////////////////////////////////////////////////////////////////
157 virtual EFrameworkunifiedStatus UpdateHistory() = 0;
159 ///////////////////////////////////////////////////////////////////////////////////////////
160 /// \ingroup CFrameworkunifiedHistoryState
161 /// \~english @par Brief
162 /// - This function sets the default active state in history state.
163 /// \~english @param None
164 /// \~english @retval eFrameworkunifiedStatusOK - Success
165 /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Pointer
166 /// \~english @par Preconditons
167 /// -Calls constructor to successfully create object.
168 /// \~english @par Change of internal status
170 /// \~english @par Conditions of processing failure
171 /// -m_pParentState is NULL.[eFrameworkunifiedStatusNullPointer]
172 /// \~english @par Detail
173 /// -This function sets the default state of parent state to the newest active state.
174 /// \~english @par Classification
176 /// \~english @see None
177 ///////////////////////////////////////////////////////////////////////////////////////////
178 /// SetDefaultHistory
179 /// This function sets the default active state in history state
182 /// \return EFrameworkunifiedStatus
183 /// EFrameworkunifiedStatus - Returns status of operation
184 EFrameworkunifiedStatus SetDefaultHistory();
188 ///////////////////////////////////////////////////////////////////////////////////////////
189 /// FrameworkunifiedOnEntry
190 /// state initialization can be performed in this function.
192 /// \param [in] f_pEventData
193 /// CEventDataPtr - Event data
195 /// \return EFrameworkunifiedStatus
196 /// EFrameworkunifiedStatus - Returns status of operation
197 ///////////////////////////////////////////////////////////////////////////////////////////
198 EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
200 ///////////////////////////////////////////////////////////////////////////////////////////
201 /// FrameworkunifiedOnExit
202 /// state cleanup can be performed in this function.
204 /// \param [in] f_pEventData
205 /// CEventDataPtr - Event data
207 /// \return EFrameworkunifiedStatus
208 /// EFrameworkunifiedStatus - Returns status of operation
209 ///////////////////////////////////////////////////////////////////////////////////////////
210 EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
212 ///////////////////////////////////////////////////////////////////////////////////////////
213 /// FrameworkunifiedOnHSMStart
214 /// This function is called recursively till the leaf state is reached. This internally
215 /// calls the Entry function of the current state.
217 /// \param [in] f_pEventData
218 /// CEventDataPtr - Event data
220 /// \return CurrentState
221 /// CFrameworkunifiedState* - Returns current state after operation
222 ///////////////////////////////////////////////////////////////////////////////////////////
223 virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
225 ///////////////////////////////////////////////////////////////////////////////////////////
226 /// FrameworkunifiedOnHSMStop
227 /// This function is called recursively till the required parent state is reached. This
228 /// internally calls the Exit function of the current state.
230 /// \param [in] f_pEventData
231 /// CEventDataPtr - Event data
233 /// \return CurrentState
234 /// CFrameworkunifiedState* - Returns current state after operation
235 ///////////////////////////////////////////////////////////////////////////////////////////
236 virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
239 CFrameworkunifiedState *m_pLastActiveState;
241 // event id of history state
245 std::string m_cEventName;
247 #endif // _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)