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); } } } }
public Entry(SampleDispatcher dispatcher, SampleHandler handler) { this.dispatcher = dispatcher; this.name = dispatcher.getName(); this.signature = dispatcher.getSignature(); this.handler = handler; }
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); }
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); }
public override void registerSampleRef(SampleDispatcher dispatcher) { decoder.registerSampleRef(registry.add( dispatcher, rename(dispatcher.getName()))); }
public override void register(SampleDispatcher dispatcher, SampleHandler handler) { decoder.register(registry.add( dispatcher, rename(dispatcher.getName())), handler); }