Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

该项目是否支持类似C++语言的goto语句的功能? #47

Closed
libaineu2004 opened this issue Feb 18, 2023 · 1 comment
Closed
Labels
help wanted Extra attention is needed

Comments

@libaineu2004
Copy link

例如我的应用场景如下,a,b,c,d,e是5个节点:
a-b-d-e
\c/
当d节点运行完成了,如果条件满足就执行e节点,如果条件不满足就goto到a节点。
这个怎么实现?

@ChunelFeng
Copy link
Owner

不确定您说的 goto 到a节点,是 goto到特定为止,还是goto到任意为止。

首先,e节点是否执行,可以在node内部写逻辑,也可以将 node添加进入 condition中,
通过条件判断是否执行。
参考demo:https://github.com/ChunelFeng/CGraph/blob/main/tutorial/T06-Condition.cpp

其次,CGraph自身不支持 goto逻辑,但支持 condition中加入node、 group 或者 多层group 的逻辑,
如果将 需要goto的头节点位置,和尾节点位置 设置成一个 region的话,
理论上是可以实现 返回group的头循环执行的逻辑的。

参考demo:https://github.com/ChunelFeng/CGraph/blob/main/tutorial/T04-Complex.cpp
参考图片:https://github.com/ChunelFeng/CGraph/blob/main/doc/image/tutorial/T04-Complex.png

@ChunelFeng ChunelFeng added the help wanted Extra attention is needed label Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants