private void init(DDS.DomainParticipant participant,
                          string topicName,
                          string typeName,
                          Func <T, TKey> keySelector,
                          IEqualityComparer <TKey> comparer,
                          Dictionary <TKey, DDSKeyedSubject <TKey, T> > keySubDict,
                          DDS.Duration_t tmout)
        {
            _mutex = new object();

            _scheduler = new EventLoopScheduler();
            _timeout   = tmout;

            _typeName = typeName ?? typeof(T).ToString();

            _participant      = participant;
            _topicName        = topicName;
            _keySelector      = keySelector;
            _comparer         = comparer;
            _keyedSubjectDict = keySubDict;
            _handleKeyDict    = new Dictionary <DDS.InstanceHandle_t, TKey>(new InstanceHandleComparer());

            if (_scheduler == null ||
                _typeName == null ||
                _participant == null ||
                _topicName == null ||
                _keySelector == null ||
                _keyedSubjectDict == null ||
                _comparer == null)
            {
                throw new ArgumentNullException("ObservableTopic: Null parameters detected");
            }
        }
Esempio n. 2
0
        public static IObservable <T> FromTopicWaitSet <T>(DDS.DomainParticipant participant,
                                                           string topicName,
                                                           DDS.Duration_t timeout)
            where T : class, DDS.ICopyable <T>, new()
        {
            string type_name     = null;
            var    ddsObservable = new ObservableTopicWaitSet <T>(participant, topicName, type_name, timeout);

            return(ddsObservable);
        }
Esempio n. 3
0
        FromKeyedTopicWaitSet <TKey, T>(DDS.DomainParticipant participant,
                                        string topicName,
                                        Func <T, TKey> keySelector,
                                        DDS.Duration_t timeout)
            where T : class, DDS.ICopyable <T>, new()
        {
            string type_name     = null;
            var    ddsObservable =
                new ObservableKeyedTopicWaitSet <TKey, T>(participant, topicName, type_name, keySelector,
                                                          EqualityComparer <TKey> .Default, timeout);

            return(ddsObservable);
        }
Esempio n. 4
0
 public WaitsetSubscriber(DDS.DomainParticipant participant, string topicName, string typeName, DDS.Duration_t timeout, Demultiplexer <T> demux)
 {
     this.participant = participant;
     this.topicName   = topicName;
     if (typeName == null)
     {
         this.typeName = typeof(T).ToString();
     }
     else
     {
         this.typeName = typeName;
     }
     this.timeout       = timeout;
     this.demultiplexer = demux;
 }
        public ObservableKeyedTopicWaitSet(DDS.DomainParticipant participant,
                                           string topicName,
                                           string typeName,
                                           Func <T, TKey> keySelector,
                                           IEqualityComparer <TKey> comparer,
                                           DDS.Duration_t tmout)
        {
            init(participant,
                 topicName,
                 typeName,
                 keySelector,
                 comparer,
                 new Dictionary <TKey, DDSKeyedSubject <TKey, T> >(comparer),
                 tmout);

            _externalSubDict = false;
        }
        public ObservableTopicWaitSet(DDS.DomainParticipant participant,
                                      string topicName,
                                      string typeName,
                                      DDS.Duration_t tmout)
        {
            _mutex = new object();

            _scheduler = new EventLoopScheduler();
            _timeout   = tmout;

            _typeName = typeName ?? typeof(T).ToString();

            _participant = participant;
            _topicName   = topicName;

            if (_scheduler == null ||
                _typeName == null ||
                _participant == null ||
                _topicName == null)
            {
                throw new ArgumentNullException("ObservableTopic: Null parameters detected");
            }
        }