btck::UniqueHandle

Owning RAII handle for a non-copyable C object, backed by std::unique_ptr.

Synopsis

Declared in <kernel/bitcoinkernel_wrapper.h>

template<
    typename CType,
    void(* DestroyFunc)(CType*)>
class UniqueHandle;

Description

Destroys the C object with DestroyFunc on scope exit.

Member Functions

NameDescription
UniqueHandle [constructor]Takes ownership of ptr, throwing if it is null.
get Returns the owned C handle.

Protected Types

NameDescription
Deleter Custom deleter that forwards to the C destroy function.

Protected Data Members

NameDescription
m_ptr The owned C handle.

Derived Classes

NameDescription
ChainstateManagerOptions Owning wrapper over btck_ChainstateManagerOptions, configuring a ChainMan.
ContextOptions Owning wrapper over btck_ContextOptions, configuring a Context before creation.
TxValidationState Owning wrapper over a btck_TxValidationState, holding a transaction's validation outcome.