47add_pickle(pybind11::class_<T_Args...> &cl, T_SeriesAccessor &&seriesAccessor)
51 typename std::tuple_element<0, std::tuple<T_Args...> >::type;
56 [](
const PickledClass &a) {
63 [&seriesAccessor](py::tuple
const &t) {
66 throw std::runtime_error(
"Invalid state!");
68 std::string
const filename = t[0].cast<std::string>();
69 std::vector<std::string>
const group =
70 t[1].cast<std::vector<std::string> >();
75 thread_local std::optional<openPMD::Series> series;
76 bool re_initialize = [&]() {
79 return !series.has_value() ||
80 !series->operator bool() ||
81 auxiliary::replace_all(
82 series->myPath().filePath(),
"\\",
"/") !=
83 auxiliary::replace_all(filename,
"\\",
"/");
100 series = std::make_optional<Series>(
103 "defer_iteration_parsing = true");
106 return seriesAccessor(*series, group);
std::vector< std::string > group
e.g., .bp, .h5, .json, ...
Definition Attributable.hpp:379