Conversion Code Clean-Up

From EPICSWIKI
Revision as of 16:25, 18 October 2010 by RalphLange (talk | contribs) (First version of Conversion Code Clean-Up description)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Conversion Code Clean-Up

Current Situation

There are two codes for conversion, a full version in db/dbConvert.c and a "fast" version in db/dbFastLinkConv.c.

Both contain the full matrix of conversions as a large set of almost identical C functions.

Possible Improvements

Using templated functions in C++ would greatly reduce the source code, still allowing for source level optimization by providing explicit instantiations for simple cases (e.g. same type).

The new functions could also be changed to not use dbAddr as parameter (explicitly name the parts needed from dbAddr instead), so they can be used for non-V3-record applications.

The array interface could be improved:

* Start/End/Increment parameters would allow extracting sub arrays
* Chunked array storage could be supported

Approach

First step should be adding test code that verifies all conversions, and takes performance numbers. That way the existing code could be tested for both function and performance.

Then, the new conversion routines should be implemented, with simple wrappers that map the existing (array of function pointer) interfaces to use the new code.

The test code should be used to verify and spec the new implementation.