45template<
typename RETTYPE,
typename ... ARGTYPES>
56 template <
typename LAMBDA>
69 template <
typename LAMBDA>
76 template<
class CLASS, RETTYPE (CLASS::*METHOD)(ARGTYPES ...)>
static Delegate<RETTYPE(ARGTYPES ...)>
FromMethod(CLASS*
objPtr);
80 template <
typename LAMBDA>
static Delegate<RETTYPE(ARGTYPES ...)>
FromLambda(
const LAMBDA & instance);
83 template<
class CLASS>
const CLASS*
GetObject()
const;
90 using StubType = RETTYPE(*)(
void*, ARGTYPES...);
93 template<
class CLASS, RETTYPE(CLASS::*METHOD)(ARGTYPES ...)>
static RETTYPE
MethodStub(
void*
objPtr, ARGTYPES ... args);
95 template<RETTYPE(*FUNCTION)(ARGTYPES ... )>
static RETTYPE
FunctionStub(
void* dummyPtr, ARGTYPES ... args);
109template<
typename RETTYPE,
typename ... ARGTYPES>
120template<
typename RETTYPE,
typename ... ARGTYPES>
131template<
typename RETTYPE,
typename ... ARGTYPES>
136 rhs.objPtr =
nullptr;
137 rhs.stubPtr =
nullptr;
143template<
typename RETTYPE,
typename ... ARGTYPES>
144template <
typename LAMBDA>
147 static_assert(
sizeof(LAMBDA) == 1ULL,
"Util::Delegate does accept lambdas carrying capture variables! Read the description of at the top of util/delegate.h");
154template<
typename RETTYPE,
typename ... ARGTYPES>
160 this->
objPtr = rhs.objPtr;
168template<
typename RETTYPE,
typename ... ARGTYPES>
174 this->
objPtr = rhs.objPtr;
176 rhs.objPtr =
nullptr;
177 rhs.stubPtr =
nullptr;
184template<
typename RETTYPE,
typename ... ARGTYPES>
185template <
typename LAMBDA>
187Delegate<RETTYPE(ARGTYPES...)>::operator=(LAMBDA
const& instance)
189 static_assert(
sizeof(LAMBDA) == 1ULL,
"Util::Delegate does accept lambdas carrying capture variables! Read the description of at the top of util/delegate.h");
197template<
typename RETTYPE,
typename ... ARGTYPES>
199Delegate<RETTYPE(ARGTYPES...)>::operator==(std::nullptr_t)
201 return this->
stubPtr ==
nullptr;
207template<
typename RETTYPE,
typename ... ARGTYPES>
211 return this->
stubPtr ==
nullptr;
217template<
typename RETTYPE,
typename ... ARGTYPES> RETTYPE
218Delegate<RETTYPE(ARGTYPES...)>::operator()(ARGTYPES ... args)
const
226template<
typename RETTYPE,
typename ... ARGTYPES>
227template<
class CLASS, RETTYPE (CLASS::*METHOD)(ARGTYPES ...)>
232 del.objPtr = objPtr_;
240template<
typename RETTYPE,
typename ... ARGTYPES>
241template<RETTYPE(*FUNCTION)(ARGTYPES ...)>
254template<
typename RETTYPE,
typename ... ARGTYPES>
255template<
typename LAMBDA>
259 static_assert(
sizeof(LAMBDA) == 1ULL,
"Util::Delegate does accept lambdas carrying capture variables! Read the description of at the top of util/delegate.h");
266template<
typename RETTYPE,
typename ... ARGTYPES>
267template<
class CLASS, RETTYPE (CLASS::*METHOD)(ARGTYPES ...)>
271 CLASS* obj =
static_cast<CLASS*
>(objPtr_);
272 return (obj->*METHOD)(arg_...);
278template<
typename RETTYPE,
typename ... ARGTYPES>
279template<RETTYPE(*FUNCTION)(ARGTYPES ...)>
283 return (*FUNCTION)(arg_...);
289template<
typename RETTYPE,
typename ... ARGTYPES>
290template<
typename LAMBDA>
294 LAMBDA* p =
static_cast<LAMBDA*
>(
objPtr);
295 return (p->operator())(arg_...);
301template<
typename RETTYPE,
typename ... ARGTYPES>
306 return (CLASS*)this->
objPtr;
312template<
typename RETTYPE,
typename ... ARGTYPES>
316 return (0 != this->stubPtr);
322template<
typename RETTYPE,
typename ... ARGTYPES>
bool IsValid()
returns true if delegate is valid
static Delegate< RETTYPE(ARGTYPES ...)> FromMethod(CLASS *objPtr)
setup a new delegate from a method call
RETTYPE operator()(ARGTYPES ... args) const
invokation operator
Definition delegate.h:218
static Delegate< RETTYPE(ARGTYPES ...)> FromFunction()
setup a new delegate from a function call
bool operator!()
check if null
Definition delegate.h:209
const CLASS * GetObject() const
get object pointer
Definition delegate.h:304
Delegate< RETTYPE(ARGTYPES ...)> & operator=(LAMBDA const &instance)
lambda assignment operator
static RETTYPE FunctionStub(void *dummyPtr, ARGTYPES ... args)
static function-call stub
Definition delegate.h:281
static Delegate< RETTYPE(ARGTYPES ...)> FromLambda(const LAMBDA &instance)
setup a new delegate from lambda
void Assign(void *obj, typename Delegate< RETTYPE(ARGTYPES...)>::StubType stub)
assignment method
Definition delegate.h:324
RETTYPE(*)(void *, ARGTYPES...) StubType
method pointer typedef
Definition delegate.h:90
StubType stubPtr
Definition delegate.h:103
void operator=(Delegate< RETTYPE(ARGTYPES...)> const &rhs)
assignment operator
Definition delegate.h:156
Delegate()
constructor
Definition delegate.h:110
static RETTYPE LambdaStub(void *objPtr, ARGTYPES... arg)
static lambda-call stub
static RETTYPE MethodStub(void *objPtr, ARGTYPES ... args)
static method-call stub
Definition delegate.h:269
void * objPtr
Definition delegate.h:102
Nebula delegate class, allows to store a function, method or lambda call into a C++ object for later ...
Definition delegate.h:39
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
bool operator==(const String &a, const String &b)
Definition string.cc:830