Exemple #1
0
 public void Process(IOMessage message)
 {
     if (message.Matches(filter))
     {
         responder(message);
     }
 }
Exemple #2
0
        private void Storage_ChildRekeyed(IOMessage message)
        {
            var oldduration = CodeTools.ReadDuration(message.Relation);
            var newduration = CodeTools.ReadDuration(message.NewRelation);

            field.TryMoveUnique(oldduration, newduration);
        }
Exemple #3
0
 public bool Matches(IOMessage filter) =>
 Verb == filter.Verb &&
 (Subject == filter.Subject || filter.Subject == StorageObjectID.Any) &&
 ((Verb & IOEvent.ChildEvent) == IOEvent.ChildEvent ?
  ((Object == filter.Object || filter.Object == StorageObjectID.Any) &&
   (NewRelation == filter.NewRelation) || filter.NewRelation == default(string) &&
   (Relation == filter.Relation) || filter.Relation == default(string))
     : true);
Exemple #4
0
 public IOListener(
     IOMessage filter,
     Action <IOMessage> responder
     )
 {
     this.filter    = filter;
     this.responder = responder;
 }
        private void Messages_ItemWithdrawn(IOMessage msg, int i)
        {
            lock (locker) {
                foreach (var subject in lookup_subject)
                {
                    subject.Value.Value.Withdraw(i);
                }

                foreach (var verb in lookup_verb)
                {
                    verb.Value.Value.Withdraw(i);
                }
            }
        }
        private void Messages_ItemInserted(IOMessage msg, int i)
        {
            for (int j = 0; j < listeners.Count; j++)
            {
                var listener = listeners[j];

                while (readylisteners.Count <= j)
                {
                    Thread.Sleep(20);
                }

                var readystate = readylisteners[j];
                if (readystate < i)
                {
                    listener.Process(msg);
                }
            }
        }
        private void Messages_ItemInserted(IOMessage msg, int i)
        {
            int[] indicies_listeners;

            lock (locker) {
                var lookup_subject_this =
                    lookup_subject.Lookup(
                        msg.Subject,
                        () =>
                        new KeyValuePair <ShiftableBitArray, ShiftableBitArray>(
                            new ShiftableBitArray(),
                            new ShiftableBitArray()
                            )
                        );

                var lookup_verb_this =
                    lookup_verb.Lookup(
                        msg.Verb,
                        () =>
                        new KeyValuePair <ShiftableBitArray, ShiftableBitArray>(
                            new ShiftableBitArray(),
                            new ShiftableBitArray()
                            )
                        );

                indicies_listeners = lookup_subject_this.Key.AllOnes(lookup_verb_this.Key).ToArray();

                foreach (var subject in lookup_subject)
                {
                    subject.Value.Value.Insert(i, subject.Key == msg.Subject);
                }

                foreach (var verb in lookup_verb)
                {
                    verb.Value.Value.Insert(i, verb.Key == msg.Verb);
                }
            }

            for (int j = 0; j < indicies_listeners.Length; j++)
            {
                Listeners[indicies_listeners[j]].Responder(msg);
            }
        }
 private void Messages_ItemRemoved(IOMessage msg)
 {
     throw new InvalidOperationException();
 }