annotate runner/JsonLDFeatureWriter.h @ 277:c5fc82b8caab json-ld

Copy-paste fixes
author Chris Cannam
date Thu, 15 Sep 2016 18:53:22 +0100
parents f4315a0ade89
children
rev   line source
alo@223 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
alo@223 2
alo@223 3 /*
alo@223 4 Sonic Annotator
alo@223 5 A utility for batch feature extraction from audio files.
alo@223 6
alo@223 7 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
alo@223 8 Copyright 2007-2014 QMUL.
alo@223 9
alo@223 10 This program is free software; you can redistribute it and/or
alo@223 11 modify it under the terms of the GNU General Public License as
alo@223 12 published by the Free Software Foundation; either version 2 of the
alo@223 13 License, or (at your option) any later version. See the file
alo@223 14 COPYING included with this distribution for more information.
alo@223 15 */
alo@223 16
alo@223 17 #ifndef JSONLD_FEATURE_WRITER_H
alo@223 18 #define JSONLD_FEATURE_WRITER_H
alo@223 19
alo@223 20 #include "transform/FileFeatureWriter.h"
alo@223 21
alo@223 22 #include "rdf/PluginRDFDescription.h"
alo@223 23
alo@223 24 class JsonLDFileWriter;
alo@223 25
alo@223 26 class JsonLDFeatureWriter : public FileFeatureWriter
alo@223 27 {
alo@223 28 public:
alo@223 29 JsonLDFeatureWriter();
alo@223 30 virtual ~JsonLDFeatureWriter();
alo@223 31
alo@223 32 string getDescription() const;
alo@223 33
alo@223 34 virtual ParameterList getSupportedParameters() const;
alo@223 35 virtual void setParameters(map<string, string> &params);
alo@223 36
alo@223 37 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata);
alo@223 38
alo@223 39 virtual void setNofM(int, int);
alo@223 40
alo@223 41 virtual void write(QString trackid,
alo@223 42 const Transform &transform,
alo@223 43 const Vamp::Plugin::OutputDescriptor &output,
alo@223 44 const Vamp::Plugin::FeatureList &features,
alo@223 45 std::string summaryType = "");
alo@223 46
alo@223 47 virtual void finish();
alo@223 48
alo@223 49 virtual QString getWriterTag() const { return "jsld"; }
alo@223 50
alo@223 51 private:
alo@223 52 enum Task {
alo@223 53 UnknownTask,
alo@223 54 BeatTask,
alo@223 55 OnsetTask,
alo@223 56 ChordTask,
alo@223 57 SegmentTask,
alo@223 58 KeyTask,
alo@223 59 NoteTask,
alo@223 60 MelodyTask,
alo@223 61 PitchTask,
alo@223 62 };
alo@223 63
alo@223 64 typedef map<QString, PluginRDFDescription> RDFDescriptionMap; // by plugin id
alo@223 65 RDFDescriptionMap m_rdfDescriptions;
alo@223 66
alo@223 67 typedef QString TrackId;
alo@223 68 typedef pair<TrackId, Transform> DataId;
alo@223 69
alo@223 70 typedef map<TrackId, TrackMetadata> TrackMetadataMap;
alo@223 71 TrackMetadataMap m_trackMetadata;
alo@223 72
alo@223 73 typedef map<TrackId, QString> TrackTimelineMap;
alo@223 74 TrackTimelineMap m_trackTimelineGuids;
alo@223 75
alo@223 76 typedef set<TrackId> TrackIds;
alo@223 77 typedef map<QTextStream *, TrackIds> StreamTrackMap;
alo@223 78 StreamTrackMap m_streamTracks;
alo@223 79
alo@223 80 typedef set<Task> Tasks;
alo@223 81 typedef map<QTextStream *, Tasks> StreamTaskMap;
alo@223 82 StreamTaskMap m_streamTasks;
alo@223 83
alo@223 84 typedef set<DataId> DataIds;
alo@223 85 typedef map<QTextStream *, DataIds> StreamDataMap;
alo@223 86 StreamDataMap m_streamData;
alo@223 87
alo@223 88 typedef map<DataId, QString> DataMap;
alo@223 89 DataMap m_data;
alo@223 90
alo@223 91 typedef map<TransformId, Task> TaskMap;
alo@223 92 TaskMap m_tasks;
alo@223 93
alo@223 94 void loadRDFDescription(const Transform &);
alo@223 95 void identifyTask(const Transform &);
alo@223 96
alo@223 97 QString getTaskKey(Task);
alo@223 98
alo@223 99 QString writeTransformToObjectContents(const Transform &);
alo@223 100
alo@223 101 QString writeContext();
alo@223 102
alo@223 103 std::string m_format;
alo@223 104 bool m_network;
alo@223 105 bool m_networkRetrieved;
alo@223 106 int m_n;
alo@223 107 int m_m;
alo@223 108 int m_digits;
alo@223 109 };
alo@223 110
alo@223 111 #endif
alo@223 112