1 #ifndef MSP_DATAFILE_BINARYWRITER_H_
2 #define MSP_DATAFILE_BINARYWRITER_H_
7 #include "writermode.h"
13 Writes data in binary format.
15 class BinaryWriter: public WriterMode
18 typedef std::map<StatementKey, int> Dictionary;
19 typedef std::map<std::string, unsigned> StringMap;
22 unsigned next_kwd_id = 1;
24 unsigned next_str_id = 1;
25 unsigned float_precision = 32;
28 BinaryWriter(Output &o);
30 void set_float_precision(unsigned) override;
31 void write(const Statement &st) override;
33 void write_(const Statement &st);
34 void collect_keywords(const Statement &st);
35 void write_int(IntType::Store n);
36 void write_string(const StringType::Store &s);
37 void write_float(FloatType::Store f);
38 void write_symbol(const SymbolType::Store &s);
41 } // namespace DataFile