Commit 86fbae45a1d47ba2c6c6ef9120a564d449b271f7

Authored by Benjamin Renard
1 parent d6800e08

Compute param Id correction only once (cf. #6134)

src/Parameters/ParameterManager.cc
... ... @@ -117,6 +117,11 @@ ParameterSPtr ParameterManager::findParamInParameterList(const std::string& para
117 117  
118 118 void ParameterManager::applyParamIdCorrection(std::string& paramId)
119 119 {
  120 + if (_paramIdCorrectionMap.find(paramId) != _paramIdCorrectionMap.end()) {
  121 + paramId = _paramIdCorrectionMap[paramId];
  122 + return;
  123 + }
  124 +
120 125 //Some characters are used to apply an operation, a process, etc... in an expression
121 126 //These characters can't be used for a parmId
122 127 //=> replace "-", "+", "*", "/", "^", "(", ")", "[", "]", "{", "}","&","|",
... ... @@ -127,6 +132,7 @@ void ParameterManager::applyParamIdCorrection(std::string& paramId)
127 132 "&", "|", "$", ".", ",", "#",
128 133 };
129 134  
  135 + std::string originalParamId = paramId;
130 136 std::string replaceBy;
131 137 for (auto c : charList) {
132 138 replaceBy = "";
... ... @@ -135,6 +141,8 @@ void ParameterManager::applyParamIdCorrection(std::string& paramId)
135 141 replaceBy += "_";
136 142 paramId = boost::replace_all_copy(paramId, c, replaceBy);
137 143 }
  144 +
  145 + _paramIdCorrectionMap[originalParamId] = paramId;
138 146 }
139 147  
140 148 ParameterSPtr& ParameterManager::checkIfIsANeededParameter(ParameterSPtr& pParam) {
... ...
src/Parameters/ParameterManager.hh
... ... @@ -189,6 +189,11 @@ private:
189 189 std::map<int, std::map<std::string, std::vector<std::string>>> _timeIntervalDataList;
190 190  
191 191 /*
  192 + * @brief store paramId correction to compute it only once and improve execution time
  193 + */
  194 + std::map<std::string,std::string> _paramIdCorrectionMap;
  195 +
  196 + /*
192 197 * @brief default value for the gap threshold of all parameters
193 198 */
194 199 double _defaultGapThreshold;
... ...