00001 // -*- c++ -*- 00002 //***************************************************************************** 00015 //***************************************************************************** 00016 00017 #ifndef polybori_groebner_PairManagerFacade_h_ 00018 #define polybori_groebner_PairManagerFacade_h_ 00019 00020 #include "PairStatusSet.h" 00021 00022 00023 // include basic definitions 00024 #include "groebner_defs.h" 00025 #include "PairManager.h" 00026 00027 BEGIN_NAMESPACE_PBORIGB 00028 00040 template <class StrategyType> 00041 class PairManagerWithStrategy: 00042 public PairManager { 00043 00044 public: 00045 PairManagerWithStrategy(const PairManager& mgr, StrategyType& strategy): 00046 PairManager(mgr), m_strategy(strategy) { } 00047 00049 using PairManager::cleanTopByChainCriterion; 00050 00052 void cleanTopByChainCriterion() { cleanTopByChainCriterion(m_strategy); } 00053 00055 void introducePair(const Pair& pair) { introducePair(pair, isHFE()); }; 00056 00058 using PairManager::introducePair; 00059 00060 protected: 00061 bool isHFE() const { return m_strategy.optHFE; } 00062 00063 private: 00064 StrategyType& m_strategy; 00065 }; 00066 00078 template <class StrategyType> 00079 class PairManagerFacade { 00080 typedef PairManagerFacade self; 00081 typedef StrategyType strategy_type; 00082 00083 public: 00084 00085 PairManagerFacade(const BoolePolyRing& ring): 00086 pairs(ring, get()) {} 00087 00088 PairManagerFacade(const self& rhs): 00089 pairs(rhs.pairs, get()) { } 00090 00091 void cleanTopByChainCriterion() { pairs.cleanTopByChainCriterion(get()); } 00092 void introducePair(const Pair& pair) { pairs.introducePairs(pair, isHFE()); } 00093 00095 PairManagerWithStrategy<strategy_type> pairs; 00096 00097 private: 00098 bool isHFE() const { return get().optHFE; } 00099 strategy_type& get() { return static_cast<strategy_type&>(*this); } 00100 }; 00101 00102 END_NAMESPACE_PBORIGB 00103 00104 #endif /* polybori_groebner_PairManagerFacade_h_ */