template <typename T, void (*Destroy)(T), T DEFAULT>

class ScopedAResource

Defined at line 148 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

This baseclass owns a single object, used to make various classes RAII.

Public Methods

void ScopedAResource<T, Destroy, DEFAULT> (T t)

Takes ownership of t.

Defined at line 153 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

void ~ScopedAResource<T, Destroy, DEFAULT> ()

This deletes the underlying object if it exists. See set.

Defined at line 158 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

void set (T t)

Takes ownership of t.

Defined at line 163 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

T get ()

This returns the underlying object to be modified but does not affect ownership.

Defined at line 171 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

const T get ()

This returns the const underlying object but does not affect ownership.

Defined at line 176 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

T release ()

Release the underlying resource.

Defined at line 181 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

T * 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:

ScopedAResource

<T

> a; // will be nullptr

SomeInitFunction(a.getR()); // value is initialized with refcount

Other usecases are discouraged.

Defined at line 199 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

void ScopedAResource<T, Destroy, DEFAULT> (const ScopedAResource<T, Destroy, DEFAULT> & )

copy-constructing/assignment is disallowed

Defined at line 202 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

ScopedAResource<T, Destroy, DEFAULT> & operator= (const ScopedAResource<T, Destroy, DEFAULT> & )

Defined at line 203 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

void ScopedAResource<T, Destroy, DEFAULT> (ScopedAResource<T, Destroy, DEFAULT> && other)

move-constructing/assignment is okay

Defined at line 206 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h

ScopedAResource<T, Destroy, DEFAULT> & operator= (ScopedAResource<T, Destroy, DEFAULT> && other)

Defined at line 209 of file ../../third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp/android/binder_auto_utils.h