AuboCaps  0.6.0
arcs::aubo_scope::FunctionModel Class Reference

#include <function_model.h>

Public Member Functions

 FunctionModel (FunctionModel &f)
 
 FunctionModel (FunctionModel &&f)
 
 ~FunctionModel ()
 
FunctionPtr addFunction (const std::string &name, const std::vector< std::string > &argumentNames)
 
bool removeFunction (FunctionPtr func)
 
FunctionPtr getFunction (const std::string &name)
 
std::vector< FunctionPtr > getFunctions ()
 

Private Member Functions

 FunctionModel ()
 

Private Attributes

void * d_ { nullptr }
 

Friends

class DataSwitch
 

Detailed Description

This interface provides methods to add and remove script functions in the Expression Editor accessible from Assignment and If program nodes among others.

Added functions merely serve as an easy way for the end customer to use the contributed functions. The implementation of a given script function must be added in the preamble of program through the use of InstallationNodeContribution#generateScript(ScriptWriter).

The full set of functions which can be contributed must be added in the preamble at all times, regardless of whether they are added to the Expression Editor or not. Otherwise old programs that rely on a script function contribution might stop working.

See also Function.

Definition at line 33 of file function_model.h.

Constructor & Destructor Documentation

arcs::aubo_scope::FunctionModel::FunctionModel ( FunctionModel f)
arcs::aubo_scope::FunctionModel::FunctionModel ( FunctionModel &&  f)
arcs::aubo_scope::FunctionModel::~FunctionModel ( )
arcs::aubo_scope::FunctionModel::FunctionModel ( )
private

Member Function Documentation

FunctionPtr arcs::aubo_scope::FunctionModel::addFunction ( const std::string &  name,
const std::vector< std::string > &  argumentNames 
)
Parameters
nameName of the function. Safe names must match regex [a-zA-Z][a-zA-Z0-9_]{0,24} for a total of 25 characters. A range of Universal Robots reserved names exists and cannot be used. In case of an illegal or reserved name, an FunctionException will be thrown.
argumentNamesIs a list of hints (for the function arguments) to be shown comma separated inside angle brackets in the Expression Editor. No more than five arguments can be specified. The hints must also match the regex [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters. Otherwise an FunctionException will be thrown.
Returns
If the script function was successfully added, an object representing the Function will be returned. Null otherwise (e.g. if a function with the same name was already added).
Exceptions
FunctionExceptionif the name is illegal or more than five arguments are specified.
FunctionPtr arcs::aubo_scope::FunctionModel::getFunction ( const std::string &  name)
Parameters
nameThe name of the function.
Returns
The function if found, otherwise null.
std::vector<FunctionPtr> arcs::aubo_scope::FunctionModel::getFunctions ( )
Parameters
filterThe filter being applied to the full list of added functions (by AuboCaps).
Returns
A collection of added functions that meet the filter criteria.
bool arcs::aubo_scope::FunctionModel::removeFunction ( FunctionPtr  func)
Parameters
functionFunction to be removed. Only functions added by this AuboCap can be removed.
Returns
true, if the function was successfully removed. false otherwise (e.g. if the function was not added by this AuboCap).

Friends And Related Function Documentation

friend class DataSwitch
friend

Definition at line 84 of file function_model.h.

Member Data Documentation

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

Definition at line 86 of file function_model.h.


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