Init basesystem source codes.
[staging/basesystem.git] / video_in_hal / nsframework / framework_unified / client / NS_FrameworkCore / src / statemachine / frameworkunified_sm_shallowhistorystate.cpp
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 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup  tag_NSFramework
20 /// .
21 ///////////////////////////////////////////////////////////////////////////////////////////////////
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup  tag_NSFramework
25 /// \brief
26 ///
27 /// This file has the CFrameworkunifiedShallowHistoryState class definitions. CFrameworkunifiedShallowHistoryState is derived
28 /// from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported by
29 /// HSM ShallowHistory state.
30 ///
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32
33 #include <native_service/frameworkunified_sm_shallowhistorystate.h>
34 #include <native_service/frameworkunified_sm_framework_types.h>
35 #include <string>
36
37 // define static members of class
38 const UI_32 CFrameworkunifiedShallowHistoryState::m_suievShallowHistory = 71;
39
40 ////////////////////////////////////////////////////////////////////////////////////////////////////
41 /// CFrameworkunifiedShallowHistoryState
42 /// Parameterized constructor
43 ////////////////////////////////////////////////////////////////////////////////////////////////////
44 CFrameworkunifiedShallowHistoryState::CFrameworkunifiedShallowHistoryState(std::string f_pName): CFrameworkunifiedHistoryState(f_pName) {
45   m_uiEventId = m_suievShallowHistory;
46   m_cEventName = "evShallowHistory";
47 }
48
49 ////////////////////////////////////////////////////////////////////////////////////////////////////
50 /// ~CFrameworkunifiedShallowHistoryState
51 /// Class destructor
52 ////////////////////////////////////////////////////////////////////////////////////////////////////
53 CFrameworkunifiedShallowHistoryState::~CFrameworkunifiedShallowHistoryState() {
54   FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedShallowHistoryState destructor");
55 }
56
57 ////////////////////////////////////////////////////////////////////////////////////////////////////
58 /// UpdateHistory
59 /// This function stores the last active state
60 ////////////////////////////////////////////////////////////////////////////////////////////////////
61 EFrameworkunifiedStatus CFrameworkunifiedShallowHistoryState::UpdateHistory() {
62   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
63
64   try {
65     CHKNULL(m_pParentState);
66
67     m_pLastActiveState = m_pParentState->m_pActiveState;
68   } catch (std::exception &e) {
69     FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
70     l_eStatus = eFrameworkunifiedStatusNullPointer;
71   }
72
73   return l_eStatus;
74 }