Skip to content

1.6.0

Compare
Choose a tag to compare
@Tectu Tectu released this 14 Jul 16:16
· 35 commits to master since this release

General

  • Add YAML support (thanks to @vowstar)
  • Improve testing infrastructure
  • Various minor internal improvements

Serialization interface

The serialization interface gpds::serialize was extended. These previously existing functions are now marked as deprecated:

  • gpds::serialize::to_string()
  • gpds::serialize::from_string()
  • gpds::serialize::to_file()
  • gpds::serialize::from_file()

As a replacement, free-standing function templates have been introduced which provide the following benefits:

  • They accept the archiver as a template parameter (for example gpds::archiver_xml or gpds::archiver_yaml).
  • They can optionally automatically fetch the serialization root name from a serializable via the T::gpds_name static member (if present).
  • Once the now deprecated member functions are removed, potential function/name collisions are avoided.

As such, consuming code should replace the now deprecated functions listed above with call to the corresponding replacements:

  • gpds::to_string()
  • gpds::from_string()
  • gpds::to_file()
  • gpds::from_file()

As an example, previous consuming code would have looked like this:

class dut :
    public gpds::serialize
{
    // ...
};

dut d;
const auto& [success, msg] = d.to_string(str, "dut");

Now looks like this:

class dut :
    public gpds::serialize
{
    static constexpr const char* gpds_name = "dut";

    // ...
};

dut d;
const auto& [success, msg] = gpds::to_string<gpds::archiver_xml>(str, d);

Refer to /examples/basic/ for more information.