Class Delegate
Delegate object that can be used to bind and call multiply functions. Thread-safe to register/unregister during the call. Execution order of bound functions is not stable.
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Core/Delegate.h
Syntax
public class Delegate<Params>
Type Parameters
Params
|
Constructors
~Delegate()
Declaration
public ~Delegate()
Delegate()
Declaration
public Delegate()
Delegate(const Delegate& other)
Delegate(Delegate&& other)
Fields
_data
Declaration
protected intptr volatile _data = 0
Field Value
intptr volatile
|
Methods
Bind()
Binds a static function.
Declaration
public void Bind()
Type Parameters
Method
|
Bind(const FunctionType& f)
Binds a function.
Declaration
public void Bind(const FunctionType& f)
Parameters
FunctionType
f
The function to bind. |
Bind(const T& lambda)
Binds a lambda.
Declaration
public void Bind(const T& lambda)
Parameters
T
lambda
The lambda. |
Type Parameters
typename T
|
Bind(Signature method)
Binds a function.
Declaration
public void Bind(Signature method)
Parameters
Signature
method
The method. |
Bind(T* callee)
Binds a member function.
Declaration
public void Bind(T* callee)
Parameters
T
callee
The object instance. |
Type Parameters
class T
|
Method
|
BindUnique()
Binds a static function (if not bound yet).
Declaration
public void BindUnique()
Type Parameters
Method
|
BindUnique(const FunctionType& f)
Binds a function (if not bound yet).
Declaration
public void BindUnique(const FunctionType& f)
Parameters
FunctionType
f
The function to bind. |
BindUnique(Signature method)
Binds a function (if not bound yet).
Declaration
public void BindUnique(Signature method)
Parameters
Signature
method
The method. |
BindUnique(T* callee)
Binds a member function (if not bound yet).
Declaration
public void BindUnique(T* callee)
Parameters
T
callee
The object instance. |
Type Parameters
class T
|
Method
|
Capacity()
Gets the current capacity of delegate table (amount of function to store before resizing).
Declaration
public int32 Capacity() const
Returns
int32
|
Count()
Counts the amount of bound functions.
Declaration
public int32 Count() const
Returns
int32
The bound functions count. |
GetBindings(FunctionType* buffer, int32 bufferSize)
Gets all the bound functions.
Declaration
public int32 GetBindings(FunctionType* buffer, int32 bufferSize) const
Parameters
FunctionType
buffer
The result bindings functions memory. |
int32
bufferSize
The result bindings functions memory size. |
Returns
int32
The amount of written items into the output bindings buffer. Can be equal or less than input bindingsCount capacity. |
IsBinded()
Determines whether any function is bound.
Declaration
public bool IsBinded() const
Returns
bool
|
operator()(Params... params)
Calls all the bound functions. Supports unbinding of the called functions during invocation.
Declaration
public void operator()(Params... params) const
Parameters
Params...
params
A list of parameters for the function invocation. |
operator=(const Delegate& other)
Declaration
public Delegate operator=(const Delegate& other)
Parameters
Delegate
other
|
Returns
Delegate
|
operator=(Delegate&& other)
Declaration
public Delegate operator=(Delegate&& other) noexcept
Parameters
Delegate
other
|
Returns
Delegate
|
Unbind()
Unbinds a static function.
Declaration
public void Unbind()
Type Parameters
Method
|
Unbind(const FunctionType& f)
Unbinds the specified function.
Declaration
public void Unbind(const FunctionType& f)
Parameters
FunctionType
f
The function to unbind. |
Unbind(Signature method)
Unbinds the specified function.
Declaration
public void Unbind(Signature method)
Parameters
Signature
method
The method. |
Unbind(T* callee)
Unbinds a member function.
Declaration
public void Unbind(T* callee)
Parameters
T
callee
The object instance. |
Type Parameters
class T
|
Method
|
UnbindAll()
Unbinds all the functions.
Declaration
public void UnbindAll()