CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
L1GtVhdlTemplateFile Class Reference

#include <L1GtVhdlTemplateFile.h>

Public Member Functions

void append (const std::string &str)
 adds a line at the end of the the file with the content of str More...
 
void append (const L1GtVhdlTemplateFile &file)
 adds the content of file at the end of (*this); the parameter map won't be changed More...
 
bool close ()
 
bool extractParametersFromString (const std::string &str, std::vector< std::string > &parameters) const
 
void getConditionsFromAlgo (std::string condString, std::vector< std::string > &result) const
 extracts all conditions from a algorithm More...
 
std::string getInternalParameter (const std::string &indentifier)
 returns a parameter of a internal template file More...
 
std::vector< std::string > getSubstitutionParametersFromTemplate () const
 returns a vector with all substitution parameters that are found in the template file More...
 
bool insert (const std::string &atLine, const std::vector< std::string > &content)
 replaces the whole line containing atLine and inserts content instead of it More...
 
bool insert (const std::string atLine, const L1GtVhdlTemplateFile &file)
 replaces the whole line containing atLine with the content of file More...
 
bool isBlank (const char &chr) const
 checks weather a char is a blank More...
 
 L1GtVhdlTemplateFile ()
 standard constructor More...
 
 L1GtVhdlTemplateFile (const std::string &filename)
 constructor with filename More...
 
 L1GtVhdlTemplateFile (const L1GtVhdlTemplateFile &rhs)
 copy constructor More...
 
std::string lines2String () const
 returns a string with the content of vector lines More...
 
bool open (const std::string &fileName, bool internal=false)
 opens a template file. If the header information shall be parsed intern has to be set to true More...
 
void print () const
 prints the content of the VHDL File (only lines_) More...
 
void printParameterMap () const
 prints the parameter map More...
 
bool removeEmptyLines ()
 deletes all empty lines in a template file More...
 
bool removeLineWithContent (const std::string &str)
 removes all lines that contain the str More...
 
std::vector< std::string > returnLines () const
 returns a string vector with the current content of the VHDL File More...
 
std::map< std::string,
std::string > 
returnParameterMap () const
 returns parameter map More...
 
bool save (const std::string &fileName)
 saves the content of the template file to a local file (the content of parameterMap_ will not be saved!) More...
 
bool split (const std::string &param, std::vector< std::string > &result) const
 seperates a string at all blanks and saves the elements in result More...
 
bool substitute (const std::string &searchString, const std::string &replaceString)
 replaces searchString with replaceString More...
 
 ~L1GtVhdlTemplateFile ()
 destructor More...
 

Static Public Member Functions

static const bool findAndReplaceString (std::string &paramString, const std::string &searchString, const std::string &replaceString)
 replaces searchString with replaceString at it's first occurance in string More...
 

Private Attributes

bool intern_
 
std::vector< std::string > lines_
 containing the content of the VHDL file More...
 
std::map< std::string,
std::string > 
parameterMap_
 containing the header information of internal files More...
 

Detailed Description

The routines of this class provide all necessary features to deal with the VHDL templates for the firmware code of the GT

Implementation: <TODO: enter implementation details>

Author
Philipp Wagner

Description: a class to deal with VHDL template files

Implementation: <TODO: enter implementation details>

Author
: Philipp Wagner

Definition at line 25 of file L1GtVhdlTemplateFile.h.

Constructor & Destructor Documentation

L1GtVhdlTemplateFile::L1GtVhdlTemplateFile ( )

standard constructor

Definition at line 29 of file L1GtVhdlTemplateFile.cc.

References intern_.

30 {
31  intern_=false;
32 }
L1GtVhdlTemplateFile::L1GtVhdlTemplateFile ( const std::string &  filename)

constructor with filename

Definition at line 36 of file L1GtVhdlTemplateFile.cc.

References gather_cfg::cout, and open().

37 {
38  if (!open(filename,false)) std::cout<<"Error while opening file: "<<filename<<std::endl;
39 }
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
bool open(const std::string &fileName, bool internal=false)
opens a template file. If the header information shall be parsed intern has to be set to true ...
L1GtVhdlTemplateFile::L1GtVhdlTemplateFile ( const L1GtVhdlTemplateFile rhs)

copy constructor

