include/implement csvseparator option

This commit is contained in:
2021-01-25 18:06:37 +01:00
parent 02adaa7908
commit 529b80f4f9
3 changed files with 25 additions and 7 deletions

View File

@@ -673,7 +673,7 @@ void tdm_reaper::print_channel(std::string &id, const char* filename, bool inclu
fou.close();
}
void tdm_reaper::print_group(std::string &id, const char* filename, bool include_meta)
void tdm_reaper::print_group(std::string &id, const char* filename, bool include_meta, char sep)
{
// check for group id
if ( this->tdmchannelgroups_.count(id) != 1 )
@@ -759,12 +759,22 @@ void tdm_reaper::print_group(std::string &id, const char* filename, bool include
{
if ( allchns.at(chi).size() > row )
{
fou<<std::setw(width)<<std::left<<allchns.at(chi).at(row);
// use given csv separator token
if ( sep == ' ' )
{
fou<<std::setw(width)<<std::left<<allchns.at(chi).at(row);
}
else
{
fou<<allchns.at(chi).at(row);
}
}
else
{
fou<<std::setw(width)<<std::left<<"";
}
if ( chi+1 < chngrp.channels_.size() ) fou<<sep;
}
fou<<"\n";
}

View File

@@ -216,7 +216,7 @@ public:
// dump a single channel/entire group (identified by id) to file
void print_channel(std::string &id, const char* filename, bool include_meta = true);
void print_group(std::string &id, const char* filename, bool include_meta = true);
void print_group(std::string &id, const char* filename, bool include_meta = true, char sep = ' ');
private: