Init basesystem source codes.
[staging/basesystem.git] / nsframework / framework_unified / client / include / native_service / frameworkunified_sm_leafstate.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 CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
22 /// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
23 ///////////////////////////////////////////////////////////////////////////////
24 //@{
25 /**
26  * @file frameworkunified_sm_leafstate.h
27  * @brief \~english This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
28  *        FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
29  *
30  */
31 /** @addtogroup BaseSystem
32  *  @{
33  */
34 /** @addtogroup native_service
35  *  @ingroup BaseSystem
36  *  @{
37  */
38 /** @addtogroup framework_unified
39  *  @ingroup native_service
40  *  @{
41  */
42 /** @addtogroup framework
43  *  @ingroup framework_unified
44  *  @{
45  */
46 /** @addtogroup statemachine
47  *  @ingroup framework
48  *  @{
49  */
50 #ifndef _FRAMEWORKUNIFIEDLEAFSTATE_H  // NOLINT  (build/header_guard)
51 #define _FRAMEWORKUNIFIEDLEAFSTATE_H
52
53 ///////////////////////////////////////////////////////////////////////////////////////////////////
54 // Include Files
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56
57 #include <native_service/frameworkunified_sm_state.h>
58 #include <string>
59 ///////////////////////////////////////////////////////////////////////////////////////////////////
60 /// This class implements the additional functionality supported by HSM Leafstate.
61 ///////////////////////////////////////////////////////////////////////////////////////////////////
62 class CFrameworkunifiedLeafState : public CFrameworkunifiedState {
63  public :
64
65   ///////////////////////////////////////////////////////////////////////////////////////////
66   /// \ingroup CFrameworkunifiedLeafState
67   /// \~english @par Brief
68   ///        It is a constructor for CFrameworkunifiedLeafState classes.
69   /// \~english @param [in] f_pName
70   ///        std::string   - state name
71   /// \~english @retval None
72   /// \~english @par Prerequisite
73   ///       - None
74   /// \~english @par Change of internal state
75   ///       - The internal state is not changed.
76   /// \~english @par Conditions of processing failure
77   ///       - None
78   /// \~english @par Detail
79   ///       Inherits CFrameworkunifiedState, which is a superclass of state machines.\n
80   ///       This class is implemented by HSM Leafstate as an additional class of functional support.\n
81   ///       It inherits from the CFrameworkunifiedState classes and instantiates the CFrameworkunifiedLeafState.
82   /// \~english @par Immediate
83   ///          Brief
84   /// \~english @par Classification
85   ///       Public
86   /// \~english @par Type
87   ///       Not applicable
88   /// \~english @see ~CFrameworkunifiedLeafState
89   ///////////////////////////////////////////////////////////////////////////////////////////
90   /// CFrameworkunifiedState
91   /// Parameterized constructor
92   /// \param [in] f_pName
93   ///     string - Name of the state
94   ///
95   /// \return none
96   CFrameworkunifiedLeafState(std::string f_pName);  // NOLINT  (readability/nolint)
97
98   ///////////////////////////////////////////////////////////////////////////////////////////
99   /// \ingroup CFrameworkunifiedLeafState
100   /// \~english @par Brief
101   ///        Destructors for CFrameworkunifiedLeafState classes.
102   /// \~english @retval None
103   /// \~english @par Prerequisite
104   ///       - Its own instance (CFrameworkunifiedLeafState) has been created.
105   /// \~english @par Change of internal state
106   ///       - The internal state is not changed.
107   /// \~english @par Conditions of processing failure
108   ///       - None
109   /// \~english @par Detail
110   ///       Frees instances of CFrameworkunifiedLeafState classes.
111   /// \~english @par Classification
112   ///       Public
113   /// \~english @par Type
114   ///       Not applicable
115   /// \~english @see CFrameworkunifiedLeafState::CFrameworkunifiedLeafState
116   ///////////////////////////////////////////////////////////////////////////////////////////
117   ///////////////////////////////////////////////////////////////////////////////////////////
118   /// ~CFrameworkunifiedState
119   /// Class destructor
120   ///
121   /// \return none
122   virtual ~CFrameworkunifiedLeafState();
123
124   ///////////////////////////////////////////////////////////////////////////////////////////
125   /// \ingroup CFrameworkunifiedLeafState
126   /// \~english @par Brief
127   ///        Get the active state.
128   /// \~english @retval CFrameworkunifiedState* Pointers to active-state (CFrameworkunifiedState classes) objects
129   /// \~english @par Prerequisite
130   ///       - Its own instance (CFrameworkunifiedLeafState) has been created.
131   /// \~english @par Change of internal state
132   ///       - The internal state is not changed.
133   /// \~english @par Conditions of processing failure
134   ///       - None
135   /// \~english @par Detail
136   ///       This method overrides and uses CFrameworkunifiedState::FrameworkunifiedGetActiveState, which is pure virtual functions.\n
137   ///       Returns the current state (this) as the active state.
138   /// \~english @par Classification
139   ///       Public
140   /// \~english @par Type
141   ///       Not applicable
142   /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
143   ///////////////////////////////////////////////////////////////////////////////////////////
144   ///////////////////////////////////////////////////////////////////////////////////////////
145   /// FrameworkunifiedGetActiveState
146   /// This interface returns the Active state of the current composite state. In case of
147   /// non-composite state current state is active state
148   ///
149   /// \return Active state
150   ///     CFrameworkunifiedState* - Active state
151   virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
152
153   ///////////////////////////////////////////////////////////////////////////////////////////
154   /// \ingroup CFrameworkunifiedLeafState
155   /// \~english @par Brief
156   ///        Save the last active state.
157   /// \~english @retval eFrameworkunifiedStatusOK success
158   /// \~english @par Prerequisite
159   ///       - Its own instance (CFrameworkunifiedLeafState) has been created.
160   /// \~english @par Change of internal state
161   ///       - The internal state is not changed.
162   /// \~english @par Conditions of processing failure
163   ///       - None
164   /// \~english @par Detail
165   ///       This method overrides CFrameworkunifiedState::UpdateHistory, which is pure virtual functions.Used and saves the last active state.
166   /// \~english @par Classification
167   ///       Public
168   /// \~english @par Type
169   ///       Not applicable
170   /// \~english @see CFrameworkunifiedState::UpdateHistory
171   ///////////////////////////////////////////////////////////////////////////////////////////
172   /// UpdateHistory
173   /// This function stores the last active state
174   ///
175   /// \return EFrameworkunifiedStatus
176   ///     EFrameworkunifiedStatus - Returns status of operation
177   EFrameworkunifiedStatus UpdateHistory();
178
179  protected :
180
181   ///////////////////////////////////////////////////////////////////////////////////////////
182   /// \ingroup CFrameworkunifiedLeafState
183   /// \~english @par Brief
184   ///        Initialize state
185   /// \~english @param f_pEventData
186   ///      CEventDataPtr - Pointer to the event data class
187   /// \~english @retval eFrameworkunifiedStatusOK success
188   /// \~english @par Prerequisite
189   ///       - Its own instance (CFrameworkunifiedLeafState) has been created.
190   /// \~english @par Change of internal state
191   ///       - The internal state is not changed.
192   /// \~english @par Conditions of processing failure
193   ///       - None
194   /// \~english @par Detail
195   ///       This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnEntry, which is pure virtual functions, to initialize state.
196   /// \~english @par Classification
197   ///       Public
198   /// \~english @par Type
199   ///       Not applicable
200   /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnEntry, FrameworkunifiedOnExit
201   ///////////////////////////////////////////////////////////////////////////////////////////
202   ///////////////////////////////////////////////////////////////////////////////////////////
203   /// FrameworkunifiedOnEntry
204   /// state initialization can be performed in this function.
205   ///
206   /// \param [in] f_pEventData
207   ///     CEventDataPtr - Event data
208   ///
209   /// \return EFrameworkunifiedStatus
210   ///     EFrameworkunifiedStatus - Returns status of operation
211   virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
212
213   ///////////////////////////////////////////////////////////////////////////////////////////
214   /// \ingroup CFrameworkunifiedLeafState
215   /// \~english @par Brief
216   ///        Clean up state.
217   /// \~english @param f_pEventData
218   ///      CEventDataPtr - Pointer to the event data class
219   /// \~english @retval eFrameworkunifiedStatusOK success
220   /// \~english @par Prerequisite
221   ///       - Its own instance (CFrameworkunifiedLeafState) has been created.
222   /// \~english @par Change of internal state
223   ///       - The internal state is not changed.
224   /// \~english @par Conditions of processing failure
225   ///       - None
226   /// \~english @par Detail
227   ///       This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnExit, which is pure virtual functions, to clean up state.
228   /// \~english @par Classification
229   ///       Public
230   /// \~english @par Type
231   ///       Not applicable
232   /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnExit, FrameworkunifiedOnEntry
233   ///////////////////////////////////////////////////////////////////////////////////////////
234   ///////////////////////////////////////////////////////////////////////////////////////////
235   /// FrameworkunifiedOnExit
236   /// state cleanup can be performed in this function.
237   ///
238   /// \param [in] f_pEventData
239   ///     CEventDataPtr - Event data
240   ///
241   /// \return EFrameworkunifiedStatus
242   ///     EFrameworkunifiedStatus - Returns status of operation
243   virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
244 };
245
246 #endif  // _FRAMEWORKUNIFIEDLEAFSTATE_H  // NOLINT  (build/header_guard)
247 /** @}*/
248 /** @}*/
249 /** @}*/
250 /** @}*/
251 /** @}*/
252 //@}