Go to the documentation of this file. 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)
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;
317 static_cast<JMultipleFileScanner_t&>(*
this) = file_list;
340 using namespace JLANG;
346 unsigned int count = 0;
350 for (const_iterator i = this->begin(); i != this->end(); ++i) {
352 scanner.
open(i->c_str());
360 else if (header.
match(buffer))
363 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
371 copy(header,
object);
373 if (count != 0 && count != this->size()) {
375 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
395 const Head* p = NULL;
397 if (!this->hasNext() || (p = this->next()) == NULL) {
443 const bool option =
false)
449 for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
455 catch(std::exception&) {}
bool match(const JHead &header, const bool option=true) const
Test match of headers.
const Head & getHeader()
Get Monte Carlo Header.
Object reading from file.
JMultipleFileScanner()
Default constructor.
Auxiliary base class for list of file names.
std::ostream & rewind(std::ostream &out)
Rewind character.
Abstract object iterator with rewinding.
std::istream & operator>>(std::istream &in, Head &header)
Read header from input.
Exception for null pointer operation.
virtual bool hasNext()=0
Check availability of next element.
JMonteCarloFileReader()
Default constructor.
void copy(const Head &from, JHead &to)
Copy header from from to to.
virtual void open(const char *file_name)
Open file.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
virtual bool hasNext()
Check availability of next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template implementation of stream output for single data type.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
virtual void open(const char *file_name)
Open file.
Template specialisation of JMultipleFileScanner for Monte Carlo header.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Template definition of Monte Carlo object reader.
T * open(const std::string &file_name)
Open file.
Template definition of Monte Carlo object reader for gzipped ASCII formatted file (i....
JHead & add(const JHead &header)
Addition of headers.
JMultipleFileScanner(const JMultipleFileScanner_t &file_list)
Copy constructor.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Template definition of Monte Carlo stream output for single data type.
virtual void open(const char *file_name)
Open file.
General purpose class for object reading from a list of file names.
static bool merge
Allow merging of files w/o header.
Support classes and methods for experiment specific I/O.
virtual void close()=0
Close device.
Object reading from gzipped file.
virtual void rewind()
Rewind.
Auxiliary classes and methods for language specific functionality.
virtual bool setObject(Head &object)
Set object.
Template definition of Monte Carlo object reader for ASCII formatted file (i.e.
virtual const pointer_type & next()=0
Get next element.
Object reading from ASCII file.
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, const JHead &header, const bool option=false)
Get list of files compatible with geven header.