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 00068 template<class DDType, class OutputType> 00069 OutputType 00070 dd_last_lexicographical_term(const DDType& dd, type_tag<OutputType>) { 00071 00072 typedef typename DDType::idx_type idx_type; 00073 typedef typename DDType::size_type size_type; 00074 typedef OutputType term_type; 00075 00076 term_type result(dd.ring()); 00077 00078 assert(!dd.emptiness()); 00079 00080 size_type nlen = std::distance(dd.lastBegin(), dd.lastEnd()); 00081 00082 // store indices in list 00083 std::vector<idx_type> indices(nlen); 00084 00085 // iterator, which uses changeAssign to insert variable 00086 // wrt. given indices to a monomial 00087 PBoRiOutIter<term_type, idx_type, change_assign<term_type> > 00088 outiter(result); 00089 00090 // insert backward (for efficiency reasons) 00091 reversed_inter_copy(dd.lastBegin(), dd.lastEnd(), indices, outiter); 00092 00093 return result; 00094 } 00095 00096 00097 END_NAMESPACE_PBORI