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