#include <reflectionbase.h>
Function represents a C++ function. It describes the name, return type and parameter types of the function, but also has the Invoke method to invoke the function.
There are three kinds of functions:
c
this instance)const this
instance)The implicit this
argument is not part of the parameter types, but for the Invoke method it has to be specified as first argument if the function is an instance function.
Public Member Functions | |
MAXON_METHOD Result< void > | Invoke (void *result, const Block< Argument > &arguments) const |
template<typename T , typename... ARGS> | |
Result< typename InvokeHelper< T >::type > | Invoke (ARGS &&... args) const |
MAXON_METHOD ParameterType | GetReturnType () const |
MAXON_METHOD Block< const ParameterType > | GetParameterTypes () const |
MAXON_METHOD const Block< const Parameter > & | GetParameters () const |
MAXON_METHOD Bool | IsPure () const |
MAXON_METHOD void * | GetAddress () const |
Public Member Functions inherited from Member | |
enum maxon::reflection::Member::KIND | MAXON_ENUM_FLAGS_CLASS (KIND) |
MAXON_METHOD const Container * | GetEnclosingContainer () const |
MAXON_METHOD KIND | GetKind () const |
MAXON_METHOD const Id & | GetSimpleName () const |
MAXON_METHOD const Id & | GetId () const |
MAXON_METHOD String | ToString (const FormatStatement *fs=nullptr) const |
Static Public Member Functions | |
static MAXON_METHOD const Function * | PrivateFindMethod (const InterfaceReference &vi, Int offset) |
static const Function * | Find (const Id &memberId) |
static MAXON_METHOD Result< void > | FindAll (const Id &memberId, const ValueReceiver< const Function * > &result) |
Static Public Member Functions inherited from Member | |
static MAXON_METHOD Result< Bool > | GetMembers (const ValueReceiver< const Member & > &members) |
static MAXON_METHOD const Member * | Find (const Id &memberId) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL_DERIVED (Function, MAXON_REFERENCE_NONE, "net.maxon.reflection.interface.function") | |
Additional Inherited Members | |
Public Types inherited from Member | |
enum class | KIND { PACKAGE , CLASS , FUNCTION , INSTANCE_FUNCTION , CONST_INSTANCE_FUNCTION , CONTAINER_TEST , FUNCTION_TEST } |
|
private |
MAXON_METHOD Result<void> Invoke | ( | void * | result, |
const Block< Argument > & | arguments | ||
) | const |
Invokes this function with the given arguments. If this is an instance function, the this
pointer has to be given as first argument. result
has to point to an object of the return type of the function, the result will then be written to that object. For a function with void
return type, result
may be nullptr
.
[out] | result | Pointer to a value to which the function result is written. May be nullptr if the functions returns void . The type of the value must be the return type of the function, otherwise the behaviour is undefined. |
[in] | arguments | Arguments for the function. For an instance function, the first argument is the this pointer. The arguments have to match in type, otherwise the behaviour is undefined. |
void
function) result
is nullptr
, otherwise OK. Result<typename InvokeHelper<T>::type> Invoke | ( | ARGS &&... | args | ) | const |
Invokes this function with the given arguments. If this is an instance function, the this
pointer has to be given as first argument. T
has to be of the form R(A1, ..., An)
, where R
is the return type of the function and A1
, ..., An
are the parameter types. For instance functions, A1
has to be the type of the additional this
argument. If the types don't match the actual types of the function, the behaviour is undefined.
T | Type of the function of the form R(A1, ..., An) . If this doesn't match the actual type, the behaviour is undefined. |
[in] | args | Arguments for the function. For an instance function, the first argument is the this pointer. |
MAXON_METHOD ParameterType GetReturnType | ( | ) | const |
MAXON_METHOD Block<const ParameterType> GetParameterTypes | ( | ) | const |
MAXON_METHOD const Block<const Parameter>& GetParameters | ( | ) | const |
MAXON_METHOD Bool IsPure | ( | ) | const |
MAXON_METHOD void* GetAddress | ( | ) | const |
|
static |
|
static |
Finds all functions overloads which have the given (unqualified) id
.
[in] | memberId | A member id. |
[out] | result | Receiver for the found functions. |