gfx.core.rc

Reference counting module

Members

Enums

isAtomicRefCounted
eponymoustemplate isAtomicRefCounted(T)

compile time check that T can be ref counted atomically.

Functions

countObj
size_t countObj(T obj)

Counts the number of references of a single object.

disposeAA
void disposeAA(T[K] arr)

Dispose GC allocated associative array of resources

disposeArr
void disposeArr(T[] arr)

Dispose GC allocated array of resources

disposeObj
void disposeObj(T obj)

Dispose and nullify a single object, that might be null

giveAwayObj
T giveAwayObj(T obj)

Decreases the reference count of a single object without disposing it. Use this to move an object out of a scope (typically return at the end of a return function)

lockObj
T lockObj(T obj)

Locks a single object.

reinitAA
void reinitAA(T[K] arr)

Reinitialises a GC allocated associative array of struct. Useful if the struct release resource in its destructor.

reinitArr
void reinitArr(T[] arr)

Reinitialises a GC allocated array of struct. Useful if the struct release resource in its destructor.

reinitStruct
void reinitStruct(T t)

Reinitialises a single struct Useful if the struct release resource in its destructor.

releaseAA
void releaseAA(T[K] arr)

Release GC allocated associative array of ref-counted resources

releaseArr
void releaseArr(T[] arr)

Release GC allocated array of ref-counted resources

releaseObj
bool releaseObj(T obj, Flag!"disposeOnZero" disposeOnZero)

Releases and nullify a single object. The object may be null.

retainAA
void retainAA(T[K] arr)

Retain GC allocated associative array of ref-counted resources

retainArr
void retainArr(T[] arr)

Retain GC allocated array of ref-counted resources

retainObj
T retainObj(T obj)

Retains a single object.

Interfaces

AtomicRefCounted
interface AtomicRefCounted

A atomic reference counted resource. Objects implementing this interface can be safely manipulated as shared.

Disposable
interface Disposable

A resource that can be disposed

Manifest constants

atomicRcCode
enum atomicRcCode;

A string that can be mixed-in a class declaration to implement AtomicRefCounted. dispose is not implemented of course, but is called by release while the object is locked. Classes implementing it are free to do it in a non-thread safe manner as long as dispose does not manipulate external state.

gfxRcMask
enum gfxRcMask;
Undocumented in source.

Properties

nullRc
Rc!T nullRc [@property getter]

Produces an Rc!T holding a null object

Static variables

rcPrintStack
bool rcPrintStack;
Undocumented in source.
rcTypeRegex
string rcTypeRegex;
Undocumented in source.

Structs

Rc
struct Rc(T)

Helper struct that manages the reference count of an object using RAII.

Uniq
struct Uniq(T)

A helper struct that manage the lifetime of a Disposable using RAII. Note: dlang has capability to enforce a parameter be a lvalue (ref param) but has no mechanism such as c++ rvalue reference which would enforce true uniqueness by the compiler. Uniq gives additional robustness, but it is up to the programmer to make sure that the values passed in by rvalue are not referenced somewhere else in the code

Weak
struct Weak(T)

Helper struct that keeps a weak reference to a Resource.

Templates

makeRc
template makeRc(T)

Helper that build a new instance of T and returns it within a Rc!T

makeUniq
template makeUniq(T)

Creates a new instance of T and returns it under a Uniq!T.

rc
template rc(T)

Helper that places an instance of T within a Rc!T

Variables

gfxRcLog
auto gfxRcLog;
Undocumented in source.

Meta