164 #define HAVE_HASH_MAP 1
166 # include <ext/hash_map>
171 #ifndef pbori_func_h_
172 #define pbori_func_h_
178 template <
class ListType,
class ValueType =
typename ListType::value_type >
184 theList.push_back(elt);
191 template <
class RhsType,
class LhsType =
typename RhsType::
idx_type >
195 RhsType operator() (
const RhsType& rhs,
const LhsType& lhs)
const {
196 return (rhs.change(lhs));
203 template <
class RhsType = void,
209 template <
class RhsType,
class LhsType>
213 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
214 return (rhs.changeAssign(lhs));
225 template <
class RhsType,
class LhsType>
226 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
227 return (rhs.changeAssign(lhs));
234 template <
class RhsType,
class LhsType =
typename RhsType::
idx_type>
238 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
239 (rhs.subset1Assign(lhs));
246 template <
class RhsType,
class LhsType>
250 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
251 return (rhs.subset0Assign(lhs));
256 template <
class RhsType,
259 public std::binary_function<RhsType&, const LhsType&, RhsType&> {
262 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
263 return (rhs.uniteAssign(lhs));
275 template <
unsigned int ITH,
unsigned int NLEN = ITH>
280 template <
unsigned int NLEN>
285 template <
class ValueType>
286 void operator() (
const ValueType&, ...)
const { }
291 template <
unsigned int NLEN>
296 template <
class ValueType>
297 const ValueType& operator() (
const ValueType& value, ...)
const {
302 template <
class ValueType>
303 ValueType& operator() (ValueType& value, ...)
const {
311 template <
unsigned int NLEN>
316 template <
class FirstType,
class ValueType>
318 operator() (
const FirstType&,
const ValueType& value, ...)
const {
323 template <
class FirstType,
class ValueType>
324 ValueType& operator() (
const FirstType&, ValueType& value, ...)
const {
332 template <
unsigned int NLEN>
337 template <
class FirstType,
class SecondType,
class ValueType>
339 operator() (
const FirstType&,
const SecondType&,
340 const ValueType& value, ...)
const {
345 template <
class FirstType,
class SecondType,
class ValueType>
346 ValueType& operator() (
const FirstType&,
const SecondType&,
347 ValueType& value, ...)
const {
376 template <
class Type>
377 const self&
operator=(
const Type&)
const {
return *
this;}
394 template <
class IntType, IntType INTCONST,
class ResultType = IntType>
404 template <
class BinaryOp,
class FirstOp,
class SecondOp>
421 base(binop), first_op(unop1), second_op(unop2) {}
427 template <
class FirstType,
class SecondType>
429 const SecondType& second)
const {
430 return base::operator()(first_op(first), second_op(second));
434 template <
class FirstType,
class SecondType>
436 const SecondType& second)
const {
437 return base::operator()(first_op(first), second_op(second));
441 template <
class FirstType,
class SecondType>
443 SecondType& second)
const {
444 return base::operator()(first_op(first), second_op(second));
455 template <
class BinaryOp,
class UnaryOperation>
472 base(binop, unop, unop) {}
477 template<
class ValueType>
483 return max = std::max(max, val);
492 template <
class DDType>
499 #ifdef PBORI_ADD_BY_ITE
500 lhs.iteAssign(lhs.diff(rhs), rhs);
502 # elif defined(PBORI_ADD_BY_OR)
503 (lhs = (lhs.diff(rhs)).unite(rhs.diff(lhs)));
505 # elif defined(PBORI_ADD_BY_UNION)
506 (lhs = lhs.unite(rhs).diff( lhs.intersect(rhs) ) );
507 # elif defined(PBORI_ADD_BY_EXTRA_XOR) || defined(PBORI_ADD_BY_XOR)
508 (lhs = lhs.Xor(rhs));
515 template <
class DDType,
class IdxType =
typename DDType::
idx_type>
522 DDType tmp( lhs.subset0(idx) );
537 template <
class DDType,
class IdxType =
typename DDType::
idx_type>
543 lhs.uniteAssign( lhs.change(idx) );
567 template <
class RhsType = void,
571 template <
class RhsType,
class LhsType>
573 public std::binary_function<RhsType&, const LhsType&, RhsType&> {
576 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
585 template <
class RhsType,
class LhsType>
586 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
595 template <
class RhsType = void,
599 template <
class RhsType,
class LhsType>
601 public std::binary_function<RhsType&, const LhsType&, RhsType&> {
604 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
605 rhs.insertAssign(lhs);
613 template <
class RhsType,
class LhsType>
614 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
615 rhs.insertAssign(lhs);
624 template <
class RhsType = void,
629 template <
class RhsType,
class LhsType>
631 public std::binary_function<RhsType&, const LhsType&, RhsType&> {
634 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
645 template <
class RhsType,
class LhsType>
646 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
654 template <
class RhsType = void,
659 template <
class RhsType,
class LhsType>
661 public std::binary_function<RhsType&, const LhsType&, RhsType&> {
664 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
665 rhs.removeAssign(lhs);
675 template <
class RhsType,
class LhsType>
676 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
677 rhs.removeAssign(lhs);
684 template <
class ListType,
class RhsType,
class LhsType>
689 theList(theList__) {};
691 RhsType& operator() (RhsType& rhs,
const LhsType& lhs)
const {
704 template <
class Type1,
class Type2>
707 template <
class Type>
711 template <
class Type1,
class Type2>
719 template <
class Type1,
class Type2,
class ThenType,
class ElseType>
722 template <
class Type,
class ThenType,
class ElseType>
728 template <
class Type1,
class Type2,
class ThenType,
class ElseType>
746 template <
class Type>
757 template <
class Type>
768 template <
class Type>
775 typedef __gnu_cxx::hash_map<Type, idx_type, hashes<Type> >
type;
777 typedef std::map<Type, idx_type>
type;
784 template <
class ListType>
786 public std::binary_function<const ListType&, const ListType&, bool> {
789 bool operator()(
const ListType& lhs,
const ListType& rhs)
const {
790 return (lhs.size() < rhs.size());
797 template <
class BiIterator>
809 typedef typename std::iterator_traits<iterator>::difference_type
811 typedef typename std::iterator_traits<iterator>::pointer
pointer;
812 typedef typename std::iterator_traits<iterator>::reference
reference;
813 typedef typename std::iterator_traits<iterator>::value_type
value_type;
839 return m_iter == rhs.m_iter;
843 return m_iter != rhs.m_iter;
854 template <
class DDType>
856 public std::unary_function<DDType, typename DDType::navigator> {
865 typedef std::unary_function<dd_type, navigator>
base;
869 return rhs.navigation();
875 template <
class ValueType>
886 template <
template<
class>
class BindType,
class BinaryFunction,
887 class ValueType,
class ConstantOp>
889 public BindType<BinaryFunction>{
900 template <
class BinaryFunction,
class ConstantOp>
903 typename BinaryFunction::second_argument_type,
908 template <
class BinaryFunction,
class ConstantOp>
911 typename BinaryFunction::first_argument_type,
915 template <
template<
class>
class BindType,
916 class BinaryFunction,
class ValueType>
918 public BindType<BinaryFunction>{
928 template <
class BinaryFunction>
931 typename BinaryFunction::second_argument_type> {
934 typename BinaryFunction::second_argument_type>
941 template <
class BinaryFunction>
944 typename BinaryFunction::first_argument_type> {
965 template <
class ManagerType,
967 class VarNameType =
typename ManagerType::const_varname_reference>
979 return m_mgr.getName(idx);
987 template <
class MapType,
class VariableType,
class TermType,
class NodeType>
999 return ((TermType)VariableType(m_map[idx]))*first + second;
1005 const map_type& m_map;
1013 template <
class NewType>
1018 template <
class DDType>
1023 return rhs.getNode();
1027 template<
unsigned ErrorNumber = CUDD_INTERNAL_ERROR>
1045 reinterpret_cast<const handle_error<ErrorNumber - 1
>&>(*this)(err);