XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGraphPatch Class Referenceabstract

Patch base class for xiiAbstractObjectGraph patches. More...

#include <GraphPatch.h>

Inheritance diagram for xiiGraphPatch:
[legend]

Public Types

enum class  PatchType : xiiUInt8 { NodePatch , GraphPatch }
 

Public Member Functions

 xiiGraphPatch (xiiStringView sType, xiiUInt32 uiTypeVersion, PatchType type=PatchType::NodePatch)
 Constructor. pType is the type to patch. uiTypeVersion is the version to patch to.
 
virtual void Patch (xiiGraphPatchContext &ref_context, xiiAbstractObjectGraph *pGraph, xiiAbstractObjectNode *pNode) const =0
 Patch function. If type == PatchType::NodePatch, the implementation needs to patch pNode in pGraph to m_uiTypeVersion. If type == PatchType::GraphPatch, pNode will be nullptr and the implementation has to figure out what to patch in pGraph on its own.
 
xiiStringView GetType () const
 Returns the type to patch.
 
xiiUInt32 GetTypeVersion () const
 Returns the type version to patch to.
 
PatchType GetPatchType () const
 
 XII_DECLARE_ENUMERABLE_CLASS (xiiGraphPatch)
 

Additional Inherited Members

- Static Public Member Functions inherited from xiiNoBase
static const xiiRTTIGetStaticRTTI ()
 
- Protected Attributes inherited from xiiEnumerable< xiiGraphPatch >
xiiEnumerablem_pNextInstance
 

Detailed Description

Patch base class for xiiAbstractObjectGraph patches.

Create static instance of derived class to automatically patch graphs on load.

Member Enumeration Documentation

◆ PatchType

enum class xiiGraphPatch::PatchType : xiiUInt8
strong
Enumerator
NodePatch 

Patch applies to a node of a certain type and version.

GraphPatch 

Patch applies to an entire graph without any restrictions.

Constructor & Destructor Documentation

◆ xiiGraphPatch()

xiiGraphPatch::xiiGraphPatch ( xiiStringView sType,
xiiUInt32 uiTypeVersion,
PatchType type = PatchType::NodePatch )

Constructor. pType is the type to patch. uiTypeVersion is the version to patch to.

Patches are executed in order from version uiTypeVersion-1 to uiTypeVersion. If no patch exists for previous versions the input to the patch function can potentially be of a lower version than uiTypeVersion-1. If type is PatchType::NodePatch, the patch is executed for each instance of the given type. If type is PatchType::GraphPatch, the patch is executed once for the entire graph. In this case szType and uiTypeVersion are ignored and the patch function has to figure out what to do by itself.


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