Init basesystem source codes.
[staging/basesystem.git] / nsframework / framework_unified / client / include / native_service / frameworkunified_sm_historystate.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 the declaration of CFrameworkunifiedHistoryState interface.
22 /// CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
23 ///////////////////////////////////////////////////////////////////////////////
24 //@{
25 /**
26  * @file frameworkunified_sm_historystate.h
27  * @brief \~english This file has the declaration of CFrameworkunifiedHistoryState interface.
28  *        CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
29  */
30 /** @addtogroup BaseSystem
31  *  @{
32  */
33 /** @addtogroup native_service
34  *  @ingroup BaseSystem
35  *  @{
36  */
37 /** @addtogroup framework_unified
38  *  @ingroup native_service
39  *  @{
40  */
41 /** @addtogroup framework
42  *  @ingroup framework_unified
43  *  @{
44  */
45 /** @addtogroup statemachine
46  *  @ingroup framework
47  *  @{
48  */
49 #ifndef _FRAMEWORKUNIFIEDHISTORYSTATE_H  // NOLINT  (build/header_guard)
50 #define _FRAMEWORKUNIFIEDHISTORYSTATE_H
51
52 #include <native_service/frameworkunified_types.h>
53 #include <native_service/frameworkunified_sm_state.h>
54 #include <string>
55
56 /**
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.
61  *
62  */
63 class CFrameworkunifiedHistoryState : public CFrameworkunifiedState {
64  public :
65
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
74   ///       - None
75   /// \~english @par Change of internal status
76   ///       - None
77   /// \~english @par Conditions of processing failure
78   ///       - None
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
84   ///       Public
85   /// \~english @see ~CFrameworkunifiedHistoryState
86   ///////////////////////////////////////////////////////////////////////////////////////////
87   /// CFrameworkunifiedHistoryState
88   /// Parameterized constructor
89   /// \param [in] f_pName
90   ///     string - Name of the state
91   ///
92   /// \return none
93   CFrameworkunifiedHistoryState(std::string f_pName);  // NOLINT  (readability/nolint)
94
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
104   ///       - None
105   /// \~english @par Conditions of processing failure
106   ///       - None
107   /// \~english @par Detail
108   ///       -Destruct the object of this class.
109   /// \~english @par Classification
110   ///          Public
111   /// \~english @see CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState
112   ///////////////////////////////////////////////////////////////////////////////////////////
113   /// ~CFrameworkunifiedHistoryState
114   /// Class destructor
115   ///
116   /// \return none
117   virtual ~CFrameworkunifiedHistoryState();
118
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
128   ///       - None
129   /// \~english @par Conditions of processing failure
130   ///       - None
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
134   ///       - Public
135   /// \~english @see None
136   ///////////////////////////////////////////////////////////////////////////////////////////
137   virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
138
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
146   ///          - None
147   /// \~english @par Change of internal status
148   ///          - None
149   /// \~english @par Conditions of processing failure
150   ///          - None
151   /// \~english @par Detail
152   ///          - This function stores the last active state.
153   /// \~english @par Classification
154   ///          - Public
155   /// \~english @see None
156   ///////////////////////////////////////////////////////////////////////////////////////////
157   virtual EFrameworkunifiedStatus UpdateHistory() = 0;
158
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
169   ///          - None
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
175   ///          Public
176   /// \~english @see None
177   ///////////////////////////////////////////////////////////////////////////////////////////
178   /// SetDefaultHistory
179   /// This function sets the default active state in history state
180   /// \param
181   ///
182   /// \return EFrameworkunifiedStatus
183   ///     EFrameworkunifiedStatus - Returns status of operation
184   EFrameworkunifiedStatus SetDefaultHistory();
185
186  protected :
187
188   ///////////////////////////////////////////////////////////////////////////////////////////
189   /// FrameworkunifiedOnEntry
190   /// state initialization can be performed in this function.
191   ///
192   /// \param [in] f_pEventData
193   ///     CEventDataPtr - Event data
194   ///
195   /// \return EFrameworkunifiedStatus
196   ///     EFrameworkunifiedStatus - Returns status of operation
197   ///////////////////////////////////////////////////////////////////////////////////////////
198   EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
199
200   ///////////////////////////////////////////////////////////////////////////////////////////
201   /// FrameworkunifiedOnExit
202   /// state cleanup can be performed in this function.
203   ///
204   /// \param [in] f_pEventData
205   ///     CEventDataPtr - Event data
206   ///
207   /// \return EFrameworkunifiedStatus
208   ///     EFrameworkunifiedStatus - Returns status of operation
209   ///////////////////////////////////////////////////////////////////////////////////////////
210   EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
211
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.
216   ///
217   /// \param [in] f_pEventData
218   ///     CEventDataPtr - Event data
219   ///
220   /// \return CurrentState
221   ///     CFrameworkunifiedState* - Returns current state after operation
222   ///////////////////////////////////////////////////////////////////////////////////////////
223   virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
224
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.
229   ///
230   /// \param [in] f_pEventData
231   ///     CEventDataPtr - Event data
232   ///
233   /// \return CurrentState
234   ///     CFrameworkunifiedState* - Returns current state after operation
235   ///////////////////////////////////////////////////////////////////////////////////////////
236   virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
237
238   // last active state
239   CFrameworkunifiedState *m_pLastActiveState;
240
241   // event id of history state
242   UI_32 m_uiEventId;
243
244   // event name
245   std::string m_cEventName;
246 };
247 #endif  // _FRAMEWORKUNIFIEDHISTORYSTATE_H  // NOLINT  (build/header_guard)
248 /** @}*/
249 /** @}*/
250 /** @}*/
251 /** @}*/
252 /** @}*/
253 //@}