20 template <
typename... Args,
class F>
21 constexpr void for_each_arg(F&& f) {
30 _instance.registerDefaultTypes<double,int,
string>();
34 template<
typename ... Args>
35 void ReaderH5::registerDefaultTypes() {
36 registerType<Counter>();
37 registerType<Estimate0D>();
38 registerType<Scatter1D>();
39 registerType<Scatter2D>();
40 registerType<Scatter3D>();
43 for_each_arg<Args...>([&](
auto&& arg) {
44 using A1 = decay_t<
decltype(arg)>;
53 for_each_arg<Args...>([&](
auto&& arg) {
54 using A2 = decay_t<
decltype(arg)>;
63 for_each_arg<Args...>([&](
auto&& arg) {
64 using A3 = decay_t<
decltype(arg)>;
74 registerType<HistoND<3>>();
79 const string& match,
const string& unmatch) {
81 vector<regex> patterns, unpatterns;
82 for (
const string& pat : Utils::split(match,
",")) { patterns.push_back(regex(pat)); }
83 for (
const string& pat : Utils::split(unmatch,
",")) { unpatterns.push_back(regex(pat)); }
92 while (reader.
next()) {
95 thisAOR = _register.find(reader.
type());
96 if (thisAOR == endAOR) {
97 throw ReadError(
"Unexpected context found: " + reader.
type());
106 const bool pattern_pass =
patternCheck(reader.
path(), patterns, unpatterns);
108 thisAOR->second->skip(reader);
113 aos.push_back(thisAOR->second->mkFromH5(reader));
User-facing BinnedDbn class in arbitrary dimension.
Helper class to extract AO information from a H5 file.
const string & path() const
Path of current AO.
bool next()
Loads next AO from file.
const string & type() const
Type of current AO.
Error for file reading errors.
Persistency reader from YODA text data format.
static Reader & create()
Singleton creation function.
void read(const YODA_H5::File &file, std::vector< AnalysisObject * > &aos, const std::string &match="", const std::string &unmatch="")
Read in a collection of objects objs from an HDF5 file.
Pure virtual base class for various output writers.
typename std::unordered_map< std::string, std::unique_ptr< AOReaderBase > >::const_iterator TypeRegisterItr
Convenience alias for AO Reader.
bool patternCheck(const std::string &path, const std::vector< std::regex > &patterns, const std::vector< std::regex > &unpatterns)
Check if a string matches any of the given patterns, and that it doesn't match any unpatterns (for pa...
Anonymous namespace to limit visibility.