YODA is hosted by Hepforge, IPPP Durham
YODA::Reader Class Referenceabstract

Pure virtual base class for various output writers. More...

#include <Reader.h>

Inheritance diagram for YODA::Reader:
YODA::ReaderAIDA YODA::ReaderFLAT YODA::ReaderYODA

Public Member Functions

virtual ~Reader ()
 Virtual destructor. More...
 
Reading multiple analysis objects,
virtual void read (std::istream &stream, std::vector< AnalysisObject * > &aos)=0
 Read in a collection of objects objs from output stream stream. More...
 
std::vector< AnalysisObject * > read (std::istream &stream)
 Read in a collection of objects from output stream stream. More...
 
void read (const std::string &filename, std::vector< AnalysisObject * > &aos)
 Read in a collection of objects objs from file filename. More...
 
std::vector< AnalysisObject * > read (const std::string &filename)
 Read in a collection of objects from output stream stream. More...
 

Detailed Description

Pure virtual base class for various output writers.

Definition at line 18 of file Reader.h.

Constructor & Destructor Documentation

virtual YODA::Reader::~Reader ( )
inlinevirtual

Virtual destructor.

Definition at line 22 of file Reader.h.

22 {}

Member Function Documentation

virtual void YODA::Reader::read ( std::istream &  stream,
std::vector< AnalysisObject * > &  aos 
)
pure virtual

Read in a collection of objects objs from output stream stream.

This version fills (actually, appends to) a supplied vector, avoiding copying, and is hence CPU efficient.

Todo:
Use SFINAE magic to allow ~arbitrary collection<AnalysisObject*> (with push_back()?) to be passed

Implemented in YODA::ReaderYODA, YODA::ReaderFLAT, and YODA::ReaderAIDA.

Referenced by read(), and YODA::read().

std::vector<AnalysisObject*> YODA::Reader::read ( std::istream &  stream)
inline

Read in a collection of objects from output stream stream.

This version returns a vector by value, involving copying, and is hence less CPU efficient than the alternative version where a vector is filled by reference.

Definition at line 40 of file Reader.h.

References read().

40  {
41  std::vector<AnalysisObject*> rtn;
42  read(stream, rtn);
43  return rtn;
44  }
virtual void read(std::istream &stream, std::vector< AnalysisObject * > &aos)=0
Read in a collection of objects objs from output stream stream.
void YODA::Reader::read ( const std::string &  filename,
std::vector< AnalysisObject * > &  aos 
)
inline

Read in a collection of objects objs from file filename.

This version fills (actually, appends to) a supplied vector, avoiding copying, and is hence CPU efficient.

Todo:
Use SFINAE magic to allow ~arbitrary collection<AnalysisObject*> (with push_back()?) to be passed

Definition at line 52 of file Reader.h.

References read().

52  {
53  std::ifstream instream;
54  instream.open(filename.c_str());
55  read(instream, aos);
56  instream.close();
57  }
virtual void read(std::istream &stream, std::vector< AnalysisObject * > &aos)=0
Read in a collection of objects objs from output stream stream.
std::vector<AnalysisObject*> YODA::Reader::read ( const std::string &  filename)
inline

Read in a collection of objects from output stream stream.

This version returns a vector by value, involving copying, and is hence less CPU efficient than the alternative version where a vector is filled by reference.

Definition at line 63 of file Reader.h.

References read().

63  {
64  std::vector<AnalysisObject*> rtn;
65  read(filename, rtn);
66  return rtn;
67  }
virtual void read(std::istream &stream, std::vector< AnalysisObject * > &aos)=0
Read in a collection of objects objs from output stream stream.

The documentation for this class was generated from the following file: