7.9. Clara Pipeline Payload Entry

Payload entries are name / path pairs defined in the pipeline definition for the currently executing pipeline for the current operator.

Application code should not free any nvidia_clara_payload_entry* pointers, nor should application code retain such pointers beyond the lifetime of the application supplied execution callback handler.

The name of a payload entry can be empty (zero length string). Only a single entry can have an empty name for any set of inputs or outputs.

Clara remaps operator input and output paths as necessary prior to starting a pipeline. The path remapping is done to enable the output of one operator (example: “/data/output”) to be mapped to the input of another operator (example: “/app/input”).

see also: Payload

7.9.1. Name

Gets the name value from a payload entry object.

The buffer to which the name value is written must be allocated by the application prior to calling this function. When called, if the buffer argument is NULL or the value of buffer_size is insufficient, the call will fail. The minimum buffer size will still be returned via len_out, and application code can use this behavior to query the minimum size of buffer before allocating.

The name of a payload entry can be empty (zero length string). Only a single entry can have an empty name for any set of inputs or outputs.

Parameters

  • entry

    type: nvidia_clara_payload_entry *

    direction: In

    Pointer to a payload entry object.

  • buffer

    type: char *

    direction: In

    Character buffer which to write the entry’s name value to.

  • buffer_size

    type: size_t

    direction: In

    The size, in bytes, of buffer.

  • len_out

    type: size_t *

    direction: Out

    The size, in bytes, of the entry’s name value, including any trailing ‘0’.

Return

Returns zero if successful; otherwise a non - zero value.

result nvidia_clara_payload_entry__name(
  IN nvidia_clara_payload_entry *entry,
  IN char *buffer,
  IN int buffer_size,
  OUT int *len_out
);

example:

static buffer_size = 0;
static char* buffer;

int read_entry_name(nvidia_clara_payload_entry* entry) {
    size_t len = 0;
    result r = 0;

read:

    r = nvidia_clara_payload_entry__name(entry, buffer, buffer_size, &len);
    if (r != 0) {
        if (buffer_size >= len) {
            printf("Unknown error reading payload entry name (%d)", r);
            goto exit;
        }

        // Use `len` to set the buffer size.
        buffer_size = len;
        buffer = realloc(buffer, buffer_size);
        if (!buffer) {
            r = = 1;
            printf("Out of memory");
            goto exit;
        }

        // Try the read again.
        goto read;
    }

    printf("Payload entry name = %s", buffer);

exit:

    return r;
}

7.9.2. Path

Gets the path value of a payload entry object.

The buffer to which the path value is written must be allocated by the application prior to calling this function.When called, if the buffer argument is NULL or the value of buffer_size is insufficient, the call will fail. The minimum buffer size will still be returned via len_out, and application code can use this behavior to query the minimum size of buffer before allocating.

Clara remaps operator input and output paths as necessary prior to starting a pipeline.The path remapping is done to enable the output of one operator (example: “/data/output”) to be mapped to the input of another operator (example: “/app/input”).

Parameters

  • entry

    type: nvidia_clara_payload_entry *

    direction: In

    Pointer to a payload entry object.

  • buffer

    type: char *

    direction: In

    Character buffer which to write the entry’s path value to.

  • buffer_size

    type: size_t

    direction: In

    The size, in bytes, of buffer.

  • len_out

    type: size_t *

    direction: Out

    The size, in bytes, of the entry’s path value, including any trailing ‘0’.

Return

Returns zero if successful; otherwise a non - zero value.

result nvidia_clara_payload_entry__path(
  IN nvidia_clara_payload_entry *entry,
  IN char *buffer,
  IN int buffer_size,
  OUT int *len_out
);

example:

static buffer_size = 0;
static char* buffer;

int read_entry_path(nvidia_clara_payload_entry* entry) {
    size_t len = 0;
    result r = 0;

read:

    r = nvidia_clara_payload_entry__path(entry, buffer, buffer_size, &len);
    if (r != 0) {
        if (buffer_size >= len) {
            printf("Unknown error reading payload entry path (%d)", r);
            goto exit;
        }

        // Use `len` to set the buffer size.
        buffer_size = len;
        buffer = realloc(buffer, buffer_size);
        if (!buffer)  {
            r = = 1;
            printf("Out of memory");
            goto exit;
        }

        // Try the read again.
        goto read;
    }

    printf("Payload entry path = %s", buffer);

exit:

    return r;
}