Isle
Loading...
Searching...
No Matches
MxCollection< T > Class Template Reference

[AI] Template class for a generic collection, providing fundamental storage and comparison facilities, in addition to customized destruction policies. More...

#include <mxcollection.h>

Inheritance diagram for MxCollection< T >:
Collaboration diagram for MxCollection< T >:

Public Member Functions

 MxCollection ()
 [AI] Constructs an empty collection, initializing count and default element destructor. More...
 
virtual MxS8 Compare (T a, T b)
 [AI] Compares two elements of the collection (default implementation returns zero; override in subclasses for meaningful comparison). More...
 
 ~MxCollection () override
 [AI] Virtual destructor for proper polymorphic destruction. More...
 
void SetDestroy (void(*p_customDestructor)(T))
 [AI] Assigns a custom destructor function to be used for elements of this collection. 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...
 

Static Public Member Functions

static void Destroy (T obj)
 [AI] Static no-op destroy function; suitable for types that do not need destruction. More...
 

Protected Attributes

MxU32 m_count
 [AI] Number of elements currently stored in the collection. More...
 
void(* m_customDestructor )(T)
 [AI] Function pointer to the custom element destructor used for cleanup of elements. More...
 

Detailed Description

template<class T>
class MxCollection< T >

[AI] Template class for a generic collection, providing fundamental storage and comparison facilities, in addition to customized destruction policies.

[AI] MxCollection is a template base class for non-owning or lightweight-owning containers within the LEGO Island engine architecture. It manages element count, supports a custom destruction strategy for elements, and provides a virtual interface for type-specific comparisons. Designed to be subclassed for concrete storage behaviors.

Template Parameters
T[AI] Type of element stored in the collection.

Definition at line 10 of file mxcollection.h.

Constructor & Destructor Documentation

◆ MxCollection()

template<class T >
MxCollection< T >::MxCollection ( )
inline

[AI] Constructs an empty collection, initializing count and default element destructor.

Definition at line 13 of file mxcollection.h.

◆ ~MxCollection()

template<class T >
MxCollection< T >::~MxCollection ( )
inlineoverride

[AI] Virtual destructor for proper polymorphic destruction.

Definition at line 26 of file mxcollection.h.

Member Function Documentation

◆ Compare()

template<class T >
virtual MxS8 MxCollection< T >::Compare ( a,
b 
)
inlinevirtual

[AI] Compares two elements of the collection (default implementation returns zero; override in subclasses for meaningful comparison).

Parameters
a[AI] First element to compare.
b[AI] Second element to compare.
Returns
[AI] See subclass documentation; default is no ordering.

Definition at line 23 of file mxcollection.h.

◆ Destroy()

template<class T >
static void MxCollection< T >::Destroy ( obj)
inlinestatic

[AI] Static no-op destroy function; suitable for types that do not need destruction.

Parameters
obj[AI] Collection element (unused in default implementation).

Definition at line 30 of file mxcollection.h.

◆ SetDestroy()

template<class T >
void MxCollection< T >::SetDestroy ( void(*)(T)  p_customDestructor)
inline

[AI] Assigns a custom destructor function to be used for elements of this collection.

Parameters
p_customDestructor[AI] Pointer to a function responsible for cleaning up individual collection elements.

Definition at line 34 of file mxcollection.h.

Member Data Documentation

◆ m_count

template<class T >
MxU32 MxCollection< T >::m_count
protected

[AI] Number of elements currently stored in the collection.

Definition at line 37 of file mxcollection.h.

◆ m_customDestructor

template<class T >
void(* MxCollection< T >::m_customDestructor) (T)
protected

[AI] Function pointer to the custom element destructor used for cleanup of elements.

Definition at line 38 of file mxcollection.h.


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