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

> Class for holding the argument information.

Class for holding the argument information.

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

---

## Constructors

### Arg \[#arg]

#### Copy

explicit

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

Construct a new `Arg` object.

**Parameters**

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

The name of the argument.

---

#### Copy (with value) (1)

```cpp showLineNumbers={false}
template <typename ArgT>
holoscan::Arg::Arg(
    const std::string &name,
    const ArgT &value
)
```

Construct a new `Arg` object.

**Parameters**

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

The name of the argument.

---

**`value`** `const ArgT &`

The value of the argument.

---

#### Copy (with value) (2)

```cpp showLineNumbers={false}
template <typename ArgT>
holoscan::Arg::Arg(
    const std::string &name,
    ArgT &&value
)
```

Construct a new `Arg` object.

**Parameters**

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

The name of the argument.

---

**`value`** `ArgT &&`

The value of the argument.

---

#### Copy (with value) (3)

```cpp showLineNumbers={false}
holoscan::Arg::Arg(
    const std::string &name,
    const char *value
)
```

Construct a new string `Arg` object from a C-style character array.

**Parameters**

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

The name of the argument.

---

**`value`** `const char *`

The value of the argument.

---

### Destructor \[#destructor]

### \~Arg

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

---

## Assignment operators

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

#### Copy assign

```cpp showLineNumbers={false}
template <typename ArgT,
          typename = std::enable_if_t<!std::is_same_v<Arg, std::decay_t<ArgT>>>>
Arg & holoscan::Arg::operator=(
    const ArgT &value
)
```

Define the assignment operator.

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

**Template parameters**

**`ArgT`** `typename`

The type of the argument.

---

**Parameters**

**`value`** `const ArgT &`

The value of the argument.

---

#### Move assign

```cpp showLineNumbers={false}
template <typename ArgT,
          typename = std::enable_if_t<!std::is_same_v<Arg, std::decay_t<ArgT>>>>
Arg && holoscan::Arg::operator=(
    ArgT &&value
)
```

Define the assignment operator.

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

**Template parameters**

**`ArgT`** `typename`

The type of the argument.

---

**Parameters**

**`value`** `ArgT &&`

The value of the argument.

---

#### Overload 3

```cpp showLineNumbers={false}
Arg & holoscan::Arg::operator=(
    const char *value
)
```

Assignment operator converting a C-style character array to a std::string.

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

**Parameters**

**`value`** `const char *`

The value of the argument.

---

---

## Methods

### name \[#name]

#### Mutable

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

Set the name of the argument.

#### Const

const

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

Get the name of the argument.

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

### arg\_type \[#argtype]

```cpp showLineNumbers={false}
const ArgType & holoscan::Arg::arg_type() const
```

Get the type of the argument.

**Returns:** The type of the argument.

### has\_value \[#hasvalue]

```cpp showLineNumbers={false}
bool holoscan::Arg::has_value() const
```

Check whether the argument contains a value.

**Returns:** true if the argument contains a value.

### value \[#value]

#### Mutable

```cpp showLineNumbers={false}
std::any & holoscan::Arg::value()
```

Get the value of the argument.

**Returns:** The reference to the value of the argument.

#### Const

const

```cpp showLineNumbers={false}
const std::any & holoscan::Arg::value() const
```

Get the value of the argument.

**Returns:** The reference to the value of the argument.

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

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

Get a `YAML` representation of the argument.

**Returns:** `YAML` node including the name, type, and value of the argument.

### value\_to\_yaml\_node \[#valuetoyamlnode]

```cpp showLineNumbers={false}
YAML::Node holoscan::Arg::value_to_yaml_node() const
```

Get a `YAML` representation of the argument value.

@ return `YAML` node including the value of the argument.

### description \[#description]

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

Get a description of the argument.

**Returns:** `YAML` string.

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

### set\_value\_ \[#setvalue]

#### Overload 1

```cpp showLineNumbers={false}
template <typename ArgT>
void holoscan::Arg::set_value_(
    const ArgT &value
)
```

#### Overload 2

```cpp showLineNumbers={false}
template <typename ArgT>
void holoscan::Arg::set_value_(
    ArgT &&value
)
```

---

## Member variables

| Name        | Type          | Description                |
| ----------- | ------------- | -------------------------- |
| `name_`     | `std::string` | The name of the argument.  |
| `arg_type_` | `ArgType`     | The type of the argument.  |
| `value_`    | `std::any`    | The value of the argument. |