#include <IdUtils.h>
Public Types | |
using | IdGenerator = AZStd::function< IdType()> |
using | IdMapper = AZStd::function< IdType(const IdType &originalId, bool replaceId, const IdGenerator &idGenerator)> |
using | IdReplacer = AZStd::function< IdType(const IdType &originalId)> |
Public Member Functions | |
unsigned int | ReplaceIdsAndIdRefs (SliceComponent::InstantiatedContainer *container, const Remapper< EntityId >::IdMapper &mapper, SerializeContext *context) |
Static Public Member Functions | |
static unsigned int | RemapIds (void *classPtr, const AZ::Uuid &classUuid, const IdMapper &mapper, AZ::SerializeContext *context, bool replaceId) |
template<typename T > | |
static unsigned int | RemapIds (T *classPtr, const IdMapper &mapper, AZ::SerializeContext *context, bool replaceId) |
static unsigned int | ReplaceIdsAndIdRefs (void *classPtr, const AZ::Uuid &classUuid, const IdMapper &mapper, AZ::SerializeContext *context=nullptr) |
template<typename T > | |
static unsigned int | ReplaceIdsAndIdRefs (T *classPtr, const IdMapper &mapper, AZ::SerializeContext *context=nullptr) |
static unsigned int | RemapIdsAndIdRefs (void *classPtr, const AZ::Uuid &classUuid, const IdReplacer &mapper, AZ::SerializeContext *context=nullptr) |
template<typename T > | |
static unsigned int | RemapIdsAndIdRefs (T *classPtr, const IdReplacer &mapper, AZ::SerializeContext *context=nullptr) |
template<typename T , typename MapType > | |
static void | GenerateNewIdsAndFixRefs (T *object, MapType &newIdMap, AZ::SerializeContext *context=nullptr) |
template<class T , class MapType > | |
static T * | CloneObjectAndGenerateNewIdsAndFixRefs (const T *object, MapType &newIdMap, AZ::SerializeContext *context=nullptr) |
AllowDuplicates | - If true allows the same id to be registered multiple times, with the newer value overwriting the stored value. If false, duplicates are not allowed and the first stored value is kept.The default is false. |
using AZ::IdUtils::Remapper< IdType, AllowDuplicates >::IdGenerator = AZStd::function<IdType()> |
Signature of function that gets passed to the IdMapper to generate a new Id of type IdType The function is retrieved from a AZ::Edit::Attributes::IdGeneratorFunction attribute when processing EditData Data element.
using AZ::IdUtils::Remapper< IdType, AllowDuplicates >::IdMapper = AZStd::function<IdType(const IdType& originalId, bool replaceId, const IdGenerator& idGenerator)> |
Signature of function that is invoked by RemapIds to either generate a new id or to return an existing id
originalId | - the original Id being remapped |
replaceId | - boolean that indicates the id supplied should have a new id generated for it |
idGenerator | - function object which can be invoked to generate a new id. The supplied idGenerator function can be empty, so an empty function check should be performed before invoking |
using AZ::IdUtils::Remapper< IdType, AllowDuplicates >::IdReplacer = AZStd::function<IdType(const IdType& originalId)> |
Signature of function that is invoked by RemapIds to return an existing id
originalId | - the original Id being remapped |
|
inlinestatic |
Clones the supplied object, enumerate over the cloned object and generate new ids of IdType using the newIdMap as both a data source and data sink for remapping ids
object | - the object to clone |
newIdMap | - An input/output map container for storing mappings of old IdType values to new IdType values. |
context | - The serialize context for enumerating the @classPtr elements |
|
inlinestatic |
Enumerates object and generates new ids of IdType using the newIdMap as a data source for remapping ids as well as updating the newIdMap with the remapped Ids
object | - the object to enumerate |
newIdMap | - An input/output map container for storing mappings of old IdType values to new IdType values. |
context | - The serialize context for enumerating the @classPtr elements |
|
inlinestatic |
Template id remap function which which retrieves the type uuid from the supplied object and forwards to the non-template method. Enumerates all elements in the object's hierarchy invoking the IdMapper function on any element that matches @IdType If the IdMapper returns a value different than the originalId that element is updated with the new value
classPtr | - the object instance to enumerate |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |
replaceId | - boolean passed into @mapper function to that indicate that a new id should be generated for the original id. otherwise an id from a map can be returned. |
|
static |
Enumerates all elements in the object's hierarchy invoking the IdMapper function on any element that matches @IdType If the IdMapper returns a value different than the originalId that element is updated with the new value
classPtr | - the object instance to enumerate |
classUuid | - the object's type id |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |
replaceId | - boolean passed into @mapper function to that indicate that a new id should be generated for the original id. otherwise an id from a map can be returned. |
|
inlinestatic |
Template version of RemapIdsAndIdRefs which retrieves the type uuid from the supplied object and forwards to the non-template method Convenience function for remapping ids in a single pass. Requires that there will be no new id generation, only mapping
classPtr | - the object instance to enumerate |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |
|
static |
Convenience function for remapping ids in a single pass. Requires that there will be no new id generation, only mapping
classPtr | - the object instance to enumerate |
classUuid | - the object's type id |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |
|
inlinestatic |
Template version of ReplaceIdsAndIdRefs which retrieves the type uuid from the supplied object and forwards to the non-template method Convenience function for remapping ids with by supplying both true and false to the @RemapIds function. True indicates that an id is the main instance id and should have a new value generated for it. False indicates that an id is a reference to the main instance id and should retrieve a new value from a map of original Id -> new Id*. First the replaceId parameter is true in RemapIds in order to allow population of an old Id -> new Id Map using the IdMapper functoin. Second the replaceId parameter is false in RemapIds in order to allow id references to be fixed up using the map populated in the first call
classPtr | - the object instance to enumerate |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |
|
static |
Convenience function for remapping ids with by supplying both true and false to the @RemapIds function. True indicates that an id is the main instance id and should have a new value generated for it. False indicates that an id is a reference to the main instance id and should retrieve a new value from a map of original Id -> new Id*. First the replaceId parameter is true in RemapIds in order to allow population of an old Id -> new Id Map using the IdMapper functoin. Second the replaceId parameter is false in RemapIds in order to allow id references to be fixed up using the map populated in the first call
classPtr | - the object instance to enumerate |
classUuid | - the object's type id |
mapper | - function object which is invoked to retrieve an id mapped from the originalId |
context | - The serialize context for enumerating the @classPtr elements |