Exemple #1
0
 public override void Abort(WrappedServiceSkelAsyncAdapter async_adapter)
 {
     try
     {
         async_adapter.MakeAsync();
         generator.AsyncAbort().ContinueWith(t => async_adapter.EndTask(t));
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
             return;
         }
     }
 }
Exemple #2
0
 public override void Write(ulong memorypos, MessageElementNestedElementList buffer, ulong bufferpos, ulong count)
 {
     try
     {
         using (buffer)
         {
             T[] buffer2 = (T[])RobotRaconteurNode.s.UnpackPodArray <T>(buffer);
             mem.Write(memorypos, buffer2, bufferpos, count);
         }
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
         }
     }
 }
Exemple #3
0
        public override MessageElementNestedElementList Read(ulong memorypos, ulong bufferpos, ulong count)
        {
            try
            {
                T[] buffer3 = new T[count];
                mem.Read(memorypos, buffer3, 0, count);

                return(RobotRaconteurNode.s.PackPodArray <T>(buffer3));
            }
            catch (Exception e)
            {
                using (MessageEntry merr = new MessageEntry())
                {
                    RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                    RRDirectorExceptionHelper.SetError(merr, e.ToString());
                }
                return(null);
            }
        }
Exemple #4
0
 public override void Write(ulong memorypos, RRBaseArray buffer, ulong bufferpos, ulong count)
 {
     try
     {
         using (buffer)
         {
             T[] buffer2 = (T[])MessageElementDataUtil.RRBaseArrayToArray(buffer);
             mem.Write(memorypos, buffer2, bufferpos, count);
         }
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
         }
     }
 }
 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());
         }
     }
 }
Exemple #6
0
 public override vector_uint64_t Dimensions()
 {
     try
     {
         vector_uint64_t o = new vector_uint64_t();
         foreach (ulong i in mem.Dimensions)
         {
             o.Add(i);
         }
         return(o);
     }
     catch (Exception e)
     {
         using (MessageEntry merr = new MessageEntry())
         {
             RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
             RRDirectorExceptionHelper.SetError(merr, e.ToString());
             return(new vector_uint64_t());
         }
     }
 }
Exemple #7
0
        public override void Read(ulong memorypos, RRBaseArray buffer, ulong bufferpos, ulong count)
        {
            try
            {
                using (buffer)
                {
                    T[] buffer3 = new T[count];
                    mem.Read(memorypos, buffer3, 0, count);

                    MessageElementDataUtil.ArrayToRRBaseArray(buffer3, buffer);
                }
            }
            catch (Exception e)
            {
                using (MessageEntry merr = new MessageEntry())
                {
                    RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                    RRDirectorExceptionHelper.SetError(merr, e.ToString());
                }
            }
        }
Exemple #8
0
 public override MessageElement Next(MessageElement m, WrappedServiceSkelAsyncAdapter async_adapter)
 {
     using (m)
     {
         try
         {
             async_adapter.MakeAsync();
             generator.AsyncNext().ContinueWith(t => async_adapter.EndTask <ReturnType>(t, async_ret => RobotRaconteurNode.s.PackAnyType <ReturnType>("return", ref async_ret)));
             return(null);
         }
         catch (Exception e)
         {
             using (MessageEntry merr = new MessageEntry())
             {
                 RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                 RRDirectorExceptionHelper.SetError(merr, e.ToString());
                 return(null);
             }
         }
     }
 }
Exemple #9
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);
     }
 }
        public override void handler(HandlerErrorInfo error)
        {
            try
            {
                if (error.error_code != 0)
                {
                    using (MessageEntry merr = new MessageEntry())
                    {
                        this.handler_func(RobotRaconteurExceptionUtil.ErrorInfoToException(error));
                        return;
                    }
                }

                handler_func(new Exception("Unknown exception"));
            }
            catch (Exception e)
            {
                using (MessageEntry merr = new MessageEntry())
                {
                    RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                    RRDirectorExceptionHelper.SetError(merr, e.ToString());
                }
            }
        }
        public override void handler(uint v, HandlerErrorInfo error)
        {
            try
            {
                if (error.error_code != 0)
                {
                    using (MessageEntry merr = new MessageEntry())
                    {
                        this.handler_task.SetException(RobotRaconteurExceptionUtil.ErrorInfoToException(error));
                        return;
                    }
                }

                this.handler_task.SetResult(v);
            }
            catch (Exception e)
            {
                using (MessageEntry merr = new MessageEntry())
                {
                    RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                    RRDirectorExceptionHelper.SetError(merr, e.ToString());
                }
            }
        }