From: Hiroo H. <hir...@co...> - 2004-10-02 02:42:03
|
Hi, I'd like to propose another core change of checksum handling. One of my questions when I made my synth driver was when I had to call calculateChecksum method. Some of core methods calculate checksum. And a synth driver also calculate checksum. It seems that calculateChecksum is called many times unnecessarily. I guess this situation occurred because it was not clear who has to calculate checksum and some method calculated it for safe. Now we define the boundary between core and synthdrivers by defining interfaces (IDriver, etc.). Now a patch goes to outside of synthdriver via the following methods. case 1. void IPatchDriver.send(IPatch, int, int) case 2. void ISingleDriver.send(IPatch) case 3. byte[] IPatch.getByteArray() case 4. void Driver.send(byte[]) Here is my proposal Proposal a) call calculateChecksum(Patch) in Driver.send(IPatch, int, int) and Driver.send(IPatch). This cover the case 1 and 2. This does not require any synthdriver change. Proposal b) Define IPatch.export(IPatch) which returns a byte array as getByteArray() after it calculate checksum. This does not require any synthdriver change, either. This cover the case 3. case 3 is for exporting Patch. For case 4, before Driver.send(byte[]) is called, calculateChecksum() is always called already. By the simple proposal a) and b), both core and synth drivers do not have to call calculateChecksum() method any more. We can get rid of IPatchDriver.calculateCheckSum(IPatch) interface method instead of adding IPatchDriver.export(). Driver class taking care of all of its subclass. A Synth driver extending Driver class does not have to call calculateChecksum method. And core does not have to call calculateChecksum method, either. This sounds good, doesn't it? I made fix locally. If there is no objection, I'll check it in a few days later. Any feedback is welcome. -- Hiroo Hayashi |