Definition at line 43 of file L1GtVhdlTemplateFile.cc.

References intern_, lines_, and parameterMap_.

44 {
45  lines_=rhs.lines_;
46  intern_=rhs.intern_;
48 
49 }
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
std::vector< std::string > lines_
containing the content of the VHDL file
L1GtVhdlTemplateFile::~L1GtVhdlTemplateFile ( )

destructor

Definition at line 53 of file L1GtVhdlTemplateFile.cc.

54 {
55  // empty
56 }

Member Function Documentation

void L1GtVhdlTemplateFile::append ( const std::string &  str)

adds a line at the end of the the file with the content of str

Definition at line 340 of file L1GtVhdlTemplateFile.cc.

References lines_.

Referenced by diclist.diclist::add(), L1GtVhdlWriterCore::buildDefValuesBuffer(), L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), BeautifulSoup.Tag::setString(), and L1GtVhdlWriterCore::writeMuonSetupVhdl().

341 {
342  lines_.push_back(str);
343 }
std::vector< std::string > lines_
containing the content of the VHDL file
void L1GtVhdlTemplateFile::append ( const L1GtVhdlTemplateFile file)

adds the content of file at the end of (*this); the parameter map won't be changed

Definition at line 346 of file L1GtVhdlTemplateFile.cc.

References i, and lines_.

Referenced by diclist.diclist::add(), and BeautifulSoup.Tag::setString().

347 {
348  for (unsigned int i=0; i<file.lines_.size(); i++)
349  {
350  lines_.push_back(file.lines_.at(i));
351  }
352 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::close ( void  )
bool L1GtVhdlTemplateFile::extractParametersFromString ( const std::string &  str,
std::vector< std::string > &  parameters 
) const

finds all substitution parameters in str and collects them in the vector parameters. This routine is used by getSubstitutionParametersFromTemplate();

Definition at line 292 of file L1GtVhdlTemplateFile.cc.

References Parameters::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getSubstitutionParametersFromTemplate().

293 {
294  // check, weather the current line is containing a substitution parameter
295  // the routine is making sure, that it's not extracting a parameter from
296  // a comment
297  if (int pos1=str.find("$(")!=std::string::npos && str.substr(0,2)!="--")
298  {
299  int pos2=str.find(")");
300  // get the substituion parameter
301  std::string tempStr=(str.substr(pos1+1,(pos2-pos1-1)));
302  // return a pair with the substitution parameter and the
303  // the rest of the string after the substitution parameter
304 
305  // here a should be checked, weather the vector is already containing
306  // the parameter befor adding it.
307 
308  parameters.push_back(tempStr);
309  //recursive call
310  while (extractParametersFromString(str.substr(pos2), parameters)) extractParametersFromString(str.substr(pos2), parameters);
311 
312  return true;
313  }
314  else
315  {
316  return false;
317  }
318 
319  return true;
320 }
dictionary parameters
Definition: Parameters.py:2
bool extractParametersFromString(const std::string &str, std::vector< std::string > &parameters) const
const bool L1GtVhdlTemplateFile::findAndReplaceString ( std::string &  paramString,
const std::string &  searchString,
const std::string &  replaceString 
)
static

replaces searchString with replaceString at it's first occurance in string

Definition at line 59 of file L1GtVhdlTemplateFile.cc.

References position, and replaceString().

Referenced by L1GtVhdlWriterCore::buildDefValuesBuffer(), L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), getConditionsFromAlgo(), L1GtVhdlWriterCore::getSubstParamCommonFromTriggerMenu(), L1GtVhdlWriterCore::processAlgorithmMap(), substitute(), L1GtVhdlWriterCore::writeAlgoSetup(), L1GtVhdlWriterCore::writeCondChipPkg(), L1GtVhdlWriterCore::writeConditionChipSetup(), L1GtVhdlWriterCore::writeDefValPkg(), L1GtVhdlWriterCore::writeEtmSetup(), L1GtVhdlWriterCore::writeMuonSetupVhdl(), and L1GtVhdlWriterCore::writeQsfSetupFiles().

