2025-02-20 16:10:09 +03:00
|
|
|
using System;
|
|
|
|
|
using mROA.Abstract;
|
2025-02-17 16:52:58 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
namespace mROA.Implementation
|
2025-02-17 16:52:58 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
public class StaticRepresentationModuleProducer : IRepresentationModuleProducer
|
2025-02-17 16:52:58 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
private IRepresentationModule? _representationModule;
|
2025-03-13 20:01:17 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public IRepresentationModule Produce(int ownership)
|
|
|
|
|
{
|
|
|
|
|
if (_representationModule == null)
|
|
|
|
|
throw new NullReferenceException("The representation module is not initialized.");
|
|
|
|
|
return _representationModule;
|
|
|
|
|
}
|
2025-03-13 20:01:17 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public void Inject<T>(T dependency)
|
|
|
|
|
{
|
|
|
|
|
if (dependency is IRepresentationModule serialisationModule)
|
|
|
|
|
_representationModule = serialisationModule;
|
|
|
|
|
}
|
2025-02-17 16:52:58 +03:00
|
|
|
}
|
|
|
|
|
}
|