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>
5 #include <aubo_caps/contribution/program/program_creation_context.h>
6 #include <aubo_caps/domain/script/script_writer.h>
7
8 namespace arcs {
9 namespace aubo_scope {
10 ARCS_CLASS_FORWARD(ProgramNodeContribution);
11
12 /**
13 * Defines an API required for specifying a AuboCap Program Node within
14 * AuboScope.
15 */
16 class ProgramNodeContribution
17 {
18 public:
19 virtual ~ProgramNodeContribution() = default;
20
21 /**
22 * Called when this node is selected in the program tree.
23 */
24 virtual void openView() = 0;
25
26 /**
27 * Called when this node is unselected in the program tree or when
28 * navigating to another view.
29 */
30 virtual void closeView() = 0;
31
32 /**
33 *
34 * @return The text displayed in the Program Tree for the program node.
35 * @throws IllegalStateException if the data model or child program
36 * sub-tree is modified
37 */
38 virtual std::string getTitle() = 0;
39
40 /**
41 * <p>
42 * Should return <code>true</code> if this program node is complete, and
43 * <code>false</code> otherwise.
44 * </p>
45 *
46 * <p>
47 * Undefined program nodes will be marked with yellow in the program
48 * tree. The user cannot start the program as long as it contains one or
49 * more undefined program nodes.
50 * </p>
51 *
52 * If this program node stores an unresolvable entity (e.g. {@link
53 * variable/PersistedVariable} or {@link tcp/TCP}) in its DataModel, the
54 * program node will be treated as undefined.
55 *
56 * @return <code>true</code> if this program node is complete and otherwise
57 * <code>false</code>.
58 * @throws IllegalStateException if the data model or child program
59 * sub-tree is modified.
60 */
61 virtual bool isDefined() = 0;
62
63 /**
64 * Defines the script code to be generated by this program node within
65 * the program.
66 *
67 * @param writer serves to add script commands that define the behaviour
68 * of this program node.
69 */
70 virtual void generateScript(ScriptWriterPtr script_writer) = 0;
71
72 /**
73 * @brief post
74 * @param pattern
75 * @param body
76 * @return
77 */
78 virtual std::string postAction(const char *pattern, const std::string &body)
79 {
80 return "";
81 }
82
83 /**
84 * @brief GET
85 * @param pattern
86 * @param body
87 * @return
88 */
89 virtual std::string getAction(const char *pattern, const std::string &body)
90 {
91 return "";
92 }
93 };
94
95 } // namespace aubo_scope
96 } // namespace arcs
97
98 #endif // AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
arcs::aubo_scope::ProgramNodeContribution
Defines an API required for specifying a AuboCap Program Node within AuboScope.
Definition: program_node_contribution.h:17
arcs::aubo_scope::ProgramNodeContribution::openView
virtual void openView()=0
Called when this node is selected in the program tree.
arcs::aubo_scope::ProgramNodeContribution::closeView
virtual void closeView()=0
Called when this node is unselected in the program tree or when navigating to another view.
arcs::aubo_scope::ProgramNodeContribution::postAction
virtual std::string postAction(const char *pattern, const std::string &body)
post
Definition: program_node_contribution.h:78
arcs::aubo_scope::ProgramNodeContribution::getTitle
virtual std::string getTitle()=0
arcs::aubo_scope::ProgramNodeContribution::getAction
virtual std::string getAction(const char *pattern, const std::string &body)
GET
Definition: program_node_contribution.h:89
arcs::aubo_scope::ProgramNodeContribution::generateScript
virtual void generateScript(ScriptWriterPtr script_writer)=0
Defines the script code to be generated by this program node within the program.
arcs::aubo_scope::ProgramNodeContribution::isDefined
virtual bool isDefined()=0
arcs::aubo_scope::ProgramNodeContribution::~ProgramNodeContribution
virtual ~ProgramNodeContribution()=default
arcs::aubo_scope::ARCS_CLASS_FORWARD
ARCS_CLASS_FORWARD(GripForceCapability)
arcs
Definition: contribution_provider.h:7
program_creation_context.h
script_writer.h