All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ContextMatcher< Arc, LabelT > Class Template Reference

#include <context-fst.h>

Inheritance diagram for ContextMatcher< Arc, LabelT >:
Collaboration diagram for ContextMatcher< Arc, LabelT >:

Public Types

typedef Fst< Arc > FST
 
typedef ContextFst< Arc, LabelT > ContextF
 
typedef Arc::StateId StateId
 
typedef Arc::Label Label
 
typedef Arc::Weight Weight
 

Public Member Functions

 ContextMatcher (const FST &fst, MatchType match_type)
 
 ContextMatcher (const ContextMatcher< Arc, LabelT > &matcher, bool safe)
 
virtual ~ContextMatcher ()
 
virtual const FSTGetFst () const
 
virtual ContextMatcher< Arc,
LabelT > * 
Copy (bool safe=false) const
 
virtual MatchType Type (bool test) const
 
void SetState (StateId s)
 
bool Find (Label match_label)
 
bool Done () const
 
const Arc & Value () const
 
void Next ()
 
virtual uint64 Properties (uint64 props) const
 

Private Member Functions

virtual void SetState_ (StateId s)
 
virtual bool Find_ (Label label)
 
virtual bool Done_ () const
 
virtual const Arc & Value_ () const
 
virtual void Next_ ()
 
void operator= (const SortedMatcher< FST > &)
 

Private Attributes

const FSTfst_
 
MatchType match_type_
 
Label match_label_
 
StateId s_
 
Arc arc_
 
bool ready_
 
bool current_loop_
 

Detailed Description

template<class Arc, class LabelT>
class fst::ContextMatcher< Arc, LabelT >

Definition at line 389 of file context-fst.h.

Member Typedef Documentation

typedef ContextFst<Arc, LabelT> ContextF

Definition at line 394 of file context-fst.h.

typedef Fst<Arc> FST

Definition at line 391 of file context-fst.h.

typedef Arc::Label Label

Definition at line 396 of file context-fst.h.

typedef Arc::StateId StateId

Definition at line 395 of file context-fst.h.

typedef Arc::Weight Weight

Definition at line 397 of file context-fst.h.

Constructor & Destructor Documentation

ContextMatcher ( const FST fst,
MatchType  match_type 
)
inline

Definition at line 403 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::match_type_.

404  : fst_(fst.Copy()),
405  match_label_(kNoLabel),
406  s_ (kNoStateId),
407  ready_(false) {
408  if (match_type == MATCH_OUTPUT && fst.Type() == (string)"context") {
409  match_type_ = MATCH_OUTPUT;
410  } else {
411  match_type_ = MATCH_NONE;
412  }
413  }
Definition: graph.dox:21
MatchType match_type_
Definition: context-fst.h:470
const FST * fst_
Definition: context-fst.h:469
ContextMatcher ( const ContextMatcher< Arc, LabelT > &  matcher,
bool  safe 
)
inline

Definition at line 415 of file context-fst.h.

416  : fst_(matcher.fst_->Copy(safe)),
417  match_type_(matcher.match_type_),
418  match_label_(kNoLabel),
419  s_ (kNoStateId),
420  ready_(false) {}
MatchType match_type_
Definition: context-fst.h:470
const FST * fst_
Definition: context-fst.h:469
virtual ~ContextMatcher ( )
inlinevirtual

Definition at line 422 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::fst_.

422  {
423  delete fst_;
424  }
const FST * fst_
Definition: context-fst.h:469

Member Function Documentation

virtual ContextMatcher<Arc, LabelT>* Copy ( bool  safe = false) const
inlinevirtual

Definition at line 428 of file context-fst.h.

428  {
429  return new ContextMatcher<Arc, LabelT>(*this, safe);
430  }
bool Done ( ) const
inline

Definition at line 444 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::ready_.

Referenced by ContextMatcher< Arc, LabelT >::Done_().

444  {
445  return !ready_;
446  }
virtual bool Done_ ( ) const
inlineprivatevirtual

Definition at line 465 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::Done().

465 { return Done(); }
bool Done() const
Definition: context-fst.h:444
virtual bool Find_ ( Label  label)
inlineprivatevirtual

Definition at line 464 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::Find().

464 { return Find(label); }
bool Find(Label match_label)
virtual const FST& GetFst ( ) const
inlinevirtual

Definition at line 426 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::fst_.

426 { return *fst_; }
const FST * fst_
Definition: context-fst.h:469
void Next ( )
inline

Definition at line 453 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::ready_.

Referenced by ContextMatcher< Arc, LabelT >::Next_().

453  { // we only ever get one arc so just set ready_ to false.
454  assert(ready_);
455  ready_ = false;
456  }
virtual void Next_ ( )
inlineprivatevirtual

Definition at line 467 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::Next().

467 { Next(); }
void operator= ( const SortedMatcher< FST > &  )
private
virtual uint64 Properties ( uint64  props) const
inlinevirtual

Definition at line 459 of file context-fst.h.

459 { return props; } // simple matcher that does
void SetState ( StateId  s)
inline

Definition at line 436 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::match_type_, and ContextMatcher< Arc, LabelT >::s_.

Referenced by ContextMatcher< Arc, LabelT >::SetState_().

436  {
437  if (match_type_ == MATCH_NONE)
438  LOG(FATAL) << "ContextMatcher: bad match type";
439  s_ = s;
440  }
MatchType match_type_
Definition: context-fst.h:470
virtual void SetState_ ( StateId  s)
inlineprivatevirtual

Definition at line 463 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::SetState().

463 { SetState(s); }
void SetState(StateId s)
Definition: context-fst.h:436
virtual MatchType Type ( bool  test) const
inlinevirtual

Definition at line 432 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::match_type_.

432  {
433  return match_type_;
434  }
MatchType match_type_
Definition: context-fst.h:470
const Arc& Value ( ) const
inline

Definition at line 448 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::arc_, and ContextMatcher< Arc, LabelT >::ready_.

Referenced by ContextMatcher< Arc, LabelT >::Value_().

448  {
449  assert(ready_);
450  return arc_;
451  }
virtual const Arc& Value_ ( ) const
inlineprivatevirtual

Definition at line 466 of file context-fst.h.

References ContextMatcher< Arc, LabelT >::Value().

466 { return Value(); }
const Arc & Value() const
Definition: context-fst.h:448

Member Data Documentation

Arc arc_
private

Definition at line 473 of file context-fst.h.

Referenced by ContextMatcher< Arc, LabelT >::Value().

bool current_loop_
private

Definition at line 475 of file context-fst.h.

const FST* fst_
private
Label match_label_
private

Definition at line 471 of file context-fst.h.

StateId s_
private

Definition at line 472 of file context-fst.h.

Referenced by ContextMatcher< Arc, LabelT >::SetState().


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