internal bool addCallback <M>(SubscriptionCallbackHelper <M> helper, string md5sum, CallbackQueueInterface queue, uint queue_size, bool allow_concurrent_callbacks, string topiclol) where M : IRosMessage, new() { lock (md5sum_mutex) { if (this.md5sum == "*" && md5sum != "*") { this.md5sum = md5sum; } } if (md5sum != "*" && md5sum != this.md5sum) { return(false); } lock (callbacks_mutex) { CallbackInfo <M> info = new CallbackInfo <M> { helper = helper, callback = queue, subscription_queue = new Callback <M>(helper.callback().func, topiclol, queue_size, allow_concurrent_callbacks) }; //if (!helper.isConst()) //{ ++nonconst_callbacks; //} callbacks.Add(info); if (latched_messages.Count > 0) { lock (publisher_links_mutex) { foreach (PublisherLink link in publisher_links) { if (link.Latched) { if (latched_messages.ContainsKey(link)) { LatchInfo latch_info = latched_messages[link]; IMessageDeserializer des = new IMessageDeserializer(helper, latch_info.message, latch_info.connection_header); bool was_full = false; ((Callback <M>)info.subscription_queue).push((SubscriptionCallbackHelper <M>)info.helper, (MessageDeserializer <M>)des, true, ref was_full, latch_info.receipt_time); ((Callback <M>)info.subscription_queue).topic = topiclol; if (!was_full) { info.callback.addCallback(info.subscription_queue, info.Get()); } } } } } } } return(true); }
public AsyncSpinner(int tc, CallbackQueueInterface queue) { throw new NotImplementedException(); }
internal bool addCallback <M>(SubscriptionCallbackHelper <M> helper, string md5sum, CallbackQueueInterface queue, uint queue_size, bool allow_concurrent_callbacks, string topiclol) where M : IRosMessage, new() { lock (md5sum_mutex) { if (this.md5sum == "*" && md5sum != "*") { this.md5sum = md5sum; } } if (md5sum != "*" && md5sum != this.md5sum) { return(false); } lock (callbacks_mutex) { CallbackInfo <M> info = new CallbackInfo <M> { helper = helper, callback = queue, subscription_queue = new Callback <M>(helper.callback().func, topiclol, queue_size, allow_concurrent_callbacks) }; //if (!helper.isConst()) //{ ++nonconst_callbacks; //} callbacks.Add(info); if (latched_messages.Count > 0) { MsgTypes ti = info.helper.type; lock (publisher_links_mutex) { foreach (PublisherLink link in publisher_links) { if (link.Latched) { if (latched_messages.ContainsKey(link)) { LatchInfo latch_info = latched_messages[link]; bool was_full = false; bool nonconst_need_copy = false; //callbacks.Count > 1; info.subscription_queue.pushitgood(info.helper, latched_messages[link].message, nonconst_need_copy, ref was_full, ROS.GetTime().data); if (!was_full) { info.callback.addCallback(info.subscription_queue, info.Get()); } } } } } } } return(true); }
public CallbackQueueInterface.ICallbackInfo spliceout(CallbackQueueInterface.ICallbackInfo info) { lock(_queue) { if (!_queue.Contains(info)) return null; _queue.RemoveAt(_queue.IndexOf(info)); return info; } }
public void enqueue(CallbackQueueInterface.ICallbackInfo info) { if (info.Callback == null) return; lock(_queue) _queue.Add(info); }
//internal ftw? public ServicePublication(string name, string md5Sum, string datatype, string reqDatatype, string resDatatype, ServiceCallbackHelper <MReq, MRes> helper, CallbackQueueInterface callback, object trackedObject) { if (name == null) { throw new Exception("NULL NAME?!"); } // TODO: Complete member initialization this.name = name; md5sum = md5Sum; this.datatype = datatype; req_datatype = reqDatatype; res_datatype = resDatatype; this.helper = helper; this.callback = callback; tracked_object = trackedObject; if (trackedObject != null) { has_tracked_object = true; } }
public CallbackQueueInterface.ICallbackInfo spliceout(CallbackQueueInterface.ICallbackInfo info) { if (!_queue.Contains(info)) return null; _queue = new ConcurrentQueue<CallbackQueueInterface.ICallbackInfo>(_queue.Except(new[] {info})); return info; }
public void enqueue(CallbackQueueInterface.ICallbackInfo info) { if (info.Callback == null) return; if (!_queue.Contains(info)) { _queue.Enqueue(info); } else { Console.WriteLine("ADDING A DUPLICATE CALLBACKINFO TO THE QUEUE"); } }