AuboStudio SDK 0.6.3

program_model.h
浏览该文件的文档.
1 #ifndef AUBO_SCOPE_PROGRAM_MODEL_H
2 #define AUBO_SCOPE_PROGRAM_MODEL_H
3
4 #include <aubo_caps/domain/program/structure/tree_node.h>
5 #include <aubo_caps/contribution/program/program_node_contribution.h>
6 #include <aubo_caps/domain/program/nodes/program_node_factory.h>
7
8 namespace arcs {
9 namespace aubo_scope {
10 ARCS_CLASS_FORWARD(ProgramModel);
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 */
62 class ARCS_ABI_EXPORT ProgramModel
63 {
64 public:
65 ProgramModel(ProgramModel &f);
66 ProgramModel(ProgramModel &&f);
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 */
83 TreeNodePtr getTreeNode(ProgramNodeContribution *root);
84
85 private:
86 friend class DataSwitch;
87 ProgramModel();
88 void *d_{ nullptr };
89 };
90
91 } // namespace aubo_scope
92 } // namespace arcs
93
94 #endif // AUBO_SCOPE_PROGRAM_MODEL_H
ARCS_ABI_EXPORT
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
arcs::aubo_scope::ProgramModel
Definition: program_model.h:63
arcs::aubo_scope::ProgramModel::ProgramModel
ProgramModel()
arcs::aubo_scope::ProgramModel::ProgramModel
ProgramModel(ProgramModel &f)
arcs::aubo_scope::ProgramModel::ProgramModel
ProgramModel(ProgramModel &&f)
arcs::aubo_scope::ProgramModel::~ProgramModel
virtual ~ProgramModel()
arcs::aubo_scope::ProgramModel::getTreeNode
TreeNodePtr getTreeNode(ProgramNodeContribution *root)
Gets the TreeNode root from ProgramNodeContribution.
arcs::aubo_scope::ProgramModel::getProgramNodeFactory
ProgramNodeFactoryPtr getProgramNodeFactory()
This method returns a ProgramNodeFactory to create program nodes.
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::ARCS_CLASS_FORWARD
ARCS_CLASS_FORWARD(GripForceCapability)
arcs
Definition: contribution_provider.h:7
program_node_contribution.h
program_node_factory.h
tree_node.h