Flyweight

Flyweight template.

Constructors

this
this(Flyweight other)

Copy constructor with automatic reference counting.

Destructor

~this
~this()

Destructor with automatic reference counting.

Postblit

this(this)
this(this)

Postblit with automatic reference counting.

Alias This

object

Members

Functions

isValid
bool isValid()

Verify if this is a valid Flyweight object

Static functions

get
Flyweight get(ID id)

Get the Flyweight instance for object identified by id, constructing it if not loaded yet.

incref
void incref(ID id)

Manually increment reference.

isAnyLoaded
bool isAnyLoaded()

Returns whether there are any Flyweight instances loaded.

isLoaded
bool isLoaded(ID id)

Returns if Flyweight identified by id is loaded of not.

isValidID
bool isValidID(ID id)

Verify if ID is a valid object ID

unload
void unload(ID id)

If Flyweight identified by id is loaded, manually unload it and reset reference count/loaded flag.

unloadAll
void unloadAll()

Manually unload all loaded instances and reset reference counts/loaded flags.

unref
void unref(ID id)

Manually decrement reference.

Variables

object
T object;

Object data

Parameters

T

Instance type

makeFunc

Callable that receives ID as argument and returns T

disposeFunc

Callable that receives ref T instance to unload it

idNames

Enum or string[] with known IDs

options

Flyweight options

Meta