3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Reflection::IReflectedFunction Class Referenceabstract

Polymorphic interface for reflected functions. More...

#include <IReflectedFunction.hpp>

Inheritance diagram for Engine3DRadSpace.Reflection::IReflectedFunction:
Collaboration diagram for Engine3DRadSpace.Reflection::IReflectedFunction:

Public Member Functions

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 Any Invoke (void *self, std::span< Any > args) const =0
 Calls the function as a member of the given object with the provided arguments.
virtual ~IReflectedFunction ()=default
const void * Get (void *objPtr) const override
 Does nothing. Functions aren't meant to be read as memory.
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 std::unique_ptr< IReflectedField > Clone () const =0
 Performs a deep copy of this instance.
virtual ~IReflectedField ()=default

Protected Member Functions

 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

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

Additional Inherited Members

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

Polymorphic interface for reflected functions.

Constructor & Destructor Documentation

◆ IReflectedFunction() [1/3]

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 )
protected

Constructs an instance of IReflectedFunction.

Parameters
numParams
fieldInfo
returnRepr
name
signature
info

◆ IReflectedFunction() [2/3]

Engine3DRadSpace.Reflection::IReflectedFunction::IReflectedFunction ( const IReflectedFunction & )
protecteddefault

◆ IReflectedFunction() [3/3]

Engine3DRadSpace.Reflection::IReflectedFunction::IReflectedFunction ( IReflectedFunction && )
protecteddefaultnoexcept

◆ ~IReflectedFunction()

virtual Engine3DRadSpace.Reflection::IReflectedFunction::~IReflectedFunction ( )
virtualdefault

Member Function Documentation

◆ DefaultValue()

const void * IReflectedFunction::DefaultValue ( ) const
overridevirtual

Returns nullptr. Functions don't have default values.

Returns
nullptr

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Get()

const void * IReflectedFunction::Get ( void * objPtr) const
overridevirtual

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

Parameters
objPtrunused

Implements Engine3DRadSpace.Reflection.IReflectedField.

Reimplemented in Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >, and Engine3DRadSpace.Reflection::ReflectedMemberFunction< R, O, Args >.

◆ Invoke()

virtual Any Engine3DRadSpace.Reflection::IReflectedFunction::Invoke ( void * self,
std::span< Any > args ) const
pure virtual

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

Parameters
selfobject
argstype erased argument pack
Returns

Implemented in Engine3DRadSpace.Reflection::ReflectedFunction< R, Args >, and Engine3DRadSpace.Reflection::ReflectedMemberFunction< R, O, Args >.

◆ NumParameters()

unsigned int IReflectedFunction::NumParameters ( ) const
noexcept

Returns the number of arguments in the parameter pack.

Returns
Number of arguments in this function.

◆ operator=() [1/2]

IReflectedFunction & Engine3DRadSpace.Reflection::IReflectedFunction::operator= ( const IReflectedFunction & )
protecteddefault

◆ operator=() [2/2]

IReflectedFunction & Engine3DRadSpace.Reflection::IReflectedFunction::operator= ( IReflectedFunction && )
protecteddefaultnoexcept

◆ ParametersInfo()

const std::vector< FieldRepresentation > & IReflectedFunction::ParametersInfo ( ) const
noexcept

Returns parameters metadata.

Returns
Parameters representations

◆ Representation()

FieldRepresentation IReflectedFunction::Representation ( ) const
overridevirtual

Returns an unnamed Function representation.

Returns

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ ReturnedTypeInfo()

const FieldRepresentation & IReflectedFunction::ReturnedTypeInfo ( ) const
noexcept

Returns representation of the return type.

Returns

◆ Set()

void IReflectedFunction::Set ( void * objPtr,
const void * value ) const
overridevirtual

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

Parameters
objPtrunused.
valueunused.

Implements Engine3DRadSpace.Reflection.IReflectedField.

◆ Signature()

const std::string & IReflectedFunction::Signature ( ) const
noexcept

Returns the signature of the function.

Returns
signature of the function

Member Data Documentation

◆ _argsInfo

std::vector<FieldRepresentation> Engine3DRadSpace.Reflection::IReflectedFunction::_argsInfo
protected

◆ _numArgs

unsigned int Engine3DRadSpace.Reflection::IReflectedFunction::_numArgs
protected

◆ _returnType

FieldRepresentation Engine3DRadSpace.Reflection::IReflectedFunction::_returnType
protected

◆ _signature

std::string Engine3DRadSpace.Reflection::IReflectedFunction::_signature
protected

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