#ifndef __JSUPPORT__JMONTECARLOFILEWRITER__ #define __JSUPPORT__JMONTECARLOFILEWRITER__ #include #include "JLang/JAccessibleStream.hh" #include "JLang/JStreamObjectOutput.hh" #include "JLang/JObjectOutput.hh" #include "JLang/JTypeList.hh" #include "JLang/JNullType.hh" /** * \author mdejong */ namespace JSUPPORT {} namespace JPP { using namespace JSUPPORT; } namespace JSUPPORT { using JLANG::JAccessibleOutputStream; using JLANG::JObjectOutput; using JLANG::JNullOutput; using JLANG::JAccessibleObjectOutput; using JLANG::JTypeList; using JLANG::JNullType; /** * Template definition of Monte Carlo stream output for single data type. * * This class provides for a null implementation of the JLANG::JObjectOutput interface. * It should be specialised for the data types that will be written to a Monte Carlo file. */ template class JMonteCarloStreamObjectOutput : public virtual JObjectOutput, public virtual JNullOutput { protected: /** * Constructor. * * \param out output stream */ JMonteCarloStreamObjectOutput(std::ostream& out) {} }; /** * Template specialisation of Monte Carlo stream object output for multiple data types. * * This class recursively implements the JLANG::JObjectOutput interface * for all data types by deriving from: * - JMonteCarloStreamObjectOutput; and * - JMonteCarloStreamObjectOutput. */ template class JMonteCarloStreamObjectOutput< JTypeList > : public virtual JObjectOutput< JTypeList >, public JMonteCarloStreamObjectOutput, public JMonteCarloStreamObjectOutput { protected: /** * Constructor. * * \param out output stream */ JMonteCarloStreamObjectOutput(std::ostream& out) : JMonteCarloStreamObjectOutput(out), JMonteCarloStreamObjectOutput(out) {} }; /** * Terminator class of recursive JMonteCarloStreamObjectOutput class. */ template class JMonteCarloStreamObjectOutput< JTypeList > : public JMonteCarloStreamObjectOutput { protected: /** * Constructor. * * \param out output stream */ JMonteCarloStreamObjectOutput(std::ostream& out) : JMonteCarloStreamObjectOutput(out) {} }; /** * Object(s) writing to Monte Carlo ASCII file (i.e.\ .evt) * * This class implements the JLANG::JAccessibleObjectOutput interface. */ template class JMonteCarloFileWriter : public JAccessibleOutputStream, public JMonteCarloStreamObjectOutput, public JAccessibleObjectOutput { public: /** * Default constructor. */ JMonteCarloFileWriter() : JAccessibleOutputStream(), JMonteCarloStreamObjectOutput(static_cast(*this)) {} }; } #endif