Quantum 3 3.1.0

Public Member Functions | List of all members
Quantum.ComponentRegistry Class Reference

Collects component registrations before ids exist, then Commit assigns dense ids deterministically: explicit ids claim their slots, the rest fill the remaining slots sorted by type name. Ids depend only on the set of collected components, never on the order they were added in, so registrations may be spread across partial declarations whose initializer order is unspecified. More...

Public Member Functions

void Commit ()
 Resets ComponentTypeId to fit all collected components, registers the built-in components and then assigns ids and registers the collected ones. More...
 
ComponentRegistry Register< T > (ComponentSerializeDelegate serialize, ComponentChangedDelegate onAdded, ComponentChangedDelegate onRemoved, ComponentFlags flags=ComponentFlags.None)
 Collect a component; its id gets assigned in Commit. Returns the registry so registrations can be chained. More...
 
ComponentRegistry Register< T > (int explicitId, ComponentSerializeDelegate serialize, ComponentChangedDelegate onAdded, ComponentChangedDelegate onRemoved, ComponentFlags flags=ComponentFlags.None)
 Collect a component pinned to an explicit id. More...
 

Detailed Description

Collects component registrations before ids exist, then Commit assigns dense ids deterministically: explicit ids claim their slots, the rest fill the remaining slots sorted by type name. Ids depend only on the set of collected components, never on the order they were added in, so registrations may be spread across partial declarations whose initializer order is unspecified.

Member Function Documentation

◆ Register< T >() [1/2]

ComponentRegistry Quantum.ComponentRegistry.Register< T > ( ComponentSerializeDelegate  serialize,
ComponentChangedDelegate  onAdded,
ComponentChangedDelegate  onRemoved,
ComponentFlags  flags = ComponentFlags.None 
)
inline

Collect a component; its id gets assigned in Commit. Returns the registry so registrations can be chained.

Type Constraints
T :unmanaged 
T :IComponent 

◆ Register< T >() [2/2]

ComponentRegistry Quantum.ComponentRegistry.Register< T > ( int  explicitId,
ComponentSerializeDelegate  serialize,
ComponentChangedDelegate  onAdded,
ComponentChangedDelegate  onRemoved,
ComponentFlags  flags = ComponentFlags.None 
)
inline

Collect a component pinned to an explicit id.

Type Constraints
T :unmanaged 
T :IComponent 

◆ Commit()

void Quantum.ComponentRegistry.Commit ( )
inline

Resets ComponentTypeId to fit all collected components, registers the built-in components and then assigns ids and registers the collected ones.