> This page is for version 4.3.
> For other versions, use one of these documentation indexes:
> - 4.6 (Latest) (default): https://docs.nvidia.com/holoscan/sdk-user-guide/4-6-latest/llms.txt
> - ltsb-2.0: https://docs.nvidia.com/holoscan/sdk-user-guide/ltsb-2-0/llms.txt
> - 4.5: https://docs.nvidia.com/holoscan/sdk-user-guide/4-5/llms.txt
> - 4.4: https://docs.nvidia.com/holoscan/sdk-user-guide/4-4/llms.txt
> - 4.3: https://docs.nvidia.com/holoscan/sdk-user-guide/4-3/llms.txt
> - Archives: https://docs.nvidia.com/holoscan/sdk-user-guide/archives/llms.txt

> 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::Entity

> Class to wrap GXF Entity (nvidia::gxf::Entity).

Class to wrap GXF `Entity` (`nvidia::gxf::Entity`).

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

**Inherits from:** `nvidia::gxf::Entity` (public)

---

## Constructors

### Entity \[#entity]

#### Default

```cpp showLineNumbers={false}
holoscan::gxf::Entity::Entity() = default
```

#### Copy

inline

explicit

```cpp showLineNumbers={false}
holoscan::gxf::Entity::Entity(
    const nvidia::gxf::Entity &other
)
```

#### Move

inline

explicit

```cpp showLineNumbers={false}
holoscan::gxf::Entity::Entity(
    nvidia::gxf::Entity &&other
)
```

---

## Methods

### operator bool \[#operatorbool]

```cpp showLineNumbers={false}
holoscan::gxf::Entity::operator bool() const
```

Return true if the entity is not null.

Calling this method on an entity object from \{cpp:func}`holoscan::IOContext::receive` will return false if there is no entity to receive.

**Returns:** true if the entity is not null. Otherwise, false.

### get \[#get]

```cpp showLineNumbers={false}
template <typename DataT,
          typename = std::enable_if_t<!holoscan::is_vector_v<DataT> &&                                        holoscan::is_one_of_v<DataT, holoscan::Tensor>>>
std::shared_ptr<DataT> holoscan::gxf::Entity::get(
    const char *name = nullptr,
    bool log_errors = true
) const
```

### add \[#add]

```cpp showLineNumbers={false}
template <typename DataT,
          typename = std::enable_if_t<!holoscan::is_vector_v<DataT> &&                                        holoscan::is_one_of_v<DataT, holoscan::Tensor>>>
void holoscan::gxf::Entity::add(
    const std::shared_ptr<DataT> &data,
    const char *name = nullptr,
    std::optional<cudaStream_t> stream = std::nullopt
)
```

Adds a tensor component to the entity.

**Template parameters**

**`DataT`** `typename`

The data type (must be [holoscan::Tensor](../../../classes/tensor)).

---

**Parameters**

**`data`** `const std::shared_ptr<DataT> &`

Shared pointer to the tensor data.

---

**`name`** `const char *` — default: nullptr

Optional name for the component.

---

**`stream`** `std::optional<cudaStream_t>` — default: std::nullopt

Optional CUDA stream for stream-aware memory deallocation. When provided, the stream is set on the tensor's memory buffer, enabling allocators like [BlockMemoryPool](../../../classes/blockmemorypool) to defer memory reuse until GPU operations complete.

---

---

## Static methods

### New \[#new]

```cpp showLineNumbers={false}
static Entity holoscan::gxf::Entity::New(
    ExecutionContext *context
)
```