# ndk::SpAIBinder


`#include <binder_auto_utils.h>`

Represents one strong pointer to an AIBinder object.

## Summary

| ### Constructors and Destructors ||
|---|---|
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1aa622544f836d321f9aba78d175984555()` Default constructor. ||
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1a29c0c128dbf1b2a53798abbdf531c359(AIBinder *binder)` Takes ownership of one strong refcount of binder. ||
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1a0a1ecf84003c0f5be4451a0264456eac(std::nullptr_t)` Convenience operator for implicitly constructing an [SpAIBinder](https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder) from nullptr. ||
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1aaf18ae344fffedd557aee0812f09cc0f(const https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder & other)` This will delete the underlying object if it exists. ||
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1a999a01ab374ef8e70960b251b77804dc()` This deletes the underlying object if it exists. ||

| ### Public functions ||
|---|---|
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1acbaf60c7be6237f6104a079eb9f55433() const ` | `AIBinder *` This returns the underlying binder object for transactions. |
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1a4f2eafb716262236e2dc500df6998610()` | `AIBinder **` This allows the value in this class to be set from beneath it. |
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1ad4904a9d8a70a2ca2078daf9321b7d2d(const https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder & other)` | `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder &` This takes ownership of a binder from another AIBinder object but it does not affect the ownership of that other object. |
| `https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder_1a7d8049d65e6c8531a727fc7d72ee6b3d(AIBinder *binder)` | `void` Takes ownership of one strong refcount of binder. |

## Public functions

### SpAIBinder

```
 SpAIBinder()
```
Default constructor.

### SpAIBinder

```
 SpAIBinder(
  AIBinder *binder
)
```
Takes ownership of one strong refcount of binder.

### SpAIBinder

```
 SpAIBinder(
  std::nullptr_t
)
```
Convenience operator for implicitly constructing an [SpAIBinder](https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder) from nullptr.

This is not explicit because it is not taking ownership of anything.

### SpAIBinder

```
 SpAIBinder(
  const SpAIBinder & other
)
```
This will delete the underlying object if it exists.

See operator=.

### get

```
AIBinder * get() const 
```
This returns the underlying binder object for transactions.

If it is used to create another [SpAIBinder](https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder) object, it should first be incremented.

### getR

```
AIBinder ** getR()
```
This allows the value in this class to be set from beneath it.

If you call this method and then change the value of T\*, you must take ownership of the value you are replacing and add ownership to the object that is put in here.

Recommended use is like this: [SpAIBinder](https://developer.android.com/ndk/reference/classndk/1-1-sp-a-i-binder#classndk_1_1_sp_a_i_binder) a; // will be nullptr SomeInitFunction(a.getR()); // value is initialized with refcount

Other usecases are discouraged.

### operator=

```
SpAIBinder & operator=(
  const SpAIBinder & other
)
```
This takes ownership of a binder from another AIBinder object but it does not affect the ownership of that other object.

### set

```
void set(
  AIBinder *binder
)
```
Takes ownership of one strong refcount of binder.

### \~SpAIBinder

```
 ~SpAIBinder()
```
This deletes the underlying object if it exists.

See set.