22 #ifndef KALDI_BASE_IO_FUNCS_H_ 23 #define KALDI_BASE_IO_FUNCS_H_ 137 template<
class T>
void WriteBasicType(std::ostream &os,
bool binary, T t);
141 template<
class T>
void ReadBasicType(std::istream &is,
bool binary, T *t);
181 const std::vector<T> &v);
190 const std::vector<std::pair<T, T> > &v);
195 std::vector<std::pair<T, T> > *v);
199 void WriteToken(std::ostream &os,
bool binary,
const char *token);
200 void WriteToken(std::ostream &os,
bool binary,
const std::string & token);
204 int Peek(std::istream &is,
bool binary);
211 void ReadToken(std::istream &is,
bool binary, std::string *token);
218 int PeekToken(std::istream &is,
bool binary);
222 void ExpectToken(std::istream &is,
bool binary,
const char *token);
223 void ExpectToken(std::istream &is,
bool binary,
const std::string & token);
228 void ExpectPretty(std::istream &is,
bool binary,
const char *token);
229 void ExpectPretty(std::istream &is,
bool binary,
const std::string & token);
245 #endif // KALDI_BASE_IO_FUNCS_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void WriteBasicType< float >(std::ostream &os, bool binary, float f)
bool InitKaldiInputStream(std::istream &is, bool *binary)
Initialize an opened stream for reading by detecting the binary header and.
void WriteIntegerPairVector(std::ostream &os, bool binary, const std::vector< std::pair< T, T > > &v)
Function for writing STL vectors of pairs of integer types.
void ExpectPretty(std::istream &is, bool binary, const char *token)
ExpectPretty attempts to read the text in "token", but only in non-binary mode.
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
void WriteBasicType< bool >(std::ostream &os, bool binary, bool b)
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure).
void ReadIntegerPairVector(std::istream &is, bool binary, std::vector< std::pair< T, T > > *v)
Function for reading STL vector of pairs of integer types.
int Peek(std::istream &is, bool binary)
Peek consumes whitespace (if binary == false) and then returns the peek() value of the stream...
void WriteBasicType< double >(std::ostream &os, bool binary, double f)
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types.
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
int PeekToken(std::istream &is, bool binary)
PeekToken will return the first character of the next token, or -1 if end of file.
void ReadBasicType< bool >(std::istream &is, bool binary, bool *b)
void WriteIntegerVector(std::ostream &os, bool binary, const std::vector< T > &v)
Function for writing STL vectors of integer types.
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
void InitKaldiOutputStream(std::ostream &os, bool binary)
InitKaldiOutputStream initializes an opened stream for writing by writing an optional binary header a...
void ReadBasicType< double >(std::istream &is, bool binary, double *d)
void ReadBasicType< float >(std::istream &is, bool binary, float *f)