Menu
Lumberyard
C++ API Reference (Version 1.10)

AZ::AttributeFunction< R(Args...)> Class Template Reference

An attribute that contains a pointer to a global function with the specified arguments and return type. More...

Inherits AZ::Attribute.

Inherited by AZ::AttributeMemberFunction< R(C::*)(Args...) const >, and AZ::AttributeMemberFunction< R(C::*)(Args...)>.

Public Types

typedef  FunctionPtr
 The type of function that the attribute contains. More...
 

Public Member Functions

 AttributeFunction (FunctionPtr f)
 Initializes an attribute with the provided function pointer. More...
 
virtual R Invoke (void *instance, Args &&... args)
 Invokes the function using the specified function arguments. More...
 
virtual AZ::Uuid GetInstanceType () const
 Gets the UUID of the instance type, which is null because the function does not belong to an instance of a class. More...
 
- Public Member Functions inherited from AZ::Attribute
 Attribute ()
 Initializes an instance of an attribute. More...
 
virtual ~Attribute ()
 An empty destructor. More...
 
void SetContextData (void *contextData)
 Associates additional data with the attribute. More...
 
void * GetContextData () const
 Gets additional data that is associated with the attribute, if any. More...
 

Public Attributes

FunctionPtr m_function
 The function pointer that the attribute contains. More...
 
- Public Attributes inherited from AZ::Attribute
bool m_describesChildren
 Indicates that this attribute is a container for child attributes. More...
 

Detailed Description

template<class R, class... Args>
class AZ::AttributeFunction< R(Args...)>

An attribute that contains a pointer to a global function with the specified arguments and return type.

The function must return a nonvoid result.

Template Parameters
RThe return type of the function.
ArgsThe types of arguments that are passed to the function.

Member Typedef Documentation

◆ FunctionPtr

template<class R , class... Args>
typedef R(* AZ::AttributeFunction< R(Args...)>::FunctionPtr) (Args...)

The type of function that the attribute contains.

Constructor & Destructor Documentation

◆ AttributeFunction()

template<class R , class... Args>
AZ::AttributeFunction< R(Args...)>::AttributeFunction ( FunctionPtr  f)
inlineexplicit

Initializes an attribute with the provided function pointer.

Parameters
fThe function pointer that the attribute will contain.

Member Function Documentation

◆ GetInstanceType()

template<class R , class... Args>
virtual AZ::Uuid AZ::AttributeFunction< R(Args...)>::GetInstanceType ( ) const
inlinevirtual

Gets the UUID of the instance type, which is null because the function does not belong to an instance of a class.

Returns
A null UUID.

Reimplemented in AZ::AttributeMemberFunction< R(C::*)(Args...) const >, and AZ::AttributeMemberFunction< R(C::*)(Args...)>.

◆ Invoke()

template<class R , class... Args>
virtual R AZ::AttributeFunction< R(Args...)>::Invoke ( void *  instance,
Args &&...  args 
)
inlinevirtual

Invokes the function using the specified function arguments.

Parameters
instanceA void pointer, which is not used because the function does not belong to an instance of a class.
argsThe arguments of the function.
Returns
The return type of the function.

Reimplemented in AZ::AttributeMemberFunction< R(C::*)(Args...) const >, and AZ::AttributeMemberFunction< R(C::*)(Args...)>.

Member Data Documentation

◆ m_function

template<class R , class... Args>
FunctionPtr AZ::AttributeFunction< R(Args...)>::m_function

The function pointer that the attribute contains.


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