The basic facility to convert data to a string is the formatter<T> template. It can be accessed by including formatter.hpp
in the source code. Its usage is fairly simple, for a scalar type use
#include <iostream>
#include <pni/core/types.hpp>
#include <pni/io/formatter.hpp>
int main(int argc,char **argv)
{
float_fmt_type float_formatter;
float64 data=4.3902e+2;
std::cout<<float_formatter(data)<<std::endl;
return 0;
}
Also container types can be handled by using the container_io_config type. To convert the data stored in a std::vector
to a string use something like this
#include <iostream>
#include <vector>
#include <pni/core/types.hpp>
#include <pni/io/formatter.hpp>
typedef std::vector<uint32> mca_type;
int main(int,char **)
{
mca_type mca{1,20,84,11};
std::cout<<mca_fmt(mca)<<std::endl;
return 0;
}