Changeset 972 for cpp/frams/genetics/genoconv.cpp
- Timestamp:
- 07/03/20 00:32:23 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/genoconv.cpp
r955 r972 123 123 /// (can be NULL if you don't need this information) 124 124 125 GenoConverter **GenoConvManager::getPath(const SString& in , const SString& out, GenoConverter **path, int maxlen, int *mapavailable)125 GenoConverter **GenoConvManager::getPath(const SString& in_format, const SString& out_format_list, GenoConverter **path, int maxlen, int *mapavailable) 126 126 { 127 127 if (!maxlen) return 0; … … 130 130 for (; gk = (GenoConverter*)converters(i); i++) 131 131 { 132 if ((gk->enabled) && (gk->in_format == in ))132 if ((gk->enabled) && (gk->in_format == in_format)) 133 133 { 134 134 *path = gk; 135 if ( gk->out_format == out)135 if (Geno::formatIsOneOf(gk->out_format, out_format_list)) 136 136 { 137 137 if (mapavailable) … … 142 142 { 143 143 int mapavail; 144 GenoConverter **ret = getPath(gk->out_format, out , path + 1, maxlen - 1, &mapavail);144 GenoConverter **ret = getPath(gk->out_format, out_format_list, path + 1, maxlen - 1, &mapavail); 145 145 if (ret) 146 146 { … … 155 155 } 156 156 157 Geno GenoConvManager::convert(Geno &in, SString format, MultiMap *map, bool using_checkpoints, bool *converter_missing) 158 { 159 if (in.getFormat() == format) { if (converter_missing) *converter_missing = false; return in; } 157 Geno GenoConvManager::convert(Geno &in, SString format_list, MultiMap *map, bool using_checkpoints, bool *converter_missing) 158 { 159 if (Geno::formatIsOneOf(in.getFormat(), format_list)) 160 { 161 if (converter_missing) *converter_missing = false; return in; 162 } 160 163 GenoConverter *path[10]; 161 164 int dep; … … 164 167 int mapavail; 165 168 for (dep = 1; dep < (int)sizeof(path); dep++) //iterative deepening 166 if (ret = getPath(in.getFormat(), format , path, dep, &mapavail)) break;169 if (ret = getPath(in.getFormat(), format_list, path, dep, &mapavail)) break; 167 170 if (!ret) { if (converter_missing) *converter_missing = true; return Geno("", Geno::INVALID_FORMAT, "", "converter not found"); } 168 171 if (converter_missing) *converter_missing = false; 169 172 if (!map) mapavail = 0; 170 173 GenoConverter **t = path; 171 SString tmp ;174 SString tmp, out_format; 172 175 tmp = in.getGenes(); 173 176 MultiMap lastmap, tmpmap; … … 177 180 GenoConverter *gk = *t; 178 181 tmp = gk->convert(tmp, mapavail ? &tmpmap : 0, using_checkpoints); 179 if (!tmp.len()) 182 out_format = gk->out_format; 183 if (!tmp.length()) 180 184 { 181 185 string t = ssprintf("f%s->f%s conversion failed (%s)", gk->in_format.c_str(), gk->out_format.c_str(), gk->name); … … 200 204 if (map) 201 205 *map = lastmap; 202 return Geno(tmp, format, in.getName(), in.getComment());203 } 206 return Geno(tmp, out_format, in.getName(), in.getComment()); 207 }
Note: See TracChangeset
for help on using the changeset viewer.