00001 // -*- c++ -*- 00002 //***************************************************************************** 00052 //***************************************************************************** 00053 00054 // include basic definitions 00055 #include "pbori_defs.h" 00056 00057 // get addition definitions 00058 #include "CTermIter.h" 00059 #include "PBoRiOutIter.h" 00060 #include <set> 00061 #include <vector> 00062 00063 00064 BEGIN_NAMESPACE_PBORI 00065 00067 template<class DDType, class OutputType> 00068 OutputType 00069 dd_last_lexicographical_term(const DDType& dd, type_tag<OutputType>) { 00070 00071 typedef typename DDType::idx_type idx_type; 00072 typedef typename DDType::size_type size_type; 00073 typedef OutputType term_type; 00074 00075 term_type result(dd.ring()); 00076 00077 assert(!dd.emptiness()); 00078 00079 size_type nlen = std::distance(dd.lastBegin(), dd.lastEnd()); 00080 00081 // store indices in list 00082 std::vector<idx_type> indices(nlen); 00083 00084 // iterator, which uses changeAssign to insert variable 00085 // wrt. given indices to a monomial 00086 PBoRiOutIter<term_type, idx_type, change_assign<term_type> > 00087 outiter(result); 00088 00089 // insert backward (for efficiency reasons) 00090 reversed_inter_copy(dd.lastBegin(), dd.lastEnd(), indices, outiter); 00091 00092 return result; 00093 } 00094 00095 00096 END_NAMESPACE_PBORI