openmicroscopy/bioformats — pull request #945 by rleigh-dundee (2014-02-27 20:42:37+00:00)
Title: cpp: bioformats: Add MetadataMap class for original metadata

This is a key-value map based upon std::map. The difference is that this mimics the needed behaviour for storing original metadata, supporting at least the same set of types as the Java interfaces support, and also lists as for the Java implementation. It also supports flattening of the lists into individual entries, as implemented in Java. The main difference is that this is a separate class, rather than being part of FormatReader. This will be used by the C++ FormatReader implementation for global and series metadata.

While the source is fairly short, note that this is fairly template-heavy even if it doesn't look like it on the surface, using boost::variant and boost::mpl to create the discriminating map which allows storage of a defined set of types, and static visitors to perform output and flattening operations. While this may look a little scary, `apply_visitor` expands the templates to support operations on every type variant transparently.

Testing: this includes a fairly comprehensive set of test cases, which should all pass.