/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Simulation/G4Svc/G4Svc-00-01-52/other_src/ProjectMessenger.cpp File Reference

#include "G4Svc/ProjectMessenger.h"
#include "G4Svc/Goofy.h"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "FadsPackageLoader/PackageLoader.h"
#include <string>
#include <fstream.h>

Go to the source code of this file.

Functions

std::string getLine (ifstream &in)
void parseTemplate (std::string dir, std::string filename, std::string dname)


Function Documentation

std::string getLine ( ifstream in  ) 

Definition at line 12 of file ProjectMessenger.cpp.

References s, and deljobs::string.

Referenced by parseTemplate().

00013 {
00014         char buffer[200];
00015         if (in.getline(buffer,200))
00016         {
00017                 std::string s=buffer;
00018                 return s;
00019         }
00020         else return "eof";
00021 }

void parseTemplate ( std::string  dir,
std::string  filename,
std::string  dname 
)

Definition at line 23 of file ProjectMessenger.cpp.

References EvtCyclic3::c_str(), getLine(), genRecEmupikp::i, RealDBUtil::npos, and deljobs::string.

Referenced by ProjectMessenger::SetNewValue().

00024 {
00025         std::string outname=dname;
00026         std::string outfile=dir+outname+".temp";
00027         ofstream out(outfile.c_str());
00028         ifstream in((dir+filename).c_str());
00029 
00030         unsigned int i=0;
00031         std::string buffer;
00032         while ((buffer=getLine(in))!="eof")
00033         {
00034                 while ((i=buffer.find("@NAME"))!=std::string::npos)
00035                 {
00036                         if (i>0) buffer.replace(i,5,outname);
00037                 }
00038                 out<<buffer<<std::endl;
00039         }
00040 } 


Generated on Tue Nov 29 23:17:15 2016 for BOSS_7.0.2 by  doxygen 1.4.7