]> git.tdb.fi Git - libs/datafile.git/blobdiff - tool/tool.cpp
Use custom encoding for floats in binary format
[libs/datafile.git] / tool / tool.cpp
index 4e6608766a8e7cbacb47900e337ba0c80436e6f6..5f9febeedda26d87a749551de4035d7ee6e07a30 100644 (file)
@@ -15,11 +15,13 @@ DataTool::DataTool(int argc, char **argv):
        in_fn("-"),
        out_fn("-"),
        binary(false),
-       compile(false)
+       compile(false),
+       float_size(0)
 {
        GetOpt getopt;
        getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
        getopt.add_option('c', "compile", compile, GetOpt::NO_ARG);
+       getopt.add_option('f', "float-size", float_size, GetOpt::REQUIRED_ARG);
        getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
        getopt(argc, argv);
 
@@ -49,6 +51,8 @@ int DataTool::main()
                DataFile::Writer writer(out_buf);
                if(binary)
                        writer.set_binary(true);
+               if(float_size)
+                       writer.set_float_precision(float_size);
 
                if(compile)
                {