1 #ifndef __JSUPPORT__JAANETSUPPORTKIT__
2 #define __JSUPPORT__JAANETSUPPORTKIT__
7 #include "evt/io_ascii.hh"
35 inline std::istream&
operator>>(std::istream& in, Head& header)
44 #ifdef __NO_HEAD_OSTREAM__
52 inline std::ostream&
operator<<(std::ostream& out,
const Head& header)
67 inline std::istream&
operator>>(std::istream& in, Evt& evt)
96 namespace JPP {
using namespace JSUPPORT; }
112 template<
class T,
template<
class>
class JFileReader_t>
122 template<
template<
class>
class JFileReader_t>
124 public JFileReader_t<Head>
131 JFileReader_t<Head>(),
141 virtual void open(
const char* file_name)
160 return JFileReader_t<Head>::hasNext();
179 template<
template<
class>
class JFileReader_t>
181 public JFileReader_t<Evt>
189 virtual void open(
const char* file_name)
195 if (this->is_open()) {
199 static_cast<istream&
>(*this) >> buffer;
340 using namespace JLANG;
347 unsigned int count = 0;
351 for (const_iterator i = this->begin(); i != this->end(); ++i) {
353 scanner.
open(i->c_str());
355 if (scanner.hasNext()) {
357 const JHead buffer = *scanner.next();
361 else if (header.equals(buffer))
364 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
372 copy(header,
object);
374 if (count != 0 && count != this->size()) {
375 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
394 const Head* p = NULL;
396 if (!this->hasNext() || (p = this->next()) == NULL) {
JMultipleFileScanner(const JMultipleFileScanner_t &file_list)
Copy constructor.
std::ostream & rewind(std::ostream &out)
Rewind character.
Object reading from ASCII file.
virtual void open(const char *file_name)
Open file.
std::istream & operator>>(std::istream &in, JHead &header)
Read header from input.
virtual void open(const char *file_name)
Open file.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
virtual void rewind()
Rewind.
JMonteCarloFileReader()
Default constructor.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Template definition of Monte Carlo object reader for gzipped ASCII formatted file (i...
T * open(const std::string &file_name)
Open file.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Template definition of Monte Carlo object reader for ASCII formatted file (i.e.
virtual void open(const char *file_name)
Open file.
std::istream & read(std::istream &in, JContainer_t< TString, JAllocator_t > &object, const JBool< false > &option)
Auxiliary method for reading if TString does not exist.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Exception for null pointer operation.
virtual bool setObject(Head &object)
Set object.
const Head & getHeader()
Get Monte Carlo Header.
JMultipleFileScanner()
Default constructor.
Template specialisation of JMultipleFileScanner for Monte Carlo header.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Interface for object iteration with named access.
Template definition of Monte Carlo object reader.
Auxiliary base class for list of file names.
General purpose class for object reading from a list of file names.
Object reading from gzipped file.
Template implementation of stream output for single data type.
virtual bool hasNext()
Check availability of next element.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Object reading from file.
Abstract object iterator with rewinding.
Template definition of Monte Carlo stream output for single data type.