AuboCaps  0.6.0
arcs::aubo_scope::ProgramModel Class Reference

#include <program_model.h>

Public Member Functions

 ProgramModel (ProgramModel &f)
 
 ProgramModel (ProgramModel &&f)
 
virtual ~ProgramModel ()
 
ProgramNodeFactoryPtr getProgramNodeFactory ()
 This method returns a ProgramNodeFactory to create program nodes. More...
 
TreeNodePtr getTreeNode (ProgramNodeContribution *root)
 Gets the TreeNode root from ProgramNodeContribution. More...
 

Private Member Functions

 ProgramModel ()
 

Private Attributes

void * d_ { nullptr }
 

Friends

class DataSwitch
 

Detailed Description

Summary

This interface makes it possible to modify sub-trees of AuboCaps. The structure of trees is separated from the contents of the nodes. The TreeNode interface is concerned with the structure of trees whereas the ProgramNode interface deals with the concrete content of the nodes of the tree.

Getting started with program modification

A ProgramModel contains a:

  • getProgramNodeFactory() - that makes it possible to create new program nodes (both built-in AuboScope nodes and AuboCap program nodes).
  • getRootTreeNode(ProgramNodeContribution root)} - returns the sub-tree of a given AuboCap ProgramNodeContribution

The TreeNode interface supports insertion and removal of nodes. With it you can retrieve the list of children of particular nodes. Calling lockChildSequence on a tree node, locks the immediate children under the node. I.e. children can not be rearranged, deleted or have other nodes inserted into the child sequence by the end user.

Example code

public class UpdateProgramExampleContribution implements
ProgramNodeContribution { ProgramModel programModel;
 public UpdateProgramExampleContribution(URCapAPI urCapAPI) {
     this.programModel = urCapAPI.getProgramModel();
 }

 private void insertIntoProgramTree() {
     TreeNode treeNode = programModel.createRootTreeNode(this);
     try {
         treeNode.addChild(programModel.getProgramNodeFactory().createCommentNode());
     } catch (TreeStructureException e) {
         // Your handler code
     }
 }

 //...
 //... rest of the implementation and a call to insertIntoProgramTree()
 //...
}

Definition at line 62 of file program_model.h.

Constructor & Destructor Documentation

arcs::aubo_scope::ProgramModel::ProgramModel ( ProgramModel f)
arcs::aubo_scope::ProgramModel::ProgramModel ( ProgramModel &&  f)
virtual arcs::aubo_scope::ProgramModel::~ProgramModel ( )
virtual
arcs::aubo_scope::ProgramModel::ProgramModel ( )
private

Member Function Documentation

ProgramNodeFactoryPtr arcs::aubo_scope::ProgramModel::getProgramNodeFactory ( )

This method returns a ProgramNodeFactory to create program nodes.

Returns
the factory to create program nodes.
TreeNodePtr arcs::aubo_scope::ProgramModel::getTreeNode ( ProgramNodeContribution root)

Gets the TreeNode root from ProgramNodeContribution.

From here, children can be added to form a sub-tree.

Parameters
rootThe AuboCap program node where a sub-tree is to be rooted.
Returns
Returns a TreeNode root.

Friends And Related Function Documentation

friend class DataSwitch
friend

Definition at line 86 of file program_model.h.

Member Data Documentation

void* arcs::aubo_scope::ProgramModel::d_ { nullptr }
private

Definition at line 88 of file program_model.h.


The documentation for this class was generated from the following file: