AuboCaps  0.6.0
program_node_contribution.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
2 #define AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
3 
4 #include <string>
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  */
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  }
81 
82  /**
83  * @brief GET
84  * @param pattern
85  * @param body
86  * @return
87  */
88  virtual std::string getAction(const char *pattern, const std::string &body)
89  {
90  }
91 };
92 
93 } // namespace aubo_scope
94 } // namespace arcs
95 
96 #endif // AUBO_SCOPE_PROGRAM_NODE_CONTRIBUTION_H
ARCS_CLASS_FORWARD(GripForceCapability)
Defines an API required for specifying a AuboCap Program Node within AuboScope.
virtual std::string getAction(const char *pattern, const std::string &body)
GET.
virtual std::string postAction(const char *pattern, const std::string &body)
post
virtual void openView()=0
Called when this node is selected in the program tree.
virtual void generateScript(ScriptWriterPtr script_writer)=0
Defines the script code to be generated by this program node within the program.
virtual void closeView()=0
Called when this node is unselected in the program tree or when navigating to another view...