using System;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.Queues
{
///
/// Byte implementation of Action queue
///
public class BytesQueue : IQueue
{
private readonly IQueue _queue;
///
/// Constructor for BytesQueue
///
/// Key
/// Action to process queued bytes
public BytesQueue(string key, Action processBytesAction)
{
_queue = new GenericQueue(key, processBytesAction);
}
///
/// Constructor for BytesQueue
///
/// Key
/// Action to process queued bytes
/// Delay in ms between actions being invoked
public BytesQueue(string key, Action processBytesAction, int pacing)
{
_queue = new GenericQueue(key, processBytesAction, pacing);
}
///
/// Enqueue a byte array to be processed
///
/// Byte array to be processed
public void Enqueue(byte[] item)
{
_queue.Enqueue(item);
}
///
/// If the instance has been disposed
///
public bool Disposed
{
get { return _queue.Disposed; }
}
///
/// Key
///
public string Key
{
get { return _queue.Key; }
}
///
/// Disposes of resources
///
public void Dispose()
{
_queue.Dispose();
}
}
}