HepMC3 event record library
ReaderPlugin.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5//
6#ifndef HEPMC3_READERPLUGIN_H
7#define HEPMC3_READERPLUGIN_H
8/**
9 * @file ReaderPlugin.h
10 * @brief Definition of \b class ReaderPlugin
11 *
12 * @class HepMC3::ReaderPlugin
13 * @brief GenEvent I/O parsing and serialization using external plugin
14 *
15 *
16 * @ingroup IO
17 *
18 */
19#include "HepMC3/Reader.h"
20#include "HepMC3/GenEvent.h"
21namespace HepMC3
22{
23class ReaderPlugin : public Reader
24{
25public:
26#ifndef HEPMC3_PYTHON_BINDINGS
27/** @brief Constructor to read from stream*/
28ReaderPlugin(std::istream & stream,const std::string &libname, const std::string &newreader);
29/** @brief Constructor to read from file*/
30#endif
31ReaderPlugin(const std::string& filename,const std::string &libname, const std::string &newreader);
32 /** @brief Reading event */
33 bool read_event(GenEvent& ev) override {if(!m_reader) return false; return m_reader->read_event(ev);};
34 /** @brief Close */
35 void close() override { if(!m_reader) return; m_reader->close(); };
36 /** @brief State */
37 bool failed() override {if(!m_reader) return true; return m_reader->failed();};
38 /** @brief Destructor */
39~ReaderPlugin() override;
40private:
41 Reader* m_reader; ///< The actual reader
42 void* dll_handle; ///< library handler
43 };
44}
45#endif
Definition of class GenEvent.
Definition of interface Reader.
Stores event-related information.
Definition: GenEvent.h:41
GenEvent I/O parsing and serialization using external plugin.
Definition: ReaderPlugin.h:24
ReaderPlugin(std::istream &stream, const std::string &libname, const std::string &newreader)
Constructor to read from stream.
Definition: ReaderPlugin.cc:28
bool failed() override
State.
Definition: ReaderPlugin.h:37
bool read_event(GenEvent &ev) override
Reading event.
Definition: ReaderPlugin.h:33
~ReaderPlugin() override
Destructor.
Definition: ReaderPlugin.cc:74
void close() override
Close.
Definition: ReaderPlugin.h:35
Reader * m_reader
The actual reader.
Definition: ReaderPlugin.h:41
void * dll_handle
library handler
Definition: ReaderPlugin.h:42
Base class for all I/O readers.
Definition: Reader.h:25
virtual bool read_event(GenEvent &evt)=0
Fill next event from input into evt.
virtual bool failed()=0
Get file and/or stream error state.
virtual void close()=0
Close file and/or stream.
HepMC3 main namespace.