AuboStudio SDK  0.6.3
program_node_contribution.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
2#define AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
3
4#include <string>
7
8namespace arcs {
9namespace aubo_scope {
11
12/**
13 * \chinese
14 * 程序节点贡献
15 * 定义了在 AuboScope 中指定 AuboCap 程序节点所需的 API。
16 * \endchinese
17 * \english
18 * ProgramNodeContribution
19 * Defines an API required for specifying a AuboCap Program Node within
20 * AuboScope.
21 * \endenglish
22 */
24{
25public:
26 virtual ~ProgramNodeContribution() = default;
27
28 /**
29 * \chinese
30 * 当此节点在程序树中被选中时调用。
31 * \endchinese
32 * \english
33 * Called when this node is selected in the program tree.
34 * \endenglish
35 */
36 virtual void openView() = 0;
37
38 /**
39 * \chinese
40 * 当此节点在程序树中被取消选中或导航到其他视图时调用。
41 * \endchinese
42 * \english
43 * Called when this node is unselected in the program tree or when
44 * navigating to another view.
45 * \endenglish
46 */
47 virtual void closeView() = 0;
48
49 /**
50 * \chinese
51 * @return 程序树中为此程序节点显示的文本。
52 * @throws IllegalStateException 如果数据模型或子程序子树被修改
53 * \endchinese
54 * \english
55 * @return The text displayed in the Program Tree for the program node.
56 * @throws IllegalStateException if the data model or child program
57 * sub-tree is modified
58 * \endenglish
59 */
60 virtual std::string getTitle() = 0;
61
62 /**
63 * \chinese
64 * <p>
65 * 如果此程序节点完整,应返回 <code>true</code>,否则返回 <code>false</code>。
66 * </p>
67 *
68 * <p>
69 * 未定义的程序节点将在程序树中以黄色标记。只要程序包含一个或多个未定义的
70 * 程序节点,用户就无法启动程序。
71 * </p>
72 *
73 * 如果此程序节点在其 DataModel 中存储了不可解析的实体(例如
74 * PersistedVariable 或 TCP),则该程序节点将被视为未定义。
75 *
76 * @return 如果此程序节点完整则返回 <code>true</code>,否则返回
77 * <code>false</code>。
78 * @throws IllegalStateException 如果数据模型或子程序子树被修改
79 * \endchinese
80 * \english
81 * <p>
82 * Should return <code>true</code> if this program node is complete, and
83 * <code>false</code> otherwise.
84 * </p>
85 *
86 * <p>
87 * Undefined program nodes will be marked with yellow in the program
88 * tree. The user cannot start the program as long as it contains one or
89 * more undefined program nodes.
90 * </p>
91 *
92 * If this program node stores an unresolvable entity (e.g. {@link
93 * variable/PersistedVariable} or {@link tcp/TCP}) in its DataModel, the
94 * program node will be treated as undefined.
95 *
96 * @return <code>true</code> if this program node is complete and otherwise
97 * <code>false</code>.
98 * @throws IllegalStateException if the data model or child program
99 * sub-tree is modified.
100 * \endenglish
101 */
102 virtual bool isDefined() = 0;
103
104 /**
105 * \chinese
106 * 定义此程序节点在程序中要生成的脚本代码。
107 *
108 * @param script_writer 用于添加定义此程序节点行为的脚本命令
109 * \endchinese
110 * \english
111 * Defines the script code to be generated by this program node within
112 * the program.
113 *
114 * @param script_writer serves to add script commands that define the behaviour
115 * of this program node.
116 * \endenglish
117 */
118 virtual void generateScript(ScriptWriterPtr script_writer) = 0;
119
120 /**
121 * \chinese
122 * @brief postAction 发送 HTTP POST 请求
123 * @param pattern URL 模式
124 * @param body 请求体
125 * @return 响应内容
126 * \endchinese
127 * \english
128 * @brief post
129 * @param pattern
130 * @param body
131 * @return
132 * \endenglish
133 */
134 virtual std::string postAction(const char *pattern, const std::string &body)
135 {
136 return "";
137 }
138
139 /**
140 * \chinese
141 * @brief getAction 发送 HTTP GET 请求
142 * @param pattern URL 模式
143 * @param body 请求体
144 * @return 响应内容
145 * \endchinese
146 * \english
147 * @brief GET
148 * @param pattern
149 * @param body
150 * @return
151 * \endenglish
152 */
153 virtual std::string getAction(const char *pattern, const std::string &body)
154 {
155 return "";
156 }
157};
158
159} // namespace aubo_scope
160} // namespace arcs
161
162#endif // AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
\chinese 程序节点贡献 定义了在 AuboScope 中指定 AuboCap 程序节点所需的 API。 \endchinese \english ProgramNodeContribution ...
virtual void openView()=0
\chinese 当此节点在程序树中被选中时调用。 \endchinese \english Called when this node is selected in the program tree.
virtual void closeView()=0
\chinese 当此节点在程序树中被取消选中或导航到其他视图时调用。 \endchinese \english Called when this node is unselected in the p...
virtual std::string postAction(const char *pattern, const std::string &body)
\chinese
virtual std::string getTitle()=0
\chinese
virtual std::string getAction(const char *pattern, const std::string &body)
\chinese
virtual void generateScript(ScriptWriterPtr script_writer)=0
\chinese 定义此程序节点在程序中要生成的脚本代码。