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

> Endpoint implementation for DDS serialization.

[Endpoint](endpoint) implementation for DDS serialization.

This class implements the [holoscan::Endpoint](endpoint) interface to enable serialization/deserialization to/from a byte buffer, which can then be used with DDS DataWriter/DataReader.

Two write-mode storage options are provided:

* **Vector mode**: backed by a `std::vector<uint8_t>` that grows automatically.
* **Raw-buffer mode**: backed by a caller-supplied fixed-size `uint8_t*` buffer; writes that would exceed the buffer size fail instead of growing.

Read mode always operates over a `const std::vector<uint8_t>*`.

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

**Inherits from:** `holoscan::Endpoint` (public)

---

## Constructors

### FastDdsEndpoint \[#fastddsendpoint]

#### From raw pointer (with output buffer)

explicit

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::FastDdsEndpoint(
    std::vector<uint8_t> *output_buffer
)
```

Construct a `FastDdsEndpoint` in write mode.

Data will be appended to the output buffer.

**Throws:** `std::invalid_argument` if output\_buffer is nullptr

**Parameters**

**`output_buffer`** `std::vector<uint8_t> *`

Non-null pointer to the output buffer. Buffer is NOT cleared; data is appended.

---

#### Overload 2

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::FastDdsEndpoint(
    uint8_t *buffer,
    size_t buffer_size
)
```

Construct a `FastDdsEndpoint` in write mode with a fixed-size raw buffer.

Data will be written starting at position 0. Unlike the vector mode, writes that exceed buffer\_size will fail (the buffer does not grow).

**Throws:** `std::invalid_argument` if buffer is nullptr

**Parameters**

**`buffer`** `uint8_t *`

Non-null pointer to the output buffer.

---

**`buffer_size`** `size_t`

Available buffer size in bytes.

---

#### From raw pointer (with input buffer)

explicit

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::FastDdsEndpoint(
    const std::vector<uint8_t> *input_buffer
)
```

Construct a `FastDdsEndpoint` in read mode.

Data will be read from the input buffer starting at position 0.

**Throws:** `std::invalid_argument` if input\_buffer is nullptr

**Parameters**

**`input_buffer`** `const std::vector<uint8_t> *`

Non-null pointer to the input buffer.

---

#### Move

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::FastDdsEndpoint(
    FastDdsEndpoint &&
) = default
```

