CMS 3D CMS Logo

L1GtVhdlTemplateFile.h
Go to the documentation of this file.
1 #ifndef L1GtConfigProducers_L1GtVhdlTemplateFile_h
2 #define L1GtConfigProducers_L1GtVhdlTemplateFile_h
3 
19 // system include files
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 
26 private:
29  bool intern_;
31  std::vector<std::string> lines_;
33  std::map<std::string, std::string> parameterMap_;
34 
35 public:
45  static const bool findAndReplaceString(std::string &paramString,
46  const std::string &searchString,
47  const std::string &replaceString);
49  bool open(const std::string &fileName, bool internal = false);
51  bool save(const std::string &fileName);
52  bool close();
54  bool substitute(const std::string &searchString, const std::string &replaceString);
56  bool insert(const std::string &atLine, const std::vector<std::string> &content);
58  bool insert(const std::string atLine, const L1GtVhdlTemplateFile &file);
60  void print() const;
62  void printParameterMap() const;
64  std::vector<std::string> returnLines() const;
66  std::map<std::string, std::string> returnParameterMap() const;
68  std::vector<std::string> getSubstitutionParametersFromTemplate() const;
71  bool extractParametersFromString(const std::string &str, std::vector<std::string> &parameters) const;
73  void append(const std::string &str);
75  void append(const L1GtVhdlTemplateFile &file);
79  bool removeEmptyLines();
81  bool isBlank(const char &chr) const;
83  bool split(const std::string &param, std::vector<std::string> &result) const;
85  void getConditionsFromAlgo(std::string condString, std::vector<std::string> &result) const;
87  std::string lines2String() const;
89  std::string getInternalParameter(const std::string &indentifier);
90 };
91 #endif /*L1GtConfigProducers_L1GtVhdlTemplateFile_h*/
L1GtVhdlTemplateFile::getSubstitutionParametersFromTemplate
std::vector< std::string > getSubstitutionParametersFromTemplate() const
returns a vector with all substitution parameters that are found in the template file
Definition: L1GtVhdlTemplateFile.cc:266
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
L1GtVhdlTemplateFile::parameterMap_
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
Definition: L1GtVhdlTemplateFile.h:33
L1GtVhdlTemplateFile::insert
bool insert(const std::string &atLine, const std::vector< std::string > &content)
replaces the whole line containing atLine and inserts content instead of it
Definition: L1GtVhdlTemplateFile.cc:177
L1GtVhdlTemplateFile::append
void append(const std::string &str)
adds a line at the end of the the file with the content of str
Definition: L1GtVhdlTemplateFile.cc:279
L1GtVhdlTemplateFile::extractParametersFromString
bool extractParametersFromString(const std::string &str, std::vector< std::string > &parameters) const
Definition: L1GtVhdlTemplateFile.cc:238
L1GtVhdlTemplateFile::getConditionsFromAlgo
void getConditionsFromAlgo(std::string condString, std::vector< std::string > &result) const
extracts all conditions from a algorithm
Definition: L1GtVhdlTemplateFile.cc:347
L1GtVhdlTemplateFile::getInternalParameter
std::string getInternalParameter(const std::string &indentifier)
returns a parameter of a internal template file
Definition: L1GtVhdlTemplateFile.cc:376
L1GtVhdlTemplateFile::lines2String
std::string lines2String() const
returns a string with the content of vector lines
Definition: L1GtVhdlTemplateFile.cc:364
L1GtVhdlTemplateFile::removeLineWithContent
bool removeLineWithContent(const std::string &str)
removes all lines that contain the str
Definition: L1GtVhdlTemplateFile.cc:287
L1GtVhdlTemplateFile::print
void print() const
prints the content of the VHDL File (only lines_)
Definition: L1GtVhdlTemplateFile.cc:214
L1GtVhdlTemplateFile::close
bool close()
Definition: L1GtVhdlTemplateFile.cc:209
L1GtVhdlTemplateFile
Definition: L1GtVhdlTemplateFile.h:25
L1GtVhdlTemplateFile::save
bool save(const std::string &fileName)
saves the content of the template file to a local file (the content of parameterMap_ will not be save...
Definition: L1GtVhdlTemplateFile.cc:145
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
L1GtVhdlTemplateFile::open
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
Definition: L1GtVhdlTemplateFile.cc:60
L1GtVhdlTemplateFile::L1GtVhdlTemplateFile
L1GtVhdlTemplateFile()
standard constructor
Definition: L1GtVhdlTemplateFile.cc:29
str
#define str(s)
Definition: TestProcessor.cc:51
L1GtVhdlTemplateFile::substitute
bool substitute(const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString
Definition: L1GtVhdlTemplateFile.cc:161
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
L1GtVhdlTemplateFile::isBlank
bool isBlank(const char &chr) const
checks weather a char is a blank
Definition: L1GtVhdlTemplateFile.cc:317
L1GtVhdlTemplateFile::returnLines
std::vector< std::string > returnLines() const
returns a string vector with the current content of the VHDL File
Definition: L1GtVhdlTemplateFile.cc:222
L1GtVhdlTemplateFile::findAndReplaceString
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
Definition: L1GtVhdlTemplateFile.cc:49
edm::replaceString
void replaceString(std::string &demangledName, std::string const &from, std::string const &to)
Definition: TypeDemangler.cc:84
L1GtVhdlTemplateFile::removeEmptyLines
bool removeEmptyLines()
deletes all empty lines in a template file
Definition: L1GtVhdlTemplateFile.cc:304
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GtVhdlTemplateFile::printParameterMap
void printParameterMap() const
prints the parameter map
Definition: L1GtVhdlTemplateFile.cc:224
Skims_PA_cff.content
content
Definition: Skims_PA_cff.py:19
L1GtVhdlTemplateFile::lines_
std::vector< std::string > lines_
containing the content of the VHDL file
Definition: L1GtVhdlTemplateFile.h:31
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
L1GtVhdlTemplateFile::intern_
bool intern_
Definition: L1GtVhdlTemplateFile.h:29
L1GtVhdlTemplateFile::returnParameterMap
std::map< std::string, std::string > returnParameterMap() const
returns parameter map
Definition: L1GtVhdlTemplateFile.cc:236
mps_fire.result
result
Definition: mps_fire.py:311
L1GtVhdlTemplateFile::split
bool split(const std::string &param, std::vector< std::string > &result) const
seperates a string at all blanks and saves the elements in result
Definition: L1GtVhdlTemplateFile.cc:323
L1GtVhdlTemplateFile::~L1GtVhdlTemplateFile
~L1GtVhdlTemplateFile()
destructor
Definition: L1GtVhdlTemplateFile.cc:45