source: trunk/examples/novice/gemc/src/MOutputBaseClass.cc

Last change on this file was 807, checked in by garnier, 16 years ago

update

File size: 1.2 KB
Line 
1// %%%%%%%%%%%%%
2// gemc headers
3// %%%%%%%%%%%%%
4#include "MOutputBaseClass.h"
5#include "usage.h"
6
7#include <fstream>
8using namespace std;
9
10MOutputBaseClass *GetMOutputClass (map<string, MOutput_Factory> MProcessOutput_Map, string outputType)
11{
12 return MProcessOutput_Map[outputType]();
13}
14
15MOutputs::MOutputs(gemc_opts Opts)
16{
17 // EVIO Buffer size set to 3M words
18 int evio_buffer = 3000000;
19
20 gemcOpt = Opts;
21 string hd_msg  = gemcOpt.args["LOG_MSG"].args + " Output File: >> ";
22
23 string optf = gemcOpt.args["OUTPUT"].args;
24 outType.assign(optf, 0, optf.find(",")) ;
25 outFile.assign(optf,    optf.find(",") + 1, optf.size()) ;
26
27 if(outType != "no") cout << hd_msg << " Opening output file \"" << TrimSpaces(outFile) << "\"." << endl; 
28 if(outType == "txt")  txtoutput = new ofstream(TrimSpaces(outFile).c_str());
29 if(outType == "evio")
30 {
31//     pchan = new evioFileChannel(TrimSpaces(outFile).c_str(), "w", evio_buffer);
32//     pchan->open();
33 }
34}
35
36MOutputs::~MOutputs()
37{
38 string hd_msg  = gemcOpt.args["LOG_MSG"].args + " Output File: >> ";
39
40 if(outType != "no")   cout << " Closing " << outFile << "." << endl;
41 if(outType == "txt")  txtoutput->close();
42 if(outType == "evio")
43 {
44//     pchan->close();
45//     delete pchan;
46 }
47}
Note: See TracBrowser for help on using the repository browser.