------------------------------------------------------------------------------
| 137 | |
| 138 | //------------------------------------------------------------------------------ |
| 139 | bool vtkStatisticsAlgorithm::ConfigureFromAlgorithmParameters( |
| 140 | const std::string& algorithmParameters) |
| 141 | { |
| 142 | std::string work = algorithmParameters; |
| 143 | // Consume a parameter name, then call ConsumeNextAlgorithmParameter() |
| 144 | // to set the value. If any string remains after the value is consumed, |
| 145 | // repeat until the string is empty or a parameter cannot be consumed. |
| 146 | for (; !work.empty();) |
| 147 | { |
| 148 | std::size_t parameterNameEnd = work.find('='); |
| 149 | if (parameterNameEnd == std::string::npos) |
| 150 | { |
| 151 | vtkErrorMacro("Could not identify parameter name in \"" << work << "\"."); |
| 152 | return false; |
| 153 | } |
| 154 | vtkStringToken parameterName(work.substr(0, parameterNameEnd)); |
| 155 | work = work.substr(parameterNameEnd + 1, std::string::npos); |
| 156 | std::size_t consumed = this->ConsumeNextAlgorithmParameter(parameterName, work); |
| 157 | if (consumed == 0) |
| 158 | { |
| 159 | vtkErrorMacro("Could not identify parameter value for \"" << parameterName.Data() |
| 160 | << "\" in \"" << work << "\"."); |
| 161 | return false; |
| 162 | } |
| 163 | work = work.substr(consumed + 1, std::string::npos); |
| 164 | } |
| 165 | return true; |
| 166 | } |
| 167 | |
| 168 | //------------------------------------------------------------------------------ |
| 169 | void vtkStatisticsAlgorithm::AppendAlgorithmParameters(std::string& algorithmParameters) const |
no test coverage detected