00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SPECTMORPH_OUT_FILE_HH
00019 #define SPECTMORPH_OUT_FILE_HH
00020
00021 #include <stdio.h>
00022 #include <string>
00023 #include <vector>
00024 #include <set>
00025 #include "smgenericout.hh"
00026
00027 namespace SpectMorph
00028 {
00029
00030 class OutFile
00031 {
00032 GenericOut *file;
00033 bool delete_file;
00034 std::set<std::string> stored_blobs;
00035
00036 protected:
00037 void write_raw_string (const std::string& s);
00038 void write_raw_int (int i);
00039 void write_file_type_and_version (const std::string& file_type, int file_version);
00040
00041 public:
00042 OutFile (const std::string& filename, const std::string& file_type, int file_version);
00043 OutFile (GenericOut *outfile, const std::string& file_type, int file_version);
00044
00045 bool
00046 open_ok()
00047 {
00048 return file != NULL;
00049 }
00050 ~OutFile();
00051
00052 void begin_section (const std::string& s);
00053 void end_section();
00054
00055 void write_int (const std::string& s, int i);
00056 void write_string (const std::string& s, const std::string& data);
00057 void write_float (const std::string& s, double f);
00058 void write_float_block (const std::string& s, const std::vector<float>& fb);
00059 void write_blob (const std::string& s, const void *data, size_t size);
00060 };
00061
00062 }
00063
00064 #endif