PDF
AuboStudio SDK  0.6.3
arcs::aubo_scope::ScriptWriter Class Reference

ScriptWriter This interface provides support for generating Script code. More...

#include <script_writer.h>

Public Member Functions

 ScriptWriter (ScriptWriter &f)
 ScriptWriter (ScriptWriter &&f)
virtual ~ScriptWriter ()
void setLabel (int lineno, const std::string &comment)
void appendLine (const std::string &script_line)
 Adds a single line of script code using auto-indentation.
void appendVectorDouble (const std::vector< double > &value)
void appendRaw (const std::string &script)
 Adds script code appending the script code as is without using auto-indentation.
std::string generateScript ()
 Generate a string with the full script code.
void writeChildren ()
 Use this method when generating script code for a node that has children nodes.
void assign (VariablePtr variable, const std::string &expression, bool sync=false)
void assign (const std::string &variableName, const ExpressionPtr &expression, bool sync=false)
void assign (VariablePtr variable, const ExpressionPtr &expression, bool sync=false)
void incrementVariable (const std::string &variable_name)
 Add 1 to the variable value.
void note (const std::string &expression)
 Add a note.
void sleep (double seconds)
 Sleep for a number of seconds.
void sync ()
 Sync.
void defineFunction (const std::string &func_name)
 Define a function.
void anonyFunction (const std::string &func_name)
void setRobotIndex (int robot_index)
void returnMethod ()
 Return from method.
void end ()
 Insert an end.
void lineFeed ()
 Insert an empty line.
void setPayload (double mass, double x, double y, double z)
 Sets the mass and Center of Gravity of the payload.
void setTcp (const std::vector< double > &pose)
 Set the Tool Center Point.
void ifCondition (const ExpressionPtr &expression)
 Start an if-conditional.
void ifNotCondition (const ExpressionPtr &expression)
 Start a negated if-conditional.
void elseIfCondition (const ExpressionPtr &expression)
 Adds an else-if branch.
void elseCondition ()
 Adds an else branch.
void forCondition (int count, int step)
 Starts a for-loop.
void whileTrue ()
 Starts a while true loop.
void whileCondition (const ExpressionPtr &expression)
 Starts a while-loop.
void whileNot (const ExpressionPtr &expression)
 Starts a negated while-loop.
void defineThread (const std::string &thread_name, bool loop_or_not)
 Start a thread definition.
void runThread (const std::string &thread_name)
 Start a thread.
void killThread (const std::string &thread_name)
 Kill a thread.
std::string getResolvedVariable (const std::string &variable_name)
 Returns a registered variable name that can be used in a script.
void increaseIndent ()
void decreaseIndent ()

Private Member Functions

 ScriptWriter ()

Private Attributes

void * d_ { nullptr }

Friends

class DataSwitch

Detailed Description

ScriptWriter This interface provides support for generating Script code.

Definition at line 23 of file script_writer.h.

Constructor & Destructor Documentation

