Menu
Lumberyard
C++ API Reference (Version 1.10)

TypeInfo.h File Reference

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.

Header file for AzTypeInfo , which uniquely describes a type so that it can be identified across Lumberyard modules and serialized into different contexts. More...

Classes

struct AZ::AzTypeInfo< T, false >
Specialization of AzTypeInfo for types that use AZ_TYPE_INFO to add type information to the class. More...
struct AZ::AzTypeInfo< T, true >
Default specialization of AzTypeInfo for enums that do not contain AzTypeInfo . More...
struct AZ::AzTypeInfo< R(Args...), false >
Specialization of AzTypeInfo for function pointers. More...

Namespaces

AZStd
AZ

Macros

#define AZ_TYPE_INFO_SPECIALIZE (_ClassName, _ClassUuid)
AzTypeInfo specialization macro that is used to externally add AzTypeInfo to a type that cannot use the AZ_RTTI / AZ_TYPE_INFO macros internally. More...
#define AZ_TYPE_INFO (...)
A macro that you add to your class to enable the class to be identified across modules and serialized into different contexts. More...

Functions

template<class T , class U >
bool AZ::operator== (AzTypeInfo< T > const &lhs, AzTypeInfo< U > const &rhs)
Compares the AzTypeInfo of two type instances for equality. More...
template<class T , class U >
bool AZ::operator!= (AzTypeInfo< T > const &lhs, AzTypeInfo< U > const &rhs)
Compares the AzTypeInfo of two type instances for inequality. More...

Detailed Description

Header file for AzTypeInfo , which uniquely describes a type so that it can be identified across Lumberyard modules and serialized into different contexts.

For a given type, AzTypeInfo stores a name and a type ID. For a type to be uniquely identified across Lumberyard, its type ID must be unique. The default implementation of AzTypeInfo attempts to generate a unique type ID by accessing static functions inside the type. For types for which this is not an option, you must specialize AzTypeInfo .

Note
We recommend against using AZ_FUNCTION_SIGNATURE to generate type IDs, because it does not always generate a unique type ID. Some compilers fail to expand the template type, and thus provide the same result for multiple types.

To add AzTypeInfo to a class, use AZ_TYPE_INFO or AZ_RTTI within the class declaration or use AZ_TYPE_INFO_SPECIALIZE externally. When referencing the class from other code, be sure to include the header file that contains the class's AzTypeInfo information. This is usually the header file of the class.

If you use AZ Code Generator, unique type IDs are automatically generated for you.

Macro Definition Documentation

AZ_TYPE_INFO

#define AZ_TYPE_INFO ( ... )

A macro that you add to your class to enable the class to be identified across modules and serialized into different contexts.

You must pass in at least a type name and a unique type ID.

Usage: AZ_TYPE_INFO(_ClassName,_ClassUuid, (optional template parameters))

Templates and type IDs are special cases. If possible, prefer AZ_TYPE_INFO_SPECIALIZE for these types.

AZ_TYPE_INFO_SPECIALIZE

#define AZ_TYPE_INFO_SPECIALIZE ( _ClassName,
_ClassUuid
)

AzTypeInfo specialization macro that is used to externally add AzTypeInfo to a type that cannot use the AZ_RTTI / AZ_TYPE_INFO macros internally.

Used for library types, middleware, and so on.