00001 #ifndef common_HPP
00002 #define common_HPP
00003
00005 #ifdef TRACE
00006 #define DINLINE
00007 #else
00008 #define DINLINE __attribute__((always_inline))
00009 #endif //TRACE
00010
00011 #define NOINLINE __attribute__((noinline))
00012
00014 #define TYPENAME typename
00015
00016 #include <vector>
00017 #include <algorithm>
00018 #include <functional>
00019 #include <limits>
00020 #include <inttypes.h>
00021
00032 typedef unsigned int item_t;
00033
00034
00035
00036 const unsigned int largest_itemsetsize =
00037 std::numeric_limits<unsigned int>::max();
00038
00039 class itemvector : public std::vector<item_t>
00040 {
00041 public:
00042 bool haveSamePrefix(const itemvector& other) const
00043 {
00044 return std::equal(
00045 std::vector<item_t>::begin(), std::vector<item_t>::end()-1,
00046 other.begin());
00047 }
00048 bool isContained(std::vector<item_t>::const_iterator transaction_beg,
00049 std::vector<item_t>::const_iterator transaction_end) const
00050 {
00051 return std::includes(
00052 transaction_beg, transaction_end,
00053 std::vector<item_t>::begin(), std::vector<item_t>::end() );
00054 }
00055 bool isContained(const std::vector<item_t>& transaction) const
00056 {
00057 return isContained(transaction.begin(), transaction.end());
00058 }
00059 };
00060
00067
00068 typedef uint32_t counter_t;
00069
00070 typedef std::pair<itemvector, counter_t> itemvecCounterPair;
00071
00072 class itemvecCounterPair_less : public
00073 std::binary_function<itemvecCounterPair, itemvecCounterPair, bool>
00074 {
00075 public:
00076 bool operator()( const itemvecCounterPair& it_vec_pair,
00077 const itemvecCounterPair& it_vec ) const
00078 {
00079 return it_vec_pair.first < it_vec.first;
00080 }
00081
00082 };
00083
00084 const counter_t TWO_POW31 = 0x80000000;
00085 const counter_t TWO_POW31_1 = TWO_POW31 - 1;
00086
00088 enum NEELevel {
00089 NEE_Off,
00090 NEE_Level1,
00091 NEE_Full
00092 };
00093
00095 enum FirstLevel {
00096
00097 FLBuildSingleTree,
00098
00099 FLBuildAllL1Trees,
00100
00101 FLSimultProject
00102 };
00103
00113 class Dummy
00114 {
00115 };
00116 #endif