WeightMaker.hpp

Go to the documentation of this file.
00001 #ifndef wali_wfa_WEIGHT_MAKER_GUARD
00002 #define wali_wfa_WEIGHT_MAKER_GUARD 1
00003 
00004 /*!
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include "wali/Common.hpp"
00009 #include "wali/SemElem.hpp"
00010 #include "wali/wfa/ITrans.hpp"
00011 
00012 namespace wali
00013 {
00014 
00015   namespace wfa
00016   {
00017     /*!
00018      * @class WeightMaker
00019      *
00020      * This class defines the interface for joining the weights
00021      * on WFA transitions during WFA intersection.
00022      *
00023      * @see wali::sem_elem_t
00024      * @see wali::wfa::WFA
00025      */
00026     class WeightMaker
00027     {
00028       public:
00029         virtual ~WeightMaker() {}
00030         virtual sem_elem_t make_weight( sem_elem_t lhs, sem_elem_t rhs ) = 0;
00031         virtual sem_elem_t make_weight( ITrans *lhs, ITrans *rhs);
00032 
00033     }; // WeightMaker
00034 
00035     /*!
00036      * @class KeepLeft
00037      *
00038      * This class joins the weights by ignoring the second parameter
00039      * (rhs).
00040      *
00041      * @see wali::wfa::WeightMaker
00042      * @see wali::sem_elem_t
00043      */
00044     class KeepLeft : public WeightMaker
00045     {
00046       public:
00047         KeepLeft() {}
00048         virtual ~KeepLeft() {}
00049         virtual sem_elem_t make_weight( sem_elem_t lhs, sem_elem_t rhs );
00050         virtual sem_elem_t make_weight( ITrans *lhs, ITrans *rhs) {
00051             return this->WeightMaker::make_weight(lhs, rhs);
00052         }
00053     }; // KeepLeft
00054 
00055     /*!
00056      * @class KeepRight
00057      *
00058      * This class joins the weights by ignoring the second parameter
00059      * (rhs).
00060      *
00061      * @see wali::wfa::WeightMaker
00062      * @see wali::sem_elem_t
00063      */
00064     class KeepRight : public WeightMaker
00065     {
00066       public:
00067         KeepRight() {}
00068         virtual ~KeepRight() {}
00069         virtual sem_elem_t make_weight( sem_elem_t lhs, sem_elem_t rhs );
00070         virtual sem_elem_t make_weight( ITrans *lhs, ITrans *rhs) {
00071             return this->WeightMaker::make_weight(lhs, rhs);
00072         }
00073     }; // KeepRight
00074 
00075     /*!
00076      * @class KeepBoth
00077      *
00078      * This class joins the weights by pairing them.
00079      *
00080      * @see wali::wfa::WeightMaker
00081      * @see wali::sem_elem_t
00082      * @see wali::SemElemPair
00083      */
00084     class KeepBoth : public WeightMaker
00085     {
00086       public:
00087         KeepBoth() {}
00088         virtual ~KeepBoth() {}
00089         virtual sem_elem_t make_weight( sem_elem_t lhs, sem_elem_t rhs );
00090         virtual sem_elem_t make_weight( ITrans *lhs, ITrans *rhs) {
00091             return this->WeightMaker::make_weight(lhs, rhs);
00092         }
00093     }; // KeepBoth
00094 
00095   } // namespace wfa
00096 
00097 } // namespace wfa
00098 
00099 #endif  // wali_wfa_WEIGHT_MAKER_GUARD
00100