change Span returns to ReadOnlySpan
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
327a458f17
commit
73ea4568ab
|
@ -74,7 +74,7 @@ namespace Encompass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<Entity> AllEntities<TComponent>() where TComponent : struct
|
public ReadOnlySpan<Entity> AllEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _store.AllEntities<TComponent>();
|
return _store.AllEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,12 +113,12 @@ namespace Encompass
|
||||||
return Lookup<TComponent>().Count > 0;
|
return Lookup<TComponent>().Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<TComponent> All<TComponent>() where TComponent : struct
|
public ReadOnlySpan<TComponent> All<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return Lookup<TComponent>().AllComponents();
|
return Lookup<TComponent>().AllComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<Entity> AllEntities<TComponent>() where TComponent : struct
|
public ReadOnlySpan<Entity> AllEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return Lookup<TComponent>().AllEntities();
|
return Lookup<TComponent>().AllEntities();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Encompass
|
||||||
return ref Lookup<TMessage>().First();
|
return ref Lookup<TMessage>().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<TMessage> All<TMessage>() where TMessage : struct, IMessage
|
public ReadOnlySpan<TMessage> All<TMessage>() where TMessage : struct, IMessage
|
||||||
{
|
{
|
||||||
return Lookup<TMessage>().All();
|
return Lookup<TMessage>().All();
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,14 +127,14 @@ namespace Encompass
|
||||||
_priorities.Clear();
|
_priorities.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<Entity> AllEntities()
|
public ReadOnlySpan<Entity> AllEntities()
|
||||||
{
|
{
|
||||||
return new Span<Entity>(_storageIndexToEntities, 0, _nextID);
|
return new ReadOnlySpan<Entity>(_storageIndexToEntities, 0, _nextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<TComponent> AllComponents()
|
public ReadOnlySpan<TComponent> AllComponents()
|
||||||
{
|
{
|
||||||
return new Span<TComponent>(_components, 0, _nextID);
|
return new ReadOnlySpan<TComponent>(_components, 0, _nextID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,9 @@ namespace Encompass
|
||||||
return _nextIndex != 0;
|
return _nextIndex != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<TMessage> All()
|
public ReadOnlySpan<TMessage> All()
|
||||||
{
|
{
|
||||||
return new Span<TMessage>(_store, 0, _nextIndex);
|
return new ReadOnlySpan<TMessage>(_store, 0, _nextIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<TMessage> WithEntity(int entityID)
|
public IEnumerable<TMessage> WithEntity(int entityID)
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Encompass
|
||||||
|
|
||||||
// existing or immediate reads
|
// existing or immediate reads
|
||||||
|
|
||||||
internal Span<TComponent> ReadExistingAndImmediateComponentsByType<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<TComponent> ReadExistingAndImmediateComponentsByType<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _upToDateComponentStore.All<TComponent>();
|
return _upToDateComponentStore.All<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ namespace Encompass
|
||||||
return ref _upToDateComponentStore.Singular<TComponent>();
|
return ref _upToDateComponentStore.Singular<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Span<Entity> GetExistingAndImmediateEntities<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<Entity> GetExistingAndImmediateEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _upToDateComponentStore.AllEntities<TComponent>();
|
return _upToDateComponentStore.AllEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ namespace Encompass
|
||||||
|
|
||||||
// existing reads
|
// existing reads
|
||||||
|
|
||||||
internal Span<TComponent> GetExistingComponents<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<TComponent> GetExistingComponents<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _existingComponentStore.All<TComponent>();
|
return _existingComponentStore.All<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace Encompass
|
||||||
return ref _existingComponentStore.Singular<TComponent>();
|
return ref _existingComponentStore.Singular<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Span<Entity> GetExistingEntities<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<Entity> GetExistingEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _existingComponentStore.AllEntities<TComponent>();
|
return _existingComponentStore.AllEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ namespace Encompass
|
||||||
|
|
||||||
// immediate reads
|
// immediate reads
|
||||||
|
|
||||||
internal Span<TComponent> ReadImmediateComponentsByType<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<TComponent> ReadImmediateComponentsByType<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _immediateComponentStore.All<TComponent>();
|
return _immediateComponentStore.All<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ namespace Encompass
|
||||||
return ref _immediateComponentStore.Singular<TComponent>();
|
return ref _immediateComponentStore.Singular<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Span<Entity> GetImmediateEntities<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<Entity> GetImmediateEntities<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _immediateComponentStore.AllEntities<TComponent>();
|
return _immediateComponentStore.AllEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ namespace Encompass
|
||||||
return _immediateComponentStore.Has(type, entityID);
|
return _immediateComponentStore.Has(type, entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Span<TComponent> GetComponentsByType<TComponent>() where TComponent : struct
|
internal ReadOnlySpan<TComponent> GetComponentsByType<TComponent>() where TComponent : struct
|
||||||
{
|
{
|
||||||
return _existingComponentStore.All<TComponent>();
|
return _existingComponentStore.All<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace Encompass
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all Entities containing the specified Component type.
|
/// Returns all Entities containing the specified Component type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Span<Entity> ReadEntities<TComponent>() where TComponent : struct, IComponent
|
protected ReadOnlySpan<Entity> ReadEntities<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
var immediateRead = ReadImmediateTypes.Contains(typeof(TComponent));
|
var immediateRead = ReadImmediateTypes.Contains(typeof(TComponent));
|
||||||
var existingRead = ReadTypes.Contains(typeof(TComponent));
|
var existingRead = ReadTypes.Contains(typeof(TComponent));
|
||||||
|
@ -273,7 +273,7 @@ namespace Encompass
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all of the Components with the specified Component Type.
|
/// Returns all of the Components with the specified Component Type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Span<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent
|
protected ReadOnlySpan<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
var immediateRead = ReadImmediateTypes.Contains(typeof(TComponent));
|
var immediateRead = ReadImmediateTypes.Contains(typeof(TComponent));
|
||||||
var existingRead = ReadTypes.Contains(typeof(TComponent));
|
var existingRead = ReadTypes.Contains(typeof(TComponent));
|
||||||
|
@ -550,7 +550,7 @@ namespace Encompass
|
||||||
/// <exception cref="Encompass.Exceptions.IllegalReadException">
|
/// <exception cref="Encompass.Exceptions.IllegalReadException">
|
||||||
/// Thrown when the Engine does not declare that it Receives the specified Message Type.
|
/// Thrown when the Engine does not declare that it Receives the specified Message Type.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
protected Span<TMessage> ReadMessages<TMessage>() where TMessage : struct, IMessage
|
protected ReadOnlySpan<TMessage> ReadMessages<TMessage>() where TMessage : struct, IMessage
|
||||||
{
|
{
|
||||||
CheckMessageRead<TMessage>();
|
CheckMessageRead<TMessage>();
|
||||||
return _messageManager.GetMessagesByType<TMessage>();
|
return _messageManager.GetMessagesByType<TMessage>();
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Encompass
|
||||||
_messageStore.ProcessDelayedMessages(dt * _timeManager.TimeDilationFactor, dt);
|
_messageStore.ProcessDelayedMessages(dt * _timeManager.TimeDilationFactor, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Span<TMessage> GetMessagesByType<TMessage>() where TMessage : struct, IMessage
|
internal ReadOnlySpan<TMessage> GetMessagesByType<TMessage>() where TMessage : struct, IMessage
|
||||||
{
|
{
|
||||||
return _messageStore.All<TMessage>();
|
return _messageStore.All<TMessage>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Encompass
|
||||||
_componentManager = componentManager;
|
_componentManager = componentManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Span<Entity> ReadEntities<TComponent>() where TComponent : struct, IComponent
|
protected ReadOnlySpan<Entity> ReadEntities<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
return _componentManager.GetExistingEntities<TComponent>();
|
return _componentManager.GetExistingEntities<TComponent>();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace Encompass
|
||||||
return ref _componentManager.ExistingSingularEntity<TComponent>();
|
return ref _componentManager.ExistingSingularEntity<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Span<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent
|
protected ReadOnlySpan<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
return _componentManager.GetComponentsByType<TComponent>();
|
return _componentManager.GetComponentsByType<TComponent>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue