holoscan::gxf::has_component

Beta
View as Markdown
bool holoscan::gxf::has_component(
gxf_context_t context,
gxf_uid_t eid,
gxf_tid_t tid = GxfTidNull(),
const char *name = nullptr,
int32_t *offset = nullptr,
gxf_uid_t *cid = nullptr
)

Determines if an entity has a specific component.

Searches for components within an entity based on certain criteria: component type, component name, and offset. Each of these criteria is optional. If no criteria are provided, the method returns the first component found. The “offset” primarily aids repeated searches, allowing continuation from the index returned by a prior search.

If no component matching the criteria is found, the function returns false.

Returns: true if a component matching the criteria is found, false otherwise.

Parameters

context
gxf_context_t

The valid GXF context.

eid
gxf_uid_t

The unique object ID (UID) of the entity being searched.

tid
gxf_tid_tDefaults to GxfTidNull()

The component type ID (TID) of the desired component (optional).

name
const char *Defaults to nullptr

The name of the component to find (optional). Ownership is not transferred.

offset
int32_t *Defaults to nullptr

The pointer to the index to start searching from. It will also store the index of the found component if one is discovered. nullptr is allowed.

cid
gxf_uid_t *Defaults to nullptr

The pointer to store the UID of the found component, if applicable.

See also: GxfComponentFind