ndk::SpAIBinder

#include <binder_auto_utils.h>

Represents one strong pointer to an AIBinder object.

Summary

Constructors and Destructors

SpAIBinder()
Default constructor.
SpAIBinder(AIBinder *binder)
Takes ownership of one strong refcount of binder.
SpAIBinder(std::nullptr_t)
Convenience operator for implicitly constructing an SpAIBinder from nullptr.
SpAIBinder(const SpAIBinder & other)
This will delete the underlying object if it exists.
~SpAIBinder()
This deletes the underlying object if it exists.

Public functions

get() const
AIBinder *
This returns the underlying binder object for transactions.
getR()
AIBinder **
This allows the value in this class to be set from beneath it.
operator!=(const SpAIBinder & rhs) const
bool
operator<(const SpAIBinder & rhs) const
bool
operator<=(const SpAIBinder & rhs) const
bool
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.
operator==(const SpAIBinder & rhs) const
bool
operator>(const SpAIBinder & rhs) const
bool
operator>=(const SpAIBinder & rhs) const
bool
set(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 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 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 a; // will be nullptr SomeInitFunction(a.getR()); // value is initialized with refcount

Other usecases are discouraged.

operator!=

bool operator!=(
  const SpAIBinder & rhs
) const 

operator<

bool operator<(
  const SpAIBinder & rhs
) const 

operator<=

bool operator<=(
  const SpAIBinder & rhs
) const 

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.

operator==

bool operator==(
  const SpAIBinder & rhs
) const 

operator>

bool operator>(
  const SpAIBinder & rhs
) const 

operator>=

bool operator>=(
  const SpAIBinder & rhs
) const 

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.