Problem Statement
JsonUtilityInterface and its implementations currently require implementing methods for specific objects to be imported/exported. If/when we want to import additional objects and/or change from Nlohmann Json to some other json library, would have to write object-specific methods.
Current arrangement can also result in circular dependencies (e.g. between json_utility_nlohmann.hpp and piece_points_bpo.hpp.
Proposed Solution
A better approach would be to have an interface class that requires implementation of more fundamental json operations, and then in our data transfer object classes, we could just use these fundamental interface methods. The interface could look something like this:
Note that proposed solution also involves changing from CRTP interface to traditional abstract base class interface. This is consistent with proposed solution for Issue [#88 ].
Problem Statement JsonUtilityInterface and its implementations currently require implementing methods for specific objects to be imported/exported. If/when we want to import additional objects and/or change from Nlohmann Json to some other json library, would have to write object-specific methods.
Current arrangement can also result in circular dependencies (e.g. between
json_utility_nlohmann.hpp
andpiece_points_bpo.hpp
.Proposed Solution A better approach would be to have an interface class that requires implementation of more fundamental json operations, and then in our data transfer object classes, we could just use these fundamental interface methods. The interface could look something like this:
And our implementation that utilizing the Nlohmann json library could look like this: