public static void AddMessageElementDispose(vectorptr_messageelement vct, int i, object data) { using (MessageElement m = NewMessageElementDispose(i, data)) { vct.Add(m); } }
public static T CastDataAndDispose <T>(MessageElement m) { object dat = null; try { dat = m.Data; return((T)dat); } catch { IDisposable dat2 = dat as IDisposable; if (dat2 != null) { dat2.Dispose(); } throw; } finally { if (m != null) { m.Dispose(); } } }
public ReturnType Next() { using (MessageElement m2 = inner_gen.Next(null)) { return(RobotRaconteurNode.s.UnpackAnyType <ReturnType>(m2)); } }
public static MessageElement NewMessageElementDispose(int i, object data) { MessageElement m = null; try { m = new MessageElement(); m.ElementNumber = i; m.ElementFlags &= ((byte)~RobotRaconteurNET.MessageElementFlags_ELEMENT_NAME_STR); m.ElementFlags |= ((byte)RobotRaconteurNET.MessageElementFlags_ELEMENT_NUMBER); m.Data = data; return(m); } catch { if (m != null) { m.Dispose(); } throw; } finally { IDisposable d = data as IDisposable; if (d != null) { d.Dispose(); } } }
public override void handler(MessageElement m, HandlerErrorInfo error) { // using (m) { try { this.Dispose(); if (error.error_code != 0) { using (m) using (MessageEntry merr = new MessageEntry()) { this.handler_task.SetException(RobotRaconteurExceptionUtil.ErrorInfoToException(error)); return; } } this.handler_task.SetResult(m); } catch (Exception e) { using (m) using (MessageEntry merr = new MessageEntry()) { RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr); RRDirectorExceptionHelper.SetError(merr, e.ToString()); } } } }
public static MessageElement NewMessageElementDispose(string name, object data) { MessageElement m = null; try { m = new MessageElement(); m.ElementName = name; m.Data = data; return(m); } catch { if (m != null) { m.Dispose(); } throw; } finally { IDisposable d = data as IDisposable; if (d != null) { d.Dispose(); } } }
public void Next(ParamType param) { using (MessageElement m = RobotRaconteurNode.s.PackAnyType <ParamType>("parameter", ref param)) { inner_gen.Next(m); } }
public static T FindElementAndCast <T>(vectorptr_messageelement elems, string name) { using (MessageElement e = MessageElement.FindElement(elems, name)) { return(e.CastData <T>()); } }
public MessageElement AddElement(string name, object data) { using (MessageElement m = new MessageElement(name, data)) { elements.Add(m); return(m); } }
public static T UnpackEnum <T>(MessageElement m) { int[] a = CastDataAndDispose <int[]>(m); if (a.Length != 1) { throw new DataTypeException("Invalid enum"); } return((T)(object)a[0]); }
public async Task AsyncNext(ParamType param, int timeout = RobotRaconteurNode.RR_TIMEOUT_INFINITE) { using (MessageElement m = RobotRaconteurNode.s.PackAnyType <ParamType>("parameter", ref param)) { AsyncRequestDirectorImpl d = new AsyncRequestDirectorImpl(); int id = RRObjectHeap.AddObject(d); inner_gen.AsyncNext(m, timeout, d, id); var mret = await d.Task; } }
public ReturnType Next(ParamType param) { using (MessageElement m = RobotRaconteurNode.s.PackAnyType <ParamType>("parameter", ref param)) { using (MessageElement m2 = inner_gen.Next(m)) { return(RobotRaconteurNode.s.UnpackAnyType <ReturnType>(m2)); } } }
public static T[] UnpackArray <T>(MessageElement m) where T : struct { T[] a = CastDataAndDispose <T[]>(m); if (a == null) { throw new NullReferenceException(); } return(a); }
public static string UnpackString(MessageElement m) { string s = MessageElementUtil.CastDataAndDispose <string>(m); if (s == null) { throw new NullReferenceException(); } return(s); }
public static T UnpackScalar <T>(MessageElement m) where T : struct { T[] a = CastDataAndDispose <T[]>(m); if (a.Length != 1) { throw new DataTypeException("Invalid scalar"); } return(a[0]); }
public static MultiDimArray UnpackMultiDimArray(MessageElement m) { MultiDimArray a = RobotRaconteurNode.s.UnpackMultiDimArrayDispose( MessageElementUtil.CastDataAndDispose <MessageElementNestedElementList>(m)); if (a == null) { throw new NullReferenceException(); } return(a); }
public static MessageElement NewMessageElement(string name, object data) { MessageElement m = null; { m = new MessageElement(); m.ElementName = name; m.Data = data; return(m); } }
public static void AddMessageElementDispose(vectorptr_messageelement vct, MessageElement m) { try { vct.Add(m); } finally { if (m != null) { m.Dispose(); } } }
public static int GetMessageElementNumber(MessageElement e) { if ((e.ElementFlags & RobotRaconteurNET.MessageElementFlags_ELEMENT_NUMBER) != 0) { return(e.ElementNumber); } else if ((e.ElementFlags & RobotRaconteurNET.MessageElementFlags_ELEMENT_NAME_STR) != 0) { return(Int32.Parse(e.ElementName)); } else { throw new InvalidDataException("Could not determine Element Number"); } }
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); } } } }
public void AsyncSendPacketAll(T value) { var iter = new WrappedPipeSubscription_send_iterator(_subscription); while (iter.Next() != null) { object dat = null; try { using (MessageElement m = RobotRaconteurNode.s.PackAnyType <T>("value", ref value)) { iter.AsyncSendPacket(m); } } finally { IDisposable d = dat as IDisposable; if (d != null) { d.Dispose(); } } } }
private static void EndAsyncNext(MessageElement m, Exception err, object p) { Action <Exception> h = (Action <Exception>)p; h(err); }
public static NamedMultiDimArray UnpackNamedMultiDimArray <T>(MessageElement m) where T : struct { return(RobotRaconteurNode.s.UnpackNamedMultiDimArrayDispose <T>( MessageElementUtil.CastDataAndDispose <MessageElementNestedElementList>(m))); }
public static T[] UnpackPodArray <T>(MessageElement m) where T : struct { return(RobotRaconteurNode.s.UnpackPodArrayDispose <T>(CastDataAndDispose <MessageElementNestedElementList>(m))); }
public static List <T> UnpackList <T>(MessageElement m) { return((List <T>)RobotRaconteurNode.s.UnpackListTypeDispose <T>(m.Data)); }
public static Dictionary <K, T> UnpackMap <K, T>(MessageElement m) { return((Dictionary <K, T>)RobotRaconteurNode.s.UnpackMapTypeDispose <K, T>(m.Data)); }
public static object UnpackVarType(MessageElement m) { return(RobotRaconteurNode.s.UnpackVarTypeDispose(m)); }
public static T UnpackStructure <T>(MessageElement m) { return(RobotRaconteurNode.s.UnpackStructureDispose <T>( MessageElementUtil.CastDataAndDispose <MessageElementNestedElementList>(m))); }