Esempio n. 1
0
 public void add(StateSubscriberBase subscriber)
 {
     // TODO: revise for performance
     Subscriber s = new Subscriber();
     s.subscriber = subscriber;
     s.ref_id_at_subscriber = (ulong)subscribers.Count;
     s.ref_id_at_publisher = 0;
     subscribers.Add(s);
 }
Esempio n. 2
0
 public void remove(StateSubscriberBase subscriber)
 {
     for (int i = 0; i < subscribers.Count; ++i)
     {
         if (subscribers[i].subscriber == subscriber)
         {
             // TODO: if unsubscribeMessaage is to be sent, it's probably the right place
             subscribers.RemoveAt(i);
             return;
         }
     }
     Debug.Assert(false); // not found
 }
Esempio n. 3
0
 public void subscribe(StateSubscriberBase subscriber, string path)
 {
     for (int i = 0; i < subscribers.Count; ++i)
         if (subscribers[i].subscriber == subscriber)
         {
             BufferT buff = platform.makeBuffer();
             IPublishableComposer composer = platform.makePublishableComposer(buff);
             PublishableStateMessageHeader mh = new PublishableStateMessageHeader();
             mh.type = PublishableStateMessageHeader.MsgType.subscriptionRequest;
             mh.priority = 0; // TODO: source
             mh.state_type_id_or_direction = subscriber.stateTypeID();
             mh.path = path;
             Debug.Assert(subscribers[i].ref_id_at_subscriber == (ulong)i);
             mh.ref_id_at_subscriber = subscribers[i].ref_id_at_subscriber;
             GMQueue.helperComposePublishableStateMessageBegin(composer, mh);
             GMQueue.helperComposePublishableStateMessageEnd(composer);
             //assert(transport != nullptr);
             transport.postMessage(buff);
             return;
         }
     Debug.Assert(false); // not found
 }
Esempio n. 4
0
 public void subscribe(StateSubscriberBase subscriber, string path)
 {
     subPool.subscribe(subscriber, path);
 }
Esempio n. 5
0
 public void remove(StateSubscriberBase obj)
 {
     subPool.remove(obj);
 }
Esempio n. 6
0
 public void add(StateSubscriberBase obj)
 {
     subPool.add(obj);
 }