in csharp/src/Containers/DataQueue.cs [343:402]
public void Put(Decimal64 data)
{
if (queueType == QueueType.ManualControl)
throw new InvalidOperationException("DataQueue: Use Manual methods PutLast, PutFirst.");
if (needDateTime)
throw new InvalidOperationException("DataQueue: Do not use this method for AutoDynamic, and do not use both with and without DateTime method for one queue instance.");
if (queueType == QueueType.ManualControl)
throw new InvalidOperationException("DataQueue: Use Manual methods putLast, putFirst.");
if (needDateTime)
throw new InvalidOperationException("DataQueue: Do not use this method for AutoDynamic, and do not use both with and without DateTime method for one queue instance.");
if (queueType == QueueType.SingleElement)
{
if (calcStatistics)
stat.Init();
if (count > 0)
{
count = 0;
OnPop?.Invoke(singleElement, DefaultDateTime);
}
previousElement = singleElement;
singleElement = data;
count = 1;
if (calcStatistics)
stat.Set(data);
OnPush?.Invoke(singleElement, DefaultDateTime);
}
else
{
if (count == queueBuffer.Length) // Need to drop something ?
{
count--;
Decimal64 data_ = queueBuffer[first++];
if (first == queueBuffer.Length)
first = 0;
if (calcStatistics)
stat.Pop(data_);
OnPop?.Invoke(data_, DefaultDateTime);
}
count++;
queueBuffer[last++] = data;
if (last == queueBuffer.Length)
last = 0;
OnPush?.Invoke(data, DefaultDateTime);
if (calcStatistics)
stat.Push(data);
}
}