> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::gxf::EntityGroup

> GXF entity group.

GXF entity group.

Define an entity group for the underlying GXF runtime. [Entity](entity) groups are used to associate components with resources inheriting from nvidia::gxf::ResourceBase. The components of this type exposed in Holoscan SDK's API are [GPUDevice](../../../classes/gpudevice) and [ThreadPool](../../../classes/threadpool).

```cpp showLineNumbers={false}
#include <holoscan/gxf/entity_group.hpp>
```

---

## Constructors

### EntityGroup \[#entitygroup]

#### Overload 2

```cpp showLineNumbers={false}
holoscan::gxf::EntityGroup::EntityGroup(
    gxf_context_t context,
    const std::string &name
)
```

#### Deleted overload 1

```cpp showLineNumbers={false}
holoscan::gxf::EntityGroup::EntityGroup() = delete
```

---

## Methods

### gxf\_gid \[#gxfgid]

```cpp showLineNumbers={false}
gxf_uid_t holoscan::gxf::EntityGroup::gxf_gid() const
```

Get the group id of the entity group.

**Returns:** The GXF group id of the entity group.

### gxf\_context \[#gxfcontext]

```cpp showLineNumbers={false}
gxf_context_t holoscan::gxf::EntityGroup::gxf_context() const
```

Get the GXF context of the entity group.

**Returns:** The GXF context of the entity group.

### name \[#name]

```cpp showLineNumbers={false}
std::string holoscan::gxf::EntityGroup::name() const
```

Get the name of the entity group.

**Returns:** The name of the entity group.

### add \[#add]

#### Add a GXF entity to the entity group

```cpp showLineNumbers={false}
void holoscan::gxf::EntityGroup::add(
    gxf_uid_t eid
)
```

Add a GXF entity to the entity group.

If the entity is already a member of a different entity group, it will be removed from that group and added to this one.

Will raise a runtime\_error if the entity is already a member of this entity group.

**Parameters**

**`eid`** `gxf_uid_t`

The GXF unique id corresponding to the entity.

---

#### Overload 2

```cpp showLineNumbers={false}
void holoscan::gxf::EntityGroup::add(
    const GXFComponent &component
)
```

Add a [GXFComponent](gxfcomponent) to the entity group.

If the component is already a member of a different entity group, it will be removed from that group and the entity it belongs to will be added to this one.

Will raise a runtime\_error if the entity is already a member of this entity group.

**Parameters**

**`component`** `const GXFComponent &`

The component to add to the entity group.

---

#### Overload 3

```cpp showLineNumbers={false}
void holoscan::gxf::EntityGroup::add(
    const std::shared_ptr<Operator> &op,
    const std::string &entity_prefix = ""
)
```

Add an [Operator](../../../classes/operator) to the entity group.

If the operator is already a member of a different entity group, it will be removed from that group and added to this one.

Will raise a runtime\_error if the entity is already a member of this entity group.

**Parameters**

**`op`** `const std::shared_ptr<Operator> &`

The operator to add to the entity group.

---

**`entity_prefix`** `const std::string &` — default: ""

A string prefix that can be used to indicate the entity the operator belongs to.

---

---

## Member variables

| Name           | Type            | Description                   |
| -------------- | --------------- | ----------------------------- |
| `name_`        | `std::string`   | The name of the entity group. |
| `gxf_context_` | `gxf_context_t` | The GXF context.              |
| `gxf_gid_`     | `gxf_uid_t`     | The GXF group id.             |