Hierarchical_State_Machine Class Reference

简介:
  #include <Hierarchical_State_Machine.h>

Collaboration diagram for Hierarchical_State_Machine:

[legend]
List of all members.

Detailed Description

This is an example of state machine implementation using Hierarchical State Machines.

For details refer to the article on Hierarchical State Machines

In conventional state machine design, all states are considered at the same level. The design does not capture the commonality that exists among states. In real life, many states handle most messages in similar fashion and differ only in handling of few key messages. Even when the actual handling differs, there is still some commonality. Hierarchical state machine design captures the commonality by organizing the states as a hierarchy. The states at the higher level in hierarchy perform the common message handling, while the lower level states inherit the commonality from higher level ones and perform the state specific functions. This examples explores hierarchichal state machines using an example of a hardware unit that can be in the following states:

Definition at line 32 of file Hierarchical_State_Machine.h.

 

Public Member Functions

void  On_Message (const Message *p_Message)
  Receive methods and invoke the handler for the currently active state.


Private Member Functions

void  Next_State (Unit_State &r_State)
  This private method changes the state for the state machine.


Private Attributes

Unit_State p_Current_State
  Pointer to the current state.

Static Private Attributes

Active  Active_State
  Static declaration of Active state. Static declarations share the same states across multiple instances.
Standby  Standby_State
  Static declaration of Standby state.
Suspect  Suspect_State
  Static declaration of Suspect state.
Failed  Failed_State
  Static declaration of Failed State.

Member Function Documentation

void Hierarchical_State_Machine::Next_State Unit_State r_State  )  [private]
 

This private method changes the state for the state machine.

The p_Current_State variable is updated with the new state

Parameters:
r_State  Reference to the desired next state

Definition at line 169 of file Hierarchical_State_Machine.h.

00170 {
00171     p_Current_State = &r_State;
00172 }

void Hierarchical_State_Machine::On_Message const Message *  p_Message  )   
 

Receive methods and invoke the handler for the currently active state.

Note that p_Current_State has already been set to the current state.

Parameters:
p_Message  Pointer to the message being processed.

Definition at line 17 of file Hierarchical_State_Machine.cpp.

00018 {
00019     switch (p_Message->GetType())
00020     {
00021     case Message::FAULT_TRIGGER:
00022         p_Current_State->On_Fault_Trigger(*this, p_Message);
00023         break;
00024 
00025     case Message::SWITCHOVER:
00026         p_Current_State->On_Switchover(*this, p_Message);
00027         break;
00028 
00029     case Message::DIAGNOSTICS_PASSED:
00030         p_Current_State->On_Diagnostics_Passed(*this, p_Message);
00031         break;
00032 
00033     case Message::DIAGNOSTICS_FAILED:
00034         p_Current_State->On_Diagnostics_Failed(*this, p_Message);
00035         break;
00036 
00037     case Message::OPERATOR_INSERVICE:
00038         p_Current_State->On_Operator_Inservice(*this, p_Message);
00039         break;
00040 
00041     default:
00042         assert(false);
00043         break;
00044     }
00045 }
相关文章
|
3月前
|
数据采集 监控 测试技术
JKI State Machine的特点与详细介绍
JKI State Machine的特点与详细介绍
52 0
JKI State Machine的特点与详细介绍
|
机器学习/深度学习 存储 数据采集
DCFEE: A Document-level Chinese Financial Event Extraction System based on Automatically Labeled论文解读
我们提出了一个事件抽取框架,目的是从文档级财经新闻中抽取事件和事件提及。到目前为止,基于监督学习范式的方法在公共数据集中获得了最高的性能(如ACE 2005、KBP 2015)。这些方法严重依赖于人工标注的训练数据。
121 0
|
存储 移动开发 自然语言处理
Document-Level event Extraction via human-like reading process 论文解读
文档级事件抽取(DEE)特别困难,因为它提出了两个挑战:论元分散和多事件。第一个挑战意味着一个事件记录的论元可能存在于文档中的不同句子中
90 0
|
人工智能 编解码 自动驾驶
YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
YOLOv7在5 FPS到160 FPS的范围内,在速度和精度方面都超过了所有已知的物体检测器,在GPU V100上以30 FPS或更高的速度在所有已知的实时物体检测器中具有最高的精度56.8% AP。
451 0
|
机器学习/深度学习 算法
Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information
Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information
Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
312 0
how to know which settype an assignment block is built based on
how to know which settype an assignment block is built based on
how to know which settype an assignment block is built based on
When should reread of cl_crm_bol_entity and $scope.$apply be called manually
When should reread of cl_crm_bol_entity and $scope.$apply be called manually
148 0
When should reread of cl_crm_bol_entity and $scope.$apply be called manually
Cannot find source code based button in SE24 - modification assistant
Cannot find source code based button in SE24 - modification assistant
159 0
|
Java 虚拟化 C++
Stack based vs Register based Virtual Machine Architecture
进程虚拟机简介 一个虚拟机是对原生操作系统的一个高层次的抽象,目的是为了模拟物理机器,本文所谈论的是基于进程的虚拟机,而不是基于系统的虚拟机,基于系统的虚拟机可以用来在同一个平台下去运行多个不同的硬件架构的操作系统,常见的有kvm,xen,vmware等,而基于进程的虚拟机常见的有JVM,PVM(python虚拟机)等,java和python的解释器将java和python的代码编译成JVM和P
3669 0