aboutsummaryrefslogtreecommitdiff
path: root/src/include/fst/fst.h
diff options
context:
space:
mode:
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>2013-03-04 11:30:34 +0000
committerPrzemyslaw Szczepaniak <pszczepaniak@google.com>2013-03-04 11:30:34 +0000
commit5bf56ba7027cd5f22ff52d0138893f7a585135fb (patch)
tree19e17fc79b8873e66f211276d4dd169c480cede1 /src/include/fst/fst.h
parent3da1eb108d36da35333b2d655202791af854996b (diff)
parent5b6dc79427b8f7eeb6a7ff68034ab8548ce670ea (diff)
downloadopenfst-idea133-weekly-release.tar.gz
Diffstat (limited to 'src/include/fst/fst.h')
-rw-r--r--src/include/fst/fst.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/include/fst/fst.h b/src/include/fst/fst.h
index dd11e4f..150fc4e 100644
--- a/src/include/fst/fst.h
+++ b/src/include/fst/fst.h
@@ -53,6 +53,11 @@ template <class A> class ArcIteratorData;
template <class A> class MatcherBase;
struct FstReadOptions {
+ // FileReadMode(s) are advisory, there are many conditions than prevent a
+ // file from being mapped, READ mode will be selected in these cases with
+ // a warning indicating why it was chosen.
+ enum FileReadMode { READ, MAP };
+
string source; // Where you're reading from
const FstHeader *header; // Pointer to Fst header. If non-zero, use
// this info (don't read a stream header)
@@ -60,19 +65,20 @@ struct FstReadOptions {
// this info (read and skip stream isymbols)
const SymbolTable* osymbols; // Pointer to output symbols. If non-zero, use
// this info (read and skip stream osymbols)
+ FileReadMode mode; // Read or map files (advisory, if possible)
- explicit FstReadOptions(const string& src = "<unspecfied>",
+ explicit FstReadOptions(const string& src = "<unspecified>",
const FstHeader *hdr = 0,
const SymbolTable* isym = 0,
- const SymbolTable* osym = 0)
- : source(src), header(hdr), isymbols(isym), osymbols(osym) {}
+ const SymbolTable* osym = 0);
explicit FstReadOptions(const string& src,
const SymbolTable* isym,
- const SymbolTable* osym = 0)
- : source(src), header(0), isymbols(isym), osymbols(osym) {}
-};
+ const SymbolTable* osym = 0);
+ // Helper function to convert strings FileReadModes into their enum value.
+ static FileReadMode ReadMode(const string &mode);
+};
struct FstWriteOptions {
string source; // Where you're writing to