Exemplo n.º 1
0
 /// <summary>
 /// read from buffer and write to array but with events
 /// </summary>
 /// <param name="cq"></param>
 /// <param name="reference"></param>
 /// <param name="range"></param>
 /// <param name="arr"></param>
 /// <param name="eArr"></param>
 /// <param name="e"></param>
 public void readEvent(ClCommandQueue cq, int reference, int range, object arr, ClEventArray eArr, ClEvent e)
 {
     if (arr.GetType() == typeof(float[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (float[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(int[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (int[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(uint[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (uint[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(double[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (double[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(long[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (long[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(byte[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (byte[])arr, eArr.h(), e.h());
     }
     else if (arr.GetType() == typeof(char[]))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, (char[])arr, eArr.h(), e.h());
     }
     else if (Functions.isTypeOfFastArr(arr))
     {
         readFromBufferRangedEvent(cq.h(), hBuffer, reference, range, ((IMemoryHandle)arr).ha(), eArr.h(), e.h());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// read from buffer to array
 /// </summary>
 /// <param name="cq">command queue to enqueue this read command</param>
 /// <param name="arr">array to write (to read on buffer)</param>
 public void read(ClCommandQueue cq, object arr)
 {
     if (arr.GetType() == typeof(float[]))
     {
         readFromBuffer(cq.h(), hBuffer, (float[])arr);
     }
     else if (arr.GetType() == typeof(int[]))
     {
         readFromBuffer(cq.h(), hBuffer, (int[])arr);
     }
     else if (arr.GetType() == typeof(uint[]))
     {
         readFromBuffer(cq.h(), hBuffer, (uint[])arr);
     }
     else if (arr.GetType() == typeof(double[]))
     {
         readFromBuffer(cq.h(), hBuffer, (double[])arr);
     }
     else if (arr.GetType() == typeof(long[]))
     {
         readFromBuffer(cq.h(), hBuffer, (long[])arr);
     }
     else if (arr.GetType() == typeof(byte[]))
     {
         readFromBuffer(cq.h(), hBuffer, (byte[])arr);
     }
     else if (arr.GetType() == typeof(char[]))
     {
         readFromBuffer(cq.h(), hBuffer, (char[])arr);
     }
     else if (Functions.isTypeOfFastArr(arr))
     {
         readFromBuffer(cq.h(), hBuffer, ((IMemoryHandle)arr).ha());
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// write to buffer from array but with constraints
 /// </summary>
 /// <param name="cq"></param>
 /// <param name="reference"></param>
 /// <param name="range"></param>
 /// <param name="arr"></param>
 public void writeRanged(ClCommandQueue cq, int reference, int range, object arr)
 {
     if (arr.GetType() == typeof(float[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (float[])arr);
     }
     else if (arr.GetType() == typeof(int[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (int[])arr);
     }
     else if (arr.GetType() == typeof(uint[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (uint[])arr);
     }
     else if (arr.GetType() == typeof(double[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (double[])arr);
     }
     else if (arr.GetType() == typeof(long[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (long[])arr);
     }
     else if (arr.GetType() == typeof(byte[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (byte[])arr);
     }
     else if (arr.GetType() == typeof(char[]))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, (char[])arr);
     }
     else if (Functions.isTypeOfFastArr(arr))
     {
         writeToBufferRanged(cq.h(), hBuffer, reference, range, ((IMemoryHandle)arr).ha());
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// add command queue to user event
 /// </summary>
 /// <param name="cq"></param>
 public void addCommandQueue(ClCommandQueue cq)
 {
     addUserEvent(cq.h(), hUserEvent);
     lock (lockObj)
     {
         ctr++;
     }
 }