#### Copy (deleted)

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::FastDdsEndpoint(
    const FastDdsEndpoint &
) = delete
```

### Destructor \[#destructor]

### \~FastDdsEndpoint

```cpp showLineNumbers={false}
holoscan::FastDdsEndpoint::~FastDdsEndpoint() override = default
```

Default destructor.

---

## Assignment operators

### operator= \[#operator\_assign]

#### Move assign

```cpp showLineNumbers={false}
FastDdsEndpoint & holoscan::FastDdsEndpoint::operator=(
    FastDdsEndpoint &&
) = default
```

#### Copy assign (deleted)

```cpp showLineNumbers={false}
FastDdsEndpoint & holoscan::FastDdsEndpoint::operator=(
    const FastDdsEndpoint &
) = delete
```

---

## Methods

### is\_write\_available \[#iswriteavailable]

```cpp showLineNumbers={false}
bool holoscan::FastDdsEndpoint::is_write_available() override
```

Check if write operations are available.

**Returns:** true if constructed in write mode with valid buffer

### is\_read\_available \[#isreadavailable]

```cpp showLineNumbers={false}
bool holoscan::FastDdsEndpoint::is_read_available() override
```

Check if read operations are available.

**Returns:** true if constructed in read mode with data remaining

### write \[#write]

```cpp showLineNumbers={false}
expected<size_t, RuntimeError> holoscan::FastDdsEndpoint::write(
    const void *data,
    size_t size
) override
```

Write data to the buffer.

Appends the specified data to the output buffer.

**Returns:** Number of bytes written, or error if in read mode

**Parameters**

**`data`** `const void *`

Pointer to data to write

---

**`size`** `size_t`

Number of bytes to write

---

### read \[#read]

```cpp showLineNumbers={false}
expected<size_t, RuntimeError> holoscan::FastDdsEndpoint::read(
    void *data,
    size_t size
) override
```

Read data from the buffer.

Reads data from the current position and advances the read position.

**Returns:** Number of bytes read, or error if insufficient data or in write mode

**Parameters**

**`data`** `void *`

Pointer to destination buffer

---

**`size`** `size_t`

Number of bytes to read

---

### write\_ptr \[#writeptr]

```cpp showLineNumbers={false}
expected<void, RuntimeError> holoscan::FastDdsEndpoint::write_ptr(
    const void *pointer,
    size_t size,
    holoscan::MemoryStorageType type
) override
```

Write a pointer reference for zero-copy support.

For DDS, GPU device memory cannot be sent directly. This method fails for `kDevice` memory — the caller must stage device data to host memory before serialization. `kCudaManaged` memory is accepted (with a warning to ensure GPU operations are complete), and `kHost`/`kSystem` memory is written directly via write().

**Returns:** Success for host/system/managed memory, error for device memory

**Parameters**

**`pointer`** `const void *`

Pointer to data

---

**`size`** `size_t`

Size of data in bytes

---

**`type`** `holoscan::MemoryStorageType`

Memory storage type (host, device, system, cuda\_managed)

---

### reset\_read\_position \[#resetreadposition]

```cpp showLineNumbers={false}
void holoscan::FastDdsEndpoint::reset_read_position()
```

Reset the read position to the beginning.

Allows re-reading the buffer from the start. Only valid in read mode.

### read\_position \[#readposition]

```cpp showLineNumbers={false}
size_t holoscan::FastDdsEndpoint::read_position() const
```

Get the current read position.

**Returns:** Current read position (0 in write mode)

### size \[#size]

```cpp showLineNumbers={false}
size_t holoscan::FastDdsEndpoint::size() const
```

Get the total bytes written (write mode) or buffer size (read mode).

**Returns:** Total size in bytes

### bytes\_remaining \[#bytesremaining]

```cpp showLineNumbers={false}
size_t holoscan::FastDdsEndpoint::bytes_remaining() const
```

Get remaining bytes available for reading.

**Returns:** Bytes remaining (0 in write mode)

### bytes\_written \[#byteswritten]

```cpp showLineNumbers={false}
size_t holoscan::FastDdsEndpoint::bytes_written() const
```

Get the number of bytes written (raw buffer mode).

**Returns:** Bytes written in raw buffer mode, or vector size in vector mode, or 0.

### is\_write\_mode \[#iswritemode]

```cpp showLineNumbers={false}
bool holoscan::FastDdsEndpoint::is_write_mode() const
```

Check if in write mode.

**Returns:** true if constructed with output buffer (vector or raw)

### is\_read\_mode \[#isreadmode]

```cpp showLineNumbers={false}
bool holoscan::FastDdsEndpoint::is_read_mode() const
```

Check if in read mode.

**Returns:** true if constructed with input buffer

### write\_trivial\_type \[#writetrivialtype]

```cpp showLineNumbers={false}
template <typename T>
expected<size_t, RuntimeError> holoscan::FastDdsEndpoint::write_trivial_type(
    const T *object
)
```

### read\_trivial\_type \[#readtrivialtype]

```cpp showLineNumbers={false}
template <typename T>
expected<size_t, RuntimeError> holoscan::FastDdsEndpoint::read_trivial_type(
    T *object
)
```

### resource\_type \[#resourcetype]

```cpp showLineNumbers={false}
ResourceType holoscan::Resource::resource_type() const
```

Get the resource type.

**Returns:** The resource type.

### name \[#name]

#### Set the name of the resource (1)

```cpp showLineNumbers={false}
Resource & holoscan::Resource::name(
    const std::string &name
) &
```

Set the name of the resource.

**Returns:** The reference to the resource.

**Parameters**

**`name`** `const std::string &`

The name of the resource.

---

#### Set the name of the resource (2)

```cpp showLineNumbers={false}
Resource && holoscan::Resource::name(
    const std::string &name
) &&
```

Set the name of the resource.

**Returns:** The reference to the resource.

**Parameters**

**`name`** `const std::string &`

The name of the resource.

---

#### Const

const

```cpp showLineNumbers={false}
const std::string & holoscan::ComponentBase::name() const
```

Get the name of the component.

**Returns:** The name of the component.

### fragment \[#fragment]

#### Set the fragment of the resource

```cpp showLineNumbers={false}
Resource & holoscan::Resource::fragment(
    Fragment *fragment
)
```

Set the fragment of the resource.

**Returns:** The reference to the resource.

**Parameters**

**`fragment`** `Fragment *`

The pointer to the fragment of the resource.

---

#### Get a pointer to \[Fragment]\(fragment) object

```cpp showLineNumbers={false}
Fragment * holoscan::ComponentBase::fragment()
```

Get a pointer to [Fragment](fragment) object.

**Returns:** The Pointer to [Fragment](fragment) object.

#### Const

const

```cpp showLineNumbers={false}
const Fragment * holoscan::ComponentBase::fragment() const
```

Get a const pointer to [Fragment](fragment) object.

**Returns:** The const pointer to [Fragment](fragment) object.

### spec \[#spec]

#### Set the component specification to the resource

```cpp showLineNumbers={false}
Resource & holoscan::Resource::spec(
    const std::shared_ptr<ComponentSpec> &spec
)
```

Set the component specification to the resource.

**Returns:** The reference to the resource.

**Parameters**

**`spec`** `const std::shared_ptr<ComponentSpec> &`

The component specification.

---

#### Get the component specification of the resource

```cpp showLineNumbers={false}
ComponentSpec * holoscan::Resource::spec()
```

Get the component specification of the resource.

**Returns:** The pointer to the component specification.

### spec\_shared \[#specshared]

```cpp showLineNumbers={false}
std::shared_ptr<ComponentSpec> holoscan::Resource::spec_shared()
```

Get the shared pointer to the component spec.

**Returns:** The shared pointer to the component spec.

### setup \[#setup]

```cpp showLineNumbers={false}
virtual void holoscan::Resource::setup(
    ComponentSpec &spec
)
```

Define the resource specification.

**Parameters**

**`spec`** `ComponentSpec &`

The reference to the component specification.

---

### initialize \[#initialize]

```cpp showLineNumbers={false}
void holoscan::Resource::initialize() override
```

Initialize the component.

This method is called only once when the component is created for the first time, and use of light-weight initialization.

### to\_yaml\_node \[#toyamlnode]

```cpp showLineNumbers={false}
YAML::Node holoscan::Resource::to_yaml_node() const override
```

Get a `YAML` representation of the resource.

**Returns:** `YAML` node including spec of the resource in addition to the base component properties.

### set\_parameters \[#setparameters]

```cpp showLineNumbers={false}
void holoscan::Resource::set_parameters() override
```

Set the parameters based on defaults (sets GXF parameters for GXF components).

### id \[#id]

```cpp showLineNumbers={false}
int64_t holoscan::ComponentBase::id() const
```

Get the identifier of the component.

By default, the identifier is set to -1. It is set to a valid value when the component is initialized.

With the default executor (GXFExecutor), the identifier is set to the GXF component ID.

**Returns:** The identifier of the component.

### add\_arg \[#addarg]

#### Add an argument to the component (1)

```cpp showLineNumbers={false}
void holoscan::ComponentBase::add_arg(
    const Arg &arg
)
```

Add an argument to the component.

**Parameters**

**`arg`** `const Arg &`

The argument to add.

---

#### Add an argument to the component (2)

```cpp showLineNumbers={false}
void holoscan::ComponentBase::add_arg(
    Arg &&arg
)
```

Add an argument to the component.

**Parameters**

**`arg`** `Arg &&`

The argument to add.

---

#### Add a list of arguments to the component (1)

```cpp showLineNumbers={false}
void holoscan::ComponentBase::add_arg(
    const ArgList &arg
)
```

Add a list of arguments to the component.

**Parameters**

**`arg`** `const ArgList &`

The list of arguments to add.

---

#### Add a list of arguments to the component (2)

```cpp showLineNumbers={false}
void holoscan::ComponentBase::add_arg(
    ArgList &&arg
)
```

Add a list of arguments to the component.

**Parameters**

**`arg`** `ArgList &&`

The list of arguments to add.

---

### args \[#args]

```cpp showLineNumbers={false}
std::vector<Arg> & holoscan::ComponentBase::args()
```

Get the list of arguments.

**Returns:** The vector of arguments.

### description \[#description]

```cpp showLineNumbers={false}
std::string holoscan::ComponentBase::description() const
```

Get a description of the component.

**Returns:** `YAML` string.

**See also:**
to\_yaml\_node()

### service \[#service]

```cpp showLineNumbers={false}
template <typename ServiceT = DefaultFragmentService>
std::shared_ptr<ServiceT> holoscan::ComponentBase::service(
    std::string_view id = ""
) const
```

Retrieve a registered fragment service or resource.

Retrieves a previously registered fragment service or resource by its type and optional identifier. Returns nullptr if no service/resource is found with the specified type and identifier.

Note that any changes to the service retrieval logic in this method should be synchronized with the implementation in `Fragment::service()` method to maintain consistency.

**Returns:** The shared pointer to the service/resource, or nullptr if not found or if type casting fails.

**Template parameters**

**`ServiceT`** `typename`

The type of the service/resource to retrieve. Must inherit from either [Resource](resource) or [FragmentService](fragmentservice). Defaults to [DefaultFragmentService](defaultfragmentservice) if not specified.

---

**Parameters**

**`id`** `std::string_view` — default: ""

The identifier of the service/resource. If empty, retrieves by type only.

---

### get\_service\_by\_type\_info \[#getservicebytypeinfo]

```cpp showLineNumbers={false}
std::shared_ptr<FragmentService> holoscan::ComponentBase::get_service_by_type_info(
    const std::type_info &service_type,
    std::string_view id = ""
) const
```

Retrieve a registered fragment service or resource for Python bindings.

This is a helper method for Python bindings to retrieve a service by its C++ type info.

**Returns:** The shared pointer to the base service, or nullptr if not found.

**Parameters**

**`service_type`** `const std::type_info &`

The type info of the service/resource to retrieve.

---

**`id`** `std::string_view` — default: ""

The identifier of the service/resource. If empty, retrieves by type only.

---

### reset\_backend\_objects \[#resetbackendobjects]

```cpp showLineNumbers={false}
virtual void holoscan::ComponentBase::reset_backend_objects()
```

Reset any backend-specific objects (e.g. GXF GraphEntity).

### update\_params\_from\_args \[#updateparamsfromargs]

#### Update parameters based on the specified arguments

```cpp showLineNumbers={false}
void holoscan::Resource::update_params_from_args()
```

Update parameters based on the specified arguments.

#### Update parameters based on the specified arguments (with params)

```cpp showLineNumbers={false}
void holoscan::ComponentBase::update_params_from_args(
    std::unordered_map<std::string, ParameterWrapper> &params
)
```

Update parameters based on the specified arguments.

### service\_provider \[#serviceprovider]

```cpp showLineNumbers={false}
void holoscan::ComponentBase::service_provider(
    FragmentServiceProvider *provider
)
```

Set the service provider that owns this component.

---

## Static methods

### register\_converter \[#registerconverter]

```cpp showLineNumbers={false}
template <typename typeT>
static void holoscan::ComponentBase::register_converter()
```

Register the argument setter for the given type.

If an operator or resource has an argument with a custom type, the argument setter must be registered using this method.

The argument setter is used to set the value of the argument from the `YAML` configuration.

This method can be called in the initialization phase of the operator/resource (e.g., `initialize()`). The example below shows how to register the argument setter for the custom type (`Vec3`):

It is assumed that `YAML::convert<T>::encode` and `YAML::convert<T>::decode` are implemented for the given type. You need to specialize the `YAML::convert<>` template class.

For example, suppose that you had a `Vec3` class with the following members:

You can define the `YAML::convert<Vec3>` as follows in a '.cpp' file:

Please refer to the [yaml-cpp documentation](https://github.com/jbeder/yaml-cpp/wiki/Tutorial#converting-tofrom-native-data-types) for more details.

**Template parameters**

**`typeT`** `typename`

The type of the argument to register.

---

**Example**

```cpp showLineNumbers={false}
void MyOp::initialize() {
  register_converter<Vec3>();
}
```

**Example**

```cpp showLineNumbers={false}
struct Vec3 {
  // make sure you have overloaded operator==() for the comparison
  double x, y, z;
};
```

**Example**

```cpp showLineNumbers={false}
namespace YAML {
template<>
struct convert<Vec3> {
  static Node encode(const Vec3& rhs) {
    Node node;
    node.push_back(rhs.x);
    node.push_back(rhs.y);
    node.push_back(rhs.z);
    return node;
  }

