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_NSFramework
20 /// This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
21 /// implementing interfaces required to use condition connector in statemachine.
23 ///////////////////////////////////////////////////////////////////////////////
26 * @file frameworkunified_sm_conditionconnector.h
27 * @brief \~english This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
28 * implementing interfaces required to use condition connector in statemachine.
31 /** @addtogroup BaseSystem
34 /** @addtogroup native_service
38 /** @addtogroup framework_unified
39 * @ingroup native_service
42 /** @addtogroup framework
43 * @ingroup framework_unified
46 /** @addtogroup statemachine
50 #ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ // NOLINT (build/header_guard)
51 #define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__
53 #include <native_service/frameworkunified_sm_externaltransition.h>
57 // This class is responsible for implementing interfaces required to use condition connector in statemachine.
58 class CFrameworkunifiedConditionConnector : public CFrameworkunifiedExternalTransition {
60 ///////////////////////////////////////////////////////////////////////////////////////////
61 /// \ingroup CFrameworkunifiedConditionConnector
62 /// \~english @par Brief
63 /// Constructor for class CFrameworkunifiedConditionConnector.
64 /// \~english @param [in] f_strName
65 /// std::string - Name of the condition connector
67 /// \~english @par Prerequisite
69 /// \~english @par Change of internal state
71 /// \~english @par Conditions of processing failure
73 /// \~english @par Detail
74 /// Inherite from base class CFrameworkunifiedExternalTransition.
75 /// \~english @par Classification
77 /// \~english @par Type
79 /// \~english @see CFrameworkunifiedExternalTransition, ~CFrameworkunifiedConditionConnector
80 ///////////////////////////////////////////////////////////////////////////////////////////
81 CFrameworkunifiedConditionConnector(std::string f_strName); // NOLINT (readability/nolint)
83 ///////////////////////////////////////////////////////////////////////////////////////////
84 /// \ingroup CFrameworkunifiedConditionConnector
85 /// \~english @par Brief
86 /// Destructor for CFrameworkunifiedCompositeState
87 /// \~english @retval none
88 /// \~english @par Preconditons
89 /// - Self instance of CFrameworkunifiedConditionConnector created.
90 /// \~english @par Change of internal status
92 /// \~english @par Conditions of processing failure
94 /// \~english @par Detail
95 /// Class CFrameworkunifiedExternalTransition instance and CFrameworkunifiedConditionConnector instance release.
96 /// \~english @par Classification
98 /// \~english @par Type
100 /// \~english @see CFrameworkunifiedConditionConnector::CFrameworkunifiedConditionConnector
101 ///////////////////////////////////////////////////////////////////////////////////////////
102 virtual ~CFrameworkunifiedConditionConnector();
104 ////////////////////////////////////////////////////////////////////////////////////////////
105 /// \ingroup CFrameworkunifiedConditionConnector
106 /// \~english @par Brief
107 /// This API evaluates the guards added in the condition list. If the guard is evaluated as
108 /// true then statemachine transitions to target state associated with guard.
109 /// \~english @param [in] f_pSourceState
110 /// CFrameworkunifiedState* - Source state in which reaction is being executed
111 /// \~english @param [in] f_pData
112 /// CEventDataPtr - event data
113 /// \~english @retval CFrameworkunifiedState*
114 /// CFrameworkunifiedState* - Returns Active state
115 /// \~english @par Preconditons
116 /// - Self instance of CFrameworkunifiedConditionConnector created.
117 /// \~english @par Change of internal status
119 /// \~english @par Conditions of processing failure
120 /// - If parameter f_pSourceState is NULL. [NULL]
121 /// - If m_pConditionList is NULL. [NULL]
122 /// \~english @par Detail
123 /// This API evaluates the guards added in the condition list. If the guard is evaluated as
124 /// true then statemachine transitions to target state associated with guard.
125 /// \~english @par Classification
127 /// \~english @par Type
129 /// \~english @see none
130 ////////////////////////////////////////////////////////////////////////////////////////////
131 virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
133 ////////////////////////////////////////////////////////////////////////////////////////////
134 /// \ingroup CFrameworkunifiedConditionConnector
135 /// \~english @par Brief
136 /// Adds connect condition into condition list of current connection
137 /// \~english @param [in] f_pGuard
138 /// CFrameworkunifiedState* - Pointer to the guard object to be added in the currrent connection
139 /// \~english @param [in] f_pTargetState
140 /// CFrameworkunifiedState* - Target state for given guard condition
141 /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
142 /// eFrameworkunifiedStatusNullPointer
143 /// \~english @par Preconditons
144 /// - Self instance of CFrameworkunifiedConditionConnector created.
145 /// \~english @par Change of internal status
147 /// \~english @par Conditions of processing failure
148 /// - If m_pConditionList is NULL. [eFrameworkunifiedStatusNullPointer]
149 /// - If parameter f_pGuard is NULL. [eFrameworkunifiedStatusNullPointer]
150 /// - If parameter f_pTargetState is NULL. [eFrameworkunifiedStatusNullPointer]
151 /// \~english @par Detail
152 /// Adds connect condition into condition list of current connection.\n
153 /// \~english @par Classification
155 /// \~english @par Type
157 /// \~english @see none
158 ////////////////////////////////////////////////////////////////////////////////////////////
159 virtual EFrameworkunifiedStatus FrameworkunifiedAddCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
162 // This class defines the conditions required in condition connector
165 ///////////////////////////////////////////////////////////////////////////////////////////
167 /// Parameterized constructor
168 /// \param [in] f_pGuard
169 /// CFrameworkunifiedGuard* - guard object
170 /// \param [in] f_pTargetState
171 /// CFrameworkunifiedState* - target state for a condition
174 ///////////////////////////////////////////////////////////////////////////////////////////
175 CCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
177 // pointer to guard that will be evaluated for a condition
178 CFrameworkunifiedGuard *m_pGuard;
180 // pointer to target state for a condition
181 CFrameworkunifiedState *m_pTargetState;
185 typedef std::vector<CCondition *> TConditionList;
187 // Condition list iterator
188 typedef TConditionList::iterator TConditionIterator;
190 // condition connector name
191 std::string m_strName;
193 // List of conditions
194 TConditionList *m_pConditionList;
197 #endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ */ // NOLINT (build/header_guard)