Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "Alignment/CocoaUtilities/interface/ALIFileOut.h"
00009
00010 #include <stdlib.h>
00011 #include <strstream>
00012
00013 std::vector<ALIFileOut*> ALIFileOut::theInstances;
00014
00015
00016
00017
00018
00019 ALIFileOut& ALIFileOut::getInstance( const ALIstring& filename )
00020 {
00021 std::vector<ALIFileOut*>::const_iterator vfcite;
00022 for( vfcite = theInstances.begin(); vfcite != theInstances.end(); vfcite++) {
00023 if( (*vfcite)->name() == filename) {
00024 return *(*vfcite);
00025 break;
00026 }
00027 }
00028
00029 if( vfcite == theInstances.end() ) {
00030 ALIFileOut* instance = new ALIFileOut( filename );
00031 instance->open(filename.c_str());
00032 if( !instance ) {
00033 std::cerr << "!! cannot open output file " << filename << std::endl;
00034 exit(0);
00035 }
00036 theInstances.push_back( instance );
00037 return *instance;
00038 }
00039
00040 ALIFileOut* instance = new ALIFileOut( filename );
00041 return *instance;
00042 }
00043