- fact.nb_values=0;
- unsigned int i=0;
- xbt_dynar_t radical_elements2 = NULL;
-
- xbt_dynar_t smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_multival_t), NULL);
- xbt_dynar_t radical_elements = xbt_str_split(smpi_coef_string, ";");
- xbt_dynar_foreach(radical_elements, iter, value) {
- memset(&fact, 0, sizeof(s_smpi_factor_multival_t));
- radical_elements2 = xbt_str_split(value, ":");
- if (xbt_dynar_length(radical_elements2) <2 || xbt_dynar_length(radical_elements2) > 5)
+
+ /** Setup the tokenizer that parses the string **/
+ typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
+ boost::char_separator<char> sep(";");
+ boost::char_separator<char> factor_separator(":");
+ std::string tmp_string(smpi_coef_string);
+ Tokenizer tokens(tmp_string, sep);
+
+ /**
+ * Iterate over patterns like A:B:C:D;E:F;G:H
+ * These will be broken down into:
+ * A --> B, C, D
+ * E --> F
+ * G --> H
+ */
+ for (Tokenizer::iterator token_iter = tokens.begin();
+ token_iter != tokens.end(); token_iter++) {
+ Tokenizer factor_values(*token_iter, factor_separator);
+
+ if (factor_values.begin() == factor_values.end()) {