コード例 #1
0
 public IReadOnlyTimeLocatedBuffer1D <double> Read(int elements)
 {
     if (elements < 0)
     {
         throw new ArgumentOutOfRangeException();
     }
     if (elements > _readBuffer.Capacity)
     {
         elements = _readBuffer.Capacity;
     }
     _queue.Read(_readBuffer, elements);
     return(_readBuffer);
 }
コード例 #2
0
        public void Transfer()
        {
            var minFree = Connections.Count > 0 ? Connections.Min(c => ((InputPortData1D)c).Free) : int.MaxValue;
            var count   = Math.Min(_transferBuffer.Capacity, minFree);

            var read = _queue.Read(_transferBuffer, count);

            foreach (var input in Connections)
            {
                var written = ((InputPortData1D)input).Write(_transferBuffer);
                if (written != read)
                {
                    throw new InvalidOperationException();
                }
            }
        }