  static bool decode(const Node& node, Vec3& rhs) {
    if(!node.IsSequence() || node.size() != 3) {
      return false;
    }

    rhs.x = node[0].as<double>();
    rhs.y = node[1].as<double>();
    rhs.z = node[2].as<double>();
    return true;
  }
};
}
```

### register\_argument\_setter \[#registerargumentsetter]

```cpp showLineNumbers={false}
template <typename typeT>
void holoscan::ComponentBase::register_argument_setter()
```

Register the argument setter for the given type.

Please refer to the documentation of `register_converter()` for more details.

**Template parameters**

**`typeT`** `typename`

The type of the argument to register.

---

---

## Types

### ResourceType

[Resource](resource) type used for the initialization of the resource.

| Name      | Value | Description      |
| --------- | ----- | ---------------- |
| `kNative` |       | Native resource. |
| `kGXF`    |       | GXF resource.    |

---

## Member variables

| Name                 | Type                               | Description                                       |
| -------------------- | ---------------------------------- | ------------------------------------------------- |
| `output_buffer_`     | `std::vector< uint8_t > *`         | Write mode buffer (non-owning, vector).           |
| `raw_output_buffer_` | `uint8_t *`                        | Write mode buffer (non-owning, raw).              |
| `raw_buffer_size_`   | `size_t`                           | Raw buffer capacity.                              |
| `write_position_`    | `size_t`                           | Current write position (raw buffer mode).         |
| `input_buffer_`      | `const std::vector< uint8_t > *`   | Read mode buffer (non-owning).                    |
| `read_position_`     | `size_t`                           | Current read position.                            |
| `resource_type_`     | `ResourceType`                     | The type of the resource.                         |
| `is_initialized_`    | `bool`                             | Whether the resource is initialized.              |
| `spec_`              | `std::shared_ptr< ComponentSpec >` | The component specification.                      |
| `id_`                | `int64_t`                          | The ID of the component.                          |
| `name_`              | `std::string`                      | Name of the component.                            |
| `fragment_`          | `Fragment *`                       | Pointer to the fragment that owns this component. |
| `args_`              | `std::vector< Arg >`               | List of arguments.                                |
| `service_provider_`  | `FragmentServiceProvider *`        | Pointer to the service provider.                  |