Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more. |
This structure is built up while you call ClassReflection functions to reflect a class's information to the behavior context. More...
Inherits AZ::Internal::GenericAttributes< ClassReflection< C > >.
Public Member Functions |
|
ClassReflection * | Allocator ( BehaviorClass::AllocateType allocate, BehaviorClass::DeallocateType deallocate) |
Sets a custom memory allocator and deallocator for a class.
More...
|
|
template<class... Params> | |
ClassReflection * | Constructor () |
Attaches additional constructor signatures to a class.
More...
|
|
template<class WrappedType > | |
ClassReflection * | Wrapping (BehaviorClassUnwrapperFunction unwrapper, void *userData) |
Use to indicate that a class is a wrapper of another class.
More...
|
|
template<class WrappedType , class MemberFunction > | |
ClassReflection * | WrappingMember (MemberFunction memberFunction) |
Provides a function to unwrap a class.
More...
|
|
ClassReflection * | UserData (void *userData) |
Attaches additional data to a class.
More...
|
|
template<class Function > | |
ClassReflection * | Method (const char *name, Function method, BehaviorValues *defaultValues=nullptr, const char *dbgDesc=nullptr) |
Reflects a class method to the behavior context.
More...
|
|
template<class Function , class = AZStd::enable_if_t<AZStd::function_traits<Function>::num_args != 0>> | |
ClassReflection * | Method (const char *name, Function method, AZStd::array< AZStd::string, AZStd::function_traits< Function >::num_args > argNames, BehaviorValues *defaultValues=nullptr, const char *dbgDesc=nullptr) |
Reflects a class method with arguments to the behavior context.
More...
|
|
template<class Getter , class Setter > | |
ClassReflection * | Property (const char *name, Getter getter, Setter setter) |
Reflects class member properties to the behavior context.
More...
|
|
template<int Value> | |
ClassReflection * | Enum (const char *name) |
Reflects class member enum types to the behavior context.
More...
|
|
template<class Getter > | |
ClassReflection * | Constant (const char *name, Getter getter) |
Reflects a class member constant to the behavior context.
More...
|
|
ClassReflection * | RequestBus (const char *busName) |
Describes the
EBus
request buses that this class uses.
More...
|
|
ClassReflection * | NotificationBus (const char *busName) |
Describes the
EBus
notification buses that this class uses.
More...
|
|
Public Attributes |
|
BehaviorClass * | m_class |
A pointer to all the information that describes a reflected class.
More...
|
|
Detailed Description
template<class C>
struct AZ::BehaviorContext::ClassReflection< C >
This structure is built up while you call ClassReflection functions to reflect a class's information to the behavior context.
The end result of this reflection is a BehaviorClass instance that is stored in the behavior context.
You call the functions in a builder pattern. To add attributes to the entire class or to individual class members, immediately follow a function call with
->
Attribute
("attributeName", attributeValue);
.
The following example shows how to add attributes.
Member Function Documentation
◆ Allocator()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Allocator | ( | BehaviorClass::AllocateType | allocate , |
BehaviorClass::DeallocateType | deallocate | ||
) |
Sets a custom memory allocator and deallocator for a class.
This is only for very specific cases where you want to override
AZ_CLASS_ALLOCATOR
or you are using third-party classes. Otherwise, you should use
AZ_CLASS_ALLOCATOR
to control which allocator the class uses.
- Parameters
-
allocate An allocator function. deallocate A deallocator function.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Constant()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Constant | ( | const char * | name , |
Getter | getter | ||
) |
Reflects a class member constant to the behavior context.
You must use a getter function to pass in the constant. If you don't have a getter function, you can use the BehaviorConstant() helper macro.
You can attach one or more attributes to the constant by following
Constant()
with
Attribute()
in a builder pattern as shown in the following example.
To reflect global constants, use BehaviorContext::Constant() .
- Parameters
-
name The name of the constant. getter A method that gets the value of the constant. You can use the BehaviorConstant() helper macro to convert a value to a function to use for this parameter.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Constructor()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Constructor | ( | ) |
Attaches additional constructor signatures to a class.
You can have any number of these. You must pass all constructor arguments as template arguments.
You can attach one or more attributes to the constructor by following
Constructor()
with
Attribute()
in a builder pattern as shown in the following example.
- Template Parameters
-
Params The constructor's argument types.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Enum()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Enum | ( | const char * | name | ) |
Reflects class member enum types to the behavior context.
All enums are treated as
int
.
You can attach one or more attributes to the enum by following
Enum()
with
Attribute()
in a builder pattern as shown in the following example.
To reflect global enums, use BehaviorContext::Enum() .
- Parameters
-
name The name of the enum.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Method() [1/2]
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Method | ( | const char * | name , |
Function | method , | ||
BehaviorValues * |
defaultValues
=
nullptr
,
|
||
const char * |
dbgDesc
=
nullptr
|
||
) |
Reflects a class method to the behavior context.
Each method must have a name unique to the class.
You can attach one or more attributes to the method by following
Method()
with
Attribute()
in a builder pattern as shown in the following example.
To reflect global methods, use BehaviorContext::Method() .
- Parameters
-
name The name of the method. method A reference to the method. defaultValues (Optional) Default values, which help you call the reflected method with fewer arguments. Default values are used right to left. dbgDesc (Optional) A description that is used for debugging.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Method() [2/2]
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Method | ( | const char * | name , |
Function | method , | ||
AZStd::array< AZStd::string, AZStd::function_traits< Function >::num_args > | argNames , | ||
BehaviorValues * |
defaultValues
=
nullptr
,
|
||
const char * |
dbgDesc
=
nullptr
|
||
) |
Reflects a class method with arguments to the behavior context.
Each method must have a name unique to the class.
You can attach one or more attributes to the method by following
Method()
with
Attribute()
in a builder pattern as shown in the following example.
To reflect global methods, use BehaviorContext::Method() .
- Parameters
-
name The name of the method. method A reference to the method. argNames An array of argument names for the method. defaultValues (Optional) Default values, which help you call the reflected method with fewer arguments. Default values are used right to left. dbgDesc (Optional) A description that is used for debugging.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ NotificationBus()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::NotificationBus | ( | const char * | busName | ) |
Describes the EBus notification buses that this class uses.
This information is used by tools and gives developers information about which notification buses this class interacts with. You don't need to reflect all notification buses that your class uses, just the ones related to class behavior.
- Parameters
-
busName The name of the notification bus.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Property()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Property | ( | const char * | name , |
Getter | getter , | ||
Setter | setter | ||
) |
Reflects class member properties to the behavior context.
A property is data that is represented by a getter and setter function. If you don't have a getter or setter function, you can use the BehaviorValueGetter() and BehaviorValueSetter() helper macros.
You can attach one or more attributes to a property by following
Property()
with
Attribute()
in a builder pattern as shown in the following example.
For more examples, see the detailed description of BehaviorContext . To reflect global properties, use BehaviorContext::Property() .
- Parameters
-
name A name for the property. getter (Optional) A method that gets the value of the property. If you pass null for this parameter, the property is write only. (This is rare.) setter (Optional) A function that sets the property. If you pass null for this parameter, the property is read only.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ RequestBus()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::RequestBus | ( | const char * | busName | ) |
Describes the EBus request buses that this class uses.
This information is used by tools and gives developers information about which request buses this class interacts with. You don't need to reflect all request buses that your class uses, just the ones related to class behavior.
- Parameters
-
busName The name of the request bus.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ UserData()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::UserData | ( | void * | userData | ) |
Attaches additional data to a class.
- Parameters
-
userData A pointer to additional data.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ Wrapping()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::Wrapping | ( | BehaviorClassUnwrapperFunction | unwrapper , |
void * | userData | ||
) |
Use to indicate that a class is a wrapper of another class.
You can use this when your class is a wrapper, such as a smart pointer.
- Template Parameters
-
WrappedType The type that is wrapped.
- Parameters
-
unwrapper A reference to a function to unwrap the class. userData A pointer to additional data for the wrapper.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
◆ WrappingMember()
ClassReflection * AZ::BehaviorContext::ClassReflection < C >::WrappingMember | ( | MemberFunction | memberFunction | ) |
Provides a function to unwrap a class.
Uses an underlying class.
- Template Parameters
-
WrappedType The type that is wrapped. MemberFunction The function type that unwraps the class.
- Parameters
-
memberFunction A reference to a function to unwrap the class.
- Returns
-
The
this
pointer so that you can keep using the builder pattern.
Member Data Documentation
◆ m_class
BehaviorClass * AZ::BehaviorContext::ClassReflection < C >::m_class |
A pointer to all the information that describes a reflected class.
The documentation for this struct was generated from the following file:
- C:/lumberyard-root/dev/Code/Framework/AZCore/AZCore/RTTI/ BehaviorContext.h