Setting input values
The graph that has been selected in the GraphContainer may have multiple input ports. The Job itself may have inputs as well, called job ports. Once the graph has been compiled, all these graph and Job inputs can be listed using the Job's getInputs()
method that returns a collection of read-only Input
descriptors. Since the collection of Input
descriptors is dependent on the current graph and is determined when the graph is compiled, each time another graph is selected using GraphContainer::setGraph()
, or re-compiled using GraphContainer::compile()
, then the collection returned by Job::getInputs()
may change.
Each Input
descriptor indicates the input's name, indicates if it is a regular graph input port or a job port, and indicates its current default value if such a value has been defined in the graph for this input port. You can verify if an input has a default value by checking if its defaultValue
field in the Input
descriptor is empty or not using the Amino::Any::has_value()
method.
For each graph input port or Job port, you can set its desired value using the Job's setInputValue()
method. If an Input
has no default value, its value must be set using setInputValue()
before executing the graph. If an Input
has a default value, you can override this value by setting another one, otherwise the default value will be used automatically when executing the graph.
0
for an int
type).When the graph is executed, all values that have been set using setInputValue()
are consumed and must be set again before the next execution.
ValueData argument
The setInputValue()
method receives a TypeTranslation::ValueData
pointer that you control, and this pointer will be passed to the TypeTranslation::convertValueFromHost()
. You can use this data pointer to pass whatever information you need from the host application to extract a host value and convert it into a Bifrost value for this specific input.
Refer to Inputs/Outputs vs TypeTranslation shared libraries for information on the relationship between the Job's setInputValue()
method and the convertValueFromHost()
method of a TypeTranslation shared library.
Concurrency
The Executor SDK supports concurrent calls to the setInputValue()
method. This allows the host application to convert and set the values of multiple graph inputs, in whatever order, and as values for these inputs become available.