| 1 | // -*- c++ -*-cxx . . $ `<file>/libbrial/include/polybori/routines/pbori_routines_cuddext.h`/ |
| 2 | //***************************************************************************** |
| 3 | /** @file pbori_routines_cuddext.h |
| 4 | * |
| 5 | * @author Alexander Dreyer |
| 6 | * @date 2006-08-23 |
| 7 | * |
| 8 | * This file includes files, which define function templates related to |
| 9 | * decision diagrams. It should be loaded from pbori_routines.h only |
| 10 | * |
| 11 | * @par Copyright: |
| 12 | * (c) 2006-2010 by The PolyBoRi Team |
| 13 | * |
| 14 | **/ |
| 15 | //***************************************************************************** |
| 16 | |
| 17 | #ifndef polybori_routines_pbori_routines_cuddext_h_ |
| 18 | #define polybori_routines_pbori_routines_cuddext_h_cxx . . $ `libbrial/include/polybori/routines/pbori_routines_cuddext.h:18:9`! |
| 19 | |
| 20 | // include basic definitions |
| 21 | #include <polybori/pbori_defs.h>cxx . . $ `<file>/libbrial/include/polybori/pbori_defs.h`/ |
| 22 | #include <map> |
| 23 | |
| 24 | |
| 25 | BEGIN_NAMESPACE_PBORIcxx . . $ polybori/ |
| 26 | |
| 27 | /// Other routines currently at external public header file pbori_algo.h |
| 28 | |
| 29 | /// Function template |
| 30 | template<class MapType, class NaviType> |
| 31 | inline typename MapType::mapped_type |
| 32 | dd_long_count_stepcxx . . $ polybori/dd_long_count_step(b04b9fc7a8d109d3).(MapType& cache, NaviType navi) { |
| 33 | |
| 34 | if(navi.isConstant()) |
| 35 | return navi.terminalValue(); |
| 36 | |
| 37 | { |
| 38 | typename MapType::iterator iter = cache.find(navi); |
| 39 | if (iter != cache.end()) |
| 40 | return iter->second; |
| 41 | } |
| 42 | |
| 43 | return cache[navi] = |
| 44 | dd_long_count_stepcxx . . $ polybori/dd_long_count_step(b04b9fc7a8d109d3).(cache, navi.thenBranch()) + |
| 45 | dd_long_count_stepcxx . . $ polybori/dd_long_count_step(b04b9fc7a8d109d3).(cache, navi.elseBranch()); |
| 46 | } |
| 47 | |
| 48 | /// Function template for generically computing number of terms |
| 49 | template <class IntType, class NaviType> |
| 50 | inline IntType |
| 51 | dd_long_countcxx . . $ polybori/dd_long_count(6510c324ac8ecfb4).(NaviType navi) { |
| 52 | |
| 53 | stdcxx . . $ std/::mapcxx . . $ std/map#<NaviType, IntType> local_cache; |
| 54 | return dd_long_count_stepcxx . . $ polybori/dd_long_count_step(b04b9fc7a8d109d3).(local_cache, navi); |
| 55 | } |
| 56 | template <class IntType, class NaviType> |
| 57 | inline IntType |
| 58 | dd_long_count_without_cachecxx . . $ polybori/dd_long_count_without_cache(6510c324ac8ecfb4).(NaviType navi) { |
| 59 | if(navi.isConstant()) |
| 60 | return navi.terminalValue(); |
| 61 | |
| 62 | return dd_long_countcxx . . $ polybori/dd_long_count(6510c324ac8ecfb4).<IntType, NaviType>(navi.thenBranch()) + |
| 63 | dd_long_countcxx . . $ polybori/dd_long_count(6510c324ac8ecfb4).<IntType, NaviType>(navi.elseBranch()); |
| 64 | } |
| 65 | |
| 66 | END_NAMESPACE_PBORIcxx . . $ `libbrial/include/polybori/pbori_defs.h:77:11`! |
| 67 | |
| 68 | #endif |