Ejemplo n.º 1
0
 public override void UnpackReadResult(MessageElementNestedElementList res, vector_uint64_t bufferpos, vector_uint64_t count)
 {
     using (res)
         using (bufferpos)
             using (count)
             {
                 PodMultiDimArray res1 = RobotRaconteurNode.s.UnpackPodMultiDimArrayDispose <T>(res);
                 buffer.AssignSubArray(bufferpos.Select(x => (uint)x).ToArray(), res1, new uint[buffer.Dims.Length], count.Select(x => (uint)x).ToArray());
             }
 }
Ejemplo n.º 2
0
 public override void Write(ulong[] memorypos, PodMultiDimArray buffer, ulong[] bufferpos, ulong[] count)
 {
     using (bufferdirector buffer1 = new bufferdirector(buffer))
         using (vector_uint64_t memorypos1 = new vector_uint64_t(memorypos))
             using (vector_uint64_t bufferpos1 = new vector_uint64_t(bufferpos))
                 using (vector_uint64_t count1 = new vector_uint64_t(count))
                 {
                     innerclient.Write(memorypos1, buffer1, bufferpos1, count1);
                 }
 }
Ejemplo n.º 3
0
 public override MessageElementNestedElementList PackWriteRequest(vector_uint64_t bufferpos, vector_uint64_t count)
 {
     using (bufferpos)
         using (count)
         {
             PodMultiDimArray o = new PodMultiDimArray(count.Select(x => (uint)x).ToArray(), new T[count.Aggregate(1, (x, y) => (int)x * (int)y)]);
             buffer.RetrieveSubArray(bufferpos.Select(x => (uint)x).ToArray(), o, new uint[buffer.Dims.Length], count.Select(x => (uint)x).ToArray());
             return(RobotRaconteurNode.s.PackPodMultiDimArray <T>(o));
         }
 }
Ejemplo n.º 4
0
        public virtual void RetrieveSubArray(uint[] memorypos, PodMultiDimArray buffer, uint[] bufferpos, uint[] count)
        {
            PodMultiDimArray mema = this;
            PodMultiDimArray memb = buffer;

            MultiDimArray_CalculateCopyIndicesIter iter = RobotRaconteurNET.MultiDimArray_CalculateCopyIndicesBeginIter(new vectoruint32(mema.Dims), new vectoruint32(memorypos), new vectoruint32(memb.Dims), new vectoruint32(bufferpos), new vectoruint32(count));

            uint indexa;
            uint indexb;
            uint len;

            while (iter.Next(out indexa, out indexb, out len))
            {
                Array.Copy(mema.pod_array, (long)indexa, memb.pod_array, (long)indexb, (long)len);
            }
        }
Ejemplo n.º 5
0
        public static PodMultiDimArray VerifyArrayLength(PodMultiDimArray a, int n_elems, uint[] len)
        {
            if (a.Dims.Length != len.Length)
            {
                throw new DataTypeException("Array dimension mismatch");
            }

            for (int i = 0; i < len.Length; i++)
            {
                if (a.Dims[i] != len[i])
                {
                    throw new DataTypeException("Array dimension mismatch");
                }
            }
            return(a);
        }
Ejemplo n.º 6
0
 public override void Write(vector_uint64_t memorypos, MessageElementNestedElementList buffer,
                            vector_uint64_t bufferpos, vector_uint64_t count)
 {
     try
     {
         using (buffer) using (memorypos) using (bufferpos) using (count)
                     {
                         PodMultiDimArray buffer2 = RobotRaconteurNode.s.UnpackPodMultiDimArray <T>(buffer);
                         mem.Write(memorypos.ToArray(), buffer2, bufferpos.ToArray(), count.ToArray());
                     }
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
         }
     }
 }
Ejemplo n.º 7
0
 public override MessageElementNestedElementList Read(vector_uint64_t memorypos, vector_uint64_t bufferpos, vector_uint64_t count)
 {
     try
     {
         using (memorypos)
             using (bufferpos)
                 using (count)
                 {
                     PodMultiDimArray buffer3 = new PodMultiDimArray(count.Select(x => (uint)x).ToArray(), new T[count.Aggregate(1, (x, y) => (int)x * (int)y)]);
                     mem.Read(memorypos.ToArray(), buffer3, new ulong[count.Count], count.ToArray());
                     return(RobotRaconteurNode.s.PackPodMultiDimArray <T>(buffer3));
                 }
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
         }
         return(null);
     }
 }
Ejemplo n.º 8
0
 public override void Attach(PodMultiDimArray memory)
 {
     throw new InvalidOperationException("Invalid for memory client");
 }
Ejemplo n.º 9
0
 public bufferdirector(PodMultiDimArray buffer)
 {
     this.buffer = buffer;
 }
Ejemplo n.º 10
0
 public virtual void Write(ulong[] memorypos, PodMultiDimArray buffer, ulong[] bufferpos, ulong[] count)
 {
     multimemory.AssignSubArray(memorypos.Select(x => (uint)x).ToArray(), buffer, bufferpos.Select(x => (uint)x).ToArray(), count.Select(x => (uint)x).ToArray());
 }
Ejemplo n.º 11
0
 public virtual void Read(ulong[] memorypos, PodMultiDimArray buffer, ulong[] bufferpos, ulong[] count)
 {
     multimemory.RetrieveSubArray(memorypos.Select(x => (uint)x).ToArray(), buffer, bufferpos.Select(x => (uint)x).ToArray(), count.Select(x => (uint)x).ToArray());
 }
Ejemplo n.º 12
0
 public virtual void Attach(PodMultiDimArray memory)
 {
     this.multimemory = memory;
 }
Ejemplo n.º 13
0
 public PodMultiDimArrayMemory(PodMultiDimArray memory)
 {
     multimemory = memory;
 }
Ejemplo n.º 14
0
 public static MessageElement PackPodMultiDimArray <T>(string name, PodMultiDimArray val)
     where T : struct
 {
     return(NewMessageElementDispose(name, RobotRaconteurNode.s.PackPodMultiDimArray <T>(val)));
 }