ANTAREX API

Clava API

LARA API

LARA Common Language API

(.js)
laraImport("antarex.margot.codegen.MargotCodeGen");

(.lara)
import antarex.margot.codegen.MargotCodeGen;

MargotCodeGen

Constructor

MargotCodeGen

new MargotCodeGen(block, [vars])

This class contains the methods to generate and insert the code of the mARGOt interface in a target application.

Every method provided here will include the mARGOt header in the correct place if needed.

Every method provided here, except {@link MargotCodeGen.init}, will also insert a default initialization to the mARGOt framework at the start of the main function.

Parameters

block: string - the name of the block, this is mandatory
vars: ...string - the names of the knob variables (optional)

Static Members

fromConfig

fromConfig(config, blockName)

Generates and returns the code generation instance needed for block with provided name.

Parameters

config: MargotConfig - the configuration from which we get the information
blockName: String - the name of the block for which the code generation infor will be returned

Returns

MargotCodeGen - an object with the code generation information

Instance Members

init

init($joinpoint)

Inserts the code for the mARGOt initialization call. This function will find the parent scope of the provided join point and will insert the 'init' call at the start of that scope.

This function will throw an exception if it is not possible to find a scope from the provided join point.

This function will issue a warning and perform nothing if the initialization was already performed. Two possible causes:
1) This function is called following any other function that inserts code. By default, if any of those functions is called and 'init' was not called beforehand, the initialization code will be inserted at the start of the main function.
2) This function is called multiple times.

Parameters

$joinpoint: joinpoint - the reference join point

log

log($joinpoint)

Inserts code to log the collected data after the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point

monitor

monitor($joinpoint, [startArgs], [stopArgs])

Inserts code to start and stop all monitors specified in the configuration around the provided join point.

This is equivalent to calling {@link MargotCodeGen.startMonitors} and then {@link MargotCodeGen.stopMonitors} with the same join point.

Parameters

$joinpoint: joinpoint - the reference join point
startArgs: string[] - the arguments to the start monitors call (optional)
stopArgs: string[] - the arguments to the stop monitors call (optional)

monitorLog

monitorLog($joinpoint, [startArgs], [stopArgs])

Inserts code to start and stop all monitors specified in the configuration around the provided join point, and also inserts the code to log after the join point.

This is equivalent to calling {@link MargotCodeGen.monitor} and then {@link MargotCodeGen.log} with the same join point.

Parameters

$joinpoint: joinpoint - The point in the code around which the code will be inserted
startArgs: string[] - The arguments to the start monitors call (optional) (optional)
stopArgs: string[] - The arguments to the stop monitors call (optional) (optional)

setFeatures

setFeatures(features)

Sets the names of the variables that hold the values of the data features.

Parameters

features: (string[]|...string) - the list of variable names

setGoal

setGoal($joinpoint, goalName, goalValue)

Inserts code to set the value of a goal.

Parameters

$joinpoint: joinpoint - the reference join point
goalName: string - the name of the goal
goalValue: string - the value to assign to the goal

setKnobs

setKnobs(knobs)

Sets the names of the variables that hold the values of the knobs.

Parameters

knobs: (string[]|...string) - the list of variable names

startMonitor

startMonitor($joinpoint, monitorName, [args])

Inserts code to start a single monitor specified in the configuration before the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point
monitorName: string - the name of the monitor to be started
args: ...string - the arguments to the start monitor call (optional)

startMonitors

startMonitors($joinpoint, [startArgs])

Inserts code to start all monitors specified in the configuration before the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point
startArgs: ...string - the arguments to the start monitors call (optional)

stopMonitor

stopMonitor($joinpoint, monitorName, [args])

Inserts code to stop a single monitor specified in the configuration after the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point
monitorName: string - the name of the monitor to be stopped
args: ...string - the arguments to the stop monitor call (optional)

stopMonitors

stopMonitors($joinpoint, [stopArgs])

Inserts code to stop all monitors specified in the configuration after the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point
stopArgs: ...string - the arguments to the start monitors call (optional)

update

update($joinpoint)

Inserts the update code before the provided join point.

Parameters

$joinpoint: joinpoint - the reference join point