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 
21 // system include files
22 
23 #include <map>
24 #include <string>
25 #include <vector>
26 
28 {
29  private:
30 
33  bool intern_;
35  std::vector<std::string> lines_;
37  std::map<std::string,std::string> parameterMap_;
38 
39  public:
40 
44  L1GtVhdlTemplateFile(const std::string &filename);
50  static const bool findAndReplaceString(std::string &paramString, const std::string &searchString, const std::string &replaceString);
52  bool open(const std::string &fileName, bool internal=false);
54  bool save(const std::string &fileName);
55  bool close();
57  bool substitute(const std::string &searchString, const std::string &replaceString);
59  bool insert(const std::string &atLine, std::vector<std::string> content);
61  bool insert(const std::string atLine, L1GtVhdlTemplateFile file);
63  void print();
65  void printParameterMap();
67  std::vector<std::string> returnLines();
69  std::map<std::string,std::string> returnParameterMap();
71  std::vector<std::string> getSubstitutionParametersFromTemplate();
74  bool extractParametersFromString(const std::string &str, std::vector<std::string> &parameters);
76  void append(const std::string &str);
78  void append(const L1GtVhdlTemplateFile& file);
80  bool removeLineWithContent(const std::string &str);
82  bool removeEmptyLines();
84  bool isBlank(const char &chr);
86  bool split(const std::string &param, std::vector<std::string> &result);
88  void getConditionsFromAlgo(std::string condString, std::vector<std::string> &result);
90  std::string lines2String();
92  std::string getInternalParameter(const std::string &indentifier);
93 
94 };
95 #endif /*L1GtConfigProducers_L1GtVhdlTemplateFile_h*/
std::map< std::string, std::string > returnParameterMap()
returns parameter map
dictionary parameters
Definition: Parameters.py:2
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
bool isBlank(const char &chr)
checks weather a char is a blank
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...
~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
L1GtVhdlTemplateFile()
standard constructor
bool insert(const std::string &atLine, std::vector< std::string > content)
replaces the whole line containing atLine and inserts content instead of it
tuple result
Definition: query.py:137
void append(const std::string &str)
adds a line at the end of the the file with the content of str
void print()
prints the content of the VHDL File (only lines_)
std::vector< std::string > returnLines()
returns a string vector with the current content of the VHDL File
std::string getInternalParameter(const std::string &indentifier)
returns a parameter of a internal template file
std::string lines2String()
returns a string with the content of vector lines
std::vector< std::string > lines_
containing the content of the VHDL file
bool split(const std::string &param, std::vector< std::string > &result)
seperates a string at all blanks and saves the elements in result
void getConditionsFromAlgo(std::string condString, std::vector< std::string > &result)
extracts all conditions from a algorithm
tuple filename
Definition: lut2db_cfg.py:20
bool extractParametersFromString(const std::string &str, std::vector< std::string > &parameters)
void printParameterMap()
prints the parameter map
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::vector< std::string > getSubstitutionParametersFromTemplate()
returns a vector with all substitution parameters that are found in the template file ...