HtkMatrixHolder Class Reference

#include <kaldi-holder-inl.h>

Collaboration diagram for HtkMatrixHolder:

Public Types

typedef std::pair< Matrix< BaseFloat >, HtkHeaderT
 

Public Member Functions

 HtkMatrixHolder ()
 
void Clear ()
 
bool Read (std::istream &is)
 
TValue ()
 
void Swap (HtkMatrixHolder *other)
 
bool ExtractRange (const HtkMatrixHolder &other, const std::string &range)
 

Static Public Member Functions

static bool Write (std::ostream &os, bool binary, const T &t)
 
static bool IsReadInBinary ()
 

Private Member Functions

 KALDI_DISALLOW_COPY_AND_ASSIGN (HtkMatrixHolder)
 

Private Attributes

T t_
 

Detailed Description

Definition at line 757 of file kaldi-holder-inl.h.

Member Typedef Documentation

◆ T

typedef std::pair<Matrix<BaseFloat>, HtkHeader> T

Definition at line 759 of file kaldi-holder-inl.h.

Constructor & Destructor Documentation

◆ HtkMatrixHolder()

HtkMatrixHolder ( )
inline

Definition at line 761 of file kaldi-holder-inl.h.

761 {}

Member Function Documentation

◆ Clear()

void Clear ( )
inline

Definition at line 772 of file kaldi-holder-inl.h.

References KaldiObjectHolder< KaldiType >::t_.

772 { t_.first.Resize(0, 0); }

◆ ExtractRange()

bool ExtractRange ( const HtkMatrixHolder other,
const std::string &  range 
)
inline

Definition at line 794 of file kaldi-holder-inl.h.

References KaldiObjectHolder< KaldiType >::KALDI_DISALLOW_COPY_AND_ASSIGN(), and KALDI_ERR.

795  {
796  KALDI_ERR << "ExtractRange is not defined for this type of holder.";
797  return false;
798  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ IsReadInBinary()

static bool IsReadInBinary ( )
inlinestatic

Definition at line 785 of file kaldi-holder-inl.h.

785 { return true; }

◆ KALDI_DISALLOW_COPY_AND_ASSIGN()

KALDI_DISALLOW_COPY_AND_ASSIGN ( HtkMatrixHolder  )
private

◆ Read()

bool Read ( std::istream &  is)
inline

Definition at line 775 of file kaldi-holder-inl.h.

References KALDI_WARN, kaldi::ReadHtk(), and KaldiObjectHolder< KaldiType >::t_.

775  {
776  bool ans = ReadHtk(is, &t_.first, &t_.second);
777  if (!ans) {
778  KALDI_WARN << "Error detected reading HTK-format matrix.";
779  return false;
780  }
781  return ans;
782  }
#define KALDI_WARN
Definition: kaldi-error.h:150
bool ReadHtk(std::istream &is, Matrix< Real > *M_ptr, HtkHeader *header_ptr)
Extension of the HTK header.

◆ Swap()

void Swap ( HtkMatrixHolder other)
inline

Definition at line 789 of file kaldi-holder-inl.h.

References kaldi::swap(), KaldiObjectHolder< KaldiType >::t_, and HtkMatrixHolder::t_.

789  {
790  t_.first.Swap(&(other->t_.first));
791  std::swap(t_.second, other->t_.second);
792  }
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)

◆ Value()

T& Value ( )
inline

Definition at line 787 of file kaldi-holder-inl.h.

References KaldiObjectHolder< KaldiType >::t_.

787 { return t_; }

◆ Write()

static bool Write ( std::ostream &  os,
bool  binary,
const T t 
)
inlinestatic

Definition at line 763 of file kaldi-holder-inl.h.

References KALDI_ERR, KALDI_WARN, and kaldi::WriteHtk().

763  {
764  if (!binary)
765  KALDI_ERR << "Non-binary HTK-format write not supported.";
766  bool ans = WriteHtk(os, t.first, t.second);
767  if (!ans)
768  KALDI_WARN << "Error detected writing HTK-format matrix.";
769  return ans;
770  }
bool WriteHtk(std::ostream &os, const MatrixBase< Real > &M, HtkHeader htk_hdr)
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_WARN
Definition: kaldi-error.h:150

Member Data Documentation

◆ t_

T t_
private

Definition at line 802 of file kaldi-holder-inl.h.

Referenced by HtkMatrixHolder::Swap().


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