FileInputImpl Class Reference
Inheritance diagram for FileInputImpl:
Collaboration diagram for FileInputImpl:

Public Member Functions

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

Private Attributes

std::ifstream is_
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ~FileInputImpl()

virtual ~FileInputImpl ( )
inlinevirtual

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

410  {
411  // Stream will automatically be closed, and we don't care about
412  // whether it fails.
413  }

Member Function Documentation

◆ Close()

virtual int32 Close ( )
inlinevirtual

Implements InputImplBase.

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

References KALDI_ERR.

399  {
400  if (!is_.is_open())
401  KALDI_ERR << "FileInputImpl::Close(), file is not open.";
402  // I believe this error can only arise from coding error.
403  is_.close();
404  // Don't check status.
405  return 0;
406  }
std::ifstream is_
Definition: kaldi-io.cc:415
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ MyType()

virtual InputType MyType ( )
inlinevirtual

Implements InputImplBase.

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

References kaldi::kFileInput.

408 { return kFileInput; }

◆ Open()

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

Implements InputImplBase.

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

References KALDI_ERR, and MapOsPath.

383  {
384  if (is_.is_open()) KALDI_ERR << "FileInputImpl::Open(), "
385  << "open called on already open file.";
386  is_.open(MapOsPath(filename).c_str(),
387  binary ? std::ios_base::in | std::ios_base::binary
388  : std::ios_base::in);
389  return is_.is_open();
390  }
std::ifstream is_
Definition: kaldi-io.cc:415
#define MapOsPath(x)
Definition: kaldi-io.cc:36
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ Stream()

virtual std::istream& Stream ( )
inlinevirtual

Implements InputImplBase.

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

References KALDI_ERR.

392  {
393  if (!is_.is_open())
394  KALDI_ERR << "FileInputImpl::Stream(), file is not open.";
395  // I believe this error can only arise from coding error.
396  return is_;
397  }
std::ifstream is_
Definition: kaldi-io.cc:415
#define KALDI_ERR
Definition: kaldi-error.h:147

Member Data Documentation

◆ is_

std::ifstream is_
private

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


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