Class Script

Inheritance Relationships

Base Type

Class Documentation

class Script : public dai::DeviceNodeCRTP<DeviceNode, Script, ScriptProperties>

Public Functions

void setScriptPath(const std::filesystem::path &path, const std::string &name = "")

Specify local filesystem path to load the script

Parameters:
  • path – Filesystem path to load the script

  • name – Optionally set a name of this script, otherwise the name defaults to the path

void setScript(const std::string &script, const std::string &name = "")

Sets script data to be interpreted

Parameters:
  • scriptScript string to be interpreted

  • name – Optionally set a name of this script

void setScript(const std::vector<std::uint8_t> &data, const std::string &name = "")

Sets script data to be interpreted

Parameters:
  • data – Binary data that represents the script to be interpreted

  • name – Optionally set a name of this script

std::filesystem::path getScriptPath() const

Get filesystem path from where script was loaded.

Returns:

std::filesystem::path from where script was loaded, otherwise returns empty path

std::string getScriptName() const

Get the script name in utf-8.

When name set with setScript() or setScriptPath(), returns that name. When script loaded with setScriptPath() with name not provided, returns the utf-8 string of that path. Otherwise, returns “<script>”

Returns:

std::string of script name in utf-8

void setProcessor(ProcessorType type)

Set on which processor the script should run

Parameters:

type – Processor type - Leon CSS or Leon MSS

ProcessorType getProcessor() const

Get on which processor the script should run

Returns:

Processor type - Leon CSS or Leon MSS

virtual void buildInternal() override

Function called from within the create function to build the node. This function is useful for initialization, setting up inputs and outputs = stuff that cannot be perform in the constuctor.

inline DeviceNodeCRTP()
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props, bool confMode)
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device, std::unique_ptr<Properties> props, bool confMode)

Public Members

InputMap inputs = {*this, "io", {DEFAULT_NAME, DEFAULT_GROUP, true, 8, {{{DatatypeEnum::Buffer, true}}}, false}}

Inputs to Script node. Can be accessed using subscript operator (Eg: inputs[‘in1’]) By default inputs are set to blocking with queue size 8

OutputMap outputs = {*this, "io", {DEFAULT_NAME, DEFAULT_GROUP, {{{DatatypeEnum::Buffer, true}}}}}

Outputs from Script node. Can be accessed subscript operator (Eg: outputs[‘out1’])

Public Static Attributes

static constexpr const char *NAME = "Script"