3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Reflection::ReflectedFunction< R, Args > Class Template Referencefinal

"Reflects" a non-member function. More...

#include <ReflectedFunction.hpp>

Inheritance diagram for Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >:
Collaboration diagram for Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >:

Public Types

using Fn = R(*)(Args...)

Public Member Functions

 ReflectedFunction (const std::string &name, Fn fn)
R operator() (Args &&... args)
Any Invoke (void *self, std::span< Any > args) const override
 Calls the function as a member of the given object with the provided arguments.
const void * Get (void *objPtr) const override
 Does nothing. Functions aren't meant to be read as memory.
std::unique_ptr< IReflectedField > Clone () const override
 Performs a deep copy of this instance.
Public Member Functions inherited from Engine3DRadSpace.Reflection::IReflectedFunction
unsigned int NumParameters () const noexcept
 Returns the number of arguments in the parameter pack.
const std::vector< FieldRepresentation > & ParametersInfo () const noexcept
 Returns parameters metadata.
const FieldRepresentation & ReturnedTypeInfo () const noexcept
 Returns representation of the return type.
const std::string & Signature () const noexcept
 Returns the signature of the function.
virtual ~IReflectedFunction ()=default
void Set (void *objPtr, const void *value) const override
 Does nothing. Functions aren't meant to be written as memory.
const void * DefaultValue () const override
 Returns nullptr. Functions don't have default values.
FieldRepresentation Representation () const override
 Returns an unnamed Function representation.
Public Member Functions inherited from Engine3DRadSpace.Reflection.IReflectedField
IntPtr Get (IntPtr objPtr)
void Set (IntPtr objPtr, IntPtr value)
const size_t TypeHash () const noexcept
 Type hash of the field's type, usually typeid(T).hash_code() for the field's type T.
const std::string & FieldName () const noexcept
 Name of the field.
const std::string & FieldDesc () const noexcept
 Description of the field.
const size_t TypeSize () const noexcept
 Size of the field's type in bytes.
const ptrdiff_t FieldOffset () const noexcept
 Offset of the field within the object, in bytes.
template<typename T>
const T GetAtOffset (void *objPtr, intptr_t offset) const
 Gets the type T with an additional offset from the field's offset within the object.
virtual ~IReflectedField ()=default

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.Reflection::IReflectedFunction
 IReflectedFunction (unsigned int numParams, std::initializer_list< FieldRepresentation > fieldInfo, const FieldRepresentation &returnRepr, const std::string &name, const std::string &signature, const std::type_info &info)
 Constructs an instance of IReflectedFunction.
 IReflectedFunction (const IReflectedFunction &)=default
 IReflectedFunction (IReflectedFunction &&) noexcept=default
IReflectedFunction & operator= (const IReflectedFunction &)=default
IReflectedFunction & operator= (IReflectedFunction &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.Reflection.IReflectedField
 IReflectedField ()=default
 IReflectedField (size_t offset, size_t size, const std::string &name, const std::string &desc, const std::type_info &info)
 IReflectedField (const IReflectedField &f)=default
 IReflectedField (IReflectedField &&)=default
IReflectedField & operator= (const IReflectedField &f)=default
IReflectedField & operator= (IReflectedField &&f)=default
Protected Attributes inherited from Engine3DRadSpace.Reflection::IReflectedFunction
unsigned int _numArgs
FieldRepresentation _returnType
std::vector< FieldRepresentation > _argsInfo
std::string _signature
Protected Attributes inherited from Engine3DRadSpace.Reflection.IReflectedField
size_t _typeHash = 0
std::type_index _typeIndex
size_t _size = 0
size_t _offset = 0
std::string _name
std::string _desc
Properties inherited from Engine3DRadSpace.Reflection.IReflectedField
ulong TypeHash [get]
string FieldName [get]
string FieldDesc [get]
ulong TypeSize [get]
ulong FieldOffset [get]
IntPtr DefaultValue [get]

Detailed Description

template<typename R, ReflectableType ... Args>
class Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >

"Reflects" a non-member function.

Member Typedef Documentation

◆ Fn

template<typename R, ReflectableType ... Args>
using Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::Fn = R(*)(Args...)

Constructor & Destructor Documentation

◆ ReflectedFunction()

template<typename R, ReflectableType ... Args>
Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::ReflectedFunction ( const std::string & name,
Fn fn )
inline

Member Function Documentation

◆ Clone()

template<typename R, ReflectableType ... Args>
std::unique_ptr< IReflectedField > Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::Clone ( ) const
inlineoverridevirtual

Performs a deep copy of this instance.

Returns
Unique pointer to a deep clone.

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Get()

template<typename R, ReflectableType ... Args>
const void * Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::Get ( void * objPtr) const
inlineoverridevirtual

Does nothing. Functions aren't meant to be read as memory.

Parameters
objPtrunused

Reimplemented from Engine3DRadSpace.Reflection::IReflectedFunction.

◆ Invoke()

template<typename R, ReflectableType ... Args>
Any Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::Invoke ( void * self,
std::span< Any > args ) const
inlineoverridevirtual

Calls the function as a member of the given object with the provided arguments.

Parameters
selfobject
argstype erased argument pack
Returns

Implements Engine3DRadSpace.Reflection::IReflectedFunction.

◆ operator()()

template<typename R, ReflectableType ... Args>
R Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >::operator() ( Args &&... args)
inline

The documentation for this class was generated from the following file: