mercredi 27 mai 2020

Retrieving object back without serialization and copy

I am working on a software stack where it is composed of three different entities:

  1. abc_data - holding the data as "plain" data structure
  2. abc_instance - acting as an API
  3. abc_repo - for internal conversions from abc_data to abc_instance. It includes methods using logic for an easy access and queries of the data (e.g., get_a() or get_b())

When creating a new abc_instance from abc_data, the abc_repo converts the abc_data to a different internal representation for fast access (e.g., vectors, maps) without holding the original abc_data representation anymore. However, this way it is not possible to go back to abc_data from a abc_instance.

What would be the best and elegant way to retrieve the abc_data back from a formerly created abc_instance, ideally without any further conversion.

NOTE: Please understand that I don't want to use de/serialization here. Also keeping a copy of the abc_data is not an option.

Any pointers and help would be appreciated. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire