diff --git a/lib/imc_channel.hpp b/lib/imc_channel.hpp index cbe1514..578957d 100644 --- a/lib/imc_channel.hpp +++ b/lib/imc_channel.hpp @@ -365,6 +365,40 @@ namespace imc <<"\"}"; return ss.str(); } + + // print channel + void print(std::string filename, const char sep = ' ', int width = 25) + { + std::ofstream fou(filename); + + // header + if ( sep == ' ' ) + { + fou< -// #include +#include #include "hexshow.hpp" #include "imc_key.hpp" @@ -324,6 +324,28 @@ namespace imc return channels; } + // print all channels in directory + void print_channels(std::string output) + { + // check for given directory + std::filesystem::path pd = output; + if ( std::filesystem::is_directory(pd) ) + { + throw std::runtime_error("given directory does not exist"); + } + + for ( std::map::iterator it = channels_.begin(); + it != channels_.end(); ++it) + { + // construct filename + std::string filenam = std::string("channel_") + it->first + std::string(".csv"); + std::filesystem::path pf = pd / filenam; + + // and print the channel + it->second.print(pf); + } + } + }; }