60 {
61  size_t position;
62  position = paramString.find(searchString);
63  if (position == std::string::npos) return false;
64  paramString.replace(position,searchString.length(),replaceString);
65  return true;
66 }
static void replaceString(std::string &name, std::string const &from, std::string const &to)
Definition: ClassUtils.cc:58
static int position[264][3]
Definition: ReadPGInfo.cc:509
void L1GtVhdlTemplateFile::getConditionsFromAlgo ( std::string  condString,
std::vector< std::string > &  result 
) const

extracts all conditions from a algorithm

Definition at line 425 of file L1GtVhdlTemplateFile.cc.

References findAndReplaceString(), i, and split().

Referenced by L1GtVhdlWriterCore::processAlgorithmMap().

426 {
427  std::vector<std::string> operators;
428 
429  operators.push_back("AND");
430  operators.push_back("OR");
431  operators.push_back("NOT");
432  operators.push_back("(");
433  operators.push_back(")");
434 
435  for (unsigned int i =0; i<operators.size(); i++)
436  {
437  while (findAndReplaceString(condString, operators.at(i), "")) findAndReplaceString(condString, operators.at(i), "");
438  }
439 
440  split(condString,result);
441 
442 }
bool split(const std::string &param, std::vector< std::string > &result) const
seperates a string at all blanks and saves the elements in result
int i
Definition: DBlmapReader.cc:9
static const bool findAndReplaceString(std::string &paramString, const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString at it&#39;s first occurance in string
tuple result
Definition: query.py:137
std::string L1GtVhdlTemplateFile::getInternalParameter ( const std::string &  indentifier)

returns a parameter of a internal template file

Definition at line 461 of file L1GtVhdlTemplateFile.cc.

References parameterMap_.

Referenced by L1GtVhdlWriterCore::buildDefValuesBuffer(), L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), and L1GtVhdlWriterCore::writeDefValPkg().

462 {
463  return parameterMap_[indentifier];
464 }
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
std::vector< std::string > L1GtVhdlTemplateFile::getSubstitutionParametersFromTemplate ( ) const

returns a vector with all substitution parameters that are found in the template file

Definition at line 323 of file L1GtVhdlTemplateFile.cc.

References extractParametersFromString(), lines_, and groupFilesInBlocks::temp.

Referenced by L1GtVhdlWriterCore::writeMuonSetupVhdl().

324 {
325  std::vector<std::string> temp;
326  std::vector<std::string>::const_iterator iter = lines_.begin();
327 
328  // loop until the substitution parameter is discovered the first time
329  while( iter != lines_.end() )
330  {
331  extractParametersFromString((*iter), temp);
332  iter++;
333  }
334 
335  return temp;
336 
337 }
bool extractParametersFromString(const std::string &str, std::vector< std::string > &parameters) const
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::insert ( const std::string &  atLine,
const std::vector< std::string > &  content 
)

replaces the whole line containing atLine and inserts content instead of it

Definition at line 210 of file L1GtVhdlTemplateFile.cc.

References lines_, and summarizeEdmComparisonLogfiles::success.

Referenced by BeautifulSoup.PageElement::_invert(), L1GtVhdlWriterCore::buildCommonHeader(), insert(), L1GtVhdlWriterCore::openVhdlFileWithCommonHeader(), L1GtVhdlWriterCore::writeCondChipPkg(), L1GtVhdlWriterCore::writeConditionChipSetup(), L1GtVhdlWriterCore::writeDefValPkg(), and L1GtVhdlWriterCore::writeMuonSetupVhdl().

211 {
212  bool success = false;
213  std::vector<std::string>::iterator iter = lines_.begin();
214 
215  //Loop until the substitution parameter is discovered the first time
216  while( iter != lines_.end() )
217  {
218  //check, weather the current line is containing the substitution parameter
219  if ((*iter).find(atLine)!=std::string::npos)
220  {
221  //Delete the line with the subsitution parameter
222  iter = lines_.erase(iter);
223  //insert the content of file
224  lines_.insert(iter,content.begin(),content.end());
225 
226  success=true;
227  break;
228  }
229 
230  iter++;
231  }
232 
233  return success;
234 }
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::insert ( const std::string  atLine,
const L1GtVhdlTemplateFile file 
)

replaces the whole line containing atLine with the content of file

Definition at line 237 of file L1GtVhdlTemplateFile.cc.

References insert(), returnLines(), and groupFilesInBlocks::temp.

Referenced by BeautifulSoup.PageElement::_invert().

