Stay organized with collections
Save and categorize content based on your preferences.
ndk::SharedRefBase
#include <binder_interface_utils.h>
Binder analog to using std::shared_ptr for an internally held refcount.
Summary
ref must be called at least one time during the lifetime of this object. The recommended way to construct this object is with SharedRefBase::make.
If you need a "this" shared reference analogous to shared_from_this, use this->ref().
Inheritance
Direct Known Subclasses:
ndk::ICInterface
Public functions
|
ref()
|
A shared_ptr must be held to this object when this is called.
|
ref()
|
std::shared_ptr< CHILD >
Convenience method for a ref (see above) which automatically casts to the desired child type.
|
Public static functions
|
make(Args &&... args)
|
std::shared_ptr< T >
Convenience method for making an object directly with a reference.
|
operator delete(void *p)
|
void
|
Public functions
SharedRefBase
SharedRefBase()
ref
std::shared_ptr< SharedRefBase > ref()
A shared_ptr must be held to this object when this is called.
This must be called once during the lifetime of this object.
ref
std::shared_ptr< CHILD > ref()
Convenience method for a ref (see above) which automatically casts to the desired child type.
~SharedRefBase
virtual ~SharedRefBase()
Public static functions
make
std::shared_ptr< T > make(
Args &&... args
)
Convenience method for making an object directly with a reference.
operator delete
void operator delete(
void *p
)
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-17 UTC.
[null,null,["Last updated 2024-04-17 UTC."],[],[],null,["# ndk::SharedRefBase Class Reference\n\nndk::SharedRefBase\n==================\n\n\n`#include \u003cbinder_interface_utils.h\u003e`\n\nBinder analog to using std::shared_ptr for an internally held refcount.\n\nSummary\n-------\n\nref must be called at least one time during the lifetime of this object. The recommended way to construct this object is with [SharedRefBase::make](/ndk/reference/classndk/1-1-shared-ref-base#classndk_1_1_shared_ref_base_1a68ccdf210a9f41b80b198991aecab6aa).\n\nIf you need a \"this\" shared reference analogous to shared_from_this, use this-\\\u003e[ref()](/ndk/reference/classndk/1-1-shared-ref-base#classndk_1_1_shared_ref_base_1a8b23f8ea6eef399879ee4cd8e1e6ec42).\n\n### Inheritance\n\nDirect Known Subclasses:[ndk::ICInterface](/ndk/reference/classndk/1-1-i-c-interface)\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SharedRefBase](#classndk_1_1_shared_ref_base_1a128cf3f78a66110828c9c1411f89ff64)`()` ||\n| [~SharedRefBase](#classndk_1_1_shared_ref_base_1af3614d28ef88d2a83eaac00ed051c3fa)`()` ||\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ref](#classndk_1_1_shared_ref_base_1a8b23f8ea6eef399879ee4cd8e1e6ec42)`()` | `std::shared_ptr\u003c `[SharedRefBase](/ndk/reference/classndk/1-1-shared-ref-base#classndk_1_1_shared_ref_base)` \u003e` A shared_ptr must be held to this object when this is called. |\n| [ref](#classndk_1_1_shared_ref_base_1a1ac6bac0ba652e50e8843cedbcb6dc5e)`()` | `std::shared_ptr\u003c CHILD \u003e` Convenience method for a ref (see above) which automatically casts to the desired child type. |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [make](#classndk_1_1_shared_ref_base_1a68ccdf210a9f41b80b198991aecab6aa)`(Args &&... args)` | `std::shared_ptr\u003c T \u003e` Convenience method for making an object directly with a reference. |\n| [operator delete](#classndk_1_1_shared_ref_base_1a687b650d4ed7900e444894ab8f934265)`(void *p)` | `void` |\n\nPublic functions\n----------------\n\n### SharedRefBase\n\n```text\n SharedRefBase()\n``` \n\n### ref\n\n```scdoc\nstd::shared_ptr\u003c SharedRefBase \u003e ref()\n``` \nA shared_ptr must be held to this object when this is called.\n\nThis must be called once during the lifetime of this object. \n\n### ref\n\n```scdoc\nstd::shared_ptr\u003c CHILD \u003e ref()\n``` \nConvenience method for a ref (see above) which automatically casts to the desired child type. \n\n### \\~SharedRefBase\n\n```text\nvirtual ~SharedRefBase()\n``` \n\nPublic static functions\n-----------------------\n\n### make\n\n```scdoc\nstd::shared_ptr\u003c T \u003e make(\n Args &&... args\n)\n``` \nConvenience method for making an object directly with a reference. \n\n### operator delete\n\n```scdoc\nvoid operator delete(\n void *p\n)\n```"]]