#ifndef DIALS_NEXUS_NXMX_H #define DIALS_NEXUS_NXMX_H #include #include #include #include #include #include namespace dials { namespace nexus { class NXmx { public: boost::optional title; boost::optional start_time; boost::optional end_time; af::shared instrument; af::shared sample; }; template <> struct serialize { template static NXmx load(const Handle &handle) { NXmx result; // Process the objects in the group for (std::size_t i = 0; i < handle.getNumObjs(); ++i) { // Get the name of the object std::string name = handle.getObjnameByIdx(i); switch (handle.getObjTypeByIdx(i)) { case H5G_GROUP: { H5::Group group = handle.openGroup(name); if (is_nx_class(group, "NXinstrument")) { result.instrument.push_back(serialize::load(group)); } else if (is_nx_class(group, "NXsample")) { result.sample.push_back(serialize::load(group)); } } break; case H5G_DATASET: { H5::DataSet dset = handle.openDataSet(name); if (name == "title") { result.title = serialize::load(dset); } else if (name == "start_time") { result.start_time = serialize::load(dset); } else if (name == "end_time") { result.end_time = serialize::load(dset); } } break; default: break; }; } // Return the NXmx object return result; } template static void dump(const NXmx &obj, Handle &handle) { } }; }} // namespace dials::nexus #endif // DIALS_NEXUS_NXMX_H