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 * <h1>Summary</h1>
14 * This interface makes it possible to modify sub-trees of aubo_studio plugins.
15 * The structure of trees is separated from the contents of the nodes.
16 * The {@link TreeNode} interface is concerned with the structure of trees
17 * whereas the {@link ProgramNode} interface deals with the concrete content of
18 * the nodes of the tree.
19 *
20 *
21 *
22 * <h1>Getting started with program modification</h1>
23 * A ProgramModel contains a:
24 * <ul>
25 * <li>getProgramNodeFactory() - that makes it possible to create new
26 * program nodes (both built-in AuboScope nodes and AuboCap program nodes).
27 * </li> <li>getRootTreeNode(ProgramNodeContribution root)} - returns the
28 * sub-tree of a given AuboCap ProgramNodeContribution</li>
29 * </ul>
30 *
31 *
32 * The TreeNode interface supports insertion and removal of nodes. With it you
33 * can retrieve the list of children of particular nodes. Calling
34 * lockChildSequence on a tree node, locks the immediate children under the
35 * node. I.e. children can not be rearranged, deleted or have other nodes
36 * inserted into the child sequence by the end user.
37 *
38 * <h1>Example code</h1>
39 * <pre>
40 * public class UpdateProgramExampleContribution implements
41 * ProgramNodeContribution { ProgramModel programModel;
42 *
43 * public UpdateProgramExampleContribution(API api) {
44 * this.programModel = api.getProgramModel();
45 * }
46 *
47 * private void insertIntoProgramTree() {
48 * TreeNode treeNode = programModel.createRootTreeNode(this);
49 * try {
50 * treeNode.addChild(programModel.getProgramNodeFactory().createCommentNode());
51 * } catch (TreeStructureException e) {
52 * // Your handler code
53 * }
54 * }
55 *
56 * //...
57 * //... rest of the implementation and a call to insertIntoProgramTree()
58 * //...
59 * }
60 * </pre>
61 */
63{
64public:
67 virtual ~ProgramModel();
68
69 /**
70 * This method returns a {@link ProgramNodeFactory} to create program nodes.
71 *
72 * @return the factory to create program nodes.
73 */
74 ProgramNodeFactoryPtr getProgramNodeFactory();
75
76 /**
77 * Gets the {@link TreeNode} root from {@link ProgramNodeContribution}. From
78 * here, children can be added to form a sub-tree.
79 *
80 * @param root The AuboCap program node where a sub-tree is to be rooted.
81 * @return Returns a {@link TreeNode} root.
82 */
84
85private:
86 friend class DataSwitch;
88 void *d_{ nullptr };
89};
90
91} // namespace aubo_scope
92} // namespace arcs
93
94#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.