CppInterOp
C++ Language Interoperability Layer
Loading...
Searching...
No Matches
Public Attributes | List of all members
Cpp::Box::ObjectOps Struct Reference

Operations vtable for a K_PtrOrObj payload. More...

#include "include/CppInterOp/Box.h"

Collaboration diagram for Cpp::Box::ObjectOps:
Collaboration graph
[legend]

Public Attributes

void(* retain )(void *) noexcept
 Increment the payload's refcount.
 
void(* release )(void *) noexcept
 Decrement the payload's refcount; on the last drop, run the payload's destructor and free storage.
 

Detailed Description

Operations vtable for a K_PtrOrObj payload.

Defined once per concrete payload type in the TU that knows the type (see Evaluate's kCompatValueOps in CppInterOp.cpp). The Box stores a pointer to this const-static struct; the storage slot is 2 pointers (16 bytes).

retain/release implement intrusive ref-counting: AdoptObject installs the payload with refcount 1; copy ctor / copy assign call retain; destructor calls release; the producer's release fires the payload's destructor when the last ref drops.

Definition at line 118 of file Box.h.

Member Data Documentation

◆ release

void(* Cpp::Box::ObjectOps::release) (void *) noexcept
noexcept

Decrement the payload's refcount; on the last drop, run the payload's destructor and free storage.

Must be noexcept; called from ~Box.

Definition at line 124 of file Box.h.

◆ retain

void(* Cpp::Box::ObjectOps::retain) (void *) noexcept
noexcept

Increment the payload's refcount.

Must be noexcept; called from the (noexcept) copy ctor / copy assign.

Definition at line 121 of file Box.h.


The documentation for this struct was generated from the following file: