comparison runner/JAMSFeatureWriter.cpp @ 200:f35bbb3e4d41 sonic-annotator-1.2

Change of tack: rename the JSON writer to JAMS. It's simpler than having a JSON writer with a mandatory flag to tell it what sort of JSON to write.
author Chris Cannam
date Tue, 01 Sep 2015 17:51:03 +0100
parents 3b7ec45abd1c
children 1f8fef5c6ea2
comparison
equal deleted inserted replaced
199:c8b934ed4ddd 200:f35bbb3e4d41
30 JAMSFeatureWriter::JAMSFeatureWriter() : 30 JAMSFeatureWriter::JAMSFeatureWriter() :
31 FileFeatureWriter(SupportOneFilePerTrackTransform | 31 FileFeatureWriter(SupportOneFilePerTrackTransform |
32 SupportOneFilePerTrack | 32 SupportOneFilePerTrack |
33 SupportOneFileTotal | 33 SupportOneFileTotal |
34 SupportStdOut, 34 SupportStdOut,
35 "json"), 35 "json"), // file extension is json even with jams writer
36 m_network(false), 36 m_network(false),
37 m_networkRetrieved(false), 37 m_networkRetrieved(false),
38 m_n(1), 38 m_n(1),
39 m_m(1) 39 m_m(1)
40 { 40 {
59 p.name = "network"; 59 p.name = "network";
60 p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally."; 60 p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally.";
61 p.hasArg = false; 61 p.hasArg = false;
62 pl.push_back(p); 62 pl.push_back(p);
63 63
64 p.name = "format";
65 p.description = "JSON format to use. Currently the only supported value is \"jams\". Other formats may be supported in future.";
66 p.hasArg = true;
67 p.mandatory = true;
68 pl.push_back(p);
69
70 return pl; 64 return pl;
71 } 65 }
72 66
73 void 67 void
74 JAMSFeatureWriter::setParameters(map<string, string> &params) 68 JAMSFeatureWriter::setParameters(map<string, string> &params)
77 71
78 for (map<string, string>::iterator i = params.begin(); 72 for (map<string, string>::iterator i = params.begin();
79 i != params.end(); ++i) { 73 i != params.end(); ++i) {
80 if (i->first == "network") { 74 if (i->first == "network") {
81 m_network = true; 75 m_network = true;
82 } else if (i->first == "format") {
83 if (i->second == "jams") {
84 m_format = i->second;
85 } else {
86 throw std::runtime_error
87 ("Unknown or invalid --json-format parameter \"" + i->second + "\"");
88 }
89 } 76 }
90 } 77 }
91 } 78 }
92 79
93 void 80 void
327 << pluginId << "\"" << endl; 314 << pluginId << "\"" << endl;
328 } else { 315 } else {
329 cerr << "NOTE: No RDF description for plugin ID \"" 316 cerr << "NOTE: No RDF description for plugin ID \""
330 << pluginId << "\"" << endl; 317 << pluginId << "\"" << endl;
331 if (!m_network) { 318 if (!m_network) {
332 cerr << " Consider using the --json-network option to retrieve plugin descriptions" << endl; 319 cerr << " Consider using the --jams-network option to retrieve plugin descriptions" << endl;
333 cerr << " from the network where possible." << endl; 320 cerr << " from the network where possible." << endl;
334 } 321 }
335 } 322 }
336 } 323 }
337 324
389 << endl; 376 << endl;
390 } 377 }
391 378
392 } else { 379 } else {
393 380
394 cerr << "WARNING: Cannot currently write dense or track-level outputs to JSON format (only sparse ones). Will proceed using UnknownTask type, but this probably isn't going to work" << endl; 381 cerr << "WARNING: Cannot currently write dense or track-level outputs to JAMS format (only sparse ones). Will proceed using UnknownTask type, but this probably isn't going to work" << endl;
395 } 382 }
396 } 383 }
397 384
398 m_tasks[transformId] = task; 385 m_tasks[transformId] = task;
399 } 386 }