GET library
GETRunFile Class Reference

#include <GETRunFile.hh>

Inheritance diagram for GETRunFile:
GETRunList GETRunSerie

Public Member Functions

Constructors, affectation, destructor
 GETRunFile (const string &fname="", bool open=true)
 
virtual ~GETRunFile ()
 
File operations
virtual int Open (const string &fname)
 
virtual int Open ()
 
virtual int Close ()
 
virtual bool IsOpen () const
 
virtual int OpenNext ()
 
virtual bool AtEnd () const
 
File information
int GetFileLun () const
 
virtual int SetFileName (const string &fname)
 
const string & GetFileName () const
 
string & GetFileName ()
 
FILE * GetFilePtr ()
 
virtual void EventCountIncr ()
 
int GetFileEventCount () const
 
ROOT related functions
 ClassDef (GETRunFile, 0)
 

Protected Attributes

u_int file_event_count
 Number of events in the file.
 
string run_file_name
 Name of the experimental data file.
 
FILE * run_file_ptr
 Pointer to experimental data file.
 

Private Member Functions

 GObject (GETRunFile)
 

Detailed Description

This is the base class for runs data files. It manages a single file, while derived classes may handle more complicated groups of files.

The run files are only open in read mode.

Constructor & Destructor Documentation

GETRunFile::GETRunFile ( const string &  fname = "",
bool  open = true 
)

Constructor.

Parameters
fnamename of the file
openwhether the file should be opened when created

References file_event_count, Open(), run_file_name, and run_file_ptr.

GETRunFile::~GETRunFile ( )
virtual

Destructor.

References Close(), and IsOpen().

Member Function Documentation

bool GETRunFile::AtEnd ( ) const
inlinevirtual

Return true if at end of file(s) (see meaning for derived classe). The function also returns true if no file is opened.

Reimplemented in GETRunSerie, and GETRunList.

References IsOpen(), and run_file_ptr.

Referenced by GETRunList::AtEnd(), and GETSystem::ReadEvent().

GETRunFile::ClassDef ( GETRunFile  ,
 
)

for use within ROOT.

int GETRunFile::Close ( )
virtual

Close the current run file, if open. The function returns 0 if no error occured

Reimplemented in GETRunSerie, and GETRunList.

References IsOpen(), run_file_name, and run_file_ptr.

Referenced by GETRunList::Close(), GETSystem::CloseRunFile(), GETRunList::OpenNext(), and ~GETRunFile().

void GETRunFile::EventCountIncr ( )
inlinevirtual

Increment the event counter.

Reimplemented in GETRunSerie, and GETRunList.

References file_event_count.

Referenced by GETRunList::EventCountIncr().

int GETRunFile::GetFileEventCount ( ) const
inline

Return the event counter since last file open.

References file_event_count.

int GETRunFile::GetFileLun ( ) const
inline

Return the logical number associated to the currently opened file. The function returns -1 if no file is opened.

References run_file_ptr.

Referenced by GETRCoBo::ReadEvent(), and GETSystem::ReadEvent().

const string & GETRunFile::GetFileName ( ) const
inline

Return the effective name of the file.

References run_file_name.

Referenced by GETSystem::GetRunFileName().

string & GETRunFile::GetFileName ( )
inline

Return the effective name of the file.

References run_file_name.

FILE * GETRunFile::GetFilePtr ( )
inline

Return the pointer to the C-file object.

References run_file_ptr.

GETRunFile::GObject ( GETRunFile  )
private

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
bool GETRunFile::IsOpen ( ) const
inlinevirtual

Return true if the file is currently opened.

Reimplemented in GETRunSerie, and GETRunList.

References run_file_ptr.

Referenced by AtEnd(), GETRunList::Close(), Close(), GETRunList::IsOpen(), GETSystem::IsRunFileOpen(), SetFileName(), and ~GETRunFile().

int GETRunFile::Open ( const string &  fname)
virtual

Open the file with argument name. If no name is given, then the file with current name is open, if defined. The function returns 0 if no error occured

Parameters
fnamename of the (disk) file

References file_event_count, run_file_name, and run_file_ptr.

Referenced by GETSystem::OpenRunFile(), and GETSystem::OpenRunSerie().

int GETRunFile::Open ( )
inlinevirtual

Open the file which name is already defined in the class object. The function returns 0 if no error occured

Reimplemented in GETRunSerie, and GETRunList.

References run_file_name.

Referenced by GETRunFile(), GETRunList::Open(), and GETRunList::OpenNext().

int GETRunFile::OpenNext ( )
inlinevirtual

Open the next effective file. For the base class GETRunFile, that processes single files, the function does nothing. It returns -1 when there no next file, or a positive value in case of error.

Reimplemented in GETRunSerie, and GETRunList.

Referenced by GETSystem::ReadEvent().

int GETRunFile::SetFileName ( const string &  fname)
virtual

Defines the name of the file. The function returns 0 if no error occured. If the file is already opened, an error is returned.

Parameters
fnamename of the (disk) file

References IsOpen(), and run_file_name.


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