12 #ifndef _HFST_INPUTSTREAM_H_
13 #define _HFST_INPUTSTREAM_H_
28 namespace implementations {
30 class LogWeightInputStream;
32 class TropicalWeightInputStream;
36 class SfstInputStream;
39 class FomaInputStream;
41 #if HAVE_MY_TRANSDUCER_LIBRARY
42 class MyTransducerLibraryInputStream;
44 class HfstOlInputStream;
98 union StreamImplementation
101 hfst::implementations::SfstInputStream * sfst;
104 hfst::implementations::TropicalWeightInputStream * tropical_ofst;
106 hfst::implementations::LogWeightInputStream * log_ofst;
110 hfst::implementations::FomaInputStream * foma;
113 #if HAVE_MY_TRANSDUCER_LIBRARY
115 my_transducer_library;
118 hfst::implementations::HfstOlInputStream * hfst_ol;
122 StreamImplementation implementation;
127 std::map<std::string,std::string> props;
130 unsigned int bytes_to_skip;
132 std::string filename;
134 bool has_hfst_header;
139 bool hfst_version_2_weighted_transducer;
145 std::istream * input_stream;
154 char &stream_get(
char &c);
157 short &stream_get(
short &i);
160 unsigned short &stream_get(
unsigned short &i);
163 void stream_unget(
char c);
167 std::string stream_getstring();
171 void ignore(
unsigned int n);
175 enum TransducerType {
177 HFST_VERSION_2_WEIGHTED,
179 HFST_VERSION_2_UNWEIGHTED_WITHOUT_ALPHABET,
181 HFST_VERSION_2_UNWEIGHTED,
202 TransducerType guess_fst_type(
int &bytes_read);
203 bool read_hfst_header(
int &bytes_read);
204 bool read_library_header(
int &bytes_read);
205 int get_header_size(
int &bytes_read);
207 void process_header_data
209 bool set_implementation_specific_header_data
213 bool read_library_header_old(
int &bytes_read);
std::vector< std::pair< std::string, std::string > > StringPairVector
A vector of string pairs.
Definition: HfstDataTypes.h:106
A synchronous finite-state transducer.
Definition: HfstTransducer.h:227
ImplementationType
The type of an HfstTransducer.
Definition: HfstDataTypes.h:43
Datatypes that are needed when using the HFST API.