C++ 的哪些状态机执行框架?实现 UML 语义?

发布于 2024-09-19 19:00:25 字数 1539 浏览 10 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

丑疤怪 2024-09-26 19:00:26

您可以查看我的 C++ 模板类框架 STTCL ,该框架旨在提供 UML 2.2 状态的映射实现类的图表符号。 STTCL 方法是 GoF 状态模式的改进,并试图填补 UML 状态图表示法的空白。

只要需要,框架实现就操作系统依赖性而言是可配置的(仅适用于异步执行模型)。

有一个 PDF 文档更详细地解释了这个概念。

You may have a look at my C++ template class framework STTCL that is purposed to provide mapping of UML 2.2 state diagram notation to implementation classes. The STTCL approach is a refinement of the GoF state pattern and tries to fill the gap(s) to the UML state chart notation.

The framework implementations are configurable regarding OS dependencies as far these are needed (only for asynchronous execution models).

There's a PDF document available explaining the concept in more detail.

葬花如无物 2024-09-26 19:00:25

查看量子平台

我已经在几个嵌入式项目(从非常小的到非常大的)中使用过它,它支持您需要的所有项目符号项目,甚至更多。

QP 的网页比我在这里做得更好。

请注意,QP 并未实现 UML 规范中指定的 100% 功能,但对偏离的情况进行了明确解释,并且根据我使用 QP 的所有经验,它们都不是项目的问题。

还有 2 个 Boost statechart 包,您似乎知道这些。

Check out the Quantum Platform.

I've used it on several embedded projects (from very tiny to very large), and it supports all of the bullet items you require, and more.

The web page for the QP does a much better job of explaining itself than I can do here.

Be aware, the QP does not implement 100% of the functionality specified in the UML specification, but the departures are clearly explained, and in all my experience with the QP, none of them have been a problem for the project.

There are also 2 Boost statechart packages, which you seem to know about.

爺獨霸怡葒院 2024-09-26 19:00:25

You should go and check out Boost MSM, it's new for Boost 1.44 but seems quite complete. I have not yet tried it out myself but it looks quite promising.

べ繥欢鉨o。 2024-09-26 19:00:25

截至今天,有一个新的 C++(支持带有 Boost 的 C++11 和 C++03)替代方案。它被称为 yasmine (我是架构师)。
它满足上述所有要求。

一些优点和缺点(引自 yasmine 网页):

使用yasmine的优点

  • 她提供了 UML 状态机语义的完整实现。
  • yasmine 是使用 C++11 的现代 C++ 实现(也提供 C++03 支持)。
  • 因为它是 C++(而不是 C),所以代码可以很好地集成到 OO 代码中。
  • 她有详细记录[...]
  • 因为她是开源的,所以您可以查看她的实现。这也保证了长期的可用性和可用性。
  • 该库使您能够在运行时创建状态机。
  • [...]

yasmine 不是什么

她不是一个优先考虑运行的最小足迹库
每个系统,无论可用资源有多么少。亚斯明不是
资源匮乏,但她不能(也不想)与
基于 switch-case 的裸机非抽象库。

注意

我知道这是一个老问题,但它是 Google 的“c++ uml 状态机”排名第一的问题,这使得它非常相关。

As of today there is a new C++ (supports C++11 and C++03 with Boost) alternative available. It's called yasmine (and I am the architect).
It fulfills all the above requirements.

Some pros and cons (cited from the yasmine web page):

Advantages of using yasmine

  • She provides a complete implementation of UML state machine semantics.
  • yasmine is a modern C++ implementation using C++11 (C++03 support is available, too).
  • Because it's C++ (and not C) the code integrates nicely into OO code.
  • She's well documented [...]
  • Because she is open source you can check her implementation out. Also this guarantees long term usability and availability.
  • The library enables you to create state machines at runtime.
  • [...]

What yasmine is not

She's not a minimum foot print library that prioritizes on running on
every system no matter how few resources are available. yasmine is not
resource hungry, but she cannot (and does not want to) compete with
switch-case-based bare-metal no-abstraction libraries.

Note

I know this is an old question, but it's Google's #1 for "c++ uml state machine" which makes it very relevant.

裂开嘴轻声笑有多痛 2024-09-26 19:00:25

如果您正在寻找一个支持具有 UML 语义的分层和并发状态机(进入/退出、转换、防护、带参数的事件、异步/同步)的框架,请查看我的 状态机代码和图表生成器

而不是“手动”实现状态机,而是用简单的人类可读可写的 xml 描述来描述状态机,并让状态机生成器用 C++、C# 或 java 编写代码源。

实际上,对于C++版本,生成的代码可以很容易地针对中/大型嵌入式系统进行交叉编译。它已经完成了。

If you are looking for a framework that supports hierarchical and concurrent state machines with UML semantics (entry/exit, transitions, guards, events with parameters, asynchronous/synchronous), have a look at my state machine code and diagram generator.

Instead on implementing the state machine "by hand", describe the state machine in a simple human readable and writable xml description and let the state machine generator write the code source in C++, C# or java.

Actually, for the C++ version, the generated code can be easily cross-compiled for an medium/large size embedded system. It has been done already.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文