238 {
239  std::vector<std::string> temp = _file.returnLines();
240 
241  if (insert(atLine,temp)) return true;
242 
243  return false;
244 }
bool insert(const std::string &atLine, const std::vector< std::string > &content)
replaces the whole line containing atLine and inserts content instead of it
bool L1GtVhdlTemplateFile::isBlank ( const char &  chr) const

checks weather a char is a blank

Definition at line 389 of file L1GtVhdlTemplateFile.cc.

Referenced by split().

390 {
391  if (chr==' ') return true;
392  return false;
393 
394 }
std::string L1GtVhdlTemplateFile::lines2String ( ) const

returns a string with the content of vector lines

Definition at line 445 of file L1GtVhdlTemplateFile.cc.

References lines_.

446 {
447  std::vector<std::string>::const_iterator iter = lines_.begin();
448  std::ostringstream buffer;
449 
450  while( iter != lines_.end() )
451  {
452  buffer<<(*iter)<<std::endl;
453  iter++;
454 
455  }
456 
457  return buffer.str();
458 }
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::open ( const std::string &  fileName,
bool  internal = false 
)

opens a template file. If the header information shall be parsed intern has to be set to true

Definition at line 69 of file L1GtVhdlTemplateFile.cc.

References recoMuon::in, analyzePatCleaning_cfg::inputFile, lines_, parameterMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1GtVhdlWriterCore::buildCommonHeader(), L1GtVhdlWriterCore::buildDefValuesBuffer(), L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), L1GtVhdlTemplateFile(), L1GtVhdlWriterCore::writeDefValPkg(), L1GtVhdlWriterCore::writeMuonSetupVhdl(), and L1GtVhdlWriterCore::writeQsfSetupFiles().

70 {
71 
72  const char paramIndicator='#';
73  const char commentIndicator='%';
74  char buffer[2000];
75  std::string stringBuffer;
76 
77  std::fstream inputFile(fileName.c_str(),std::ios::in);
78  //check weather file has been opened successfully
79  if(!inputFile.is_open()) return false;
80 
81  //store content of the template in Vector lines
82  while(!inputFile.eof())
83  {
84  inputFile.getline(buffer,2000);
85  stringBuffer=buffer;
86  //Remove DOS seperators (For example if the template file was created under NT)
87  if (stringBuffer[stringBuffer.length()-1]==13)
88  {
89  stringBuffer.replace(stringBuffer.length()-1,1,"");
90  }
91  //the current buffer + a seperator to the vector lines
92  lines_.push_back(stringBuffer/*+"\n"*/);
93  }
94 
95  inputFile.close();
96 
97  if (internal)
98  {
99 
100  //Delete lines containing parameters after moving them to parameterMap_
101  std::vector<std::string>::iterator iter = lines_.begin();
102  while( iter != lines_.end() )
103  {
104  while ((*iter)[0]==commentIndicator && (*iter)[1]==commentIndicator)
105  lines_.erase(iter);
106 
107  if ((*iter)[0]==paramIndicator)
108  {
109  std::vector<std::string>::iterator iter2 = iter;
110 
111  // get the first line of content
112  iter2++;
113 
114  while (iter2!=lines_.end())
115  {
116  if ((*iter2)[0]==paramIndicator && (*iter2)[1]==paramIndicator)
117  {
118  iter2++;
119  break;
120  }
121 
122 
123 
124  parameterMap_[(*iter).substr(1)]+=(*iter2);
125 
126  // overtake the newlines
127  std::vector<std::string>::iterator tmpIter= iter2;
128  tmpIter++;
129 
130  // check weather the next line is the end of the block
131  if (!((*tmpIter)[0]==paramIndicator && (*tmpIter)[1]==paramIndicator))
132  parameterMap_[(*iter).substr(1)]+="\n";
133 
134 
135  iter2++;
136  }
137 
138  // there has been a syntax error in the internal template
139  // stop the routine
140  if (iter2==lines_.end())
141  return false;
142 
143  // deletes the content, thas has been added to parameter map before
144  // (iter one at the moment is at the beginnig of the block, iter2 at its end)
145  lines_.erase(iter,iter2 );
146 
147  }
148 
149  // just for security
150  if (iter!=lines_.end()) iter++;
151  }
152 
153  //remove empty lines
154  iter = lines_.begin();
155  while( iter != lines_.end() )
156  {
157  if ((*iter)=="" || (*iter).length()==0 || (*iter)==" ") lines_.erase(iter); else
158  iter++;
159  }
160 
161  }
162 
163  return true;
164 
165 }
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
std::vector< std::string > lines_
containing the content of the VHDL file
void L1GtVhdlTemplateFile::print ( void  ) const

