test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
27  private:
28 
31  bool intern_;
33  std::vector<std::string> lines_;
35  std::map<std::string,std::string> parameterMap_;
36 
37  public:
38 
48  static const bool findAndReplaceString(std::string &paramString, const std::string &searchString, const std::string &replaceString);
50  bool open(const std::string &fileName, bool internal=false);
52  bool save(const std::string &fileName);
53  bool close();
55  bool substitute(const std::string &searchString, const std::string &replaceString);
57  bool insert(const std::string &atLine, const std::vector<std::string>& content);
59  bool insert(const std::string atLine, const L1GtVhdlTemplateFile& file);
61  void print() const;
63  void printParameterMap() const;
65  std::vector<std::string> returnLines() const;
67  std::map<std::string,std::string> returnParameterMap() const;
69  std::vector<std::string> getSubstitutionParametersFromTemplate() const;
72  bool extractParametersFromString(const std::string &str, std::vector<std::string> &parameters) const;
74  void append(const std::string &str);
76  void append(const L1GtVhdlTemplateFile& file);
78  bool removeLineWithContent(const std::string &str);
80  bool removeEmptyLines();
82  bool isBlank(const char &chr) const;
84  bool split(const std::string &param, std::vector<std::string> &result) const;
86  void getConditionsFromAlgo(std::string condString, std::vector<std::string> &result) const;
88  std::string lines2String() const;
90  std::string getInternalParameter(const std::string &indentifier);
91 
92 };
93 #endif /*L1GtConfigProducers_L1GtVhdlTemplateFile_h*/
bool split(const std::string &param, std::vector< std::string > &result) const
seperates a string at all blanks and saves the elements in result
std::string lines2String() const
returns a string with the content of vector lines
bool extractParametersFromString(const std::string &str, std::vector< std::string > &parameters) const
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
bool substitute(const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString
void printParameterMap() const
prints the parameter map
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...
std::vector< std::string > getSubstitutionParametersFromTemplate() const
returns a vector with all substitution parameters that are found in the template file ...
~L1GtVhdlTemplateFile()
destructor
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
bool removeLineWithContent(const std::string &str)
removes all lines that contain the str
tuple result
Definition: mps_fire.py:83
L1GtVhdlTemplateFile()
standard constructor
void append(const std::string &str)
adds a line at the end of the the file with the content of str
bool isBlank(const char &chr) const
checks weather a char is a blank
std::string getInternalParameter(const std::string &indentifier)
returns a parameter of a internal template file
static void replaceString(std::string &name, std::string const &from, std::string const &to)
Definition: ClassUtils.cc:61
bool insert(const std::string &atLine, const std::vector< std::string > &content)
replaces the whole line containing atLine and inserts content instead of it
std::vector< std::string > lines_
containing the content of the VHDL file
std::vector< std::string > returnLines() const
returns a string vector with the current content of the VHDL File
tuple filename
Definition: lut2db_cfg.py:20
bool removeEmptyLines()
deletes all empty lines in a template file
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 ...
std::map< std::string, std::string > returnParameterMap() const
returns parameter map
void getConditionsFromAlgo(std::string condString, std::vector< std::string > &result) const
extracts all conditions from a algorithm
void print() const
prints the content of the VHDL File (only lines_)