Game.Simulation.IXPSystem
Assembly: Game (inferred from project layout — adjust if different)
Namespace: Game.Simulation
Type: public interface
Base: (none)
Summary:
IXPSystem is a lightweight interface used by the simulation to transfer or forward messages to an IXPMessageHandler. Implementations are expected to hand off any queued/pending messages to the provided handler when TransferMessages is called. This is typically used during a simulation step or frame boundary to move message payloads between systems.
Fields
None
This interface does not declare any fields.
Properties
None
No properties are defined on this interface.
Constructors
None
Interfaces do not define constructors.
Methods
void TransferMessages(IXPMessageHandler handler)
Transfers the system's messages to the given IXPMessageHandler. Implementations should iterate any internal message queues/buffers and invoke the appropriate method(s) on the handler to deliver each message. Callers should provide a non-null handler; implementations may choose to guard against a null argument.
Parameters:
- handler
— the IXPMessageHandler instance that will receive the transferred messages. Consult IXPMessageHandler's definition for the exact API to invoke for delivering messages.
Usage Example
// Example implementation — adapt to the actual IXPMessage and handler API.
public class ExampleXPSystem : IXPSystem
{
private readonly Queue<IXPMessage> _messageQueue = new Queue<IXPMessage>();
public void TransferMessages(IXPMessageHandler handler)
{
if (handler == null) return; // or throw ArgumentNullException
while (_messageQueue.Count > 0)
{
var msg = _messageQueue.Dequeue();
// Deliver the message to the handler.
// Replace "Handle" below with the actual method name defined on IXPMessageHandler.
handler.Handle(msg);
}
}
// Methods to enqueue messages for this system...
}
Notes: - Check the actual IXPMessageHandler interface to see the correct method(s) for delivering messages (the example above uses a placeholder Handle method). - Implementations should consider thread-safety and the simulation's update/dispatch timing when moving messages.