问题标签 [boost-msm]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 如何使用 Boost MSM 减少编译时间
我有大约 40 个转换的根状态机(包括四个子状态机)。一切运行良好,但是当我开始提高转换次数时,编译时间显着增加(大型状态机的开发变成了地狱)。我尝试使用 boost::msm::back::favor_compile_time 策略,并将子机拆分为多个翻译单元,但它没有效果。有人对这个问题有一些解决方法吗?Boost - 1.53,编译器 - MSVC 2012,处理器 - Intel i7
Upd:减少时间的最佳方法 - 从项目中删除 boost msm
visual-studio-2010 - Sub state-machine as inital active state in boost::msm
I want a sub state-machine to be the "initial_state" of a state-machine. The following should be a broken down version of the code.
While this compiles fine, when I call process_event
, it crashes. Is this even possible or is there a way of debugging this?
EDIT 1:
I now set a breakpoint on A::on_entry
. When start
gets called, it does not break, so my obvious question - why is the sub state-machine not used!?
EDIT 2:
Interestingly, when I replace SubMachineDefinition
with boost::msm::back::state_machine<SubMachineDefinition>
(as initial_state
) I get a compilation error, stating it tries to call B::on_entry
with InitEvent
instead of E
. I am by now very confused.
EDIT 3:
Actually I did copy the wrong overloads for A
. I also did apply sehe's SubMachineDefinition::on_entry
and SubMachineDefinition::on_exit
definitions. Still, I get the compilation error, that it tries to call B::on_entry
with InitEvent
.
c++ - Boost::MSM: Transition Priority
I try to use boost::MSM to implement a simple state machine for testing purpose. There are several events which have to be processed in the right order, so i defer the other events, which are currently not allowed. I try to defer the events in the transition table, to have one place to look for it, despite having all states to look, what events they defer.
I tried to change the transition rows to change their priorities, but it didnt help. If i unkomment the anonymous transition from live_got_image to live_wait_for_image, it works as expected, but i want to transition automaticly to repeatedly enter the states live_wait_for_image/live_got_image until the ev_stop_live get sent.
I expect the following output:
but actually i get the following output:
I use boost 1.57.0 and MSVC-2013 (VS-12).
Could anybody get me a useful hint?
Georg
Here is the code:
c++ - Boost.MSM:通过连接伪状态退出正交区域
我打算将boost.msm与包含正交区域的复合概念一起使用。我想在退出时同步所有正交区域。换句话说:当且仅当所有区域都达到其最后一个状态时,我的组合之后的状态才会被激活。
UML 2.4 “上层结构”提出了连接伪状态(即第 15.3.8 章)。在 boost 中,有一个fork,但我找不到它的对应连接的任何实现。
boost.msm 中没有加入伪状态吗?我将如何使用 boost.msm 应用加入伪状态的概念?
c++ - 如何在 boost::msm 中从状态机内部触发事件?
我是 boost::msm 的新手,我不知道如何使用基本前端从状态机内部触发事件。
假设我有两个正交区域:
- 第一个具有状态 A1 和 A2
- 第二个具有状态 B1 和 B2
- 从 B1 到 B2 的转换是由事件触发的
ev_B1ToB2
。
现在,我要问的是如何ev_B1ToB2
在从 A1 转换到 A2 时触发一个事件,以便它被状态机处理。
当然,我要实现的要复杂得多,我实际上是在尝试从子机上执行此操作,而事件只会由父机处理。因此,我的第二个问题:
当子机内触发事件时,如果子机不响应此事件,它是否会在更高的层次结构级别进行处理?
c++ - boost:msm 中没有默认构造函数的状态机
在 boost::msm 的文档中,有一个没有默认构造函数的状态机示例。我可以让它在我直接从超级 SM 跳到子 SM 的地方工作。但是当我从一个子 SM 跳到另一个子 SM 时,目标 SM 是默认构造的,我的数据已经消失了。下面是一个例子。如果不为子状态提供默认构造函数,我无法编译它。我是否需要在我的子 SM 中提供一些额外信息才能使其正常工作?
当我运行示例时,我得到:
我希望 0xdeadbeef 与其他地址相同。
c++ - 在 boost::msm 中的子 SM 之间跳转
我的主 SM 中有两个子 SM。我希望能够从主 SM 跳到其中一个,也可以从一个子 SM 跳到另一个 SM。但我不能。我能够从主 SM 跳到子 SM,从一个子 SM 跳到另一个,但是当我在子 SM 之间添加“相互”转换时,编译失败,大约 10 个错误抱怨不同的事情。我想这是因为编译器进入了递归旋转。
我想我可以在主 SM 中添加一个虚拟状态,并匿名转换到目标子 SM。但随后我会放弃触发转换的真实事件,我不想要那个(它包含数据)。
这是一些测试代码,其中有问题的行被注释掉了
c++ - 将多个 MSM 状态机耦合在一起
我的问题更像是一个架构问题。我有多个相同类型的状态机。说
现在,当一个控制器发送消息时,我是否应该使用一个调度程序将名称或 ID 调度到一个队列,该队列由调用process_event()
指定 msm 的线程工作?
当事件从一个公共基础派生时,它们可以保存在一个通用队列中,但process_event()
需要知道它是什么类型的事件。访客班来派遣他们?有更好的解决方案吗?
当我将事件限制为数字 ID 时,我可以消除很多问题,但另一方面,MSM 需要类型而不是 ID。
调用 , 的线程process_event()
需要知道它们工作的状态机的类型。模板显然...
编辑:目标是解耦实现。
boost - 如何将数据传递到当前的升压元状态机 (MSM) 子状态
在下面的例子中,虽然当前执行还在 substate1 中,但我想不断地向 substate1 传递数据,然后根据数据发送 Event3 或 Event1。看起来 MSM 仅支持使用 (process_event()) 发送事件,但我不确定如何将数据连续发送到当前状态。
输出:
c++ - 提升 msm 子子状态机
我在使用 boost::msm 实现子子状态机时遇到了一些麻烦。我试图在这里最小化我的代码......
测试.cpp:
StateMachineA 在 StateMachineA.h 中定义
StateMachineB 包含一个使用完全相同的代码的 StateMachineC(将 B 替换为 C...)。
将 StateMachineC 作为 StateMachineA 的子机(省略 StateMachineB)可以正常工作。相同的 A -> B 不包括 C 也可以正常工作。重新排序状态机 (A -> C -> B) 会产生相同的错误。总结一下:两个状态机的每个组合都在工作,三个状态机的每个组合都失败了。SM sm1;
在我的主要功能中发生错误。-> 在解析模板时?没有那条线,一切都编译得很好。
错误日志很长(长到足以导致 Visual Studio 在悬停时崩溃......)。第一个错误是:
with ... 以及大约 200 条“with”行。之后,许多类型的错误:
跟随。
有任何想法吗?
谢谢!