Esempio n. 1
0
 public void add(SampleDispatcher dispatcher,
                 SampleHandler handler)
 {
     lock (this) {
         Entry e;
         byDispatcher.TryGetValue(dispatcher, out e);
         if (e != null)
         {
             e.check(dispatcher.getName(), dispatcher.getSignature());
             e.setHandler(handler);
         }
         else
         {
             foreach (Entry e2 in byIndex.Values)
             {
                 if (e2.match(dispatcher.getName(), dispatcher.getSignature()))
                 {
                     e2.setSampleDispatcher(dispatcher);
                     e2.setHandler(handler);
                     e = e2;
                     break;
                 }
             }
             if (e == null)
             {
                 e = new Entry(dispatcher, handler);
                 byDispatcher.Add(dispatcher, e);
             }
         }
     }
 }
Esempio n. 2
0
 public Entry(SampleDispatcher dispatcher,
              SampleHandler handler)
 {
     this.dispatcher = dispatcher;
     this.name       = dispatcher.getName();
     this.signature  = dispatcher.getSignature();
     this.handler    = handler;
 }
Esempio n. 3
0
        private SampleDispatcher add(SampleDispatcher identity)
        {
            SampleDispatcher renamed;

            lock (this) {
                if (!alias.TryGetValue(identity, out renamed))
                {
                    renamed = registry.add(identity, rename(identity.getName()));
                    alias.Add(identity, renamed);
                }
            }
            get(identity);
            return(renamed);
        }
Esempio n. 4
0
        public void registerSampleRef(SampleDispatcher dispatcher)
        {
            int index = ref_registry.add(dispatcher);

            begin(Constant.SAMPLE_REF);
            encodePacked32(index);
            encodeIntentions(dispatcher.getName());
            byte[] signature = dispatcher.getSignature();
            encodePacked32(signature.Length);
            for (int i = 0; i < signature.Length; i++)
            {
                encodeByte(signature[i]);
            }
            end(null);
        }
Esempio n. 5
0
 public override void registerSampleRef(SampleDispatcher dispatcher)
 {
     decoder.registerSampleRef(registry.add(
                                   dispatcher, rename(dispatcher.getName())));
 }
Esempio n. 6
0
 public override void register(SampleDispatcher dispatcher,
                               SampleHandler handler)
 {
     decoder.register(registry.add(
                          dispatcher, rename(dispatcher.getName())), handler);
 }