File indexing completed on 2025-01-18 10:01:14
0001
0002
0003
0004
0005
0006 #ifndef HEPMC3_READERPLUGIN_H
0007 #define HEPMC3_READERPLUGIN_H
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "HepMC3/Reader.h"
0020 #include "HepMC3/GenEvent.h"
0021 namespace HepMC3
0022 {
0023 class ReaderPlugin : public Reader
0024 {
0025 public:
0026
0027 ReaderPlugin(std::shared_ptr<std::istream> stream, const std::string &libname, const std::string &newreader);
0028
0029 ReaderPlugin(std::istream & stream, const std::string &libname, const std::string &newreader);
0030
0031 ReaderPlugin(const std::string& filename, const std::string &libname, const std::string &newreader);
0032
0033 bool skip(const int n) override { if (!m_reader) return false; return m_reader->skip(n); }
0034
0035 bool read_event(GenEvent& ev) override {if (!m_reader) return false; return m_reader->read_event(ev);};
0036
0037 void close() override { if (!m_reader) return; m_reader->close(); };
0038
0039 bool failed() override { if (!m_reader) return true; return m_reader->failed();};
0040
0041 std::shared_ptr<GenRunInfo> run_info() const override { return m_reader?m_reader->run_info():nullptr; }
0042
0043 void set_options(const std::map<std::string, std::string>& options) override { if (!m_reader) return; else m_reader->set_options(options); }
0044
0045 std::map<std::string, std::string> get_options() const override { return m_reader?m_reader->get_options(): std::map<std::string, std::string>(); }
0046
0047 ~ReaderPlugin() override;
0048
0049 void set_run_info(std::shared_ptr<GenRunInfo> run) override { if (!m_reader) return; else m_reader->set_run_info(run); }
0050 private:
0051 Reader* m_reader = nullptr;
0052 void* dll_handle = nullptr;
0053 };
0054 }
0055 #endif