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