Isle
Loading...
Searching...
No Matches
MxObjectFactory Class Reference

[AI] Forward declaration for the factory responsible for constructing core objects from atom or type ids. More...

#include <mxobjectfactory.h>

Inheritance diagram for MxObjectFactory:
Collaboration diagram for MxObjectFactory:

Public Member Functions

 MxObjectFactory ()
 [AI] Constructs a new MxObjectFactory and initializes atom IDs for all supported presenter classes. More...
 
const char * ClassName () const override
 [AI] Returns the class name. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Determines whether this class is or inherits from the named class. More...
 
virtual MxCoreCreate (const char *p_name)
 [AI] Creates a new instance of the class matching the provided string name. More...
 
virtual void Destroy (MxCore *p_object)
 [AI] Destroys (deletes) a dynamic object created by this factory. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Detailed Description

[AI] Forward declaration for the factory responsible for constructing core objects from atom or type ids.

[AI] Factory class for dynamic creation and destruction of presenter and core objects using their string names.

[AI]

[AI] This class is responsible for instantiating objects of several presenter types, identified by string names. It provides a polymorphic interface for creating and destroying objects derived from MxCore, enabling data-driven object management, notably from script or resource file loading. String IDs (as MxAtomId) corresponding to each supported object type are retained for fast lookup. [AI]

The factory manages a set of presenter and media handler objects used throughout the LEGO Island game engine.

Definition at line 34 of file mxobjectfactory.h.

Constructor & Destructor Documentation

◆ MxObjectFactory()

MxObjectFactory::MxObjectFactory ( )

[AI] Constructs a new MxObjectFactory and initializes atom IDs for all supported presenter classes.

[AI]

[AI] Upon initialization, string/class name mappings are built as MxAtomId members for fast lookup in Create. [AI]

Definition at line 20 of file mxobjectfactory.cpp.

Member Function Documentation

◆ ClassName()

const char * MxObjectFactory::ClassName ( ) const
inlineoverridevirtual

[AI] Returns the class name.

[AI]

Returns
[AI] Static class name string: "MxObjectFactory".

Reimplemented from MxCore.

Definition at line 42 of file mxobjectfactory.h.

◆ Create()

MxCore * MxObjectFactory::Create ( const char *  p_name)
virtual

[AI] Creates a new instance of the class matching the provided string name.

[AI]

Parameters
p_nameNull-terminated name of the class to instantiate. Must match one of the supported presenter types. [AI]

[AI] Returns a pointer to the newly created object derived from MxCore, or NULL if the class is unknown. [AI]

Reimplemented in LegoObjectFactory.

Definition at line 29 of file mxobjectfactory.cpp.

◆ Destroy()

void MxObjectFactory::Destroy ( MxCore p_object)
virtual

[AI] Destroys (deletes) a dynamic object created by this factory.

[AI]

Parameters
p_objectPointer to the object (MxCore-derived) to destroy. [AI]

[AI] Assumes the pointer was obtained from Create and is safe to delete (uses delete operator). [AI]

Reimplemented in LegoObjectFactory.

Definition at line 48 of file mxobjectfactory.cpp.

◆ IsA()

MxBool MxObjectFactory::IsA ( const char *  p_name) const
inlineoverridevirtual

[AI] Determines whether this class is or inherits from the named class.

[AI]

Parameters
p_nameName of class to check against (case sensitive). [AI]

[AI] Checks if p_name matches "MxObjectFactory" or its ancestor MxCore's name. [AI]

Reimplemented from MxCore.

Definition at line 50 of file mxobjectfactory.h.


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