File indexing completed on 2023-03-17 11:14:14
0001 #ifndef L1GtConfigProducers_L1GtVhdlTemplateFile_h
0002 #define L1GtConfigProducers_L1GtVhdlTemplateFile_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <map>
0022 #include <string>
0023 #include <vector>
0024
0025 class L1GtVhdlTemplateFile {
0026 private:
0027
0028
0029 bool intern_;
0030
0031 std::vector<std::string> lines_;
0032
0033 std::map<std::string, std::string> parameterMap_;
0034
0035 public:
0036
0037 L1GtVhdlTemplateFile();
0038
0039 L1GtVhdlTemplateFile(const std::string &filename);
0040
0041 L1GtVhdlTemplateFile(const L1GtVhdlTemplateFile &rhs);
0042
0043 ~L1GtVhdlTemplateFile();
0044
0045 static const bool findAndReplaceString(std::string ¶mString,
0046 const std::string &searchString,
0047 const std::string &replaceString);
0048
0049 bool open(const std::string &fileName, bool internal = false);
0050
0051 bool save(const std::string &fileName);
0052 bool close();
0053
0054 bool substitute(const std::string &searchString, const std::string &replaceString);
0055
0056 bool insert(const std::string &atLine, const std::vector<std::string> &content);
0057
0058 bool insert(const std::string atLine, const L1GtVhdlTemplateFile &file);
0059
0060 void print() const;
0061
0062 void printParameterMap() const;
0063
0064 std::vector<std::string> returnLines() const;
0065
0066 std::map<std::string, std::string> returnParameterMap() const;
0067
0068 std::vector<std::string> getSubstitutionParametersFromTemplate() const;
0069
0070
0071 bool extractParametersFromString(const std::string &str, std::vector<std::string> ¶meters) const;
0072
0073 void append(const std::string &str);
0074
0075 void append(const L1GtVhdlTemplateFile &file);
0076
0077 bool removeLineWithContent(const std::string &str);
0078
0079 bool removeEmptyLines();
0080
0081 bool isBlank(const char &chr) const;
0082
0083 bool split(const std::string ¶m, std::vector<std::string> &result) const;
0084
0085 void getConditionsFromAlgo(std::string condString, std::vector<std::string> &result) const;
0086
0087 std::string lines2String() const;
0088
0089 std::string getInternalParameter(const std::string &indentifier);
0090 };
0091 #endif