CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

ALIFileOut Class Reference

#include <ALIFileOut.h>

List of all members.

Public Member Functions

 ALIFileOut ()
 ALIFileOut (const ALIstring &name)
const ALIstringname ()
 ~ALIFileOut ()

Static Public Member Functions

static ALIFileOutgetInstance (const ALIstring &filename)

Private Attributes

ALIstring theName
 Name of file.

Static Private Attributes

static std::vector< ALIFileOut * > theInstances

Detailed Description

Definition at line 22 of file ALIFileOut.h.


Constructor & Destructor Documentation

ALIFileOut::ALIFileOut ( ) [inline]

Definition at line 25 of file ALIFileOut.h.

Referenced by getInstance().

{};
ALIFileOut::ALIFileOut ( const ALIstring name) [inline]

Definition at line 26 of file ALIFileOut.h.

: std::ofstream(), theName(name){};
ALIFileOut::~ALIFileOut ( ) [inline]

Definition at line 27 of file ALIFileOut.h.

{};

Member Function Documentation

ALIFileOut & ALIFileOut::getInstance ( const ALIstring filename) [static]

Definition at line 19 of file ALIFileOut.cc.

References ALIFileOut(), benchmark_cfg::cerr, cmsRelvalreport::exit, lut2db_cfg::filename, and theInstances.

Referenced by Fit::fitNextEvent(), and CocoaAnalyzer::RunCocoa().

{
  std::vector<ALIFileOut*>::const_iterator vfcite;
  for( vfcite = theInstances.begin(); vfcite != theInstances.end(); vfcite++) {
    if( (*vfcite)->name() == filename) {
      return *(*vfcite);
      break;
    }
  }

  if( vfcite == theInstances.end() ) {
    ALIFileOut* instance = new ALIFileOut( filename );
    instance->open(filename.c_str());
    if( !instance ) {
      std::cerr << "!! cannot open output file " << filename << std::endl; 
      exit(0); 
    }
    theInstances.push_back( instance );
    return *instance;
  }

  ALIFileOut* instance = new ALIFileOut( filename ); // it will not reach here, only to avoid warning
  return *instance;
}
const ALIstring& ALIFileOut::name ( ) [inline]

Definition at line 33 of file ALIFileOut.h.

References theName.

Referenced by CocoaToDDLMgr::so(), and CocoaToDDLMgr::writeSpecParsCocoa().

{ return theName; }

Member Data Documentation

std::vector< ALIFileOut * > ALIFileOut::theInstances [static, private]

Definition at line 38 of file ALIFileOut.h.

Referenced by getInstance().

Name of file.

Definition at line 41 of file ALIFileOut.h.

Referenced by name().