15 #ifndef TASK_HIFST_RTN_HPP 16 #define TASK_HIFST_RTN_HPP 36 typedef typename Arc::Label Label;
37 typedef std::unordered_map< Label , boost::shared_ptr< fst::Fst<Arc> > >
41 hifst_rtn_t rtn_ , rtn2_;
48 inline fst::Fst<Arc> *
operator() (
const unsigned cc,
const unsigned x,
const unsigned y ) {
50 typename hifst_rtn_t::iterator itx = rtn_.find ( hieroindex );
51 if ( itx != rtn_.end() )
52 return itx->second.get();
57 inline void Add (
const unsigned cc,
61 fst::Fst<Arc> *fst2 = NULL) {
63 rtn_[hieroindex] = boost::shared_ptr<fst::Fst<Arc> > ( fst );
65 rtn2_[hieroindex] = boost::shared_ptr<fst::Fst<Arc> > ( fst2 );
68 inline void Add (
const unsigned cc,
71 boost::shared_ptr< fst::Fst<Arc> >
fst ,
72 boost::shared_ptr< fst::Fst<Arc> > fst2 ) {
74 rtn_[hieroindex] =
fst;
75 rtn2_[hieroindex] = fst2;
84 inline std::size_t
size() {
89 ZDISALLOW_COPY_AND_ASSIGN (
RTN );
95 #endif //TASK_HIFST_RTN_HPP
std::size_t size()
Returns size (number of FSAs) in the RTN/cyk grid.
Convenience class that stores pointers to cell FSAs. These pointers are organized through a hash usin...
fst::Fst< Arc > * operator()(const unsigned cc, const unsigned x, const unsigned y)
If exists, returns pointer FSA for a given key. Otherwise returns NULL.
void Add(const unsigned cc, const unsigned x, const unsigned y, fst::Fst< Arc > *fst, fst::Fst< Arc > *fst2=NULL)
Adds a new cell fsa to the rtn for coordinates cc,x,y, takes ownership of the pointer. fst is the pointer arc and fst2 contains the pointee fst.
void Add(const unsigned cc, const unsigned x, const unsigned y, boost::shared_ptr< fst::Fst< Arc > > fst, boost::shared_ptr< fst::Fst< Arc > > fst2)
Adds a new cell fsa to the rtn for coordinates cc,x,y.