10 #ifndef _HFST_OUTPUTSTREAM_H_
11 #define _HFST_OUTPUTSTREAM_H_
27 namespace implementations {
30 class LogWeightOutputStream;
32 class TropicalWeightOutputStream;
35 class SfstOutputStream;
38 class FomaOutputStream;
41 class XfsmOutputStream;
43 #if HAVE_MY_TRANSDUCER_LIBRARY
44 class MyTransducerLibraryOutputStream;
46 class HfstOlOutputStream;
73 union StreamImplementation
77 hfst::implementations::LogWeightOutputStream * log_ofst;
79 hfst::implementations::TropicalWeightOutputStream * tropical_ofst;
82 hfst::implementations::SfstOutputStream * sfst;
85 hfst::implementations::FomaOutputStream * foma;
88 hfst::implementations::XfsmOutputStream * xfsm;
91 #if HAVE_MY_TRANSDUCER_LIBRARY
93 my_transducer_library;
96 hfst::implementations::HfstOlOutputStream * hfst_ol;
101 StreamImplementation implementation;
104 void write(
const std::string &s);
105 void write(
const std::vector<char> &s);
106 void write(
const char &c);
112 static void append(std::vector<char> &str,
const std::string &s);
115 void append_hfst_header_data(std::vector<char> &header);
118 void append_implementation_specific_header_data
147 HFSTDLL HfstOutputStream &
flush();
170 HFSTDLL
void close(
void);
HFSTDLL ~HfstOutputStream(void)
Destructor.
Definition: HfstOutputStream.cc:153
A synchronous finite-state transducer.
Definition: HfstTransducer.h:253
HFSTDLL HfstOutputStream & flush()
Flush the stream.
Definition: HfstOutputStream.cc:338
A skeleton class for writing a new type of binary transducers to a stream.
Definition: MyTransducerLibraryTransducer.h:112
ImplementationType
The type of an HfstTransducer.
Definition: HfstDataTypes.h:41
A stream for writing binary transducers.
Definition: HfstOutputStream.h:70
HFSTDLL HfstOutputStream(ImplementationType type, bool hfst_format=true)
Create a stream to standard output for writing binary transducers of type type. hfst_format defines w...
Definition: HfstOutputStream.cc:21
Datatypes that are needed when using the HFST API.
HFSTDLL void close(void)
Close the stream.
Definition: HfstOutputStream.cc:497
HFSTDLL HfstOutputStream & redirect(HfstTransducer &transducer)
An alias for operator<<.
Definition: HfstOutputStream.cc:351
HFSTDLL HfstOutputStream & operator<<(HfstTransducer &transducer)
Write the transducer transducer in binary format to the stream.
Definition: HfstOutputStream.cc:356