StandardInputImpl Class Reference
Inheritance diagram for StandardInputImpl:
Collaboration diagram for StandardInputImpl:

Public Member Functions

 StandardInputImpl ()
 
virtual bool Open (const std::string &filename, bool binary)
 
virtual std::istream & Stream ()
 
virtual InputType MyType ()
 
virtual int32 Close ()
 
virtual ~StandardInputImpl ()
 
- Public Member Functions inherited from InputImplBase
virtual ~InputImplBase ()
 

Private Attributes

bool is_open_
 

Detailed Description

Definition at line 419 of file kaldi-io.cc.

Constructor & Destructor Documentation

◆ StandardInputImpl()

StandardInputImpl ( )
inline

Definition at line 421 of file kaldi-io.cc.

421 : is_open_(false) { }

◆ ~StandardInputImpl()

virtual ~StandardInputImpl ( )
inlinevirtual

Definition at line 448 of file kaldi-io.cc.

448 { }

Member Function Documentation

◆ Close()

virtual int32 Close ( )
inlinevirtual

Implements InputImplBase.

Definition at line 443 of file kaldi-io.cc.

References KALDI_ERR.

443  {
444  if (!is_open_) KALDI_ERR << "StandardInputImpl::Close(), file is not open.";
445  is_open_ = false;
446  return 0;
447  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ MyType()

virtual InputType MyType ( )
inlinevirtual

Implements InputImplBase.

Definition at line 441 of file kaldi-io.cc.

References kaldi::kStandardInput.

◆ Open()

virtual bool Open ( const std::string &  filename,
bool  binary 
)
inlinevirtual

Implements InputImplBase.

Definition at line 423 of file kaldi-io.cc.

References KALDI_ERR.

423  {
424  if (is_open_) KALDI_ERR << "StandardInputImpl::Open(), "
425  "open called on already open file.";
426  is_open_ = true;
427 #ifdef _MSC_VER
428  _setmode(_fileno(stdin), binary ? _O_BINARY : _O_TEXT);
429 #endif
430  return true; // Don't check good() because would be false if
431  // eof, which may be valid input.
432  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ Stream()

virtual std::istream& Stream ( )
inlinevirtual

Implements InputImplBase.

Definition at line 434 of file kaldi-io.cc.

References KALDI_ERR.

434  {
435  if (!is_open_)
436  KALDI_ERR << "StandardInputImpl::Stream(), object not initialized.";
437  // I believe this error can only arise from coding error.
438  return std::cin;
439  }
#define KALDI_ERR
Definition: kaldi-error.h:147

Member Data Documentation

◆ is_open_

bool is_open_
private

Definition at line 450 of file kaldi-io.cc.


The documentation for this class was generated from the following file: