XLE
v0.02.0
|
Defines rules for creation, deletion and update of entities More...
#include <EntityInterface.h>
Public Member Functions | |
virtual DocumentId | CreateDocument (DocumentTypeId docType, const char initializer[])=0 |
virtual bool | DeleteDocument (DocumentId doc, DocumentTypeId docType)=0 |
virtual ObjectId | AssignObjectId (DocumentId doc, ObjectTypeId objType) const =0 |
virtual bool | CreateObject (const Identifier &id, const PropertyInitializer initializers[], size_t initializerCount)=0 |
virtual bool | DeleteObject (const Identifier &id)=0 |
virtual bool | SetProperty (const Identifier &id, const PropertyInitializer initializers[], size_t initializerCount)=0 |
virtual bool | GetProperty (const Identifier &id, PropertyId prop, void *dest, unsigned *destSize) const =0 |
virtual bool | SetParent (const Identifier &child, const Identifier &parent, int insertionPosition)=0 |
virtual ObjectTypeId | GetTypeId (const char name[]) const =0 |
virtual DocumentTypeId | GetDocumentTypeId (const char name[]) const =0 |
virtual PropertyId | GetPropertyId (ObjectTypeId type, const char name[]) const =0 |
virtual ChildListId | GetChildListId (ObjectTypeId type, const char name[]) const =0 |
Defines rules for creation, deletion and update of entities
Implementors of this interface will define rules for working with entities of a specific types.
Entities are imaginary objects with these properties:
To clients, data appears to be arranged according to these rules. However, the underlying data structures may be quite different. We use these interfaces to "reimagine" complex objects as hierachies of entities.s
This provides a simple, universal way to query and modify data throughout the system.
A good example is the "placements" interface. In reality, placement objects are stored within the native PlacementManager in their optimised native form, However, we can create an implementation of the "IObjectType" interface to make that data appear to be a hierarchy of entities.
Sometimes the underlying data is actually just a hierarchy of objects with properties, however. In these cases, IObjectType is just a generic way to access that data.
This is important for interact with the level editor. The level editor natively uses XML DOM based data structures to define everything in the scene. This maps onto the entities concept easily. So we can use this idea to move data freely between the level editor and native objects.
But it also suggests other uses that require querying and setting values in various objects in the scene. Such as animation of objects in the scene and for scripting purposes.