#include <DataPatch.h>
Classes | |
struct | LegacyStreamWrapper |
Public Types | |
enum | Flag : Flags { ForceOverrideSet = 1 << 0 , PreventOverrideSet = 1 << 1 , HidePropertySet = 1 << 2 , ForceOverrideEffect = 1 << 4 , PreventOverrideEffect = 1 << 5 , HidePropertyEffect = 1 << 6 , SetMask = 0x0F , EffectMask = 0xF0 } |
using | Flags = AZ::u8 |
using | AddressTypeElement = DataPatchInternal::AddressTypeElement |
Alias the DataPatchInternal::AddressType inside the DataPatch declaration for backwards compatibility with DataPatch::AddressType. | |
using | AddressType = DataPatchInternal::AddressType |
using | PatchMap = DataPatchInternal::PatchMap |
using | ChildPatchMap = DataPatchInternal::ChildPatchMap |
using | FlagsMap = AZStd::unordered_map< AddressType, Flags > |
Public Member Functions | |
AZ_CLASS_ALLOCATOR (DataPatch, SystemAllocator) | |
DataPatch (const DataPatch &rhs) | |
DataPatch (DataPatch &&rhs) | |
DataPatch & | operator= (DataPatch &&rhs) |
DataPatch & | operator= (const DataPatch &rhs) |
bool | Create (const void *source, const Uuid &souceClassId, const void *target, const Uuid &targetClassId, const FlagsMap &sourceFlagsMap=FlagsMap(), const FlagsMap &targetFlagsMap=FlagsMap(), SerializeContext *context=nullptr) |
template<class T , class U > | |
bool | Create (const T *source, const U *target, const FlagsMap &sourceFlagsMap=FlagsMap(), const FlagsMap &targetFlagsMap=FlagsMap(), SerializeContext *context=nullptr) |
T and U should either be the same type a common base class. | |
void * | Apply (const void *source, const Uuid &sourceClassId, SerializeContext *context=nullptr, const AZ::ObjectStream::FilterDescriptor &filterDesc=AZ::ObjectStream::FilterDescriptor(), const FlagsMap &sourceFlagsMap=FlagsMap(), const FlagsMap &targetFlagsMap=FlagsMap()) const |
template<class T > | |
T * | Apply (const T *source, SerializeContext *context=nullptr, const AZ::ObjectStream::FilterDescriptor &filterDesc=AZ::ObjectStream::FilterDescriptor(), const FlagsMap &sourceFlagsMap=FlagsMap(), const FlagsMap &targetFlagsMap=FlagsMap()) const |
template<class U , class T > | |
U * | Apply (const T *source, SerializeContext *context=nullptr, const AZ::ObjectStream::FilterDescriptor &filterDesc=AZ::ObjectStream::FilterDescriptor(), const FlagsMap &sourceFlagsMap=FlagsMap(), const FlagsMap &targetFlagsMap=FlagsMap()) const |
bool | IsValid () const |
bool | IsData () const |
Static Public Member Functions | |
static Flags | GetEffectOfParentFlagsOnThisAddress (Flags flagsAtParentAddress) |
static Flags | GetEffectOfSourceFlagsOnThisAddress (Flags flagsAtSourceAddress) |
static Flags | GetEffectOfTargetFlagsOnThisAddress (Flags flagsAtTargetAddress) |
Given data flags for target data at this address, return the effect on a DataPatch. | |
static void | Reflect (ReflectContext *context) |
static AZ_INLINE const AZ::Uuid | GetLegacyDataPatchTypeId () |
Protected Attributes | |
Uuid | m_targetClassId |
unsigned int | m_targetClassVersion |
PatchMap | m_patch |
Structure that contains patch data for a given class. The primary goal of this object is to help with tools (slices and undo/redo), this structure is not recommended to runtime due to efficiency. If you want dynamically configure objects, use data overlay which are more efficient and generic.
using AZ::DataPatch::Flags = AZ::u8 |
Data addresses can be tagged with flags to affect how patches are created and applied.
using AZ::DataPatch::FlagsMap = AZStd::unordered_map<AddressType, Flags> |
Data flags, mapped by the address where the flags are set. When patching, an address is affected not only by the flags set AT that address, but also the flags set at any parent address.
enum AZ::DataPatch::Flag : Flags |
Bit fields for data flags. These options affect how patches are created and applied. There are two categories of flags:
void * AZ::DataPatch::Apply | ( | const void * | source, |
const Uuid & | sourceClassId, | ||
SerializeContext * | context = nullptr , |
||
const AZ::ObjectStream::FilterDescriptor & | filterDesc = AZ::ObjectStream::FilterDescriptor() , |
||
const FlagsMap & | sourceFlagsMap = FlagsMap() , |
||
const FlagsMap & | targetFlagsMap = FlagsMap() |
||
) | const |
Apply the patch to a source instance and generate a patched instance, from a source instance. If patch can't be applied a null pointer is returned. Currently the only reason for that is if the resulting class ID doesn't match the stored root of the patch.
source | pointer to the source instance. |
sourceClassID | id of the class source is pointing to. |
context | if null we will grab the default serialize context. |
filterDesc | customizable filter for data in patch (ex: filter out classes and assets) |
sourceFlagsMap | flags for source data. These may affect how a patch is applied (ex: prevent patching of specific addresses) |
targetFlagsMap | flags for target data. These may affect how a patch is applied. |
AZ::DataPatch::AZ_CLASS_ALLOCATOR | ( | DataPatch | , |
SystemAllocator | |||
) |
bool AZ::DataPatch::Create | ( | const void * | source, |
const Uuid & | souceClassId, | ||
const void * | target, | ||
const Uuid & | targetClassId, | ||
const FlagsMap & | sourceFlagsMap = FlagsMap() , |
||
const FlagsMap & | targetFlagsMap = FlagsMap() , |
||
SerializeContext * | context = nullptr |
||
) |
Create a patch structure which generate the delta (patcher) from source to the target type.
source | object we will use a base for the delta |
souceClassId | class of the source type, either the same as targetClassId or a base class |
target | object we want to have is we have source and apply the returned patcher. |
targetClassId | class of the target type, either the same as sourceClassId or a base class |
sourceFlagsMap | (optional) flags for source data. These may affect how the patch is created (ex: prevent patches at specific addresses) |
targetFlagsMap | (optional) flags for target data. These may affect how the patch is created (ex: force patches at specific addresses) |
context | if null we will grab the default serialize context. |
|
static |
Given data flags affecting the parent address, return the effect upon the child address. An example of a parent and child would be a vector and an element in that vector.
|
static |
Given data flags for source data at this address, return the effect on a DataPatch. An example of source data would be the slice upon which a slice-instance is based.
|
inline |
|
inline |
|
static |
Reflect a patch for serialization.