Skip to content

Refactor FileADT to remove anti-patterns.

Paal Kvamme requested to merge kvamme62/refactor-fileadt into master

Refactor FileADT to remove some anti-patterns. The changes are split over multiple commits to make them simpler to verify.

The reason to do this now is the work on the stand alone vds2zgy application, which needs a few additions to IZgyUtils, which is currently really messy to add.

Address the following issues:

  • IFileADT and IFileBase currently don't exist. Most of the code outside the concrete "file" classes already treat FileADT as a pure virtual interface and ignore the protected static members. So adding the missing classes should be simple. It might touch many places that mentions FileADT, though.

  • The virtual methods that should have been in IFileBase are instead in FileUtilsSeismicStore. Callers need to make a dynamic cast to FileUtilsSeismicStore to access them. If type is SD, of course. Adding new user visible methods in ZgyUtils makes the mess worse. Which is why there are several such methods still on the wish list.

  • The local files currently need not and currently do not implement the IFileBase methods. Doing so would simplify application code slightly. With the above change they would need to be added in any case.

Not yet addressed:

  • IFileBase members are only used by IZgyUtils, while IFileADT members are only used by IZgyReader and IZgyWriter. They should have been completely separate interfaces. The factory method should return an IFileBase instance of the correct backend-specific concrete type. IFileBase would need a new member that creates an IFileADT instance. The concrete classes could stay as they are, implementing both interfaces.
Edited by Paal Kvamme

Merge request reports