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 330 of file context-fst.h.

Member Typedef Documentation

typedef ContextFst<Arc, LabelT> ContextF

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

typedef Fst<Arc> FST

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

typedef Arc::Label Label

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

typedef Arc::StateId StateId

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

typedef Arc::Weight Weight

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

Constructor & Destructor Documentation

ContextMatcher ( const FST fst,
MatchType  match_type 
)
inline

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

References ContextMatcher< Arc, LabelT >::match_type_.

345  : fst_(fst.Copy()),
346  match_label_(kNoLabel),
347  s_ (kNoStateId),
348  ready_(false) {
349  if (match_type == MATCH_OUTPUT && fst.Type() == (string)"context") {
350  match_type_ = MATCH_OUTPUT;
351  } else {
352  match_type_ = MATCH_NONE;
353  }
354  }
Definition: graph.dox:21
MatchType match_type_
Definition: context-fst.h:411
const FST * fst_
Definition: context-fst.h:410
ContextMatcher ( const ContextMatcher< Arc, LabelT > &  matcher,
bool  safe 
)
inline

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

357  : fst_(matcher.fst_->Copy(safe)),
358  match_type_(matcher.match_type_),
359  match_label_(kNoLabel),
360  s_ (kNoStateId),
361  ready_(false) {}
MatchType match_type_
Definition: context-fst.h:411
const FST * fst_
Definition: context-fst.h:410
virtual ~ContextMatcher ( )
inlinevirtual

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

References ContextMatcher< Arc, LabelT >::fst_.

363  {
364  delete fst_;
365  }
const FST * fst_
Definition: context-fst.h:410

Member Function Documentation

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

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

369  {
370  return new ContextMatcher<Arc, LabelT>(*this, safe);
371  }
bool Done ( ) const
inline

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

References ContextMatcher< Arc, LabelT >::ready_.

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

385  {
386  return !ready_;
387  }
virtual bool Done_ ( ) const
inlineprivatevirtual

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

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

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

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

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

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

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

References ContextMatcher< Arc, LabelT >::fst_.

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

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

References ContextMatcher< Arc, LabelT >::ready_.

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

394  { // we only ever get one arc so just set ready_ to false.
395  assert(ready_);
396  ready_ = false;
397  }
virtual void Next_ ( )
inlineprivatevirtual

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

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

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

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

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

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

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

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

377  {
378  if (match_type_ == MATCH_NONE)
379  LOG(FATAL) << "ContextMatcher: bad match type";
380  s_ = s;
381  }
MatchType match_type_
Definition: context-fst.h:411
virtual void SetState_ ( StateId  s)
inlineprivatevirtual

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

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

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

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

References ContextMatcher< Arc, LabelT >::match_type_.

373  {
374  return match_type_;
375  }
MatchType match_type_
Definition: context-fst.h:411
const Arc& Value ( ) const
inline

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

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

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

389  {
390  assert(ready_);
391  return arc_;
392  }
virtual const Arc& Value_ ( ) const
inlineprivatevirtual

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

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

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

Member Data Documentation

Arc arc_
private

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

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

bool current_loop_
private

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

const FST* fst_
private
Label match_label_
private

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

StateId s_
private

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

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


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