Re-organized sub-directory by category
[staging/basesystem.git] / service / native / framework_unified / client / include / native_service / frameworkunified_sm_reaction.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 CFrameworkunifiedReaction class definitions.This class provides the interface
22 /// for defining a reaction for an event
23 ///
24 ///////////////////////////////////////////////////////////////////////////////
25 //@{
26 /**
27  * @file frameworkunified_sm_reaction.h
28  * @brief \~english This file has the CFrameworkunifiedReaction class definitions.This class provides the interface
29  *        for defining a reaction for an event
30  *
31  */
32 /** @addtogroup BaseSystem
33  *  @{
34  */
35 /** @addtogroup native_service
36  *  @ingroup BaseSystem
37  *  @{
38  */
39 /** @addtogroup framework_unified
40  *  @ingroup native_service
41  *  @{
42  */
43 /** @addtogroup framework
44  *  @ingroup framework_unified
45  *  @{
46  */
47 /** @addtogroup statemachine
48  *  @ingroup framework
49  *  @{
50  */
51 #ifndef _FRAMEWORKUNIFIEDREACTION_H  // NOLINT  (build/header_guard)
52 #define _FRAMEWORKUNIFIEDREACTION_H
53
54 ///////////////////////////////////////////////////////////////////////////////////////////////////
55 // Include Files
56 ///////////////////////////////////////////////////////////////////////////////////////////////////
57 #include <boost/smart_ptr.hpp>
58 #include <native_service/frameworkunified_types.h>
59 #include <native_service/ns_logger_if.h>
60 #include <exception>
61
62 class CFrameworkunifiedState;
63 class CEventData;
64
65 typedef boost::shared_ptr<CEventData> CEventDataPtr;
66
67 ///////////////////////////////////////////////////////////////////////////////////////////////////
68 /// This class provides the interface for defining a reaction for an event
69 ///////////////////////////////////////////////////////////////////////////////////////////////////
70 class CFrameworkunifiedReaction {
71  public :
72   /////////////////////////////////////////////////////////////////////////////////////
73   /// \ingroup CFrameworkunifiedReaction
74   /// \~english @par Summary
75   ///       pure virtual fuction
76   /// \~english @param [in] f_pSourceState
77   ///        CFrameworkunifiedState* f_pSourceState  -  source state
78   /// \~english @param [in] f_pData
79   ///        CEventDataPtr f_pData  -  event data
80   /// \~english @retval None
81   /// \~english @par Preconditions
82   ///       - None.
83   /// \~english @par Change of the internal state
84   ///       - None
85   /// \~english @par Causes of failures
86   ///       None
87   /// \~english @par Classification
88   ///       Public
89   /// \~english @par Type
90   ///       sync only
91   /// \~english @par Detail
92   ///       pure virtual function , implement by child class
93   /// \~english @see
94   ////////////////////////////////////////////////////////////////////////////////////
95   ///////////////////////////////////////////////////////////////////////////////////////////
96   /// FrameworkunifiedReaction
97   /// The reaction for the event has to be implemented in this function
98   ///
99   /// \param [in] f_pSourceState
100   ///     CFrameworkunifiedState* - Source state in which reaction is being executed
101   ///
102   /// \param [in] f_pData
103   ///     CEventDataPtr - event data
104   ///
105   /// \return ActiveState
106   ///         CFrameworkunifiedState* - Returns Active state
107   ///
108   ///////////////////////////////////////////////////////////////////////////////////////////
109   virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
110
111   /////////////////////////////////////////////////////////////////////////////////////
112   /// \ingroup CFrameworkunifiedReaction
113   /// \~english @par Summary
114   ///       CFrameworkunifiedReaction constructor
115   /// \~english @param None
116   /// \~english @retval None
117   /// \~english @par Preconditions
118   ///       - None.
119   /// \~english @par Change of the internal state
120   ///       - m_ucRefCount = 0
121   /// \~english @par Causes of failures
122   ///       None
123   /// \~english @par Classification
124   ///       Public
125   /// \~english @par Type
126   ///       sync only
127   /// \~english @par Detail
128   ///       CFrameworkunifiedReaction Constructor, for create CFrameworkunifiedReaction object
129   /// \~english @see
130   ////////////////////////////////////////////////////////////////////////////////////
131   ///////////////////////////////////////////////////////////////////////////////////////////
132   /// CFrameworkunifiedReaction
133   /// Constructor
134   ///
135   /// \param
136   ///
137   /// \return
138   ///
139   ///////////////////////////////////////////////////////////////////////////////////////////
140   CFrameworkunifiedReaction() {
141     m_ucRefCount = 0;
142   }
143
144   /////////////////////////////////////////////////////////////////////////////////////
145   /// \ingroup CFrameworkunifiedReaction
146   /// \~english @par Summary
147   ///       CFrameworkunifiedReaction destructor
148   /// \~english @param None
149   /// \~english @retval None
150   /// \~english @par Preconditions
151   ///       - None.
152   /// \~english @par Change of the internal state
153   ///       - None
154   /// \~english @par Causes of failures
155   ///       None
156   /// \~english @par Classification
157   ///       Public
158   /// \~english @par Type
159   ///       sync only
160   /// \~english @par Detail
161   ///       CFrameworkunifiedReaction destructor, for destory CFrameworkunifiedReaction object
162   /// \~english @see
163   ////////////////////////////////////////////////////////////////////////////////////
164   ///////////////////////////////////////////////////////////////////////////////////////////
165   /// ~CFrameworkunifiedReaction
166   /// Destructor
167   ///
168   /// \param
169   ///
170   /// \return
171   ///
172   ///////////////////////////////////////////////////////////////////////////////////////////
173   virtual ~CFrameworkunifiedReaction() {}
174
175   // count to check the number of reference of this reaction in all the states of statemachine
176   UI_8 m_ucRefCount;
177 };
178 #endif  // _FRAMEWORKUNIFIEDREACTION_H  // NOLINT  (build/header_guard)
179 /** @}*/
180 /** @}*/
181 /** @}*/
182 /** @}*/
183 /** @}*/
184 //@}