示例#1
0
        public UserLogRecordHandler(Action <RRLogRecord> handler)
        {
            UserLogRecordHandlerDirectorNET director = new UserLogRecordHandlerDirectorNET(handler);
            int id = RRObjectHeap.AddObject(director);

            _SetHandler(director, id);
        }
示例#2
0
        internal PipeSubscription(WrappedPipeSubscription subscription)
        {
            _subscription = subscription;
            var director = new WrappedPipeSubscriptionDirectorNET(this);
            int id       = RRObjectHeap.AddObject(director);

            subscription.SetRRDirector(director, id);
        }
示例#3
0
        public async Task <object> AsyncGetDefaultClient(int timeout = -1)
        {
            AsyncStubReturnDirectorImpl <object> h = new AsyncStubReturnDirectorImpl <object>(null);
            int id = RRObjectHeap.AddObject(h);

            _subscription.AsyncGetDefaultClient(timeout, h, id);
            return(await h.Task);
        }
示例#4
0
        public async Task AsyncClose(int timeout = RobotRaconteurNode.RR_TIMEOUT_INFINITE)
        {
            AsyncVoidReturnDirectorImpl h = new AsyncVoidReturnDirectorImpl();
            int id = RRObjectHeap.AddObject(h);

            inner_gen.AsyncClose(timeout, h, id);
            await h.Task;
        }
示例#5
0
        private WrappedServiceSubscriptionFilter SubscribeService_LoadFilter(ServiceSubscriptionFilter filter)
        {
            WrappedServiceSubscriptionFilter filter2 = null;

            if (filter != null)
            {
                filter2 = new WrappedServiceSubscriptionFilter();
                if (filter.ServiceNames != null)
                {
                    foreach (string s in filter.ServiceNames)
                    {
                        filter2.ServiceNames.Add(s);
                    }
                }
                if (filter.TransportSchemes != null)
                {
                    foreach (string s in filter.TransportSchemes)
                    {
                        filter2.TransportSchemes.Add(s);
                    }
                }
                filter2.MaxConnections = filter.MaxConnections;
                if (filter.Nodes != null)
                {
                    var nodes2 = new vectorptr_wrappedservicesubscriptionnode();
                    foreach (var n1 in filter.Nodes)
                    {
                        if (n1 == null)
                        {
                            continue;
                        }
                        var n2 = new WrappedServiceSubscriptionFilterNode();

                        n2.NodeID   = n1.NodeID ?? NodeID.GetAny();
                        n2.NodeName = n1.NodeName ?? "";

                        n2.Username = n1.Username ?? "";
                        if (n1.Credentials != null)
                        {
                            n2.Credentials = (MessageElementData)this.PackMapType <string, object>(n1.Credentials);
                        }

                        nodes2.Add(n2);
                    }

                    filter2.Nodes = nodes2;
                }

                if (filter.Predicate != null)
                {
                    var director = new WrappedServiceSubscriptionFilterPredicateDirectorNET(filter.Predicate);
                    int id       = RRObjectHeap.AddObject(director);
                    filter2.SetRRPredicateDirector(director, id);
                }
            }
            return(filter2);
        }
示例#6
0
        private static WallTimer_initstruct AttachHandler(Action <TimerEvent> handler)
        {
            WallTimer_initstruct s = new WallTimer_initstruct();
            AsyncTimerEventReturnDirectorImpl h = new AsyncTimerEventReturnDirectorImpl(handler);

            s.handler = h;
            s.id      = RRObjectHeap.AddObject(h);
            return(s);
        }
示例#7
0
 public WrappedGenerator3ServerDirectorNET(Generator3 <ParamType> generator)
 {
     if (generator == null)
     {
         throw new NullReferenceException("Generator must not be null");
     }
     this.generator    = generator;
     this.objectheapid = RRObjectHeap.AddObject(this);
 }
示例#8
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;
     }
 }
示例#9
0
        public async Task <ReturnType> AsyncNext(int timeout = RobotRaconteurNode.RR_TIMEOUT_INFINITE)
        {
            AsyncRequestDirectorImpl d = new AsyncRequestDirectorImpl();
            int id = RRObjectHeap.AddObject(d);

            inner_gen.AsyncNext(null, timeout, d, id);
            var mret = await d.Task;

            return(RobotRaconteurNode.s.UnpackAnyType <ReturnType>(mret));
        }
示例#10
0
        public override void handler(WrappedServiceStub innerstub, HandlerErrorInfo error)
        {
            try
            {
                if (error.error_code != 0)
                {
                    using (MessageEntry merr = new MessageEntry())
                    {
                        this.handler_task.SetException(RobotRaconteurExceptionUtil.ErrorInfoToException(error));
                        return;
                    }
                }

                object s  = null;
                T      s1 = default(T);
                try
                {
                    int id = innerstub.GetObjectHeapID();
                    if (id != 0)
                    {
                        handler_task.SetResult((T)RRObjectHeap.GetObject(id));
                        return;
                    }

                    ServiceFactory f;
                    if (factory == null)
                    {
                        f = RobotRaconteurNode.s.GetServiceType(innerstub.RR_objecttype.GetServiceDefinition().Name);
                    }
                    else
                    {
                        f = factory;
                    }
                    s  = f.CreateStub(innerstub);
                    s1 = (T)s;
                }
                catch (Exception e)
                {
                    handler_task.SetException(e);
                    return;
                }

                handler_task.SetResult(s1);
            }
            catch (Exception e)
            {
                using (MessageEntry merr = new MessageEntry())
                {
                    RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr);
                    RRDirectorExceptionHelper.SetError(merr, e.ToString());
                }
            }
        }
示例#11
0
        //public int memoryid = 0;

        public WrappedPodMultiDimArrayMemoryDirectorNET(PodMultiDimArrayMemory <T> mem)
        {
            this.mem = mem;

            this.objectheapid = RRObjectHeap.AddObject(this);
        }
示例#12
0
        //public int memoryid = 0;

        public WrappedNamedArrayMemoryDirectorNET(NamedArrayMemory <T> mem)
        {
            this.mem = mem;

            this.objectheapid = RRObjectHeap.AddObject(this);
        }