W3cubDocs

/Kotlin

DetachedObjectGraph

Platform and version requirements: Native (1.3)
class DetachedObjectGraph<T>

Detached object graph encapsulates transferrable detached subgraph which cannot be accessed externally, until it is attached with the attach extension function.

Constructors

Platform and version requirements: Native (1.3)

<init>

Creates stable pointer to object, ensuring associated object subgraph is disjoint in specified mode (TransferMode.SAFE by default). Raw value returned by asCPointer could be stored to a C variable or passed to another Kotlin machine.

DetachedObjectGraph(
    mode: TransferMode = TransferMode.SAFE, 
    producer: () -> T)

Creates detached object graph from value stored earlier in a C raw pointer.

DetachedObjectGraph(pointer: COpaquePointer?)

Functions

Platform and version requirements: Native (1.3)

asCPointer

Returns raw C pointer value, usable for interoperability with C scenarious.

fun asCPointer(): COpaquePointer?

Extension Functions

Platform and version requirements: Native (1.3)

attach

Attaches previously detached object subgraph created by DetachedObjectGraph. Please note, that once object graph is attached, the DetachedObjectGraph.stable pointer does not have sense anymore, and shall be discarded.

fun <T> DetachedObjectGraph<T>.attach(): T

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-detached-object-graph/index.html