◆ ScriptWriter() [1/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter ( ScriptWriter & f)

References ScriptWriter().

Referenced by ScriptWriter(), and ScriptWriter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScriptWriter() [2/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter ( ScriptWriter && f)

References ScriptWriter().

Here is the call graph for this function:

◆ ~ScriptWriter()

virtual arcs::aubo_scope::ScriptWriter::~ScriptWriter ( )
virtual

◆ ScriptWriter() [3/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter ( )
private

Member Function Documentation

◆ anonyFunction()

void arcs::aubo_scope::ScriptWriter::anonyFunction ( const std::string & func_name)

◆ appendLine()

void arcs::aubo_scope::ScriptWriter::appendLine ( const std::string & script_line)

Adds a single line of script code using auto-indentation.

Parameters
script_linesingle line of script code to append.

◆ appendRaw()

void arcs::aubo_scope::ScriptWriter::appendRaw ( const std::string & script)

Adds script code appending the script code as is without using auto-indentation.

Parameters
scriptscript code to append.

◆ appendVectorDouble()

void arcs::aubo_scope::ScriptWriter::appendVectorDouble ( const std::vector< double > & value)

◆ assign() [1/3]

void arcs::aubo_scope::ScriptWriter::assign ( const std::string & variableName,
const ExpressionPtr & expression,
bool sync = false )

Variable assignment. Assigns the variable without a local or global qualifier.

Parameters
variableNamename of the variable, not null.
expressionexpression that is assigned to the variable, not null.

References sync().

Here is the call graph for this function:

◆ assign() [2/3]

void arcs::aubo_scope::ScriptWriter::assign ( VariablePtr variable,
const ExpressionPtr & expression,
bool sync = false )

Variable assignment.

Parameters
variablethe variable to assign an expression to, not null.
expressionexpression that is assigned to the variable, not null.

References sync().

Here is the call graph for this function:

◆ assign() [3/3]

void arcs::aubo_scope::ScriptWriter::assign ( VariablePtr variable,
const std::string & expression,
bool sync = false )

References sync().

Here is the call graph for this function:

◆ decreaseIndent()

void arcs::aubo_scope::ScriptWriter::decreaseIndent ( )

◆ defineFunction()

void arcs::aubo_scope::ScriptWriter::defineFunction ( const std::string & func_name)

Define a function.

Parameters
func_namefunction name.

◆ defineThread()

void arcs::aubo_scope::ScriptWriter::defineThread ( const std::string & thread_name,
bool loop_or_not )

Start a thread definition.

Parameters
thread_namethe thread name,
loop_or_notwhether loops.

◆ elseCondition()

void arcs::aubo_scope::ScriptWriter::elseCondition ( )

Adds an else branch.

◆ elseIfCondition()

void arcs::aubo_scope::ScriptWriter::elseIfCondition ( const ExpressionPtr & expression)

Adds an else-if branch.

Parameters
expressionthe expression.

◆ end()

void arcs::aubo_scope::ScriptWriter::end ( )

Insert an end.

◆ forCondition()

void arcs::aubo_scope::ScriptWriter::forCondition ( int count,
int step )

Starts a for-loop.

Parameters
countloop count,
steploop step.

◆ generateScript()

std::string arcs::aubo_scope::ScriptWriter::generateScript ( )

Generate a string with the full script code.

Returns
the resulting script as a string.

◆ getResolvedVariable()

std::string arcs::aubo_scope::ScriptWriter::getResolvedVariable ( const std::string & variable_name)

Returns a registered variable name that can be used in a script.

Parameters
variable_namea variable name.
Returns
variable name that can be used in a script.

◆ ifCondition()

void arcs::aubo_scope::ScriptWriter::ifCondition ( const ExpressionPtr & expression)

Start an if-conditional.

Parameters
expressionthe expression.

◆ ifNotCondition()

void arcs::aubo_scope::ScriptWriter::ifNotCondition ( const ExpressionPtr & expression)

Start a negated if-conditional.

Parameters
expressionthe expression.

◆ increaseIndent()

void arcs::aubo_scope::ScriptWriter::increaseIndent ( )

◆ incrementVariable()

void arcs::aubo_scope::ScriptWriter::incrementVariable ( const std::string & variable_name)

Add 1 to the variable value.

Parameters
variable_namethe variable to increment.

◆ killThread()

void arcs::aubo_scope::ScriptWriter::killThread ( const std::string & thread_name)

Kill a thread.

Parameters
thread_namethe thread name.

◆ lineFeed()

void arcs::aubo_scope::ScriptWriter::lineFeed ( )

Insert an empty line.

◆ note()

void arcs::aubo_scope::ScriptWriter::note ( const std::string & expression)

Add a note.

Parameters
expressionthe note expression.

◆ returnMethod()

void arcs::aubo_scope::ScriptWriter::returnMethod ( )

Return from method.

◆ runThread()

void arcs::aubo_scope::ScriptWriter::runThread ( const std::string & thread_name)

Start a thread.

Parameters
thread_namethe thread name.

◆ setLabel()

void arcs::aubo_scope::ScriptWriter::setLabel ( int lineno,
const std::string & comment )

◆ setPayload()

void arcs::aubo_scope::ScriptWriter::setPayload ( double mass,
double x,
double y,
double z )

Sets the mass and Center of Gravity of the payload.

◆ setRobotIndex()

void arcs::aubo_scope::ScriptWriter::setRobotIndex ( int robot_index)

◆ setTcp()

void arcs::aubo_scope::ScriptWriter::setTcp ( const std::vector< double > & pose)

Set the Tool Center Point.

◆ sleep()

void arcs::aubo_scope::ScriptWriter::sleep ( double seconds)

Sleep for a number of seconds.

Parameters
secondsamount of time to sleep in seconds.

◆ sync()

void arcs::aubo_scope::ScriptWriter::sync ( )

Sync.

Referenced by assign(), assign(), and assign().

Here is the caller graph for this function:

◆ whileCondition()

void arcs::aubo_scope::ScriptWriter::whileCondition ( const ExpressionPtr & expression)

Starts a while-loop.

Parameters
expressionthe loop invariant.

◆ whileNot()

void arcs::aubo_scope::ScriptWriter::whileNot ( const ExpressionPtr & expression)

Starts a negated while-loop.

Parameters
expressionthe loop invariant.

◆ whileTrue()

void arcs::aubo_scope::ScriptWriter::whileTrue ( )

Starts a while true loop.

◆ writeChildren()

void arcs::aubo_scope::ScriptWriter::writeChildren ( )

Use this method when generating script code for a node that has children nodes.

Let children nodes generate code.

◆ DataSwitch

friend class DataSwitch
friend

Definition at line 223 of file script_writer.h.

References DataSwitch.

Referenced by DataSwitch.

Member Data Documentation

◆ d_

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

Definition at line 225 of file script_writer.h.


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