prints the content of the VHDL File (only lines_)

Definition at line 254 of file L1GtVhdlTemplateFile.cc.

References gather_cfg::cout, and lines_.

Referenced by L1GtVhdlWriterCore::printCommonHeader().

255 {
256  std::vector<std::string>::const_iterator iter = lines_.begin();
257  while( iter != lines_.end())
258  {
259  std::cout<<*iter<<std::endl;
260  iter++;
261  }
262 
263 }
std::vector< std::string > lines_
containing the content of the VHDL file
tuple cout
Definition: gather_cfg.py:121
void L1GtVhdlTemplateFile::printParameterMap ( ) const

prints the parameter map

Definition at line 272 of file L1GtVhdlTemplateFile.cc.

References gather_cfg::cout, and parameterMap_.

273 {
274  std::cout<<"Enter parametermap"<<std::endl;
275 
276  std::map<std::string,std::string>::const_iterator iter = parameterMap_.begin();
277 
278  while( iter != parameterMap_.end())
279  {
280  std::cout<<(*iter).first<<": "<<(*iter).second<<std::endl;
281  iter++;;
282  }
283 }
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
tuple cout
Definition: gather_cfg.py:121
bool L1GtVhdlTemplateFile::removeEmptyLines ( )

deletes all empty lines in a template file

Definition at line 375 of file L1GtVhdlTemplateFile.cc.

References lines_.

Referenced by L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), and L1GtVmeWriterCore::writeVME().

376 {
377  std::vector<std::string>::iterator iter = lines_.begin();
378 
379  while( iter != lines_.end() )
380  {
381  if ((*iter)=="" || (*iter).length()==0 || (*iter)==" ") lines_.erase(iter); else
382  iter++;
383  }
384 
385  return true;
386 }
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::removeLineWithContent ( const std::string &  str)

removes all lines that contain the str

Definition at line 355 of file L1GtVhdlTemplateFile.cc.

References lines_, position, and summarizeEdmComparisonLogfiles::success.

Referenced by L1GtVhdlWriterCore::writeMuonSetupVhdl().

356 {
357  bool success = false;
358 
359  std::vector<std::string>::iterator iter = lines_.begin();
360  while( iter != lines_.end())
361  {
362  size_t position;
363  position = (*iter).find(str);
364 
365  if (position != std::string::npos)
366  {
367  lines_.erase(iter);
368  success=true;
369  } else iter++;
370  }
371  return success;
372 }
std::vector< std::string > lines_
containing the content of the VHDL file
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::vector< std::string > L1GtVhdlTemplateFile::returnLines ( ) const

returns a string vector with the current content of the VHDL File

Definition at line 266 of file L1GtVhdlTemplateFile.cc.

References lines_.

Referenced by insert(), and L1GtVmeWriterCore::writeVME().

267 {
268  return lines_;
269 }
std::vector< std::string > lines_
containing the content of the VHDL file
std::map< std::string, std::string > L1GtVhdlTemplateFile::returnParameterMap ( ) const

returns parameter map

Definition at line 286 of file L1GtVhdlTemplateFile.cc.

References parameterMap_.

Referenced by L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), L1GtVhdlWriterCore::getSubstParamCommonFromTriggerMenu(), and L1GtVhdlWriterCore::writeMuonSetupVhdl().

287 {
288  return parameterMap_;
289 }
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
bool L1GtVhdlTemplateFile::save ( const std::string &  fileName)

saves the content of the template file to a local file (the content of parameterMap_ will not be saved!)

Definition at line 168 of file L1GtVhdlTemplateFile.cc.

References lines_, and download_sqlite_cfg::outputFile.

Referenced by L1GtVhdlWriterCore::writeAlgoSetup(), L1GtVhdlWriterCore::writeCondChipPkg(), L1GtVhdlWriterCore::writeConditionChipSetup(), L1GtVhdlWriterCore::writeDefValPkg(), L1GtVhdlWriterCore::writeEtmSetup(), L1GtVhdlWriterCore::writeMuonSetupVhdl(), and L1GtVhdlWriterCore::writeQsfSetupFiles().

