HFST - Helsinki Finite-State Transducer Technology - C++ API
version 3.9.1
|
A stream for writing binary transducers. More...
#include <HfstOutputStream.h>
Public Member Functions | |
HFSTDLL void | close (void) |
Close the stream. More... | |
HFSTDLL HfstOutputStream & | flush () |
Flush the stream. More... | |
HFSTDLL | HfstOutputStream (ImplementationType type, bool hfst_format=true) |
Create a stream to standard output for writing binary transducers of type type. hfst_format defines whether transducers are written in hfst format or as such in their backend format. More... | |
HFSTDLL | HfstOutputStream (const std::string &filename, ImplementationType type, bool hfst_format=true) |
Open a stream to file filename for writing binary transducers of type type. hfst_format defines whether transducers are written in hfst format or as such in their backend format. More... | |
HFSTDLL HfstOutputStream & | operator<< (HfstTransducer &transducer) |
Write the transducer transducer in binary format to the stream. More... | |
HFSTDLL HfstOutputStream & | redirect (HfstTransducer &transducer) |
An alias for operator<<. More... | |
HFSTDLL | ~HfstOutputStream (void) |
Destructor. More... | |
A stream for writing binary transducers.
An example:
#include "HfstOutputStream.h" ... // Write three HFST transducers in binary format to file named "testfile" HfstOutputStream out("testfile", FOMA_TYPE); out << foma_transducer1 << foma_transducer2 << foma_transducer3; out.close();
For more information on HFST transducer structure, see this page.
HfstOutputStream | ( | ImplementationType | type, |
bool | hfst_format = true |
||
) |
Create a stream to standard output for writing binary transducers of type type. hfst_format defines whether transducers are written in hfst format or as such in their backend format.
HfstOutputStream | ( | const std::string & | filename, |
ImplementationType | type, | ||
bool | hfst_format = true |
||
) |
Open a stream to file filename for writing binary transducers of type type. hfst_format defines whether transducers are written in hfst format or as such in their backend format.
If the file exists, it is overwritten.
~HfstOutputStream | ( | void | ) |
Destructor.
void close | ( | void | ) |
Close the stream.
If the stream points to standard output, nothing is done.
HfstOutputStream & flush | ( | ) |
Flush the stream.
If the stream is of XFSM_TYPE, all transducers inserted with the operator<< are actually written to the stream. Else, does nothing.
HfstOutputStream & operator<< | ( | HfstTransducer & | transducer | ) |
Write the transducer transducer in binary format to the stream.
All transducers must have the same type as the stream, else a TransducerTypeMismatchException is thrown.
If the stream is of XFSM_TYPE, transducer is stored to a list and written when flush() is called for the stream.
TransducerTypeMismatchException |
HfstOutputStream & redirect | ( | HfstTransducer & | transducer | ) |
An alias for operator<<.