Function Class Reference

#include <reflectionbase.h>

Inheritance diagram for 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:

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.

公共成员函数

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
const MAXON_METHOD Block < const 参数 > &  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 )
const MAXON_METHOD Container GetEnclosingContainer () const
MAXON_METHOD KIND   GetKind () const
const MAXON_METHOD Id GetSimpleName () const
const MAXON_METHOD Id GetId () const
MAXON_METHOD String   ToString (const FormatStatement *fs=nullptr) const

静态公共成员函数

static const MAXON_METHOD 函数 PrivateFindMethod (const InterfaceReference &vi, Int offset)
static const 函数 Find (const Id &memberId)
static MAXON_METHOD Result < void >  FindAll (const Id &memberId, const ValueReceiver < const 函数 * > &result)
-  Static Public Member Functions inherited from Member
static MAXON_METHOD Result < Bool GetMembers (const ValueReceiver < const Member & > &members)
static const MAXON_METHOD Member Find (const Id &memberId)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL_DERIVED ( 函数 , MAXON_REFERENCE_NONE , "net.maxon.reflection.interface.function")

Additional Inherited Members

-  Public Types inherited from Member
enum   KIND {
   PACKAGE ,
   CLASS ,
   FUNCTION ,
   INSTANCE_FUNCTION ,
   CONST_INSTANCE_FUNCTION ,
   CONTAINER_TEST ,
   FUNCTION_TEST
}

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL_DERIVED()

MAXON_INTERFACE_NONVIRTUAL_DERIVED ( 函数   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.reflection.interface.function"   
)
private

◆  Invoke() [1/2]

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.
返回
An error if the argument count doesn't match or (for a non- void function) result is nullptr , otherwise OK.

◆  Invoke() [2/2]

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) ,其中 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.

Template Parameters
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.
返回
An error if the argument count doesn't match, otherwise OK.

◆  GetReturnType()

MAXON_METHOD ParameterType GetReturnType ( ) const

◆  GetParameterTypes()

MAXON_METHOD Block <const ParameterType > GetParameterTypes ( ) const

◆  GetParameters()

const MAXON_METHOD Block <const 参数 >& GetParameters ( ) const

◆  IsPure()

MAXON_METHOD Bool IsPure ( ) const

◆  GetAddress()

MAXON_METHOD void* GetAddress ( ) const

◆  PrivateFindMethod()

static const MAXON_METHOD 函数 * PrivateFindMethod ( const InterfaceReference &  vi ,
Int   offset  
)
static

◆  Find()

static const 函数 * Find ( const Id memberId )
static

◆  FindAll()

static MAXON_METHOD Result <void> FindAll ( const Id memberId ,
const ValueReceiver < const 函数 * > &  result  
)
static

Finds all functions overloads which have the given (unqualified) id .

参数
[in] memberId A member id.
[out] result Receiver for the found functions.
返回
OK unless a memory allocation failed.