# ArHostCloudAnchorFuture

An asynchronous operation for hosting a Cloud Anchor launched by `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`.

See the [Cloud Anchors developer guide](https://developers.google.com/ar/develop/c/cloud-anchors/developer-guide) for more information.

## Summary

| ### Typedefs ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorcallback)(void *context, char *cloud_anchor_id, ArCloudAnchorState cloud_anchor_state)` | typedef `void(*` Callback definition for `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`. |
| `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture` | typedef `struct ArHostCloudAnchorFuture_` Handle to an asynchronous operation launched by `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`. |

| ### Functions ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture_acquireresultcloudanchorid(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture *future, char **out_cloud_anchor_id)` | `void` Gets the Cloud Anchor ID of the hosted anchor. |
| `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture_getresultcloudanchorstate(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture *future, https://developers.google.com/ar/reference/c/group/ar-anchor#arcloudanchorstate *out_cloud_anchor_state)` | `void` Gets the result status of the hosting operation, if the operation is done. |

## Typedefs

### ArHostCloudAnchorCallback

```
void(* ArHostCloudAnchorCallback)(void *context, char *cloud_anchor_id, ArCloudAnchorState cloud_anchor_state)
```
Callback definition for `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`.

The `context` argument will be the same as that passed to `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`. The `cloud_anchor_id` argument will contain the same value as that returned by `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture_acquireresultcloudanchorid` and must be released using `https://developers.google.com/ar/reference/c/group/utility-functions#arstring_release`. The `cloud_anchor_state` argument will be the same as that returned by `https://developers.google.com/ar/reference/c/group/ar-host-cloud-anchor-future#arhostcloudanchorfuture_getresultcloudanchorstate`.

It is a best practice to free `context` memory provided to `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync` at the end of the callback implementation.

### ArHostCloudAnchorFuture

```
struct ArHostCloudAnchorFuture_ ArHostCloudAnchorFuture
```
Handle to an asynchronous operation launched by `https://developers.google.com/ar/reference/c/group/ar-session#arsession_hostcloudanchorasync`.

See the [Cloud Anchors developer guide](https://developers.google.com/ar/develop/c/cloud-anchors/developer-guide) for more information.

Release with `https://developers.google.com/ar/reference/c/group/ar-future#arfuture_release`. ([reference type, long-lived](https://developers.google.com/ar/reference/c/group/concepts#object-ownership)).

## Functions

### ArHostCloudAnchorFuture_acquireResultCloudAnchorId

```
void ArHostCloudAnchorFuture_acquireResultCloudAnchorId(
  const ArSession *session,
  const ArHostCloudAnchorFuture *future,
  char **out_cloud_anchor_id
)
```
Gets the Cloud Anchor ID of the hosted anchor.

If the operation isn't done yet or the operation failed, this will be `NULL`. The caller must release the string using `https://developers.google.com/ar/reference/c/group/utility-functions#arstring_release`.


Details Parameters `session` The ARCore session. `future` The handle for the asynchronous operation. `out_cloud_anchor_id` The Cloud Anchor ID.

### ArHostCloudAnchorFuture_getResultCloudAnchorState

```
void ArHostCloudAnchorFuture_getResultCloudAnchorState(
  const ArSession *session,
  const ArHostCloudAnchorFuture *future,
  ArCloudAnchorState *out_cloud_anchor_state
)
```
Gets the result status of the hosting operation, if the operation is done.


Details Parameters `session` The ARCore session. `future` The handle for the asynchronous operation. `out_cloud_anchor_state` The result status.