summaryrefslogtreecommitdiffstats
path: root/src/OutputFile.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-07 12:04:46 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-07 12:04:46 +0100
commit770703c9c5c926be760af836bee26e554e81a71c (patch)
treef9368db373d91d48d9476790d9dbdcbbcf3dc5dc /src/OutputFile.cpp
parent28d794ab7d47e4f2585ac73f8a69c9c68962b678 (diff)
downloaddabmod-770703c9c5c926be760af836bee26e554e81a71c.tar.gz
dabmod-770703c9c5c926be760af836bee26e554e81a71c.tar.bz2
dabmod-770703c9c5c926be760af836bee26e554e81a71c.zip
Add option to show metadata for file output
Diffstat (limited to 'src/OutputFile.cpp')
-rw-r--r--src/OutputFile.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/OutputFile.cpp b/src/OutputFile.cpp
index b7bf59a..f5a1997 100644
--- a/src/OutputFile.cpp
+++ b/src/OutputFile.cpp
@@ -36,9 +36,9 @@
using namespace std;
-OutputFile::OutputFile(std::string filename) :
- ModOutput(),
- ModMetadata(),
+OutputFile::OutputFile(const std::string& filename, bool show_metadata) :
+ ModOutput(), ModMetadata(),
+ myShowMetadata(show_metadata),
myFilename(filename)
{
PDEBUG("OutputFile::OutputFile(filename: %s) @ %p\n",
@@ -69,31 +69,33 @@ int OutputFile::process(Buffer* dataIn)
meta_vec_t OutputFile::process_metadata(const meta_vec_t& metadataIn)
{
- stringstream ss;
-
- for (const auto& md : metadataIn) {
- if (md.ts) {
- ss << " FCT=" << md.ts->fct <<
- " FP=" << (int)md.ts->fp;
- if (md.ts->timestamp_valid) {
- ss << " TS=" << md.ts->timestamp_sec << ";";
+ if (myShowMetadata) {
+ stringstream ss;
+
+ for (const auto& md : metadataIn) {
+ if (md.ts) {
+ ss << " FCT=" << md.ts->fct <<
+ " FP=" << (int)md.ts->fp;
+ if (md.ts->timestamp_valid) {
+ ss << " TS=" << md.ts->timestamp_sec << ";";
+ }
+ else {
+ ss << " No TS;";
+ }
}
else {
- ss << " No TS;";
+ ss << " void, ";
}
}
+
+ if (metadataIn.empty()) {
+ etiLog.level(debug) << "Output File got no mdIn";
+ }
else {
- ss << " void, ";
+ etiLog.level(debug) << "Output File got metadata: " << ss.str();
}
- }
- if (metadataIn.empty()) {
- etiLog.level(debug) << "Output File got no mdIn";
}
- else {
- etiLog.level(debug) << "Output File got metadata: " << ss.str();
- }
-
return {};
}