169 {
170  std::ofstream outputFile(fileName.c_str());
171  std::vector<std::string>::iterator iter = lines_.begin();
172 
173  //Write content of lines_ into the outputfile.
174  while( iter != lines_.end() )
175  {
176  //std::cout<<"Last sign: "<<*iter[(*iter).length()-3];
177  outputFile << *iter<<std::endl;
178  iter++;
179  }
180 
181  outputFile.close();
182 
183  return true;
184 
185 }
std::vector< std::string > lines_
containing the content of the VHDL file
bool L1GtVhdlTemplateFile::split ( const std::string &  param,
std::vector< std::string > &  result 
) const

seperates a string at all blanks and saves the elements in result

Definition at line 397 of file L1GtVhdlTemplateFile.cc.

References i, isBlank(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

Referenced by getConditionsFromAlgo().

398 {
399  unsigned int i = 0;
400  while (isBlank(param[i]))
401  {
402  i++;
403  }
404 
405  std::string temp = param.substr(i);
406  std::size_t pos = temp.find(" ");
407 
408  if (pos != std::string::npos)
409  {
410  std::string temp2 = temp.substr(0, pos);
411  result.push_back(temp2);
412  while (split(temp.substr(pos),result)) split(temp.substr(pos),result);
413 
414  } else if (!isBlank(temp[pos+1]))
415  {
416  result.push_back(temp);
417  return false;
418  } else
419  return false;
420 
421  return false;
422 }
bool split(const std::string &param, std::vector< std::string > &result) const
seperates a string at all blanks and saves the elements in result
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
bool isBlank(const char &chr) const
checks weather a char is a blank
bool L1GtVhdlTemplateFile::substitute ( const std::string &  searchString,
const std::string &  replaceString 
)

replaces searchString with replaceString

Definition at line 188 of file L1GtVhdlTemplateFile.cc.

References findAndReplaceString(), lines_, and summarizeEdmComparisonLogfiles::success.

Referenced by L1GtVhdlWriterCore::buildCommonHeader(), L1GtVhdlWriterCore::buildDefValuesBuffer(), L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu(), L1GtVhdlWriterCore::openVhdlFileWithCommonHeader(), L1GtVhdlWriterCore::writeAlgoSetup(), L1GtVhdlWriterCore::writeCondChipPkg(), L1GtVhdlWriterCore::writeConditionChipSetup(), L1GtVhdlWriterCore::writeEtmSetup(), L1GtVhdlWriterCore::writeMuonSetupVhdl(), L1GtVhdlWriterCore::writeQsfSetupFiles(), and L1GtVmeWriterCore::writeVME().

189 {
190 
191  bool success = false;
192 
193  std::vector<std::string>::iterator iter = lines_.begin();
194  while( iter != lines_.end())
195  {
196  //The substitution parameter always appears as follows: $(parameter)
197  while (findAndReplaceString(*iter,("$("+searchString+")"), replaceString))
198  {
199  findAndReplaceString(*iter,("$("+searchString+")"), replaceString);
200  success = true;
201  }
202  iter++;
203  }
204 
205  return success;
206 
207 }
static const bool findAndReplaceString(std::string &paramString, const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString at it&#39;s first occurance in string
static void replaceString(std::string &name, std::string const &from, std::string const &to)
Definition: ClassUtils.cc:58
std::vector< std::string > lines_
containing the content of the VHDL file

Member Data Documentation

bool L1GtVhdlTemplateFile::intern_
private

internal files additionally have entries in parameterMap_ for "normal" files parameterMap is empty

Definition at line 31 of file L1GtVhdlTemplateFile.h.

Referenced by L1GtVhdlTemplateFile().

std::vector<std::string> L1GtVhdlTemplateFile::lines_
private
std::map<std::string,std::string> L1GtVhdlTemplateFile::parameterMap_
private

containing the header information of internal files

Definition at line 35 of file L1GtVhdlTemplateFile.h.

Referenced by getInternalParameter(), L1GtVhdlTemplateFile(), open(), printParameterMap(), and returnParameterMap().