2 * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
6 * Licensed under the Apache License, Version 2.0 (the License){}
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef CICOHISTORYSTATE_H
20 #define CICOHISTORYSTATE_H
25 #include "CicoStateCore.h"
31 #ifndef CICOSTATEMACHINE_H
32 class CicoStateMachine;
36 * history state object class
42 * @brief The CicoHistoryState class
44 class CicoHistoryState : public CicoStateCore
49 Shallow = 1, // Shallow History
53 CicoHistoryState(CicoState* parent=0);
54 CicoHistoryState(const std::string& name, CicoState* parent=0);
55 CicoHistoryState(int value, CicoState* parent=0);
56 CicoHistoryState(const std::string& name, int value,
58 CicoHistoryState(CicoStateMachine* parent);
59 CicoHistoryState(const std::string& name,
60 CicoStateMachine* parent);
61 CicoHistoryState(int value, CicoStateMachine* parent);
62 CicoHistoryState(const std::string& name, int value,
63 CicoStateMachine* parent);
68 void addDefaultState(std::vector<CicoState*> stts);
69 void addDefaultState(CicoState* stt);
71 E_HType getHistoryType() const;
72 void setHistoryType(E_HType type);
74 void setParent(CicoState* parent);
75 void setParent(CicoStateMachine* parent);
77 void addEntryAction(CicoStateAction* action, int addval = 0);
79 void addExitAction(CicoStateAction* action, int addval = 0);
82 virtual bool start(const CicoEvent& ev, bool parent=false);
84 virtual void holdHistory();
87 E_HType m_historyType; // history type
88 std::vector<CicoState*> m_vDState; // store default area
89 std::vector<CicoState*> m_vHState; // store history area
93 * @brief CicoHistoryState::getHistoryType
94 * @return history type(Shallow or Deep)
96 inline CicoHistoryState::E_HType CicoHistoryState::getHistoryType() const
102 * @brief CicoHistoryState::setHistoryType
104 * @param type history type(Shallow or Deep)
106 inline void CicoHistoryState::setHistoryType(E_HType type)
108 m_historyType = type;
112 * @brief CicoHistoryState::addEntryAction
113 * @param action register callback action class
114 * @param addval additional value
116 inline void CicoHistoryState::addEntryAction(CicoStateAction* action, int addval)
118 CicoStateCore::addEntryAction(action, addval);
122 * @brief CicoHistoryState::addExitAction
123 * @param action register callback action class
124 * @param addval additional value
126 inline void CicoHistoryState::addExitAction(CicoStateAction* action, int addval)
128 CicoStateCore::addExitAction(action, addval);
131 #endif // CICOHISTORYSTATE_H