AuboStudio SDK  0.6.3
program_model.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_PROGRAM_MODEL_H
2#define AUBO_SCOPE_PROGRAM_MODEL_H
3
7
8namespace arcs {
9namespace aubo_scope {
11
12/**
13 * @ingroup ProgramApi
14 * <h1>Summary</h1>
15 * This interface makes it possible to modify sub-trees of aubo_studio plugins.
16 * The structure of trees is separated from the contents of the nodes.
17 * The {@link TreeNode} interface is concerned with the structure of trees
18 * whereas the {@link ProgramNode} interface deals with the concrete content of
19 * the nodes of the tree.
20 *
21 *
22 *
23 * <h1>Getting started with program modification</h1>
24 * A ProgramModel contains a:
25 * <ul>
26 * <li>getProgramNodeFactory() - that makes it possible to create new
27 * program nodes (both built-in AuboScope nodes and AuboCap program nodes).
28 * </li> <li>getRootTreeNode(ProgramNodeContribution root)} - returns the
29 * sub-tree of a given AuboCap ProgramNodeContribution</li>
30 * </ul>
31 *
32 *
33 * The TreeNode interface supports insertion and removal of nodes. With it you
34 * can retrieve the list of children of particular nodes. Calling
35 * lockChildSequence on a tree node, locks the immediate children under the
36 * node. I.e. children can not be rearranged, deleted or have other nodes
37 * inserted into the child sequence by the end user.
38 *
39 * <h1>Example code</h1>
40 * <pre>
41 * public class UpdateProgramExampleContribution implements
42 * ProgramNodeContribution { ProgramModel programModel;
43 *
44 * public UpdateProgramExampleContribution(API api) {
45 * this.programModel = api.getProgramModel();
46 * }
47 *
48 * private void insertIntoProgramTree() {
49 * TreeNode treeNode = programModel.createRootTreeNode(this);
50 * try {
51 * treeNode.addChild(programModel.getProgramNodeFactory().createCommentNode());
52 * } catch (TreeStructureException e) {
53 * // Your handler code
54 * }
55 * }
56 *
57 * //...
58 * //... rest of the implementation and a call to insertIntoProgramTree()
59 * //...
60 * }
61 * </pre>
62 */
64{
65public:
68 virtual ~ProgramModel();
69
70 /**
71 * This method returns a {@link ProgramNodeFactory} to create program nodes.
72 *
73 * @return the factory to create program nodes.
74 */
75 ProgramNodeFactoryPtr getProgramNodeFactory();
76
77 /**
78 * Gets the {@link TreeNode} root from {@link ProgramNodeContribution}. From
79 * here, children can be added to form a sub-tree.
80 *
81 * @param root The AuboCap program node where a sub-tree is to be rooted.
82 * @return Returns a {@link TreeNode} root.
83 */
85
86private:
87 friend class DataSwitch;
89 void *d_{ nullptr };
90};
91
92} // namespace aubo_scope
93} // namespace arcs
94
95#endif // AUBO_SCOPE_PROGRAM_MODEL_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
ProgramModel(ProgramModel &&f)
TreeNodePtr getTreeNode(ProgramNodeContribution *root)
Gets the TreeNode root from ProgramNodeContribution.
ProgramNodeFactoryPtr getProgramNodeFactory()
This method returns a ProgramNodeFactory to create program nodes.
Defines an API required for specifying a AuboCap Program Node within AuboScope.