+ delete writer;
+ delete out;
+}
+
+void DataTool::do_pack()
+{
+ Packer packer(*this);
+ for(vector<string>::const_iterator i=in_fns.begin(); i!=in_fns.end(); ++i)
+ packer.pack_file(*i);
+ packer.create_pack(out_fn);
+}
+
+IO::Base *DataTool::open_output(const string &fn)
+{
+ if(fn=="-")
+ return new IO::Buffered(IO::cout);
+ else
+ return new IO::BufferedFile(fn, IO::M_WRITE);
+}
+
+IO::Base *DataTool::open_input(const string &fn)
+{
+ if(fn=="-")
+ return new IO::Buffered(IO::cin);
+ else
+ return new IO::BufferedFile(fn, IO::M_READ);
+}
+
+DataFile::Writer *DataTool::create_writer(IO::Base &out)
+{
+ DataFile::Writer *writer = new DataFile::Writer(out);
+ if(compress)
+ writer->set_compressed();
+ if(binary)
+ writer->set_binary(true);
+ if(float_size)
+ writer->set_float_precision(float_size);
+ return writer;