# Action

<a id="action"></a>

# Action

```cpp
#include <icy/ipc.h>

struct Action
```

[Defined in src/base/include/icy/ipc.h:33](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L33)

Default action type for executing synchronized callbacks.

## Public Attributes

| Return | Name | Description |
|--------|------|-------------|
| [`Callback`](#callback-2) | [`target`](#target)  | The callable to invoke when the action is dispatched. |
| `void *` | [`arg`](#arg)  | Optional opaque pointer passed to the callback. |
| `std::string` | [`data`](#data-5)  | Optional string payload passed to the callback. |

---

<a id="target"></a>

### target

```cpp
Callback target
```

Type: [`Callback`](#callback-2)

[Defined in src/base/include/icy/ipc.h:37](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L37)

The callable to invoke when the action is dispatched.

---

<a id="arg"></a>

### arg

```cpp
void * arg
```

[Defined in src/base/include/icy/ipc.h:38](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L38)

Optional opaque pointer passed to the callback.

---

<a id="data-5"></a>

### data

```cpp
std::string data
```

[Defined in src/base/include/icy/ipc.h:39](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L39)

Optional string payload passed to the callback.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`Action`](#action-1) `inline` | Constructs an [Action](#action) with the given callback, optional argument, and optional data. |

---

<a id="action-1"></a>

### Action

`inline`

```cpp
inline Action(Callback target, void * arg = nullptr, const std::string & data = "")
```

[Defined in src/base/include/icy/ipc.h:45](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L45)

Constructs an [Action](#action) with the given callback, optional argument, and optional data.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `target` | [`Callback`](#callback-2) | Callback to invoke on dispatch. |
| `arg` | `void *` | Opaque pointer passed to the callback (default: nullptr). |
| `data` | `const std::string &` | String payload passed to the callback (default: empty). |

## Public Types

| Name | Description |
|------|-------------|
| [`Callback`](#callback-2)  |  |

---

<a id="callback-2"></a>

### Callback

```cpp
using Callback = std::function< void(const Action &)>
```

Type: std::function< void(const [`Action`](#action) &)>

[Defined in src/base/include/icy/ipc.h:35](https://github.com/auscaster/icey/blob/main/src/base/include/icy/ipc.h#L35)
