Mercurial > hg > piper-cpp
comparison json/VampJson.h @ 57:7aec704705c7
Make the output ID mapper stuff safer by using shared_ptr
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 19 Sep 2016 14:43:32 +0100 |
parents | 815e94fedc1c |
children | 77833938f0f8 |
comparison
equal
deleted
inserted
replaced
56:815e94fedc1c | 57:7aec704705c7 |
---|---|
1009 jo["success"] = true; | 1009 jo["success"] = true; |
1010 jo["errorText"] = ""; | 1010 jo["errorText"] = ""; |
1011 json11::Json::object po; | 1011 json11::Json::object po; |
1012 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); | 1012 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); |
1013 po["features"] = fromFeatureSet(resp.features, | 1013 po["features"] = fromFeatureSet(resp.features, |
1014 pmapper.pluginToOutputIdMapper(resp.plugin), | 1014 *pmapper.pluginToOutputIdMapper(resp.plugin), |
1015 serialisation); | 1015 serialisation); |
1016 jo["content"] = po; | 1016 jo["content"] = po; |
1017 return json11::Json(jo); | 1017 return json11::Json(jo); |
1018 } | 1018 } |
1019 | 1019 |
1039 jo["success"] = true; | 1039 jo["success"] = true; |
1040 jo["errorText"] = ""; | 1040 jo["errorText"] = ""; |
1041 json11::Json::object po; | 1041 json11::Json::object po; |
1042 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); | 1042 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); |
1043 po["features"] = fromFeatureSet(resp.features, | 1043 po["features"] = fromFeatureSet(resp.features, |
1044 pmapper.pluginToOutputIdMapper(resp.plugin), | 1044 *pmapper.pluginToOutputIdMapper(resp.plugin), |
1045 serialisation); | 1045 serialisation); |
1046 jo["content"] = po; | 1046 jo["content"] = po; |
1047 return json11::Json(jo); | 1047 return json11::Json(jo); |
1048 } | 1048 } |
1049 | 1049 |
1182 if (successful(j)) { | 1182 if (successful(j)) { |
1183 auto jc = j["content"]; | 1183 auto jc = j["content"]; |
1184 auto h = jc["pluginHandle"].int_value(); | 1184 auto h = jc["pluginHandle"].int_value(); |
1185 resp.plugin = pmapper.handleToPlugin(h); | 1185 resp.plugin = pmapper.handleToPlugin(h); |
1186 resp.features = toFeatureSet(jc["features"], | 1186 resp.features = toFeatureSet(jc["features"], |
1187 pmapper.handleToOutputIdMapper(h), | 1187 *pmapper.handleToOutputIdMapper(h), |
1188 serialisation); | 1188 serialisation); |
1189 } | 1189 } |
1190 return resp; | 1190 return resp; |
1191 } | 1191 } |
1192 | 1192 |
1209 if (successful(j)) { | 1209 if (successful(j)) { |
1210 auto jc = j["content"]; | 1210 auto jc = j["content"]; |
1211 auto h = jc["pluginHandle"].int_value(); | 1211 auto h = jc["pluginHandle"].int_value(); |
1212 resp.plugin = pmapper.handleToPlugin(h); | 1212 resp.plugin = pmapper.handleToPlugin(h); |
1213 resp.features = toFeatureSet(jc["features"], | 1213 resp.features = toFeatureSet(jc["features"], |
1214 pmapper.handleToOutputIdMapper(h), | 1214 *pmapper.handleToOutputIdMapper(h), |
1215 serialisation); | 1215 serialisation); |
1216 } | 1216 } |
1217 return resp; | 1217 return resp; |
1218 } | 1218 } |
1219 }; | 1219 }; |