10 #ifndef _HFST_INPUTSTREAM_H_
11 #define _HFST_INPUTSTREAM_H_
28 namespace implementations {
30 class LogWeightInputStream;
32 class TropicalWeightInputStream;
36 class SfstInputStream;
39 class FomaInputStream;
42 class XfsmInputStream;
44 #if HAVE_MY_TRANSDUCER_LIBRARY
45 class MyTransducerLibraryInputStream;
47 class HfstOlInputStream;
101 union StreamImplementation
104 hfst::implementations::SfstInputStream * sfst;
107 hfst::implementations::TropicalWeightInputStream * tropical_ofst;
109 hfst::implementations::LogWeightInputStream * log_ofst;
113 hfst::implementations::FomaInputStream * foma;
116 hfst::implementations::XfsmInputStream * xfsm;
119 #if HAVE_MY_TRANSDUCER_LIBRARY
121 my_transducer_library;
124 hfst::implementations::HfstOlInputStream * hfst_ol;
128 StreamImplementation implementation;
133 std::map<std::string,std::string> props;
136 unsigned int bytes_to_skip;
138 std::string filename;
140 bool has_hfst_header;
145 bool hfst_version_2_weighted_transducer;
151 std::istream * input_stream;
160 char &stream_get(
char &c);
163 short &stream_get(
short &i);
166 unsigned short &stream_get(
unsigned short &i);
169 void stream_unget(
char c);
173 std::string stream_getstring();
177 void ignore(
unsigned int n);
181 enum TransducerType {
183 HFST_VERSION_2_WEIGHTED,
185 HFST_VERSION_2_UNWEIGHTED_WITHOUT_ALPHABET,
187 HFST_VERSION_2_UNWEIGHTED,
210 TransducerType guess_fst_type(
int &bytes_read);
211 bool read_hfst_header(
int &bytes_read);
212 bool read_library_header(
int &bytes_read);
213 int get_header_size(
int &bytes_read);
215 void process_header_data
217 bool set_implementation_specific_header_data
221 bool read_library_header_old(
int &bytes_read);
255 HFSTDLL
void close(
void);
258 HFSTDLL
bool is_eof(
void);
260 HFSTDLL
bool is_bad(
void);
std::vector< std::pair< std::string, std::string > > StringPairVector
A vector of string pairs.
Definition: HfstDataTypes.h:105
A synchronous finite-state transducer.
Definition: HfstTransducer.h:253
ImplementationType
The type of an HfstTransducer.
Definition: HfstDataTypes.h:41
Datatypes that are needed when using the HFST API.