[#btck-UniqueHandle-0da]
= xref:btck.adoc[btck]::UniqueHandle
:relfileprefix: ../
:mrdocs:

Owning RAII handle for a non&hyphen;copyable C object, backed by std&colon;&colon;unique&lowbar;ptr&period;

== Synopsis

Declared in `&lt;kernel&sol;bitcoinkernel&lowbar;wrapper&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename CType,
    void(* DestroyFunc)(CType*)&gt;
class UniqueHandle;
----

== Description

Destroys the C object with `DestroyFunc` on scope exit&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:btck/UniqueHandle-0da/2constructor.adoc[`UniqueHandle`]         [.small]#[constructor]#
| Takes ownership of `ptr,` throwing if it is null&period;
| xref:btck/UniqueHandle-0da/get-09.adoc[`get`] 
| Returns the owned C handle&period;
|===


== Protected Types

[cols="1,4"]
|===
| Name| Description
| xref:btck/UniqueHandle-0da/Deleter.adoc[`Deleter`] 
| Custom deleter that forwards to the C destroy function&period;
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:btck/UniqueHandle-0da/m_ptr.adoc[`m&lowbar;ptr`] 
| The owned C handle&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:btck/ChainstateManagerOptions.adoc[`ChainstateManagerOptions`] 
| Owning wrapper over `btck&lowbar;ChainstateManagerOptions`, configuring a ChainMan&period;
| xref:btck/ContextOptions.adoc[`ContextOptions`] 
| Owning wrapper over `btck&lowbar;ContextOptions`, configuring a Context before creation&period;
| xref:btck/TxValidationState.adoc[`TxValidationState`] 
| Owning wrapper over a `btck&lowbar;TxValidationState`, holding a transaction&apos;s validation outcome&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
