Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CacheDFDecoder< FR > Class Template Reference

A very fast stack-based decoder. More...

#include <CacheDFDecoder.hpp>

Inheritance diagram for CacheDFDecoder< FR >:

Inheritance graph
[legend]
Collaboration diagram for CacheDFDecoder< FR >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef DecoderBase< BufferedOutput<
FR > >::params_t 
params_t

Public Member Functions

 CacheDFDecoder (const params_t *par)
 ~CacheDFDecoder ()
void pushItem (const item_t item)
void write (counter_t support)
void writeNEE (counter_t support, const std::vector< item_t > &nee_items)
 This adds and writes out all subsets of an itemset to the itemset stored in the stack.
void pushItemWithWrite (const item_t item, counter_t support)
void pushItemWithPrevSupport (const item_t item)
void popItem ()
void popAll ()
std::string getCurrentPatternAsString ()
void hint (std::string hint)
 Outputs a given string directly to the pattern file. Useful for debugging.
void setCodeInverse (const std::vector< item_t > &code_inverse)
 DecoderBase (const params_t *par)
template<typename InputIterator>
void writeItemsetAndCounter (InputIterator first, InputIterator last, counter_t support)
 Writes out one itemset and its counter.

Static Public Member Functions

static bool DINLINE isDFO ()

Protected Attributes

std::vector< std::pair< char *,
unsigned int > > 
code_inverse
 The inverse of code vector.
std::streamsize buffer_size
 The size of the buffer.
char * buffer
 The buffer.

Private Attributes

std::stack< std::streamsize > positions
char * support_buffer
 The buffer for the string representation of the support.
std::streamsize support_buffer_size
 The size of the support_buffer.
size_t support_length
 The length of the representation of the support.

Classes

class  params_t

Detailed Description

template<class FR = FDRepr>
class CacheDFDecoder< FR >

A very fast stack-based decoder.

Author:
Ferenc Bodon

Definition at line 18 of file CacheDFDecoder.hpp.


Member Typedef Documentation

template<class FR = FDRepr>
typedef DecoderBase< BufferedOutput<FR> >::params_t CacheDecoderBase< FR >::params_t [inherited]
 

Reimplemented from DecoderBase< BufferedOutput< FR > >.

Reimplemented in CacheNormalDecoder< FR >.

Definition at line 25 of file CacheDecoderBase.hpp.


Constructor & Destructor Documentation

template<class FR = FDRepr>
CacheDFDecoder< FR >::CacheDFDecoder const params_t par  )  [inline]
 

Definition at line 32 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::positions, CacheDFDecoder< FR >::support_buffer, and CacheDFDecoder< FR >::support_buffer_size.

template<class FR = FDRepr>
CacheDFDecoder< FR >::~CacheDFDecoder  )  [inline]
 

Definition at line 39 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::support_buffer.


Member Function Documentation

DecoderBase< BufferedOutput< FR > >::DecoderBase const params_t par  )  [inline, inherited]
 

Definition at line 28 of file DecoderBase.hpp.

template<class FR = FDRepr>
std::string CacheDFDecoder< FR >::getCurrentPatternAsString  )  [inline]
 

Definition at line 86 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::positions.

template<class FR = FDRepr>
void CacheDFDecoder< FR >::hint std::string  hint  )  [inline]
 

Outputs a given string directly to the pattern file. Useful for debugging.

Definition at line 92 of file CacheDFDecoder.hpp.

template<class FR = FDRepr>
static bool DINLINE CacheDFDecoder< FR >::isDFO  )  [inline, static]
 

Reimplemented from OutputBase< FR >.

Definition at line 44 of file CacheDFDecoder.hpp.

template<class FR = FDRepr>
void CacheDFDecoder< FR >::popAll  )  [inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 79 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::positions.

template<class FR = FDRepr>
void CacheDFDecoder< FR >::popItem  )  [inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 74 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::positions.

Referenced by CacheDFDecoder< FR >::writeNEE().

template<class FR>
void CacheDFDecoder< FR >::pushItem const item_t  item  )  [inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 111 of file CacheDFDecoder.hpp.

References BufferedOutput< FR >::buffer, CacheDecoderBase< FR >::code_inverse, and CacheDFDecoder< FR >::positions.

Referenced by CacheDFDecoder< FR >::pushItemWithPrevSupport(), CacheDFDecoder< FR >::pushItemWithWrite(), and CacheDFDecoder< FR >::writeNEE().

template<class FR>
void CacheDFDecoder< FR >::pushItemWithPrevSupport const item_t  item  )  [inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 169 of file CacheDFDecoder.hpp.

References BufferedOutput< FR >::buffer, CacheDFDecoder< FR >::positions, CacheDFDecoder< FR >::pushItem(), CacheDFDecoder< FR >::support_buffer, CacheDFDecoder< FR >::support_buffer_size, and CacheDFDecoder< FR >::support_length.

template<class FR = FDRepr>
void CacheDFDecoder< FR >::pushItemWithWrite const item_t  item,
counter_t  support
[inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 68 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::pushItem(), and CacheDFDecoder< FR >::write().

template<class FR = FDRepr>
void CacheDecoderBase< FR >::setCodeInverse const std::vector< item_t > &  code_inverse  )  [inline, inherited]
 

Reimplemented from DecoderBase< BufferedOutput< FR > >.

Definition at line 37 of file CacheDecoderBase.hpp.

References BufferedOutput< FR >::buffer_size, and Formatter::IntToStringBack().

template<class FR>
void CacheDFDecoder< FR >::write counter_t  support  )  [inline]
 

Reimplemented from OutputBase< FR >.

Definition at line 123 of file CacheDFDecoder.hpp.

References BufferedOutput< FR >::buffer, Formatter::IntToStringBack(), CacheDFDecoder< FR >::positions, CacheDFDecoder< FR >::support_buffer, CacheDFDecoder< FR >::support_buffer_size, and CacheDFDecoder< FR >::support_length.

Referenced by CacheDFDecoder< FR >::pushItemWithWrite(), and CacheDFDecoder< FR >::writeNEE().

template<class FR = FDRepr>
template<typename InputIterator>
void OutputBase< FR >::writeItemsetAndCounter InputIterator  first,
InputIterator  last,
counter_t  support
[inline, inherited]
 

Writes out one itemset and its counter.

Parameters:
first An input iterator.
last An input iterator.
support the support of the itemset
The elements of the itemset are in the range [first, last).

Here you can see an example of the usage

#include "common.hpp"  
#include "io/output/normal/SimpleOutput.hpp"  
#include "io/StreamRepr.hpp"
#include "io/FILERepr.hpp"
#include "io/output/OutputBase.hpp"
#include "io/output/normal/BufferedNormalOutput.hpp"
#include <set>
#include <vector>
using namespace std;


int main()
{
   typedef Bodon::SimpleOutput O_M;
// typedef BufferedNormalOutput<FStreamOutput> O_M;
// typedef BufferedNormalOutput<FILEOutput> O_M;

   O_M::params_t par;
   par.file_name = "output.txt";
   O_M o_manager(&par);

   counter_t support = 19283;

// itemset is stored in an array
  item_t itemset_array[] = {1, 4, 2, 8, 5, 7};
  const int N = sizeof(itemset_array) / sizeof(item_t);
  o_manager.writeItemsetAndCounter(
     (item_t*) itemset_array, itemset_array + N, support);

// itemset is stored in an vector
  vector<item_t> itemset_vector(itemset_array, itemset_array + N);
  o_manager.writeItemsetAndCounter(
     itemset_vector.begin(), itemset_vector.end(), support);

// itemset is stored in an set
  set<item_t> itemset_set(itemset_array, itemset_array + N);
  o_manager.writeItemsetAndCounter(
     itemset_set.begin(), itemset_set.end(), support);

  return 1;
}

Reimplemented in CacheNormalDecoder< FR >, NoOutput< ISDFO, FR >, BufferedNormalOutput< FR >, SimpleOutput, and BufferedNormalOutput< StreamRepr >.

Definition at line 51 of file OutputBase.hpp.

Referenced by NoOutput< ISDFO, FR >::writeItemsetAndCounter().

template<class FR>
void CacheDFDecoder< FR >::writeNEE counter_t  support,
const std::vector< item_t > &  nee_items
[inline]
 

This adds and writes out all subsets of an itemset to the itemset stored in the stack.

This method is useful when the equisupport pruning technique (not generating any extension of an itemset that has the same support as its prefix) is used.

Parameters:
support the support that is attributed with each extended itemset.
nee_items the itemset whose subsets are generated. This means that if the size of nee_items is n, then $2^n$ number of itemsets are written out.

Definition at line 139 of file CacheDFDecoder.hpp.

References CacheDFDecoder< FR >::popItem(), CacheDFDecoder< FR >::pushItem(), and CacheDFDecoder< FR >::write().


Member Data Documentation

template<class FR = FDRepr>
char* BufferedOutput< FR >::buffer [protected, inherited]
 

The buffer.

Definition at line 47 of file BufferedOutput.hpp.

Referenced by BufferedOutput< StreamRepr >::BufferedOutput(), SimpleBufferedDFDecoder< FR >::pushItem(), CacheDFDecoder< FR >::pushItem(), CacheDFDecoder< FR >::pushItemWithPrevSupport(), SimpleBufferedDFDecoder< FR >::write(), CacheDFDecoder< FR >::write(), CacheNormalDecoder< FR >::writeItemsetAndCounter(), and BufferedOutput< StreamRepr >::~BufferedOutput().

template<class FR = FDRepr>
std::streamsize BufferedOutput< FR >::buffer_size [protected, inherited]
 

The size of the buffer.

Definition at line 45 of file BufferedOutput.hpp.

Referenced by BufferedOutput< StreamRepr >::BufferedOutput(), CacheDecoderBase< FR >::setCodeInverse(), CacheNormalDecoder< FR >::writeItemsetAndCounter(), and BufferedNormalOutput< StreamRepr >::writeItemsetAndCounter().

template<class FR = FDRepr>
std::vector< std::pair<char*, unsigned int> > CacheDecoderBase< FR >::code_inverse [protected, inherited]
 

The inverse of code vector.

code_inverse[i] stores the string representation of that item whose new code is i.

Definition at line 63 of file CacheDecoderBase.hpp.

Referenced by CacheDFDecoder< FR >::pushItem(), CacheNormalDecoder< FR >::writeItemsetAndCounter(), and CacheDecoderBase< FR >::~CacheDecoderBase().

template<class FR = FDRepr>
std::stack<std::streamsize> CacheDFDecoder< FR >::positions [private]
 

Definition at line 98 of file CacheDFDecoder.hpp.

Referenced by CacheDFDecoder< FR >::CacheDFDecoder(), CacheDFDecoder< FR >::getCurrentPatternAsString(), CacheDFDecoder< FR >::popAll(), CacheDFDecoder< FR >::popItem(), CacheDFDecoder< FR >::pushItem(), CacheDFDecoder< FR >::pushItemWithPrevSupport(), and CacheDFDecoder< FR >::write().

template<class FR = FDRepr>
char* CacheDFDecoder< FR >::support_buffer [private]
 

The buffer for the string representation of the support.

Definition at line 101 of file CacheDFDecoder.hpp.

Referenced by CacheDFDecoder< FR >::CacheDFDecoder(), CacheDFDecoder< FR >::pushItemWithPrevSupport(), CacheDFDecoder< FR >::write(), and CacheDFDecoder< FR >::~CacheDFDecoder().

template<class FR = FDRepr>
std::streamsize CacheDFDecoder< FR >::support_buffer_size [private]
 

The size of the support_buffer.

Definition at line 104 of file CacheDFDecoder.hpp.

Referenced by CacheDFDecoder< FR >::CacheDFDecoder(), CacheDFDecoder< FR >::pushItemWithPrevSupport(), and CacheDFDecoder< FR >::write().

template<class FR = FDRepr>
size_t CacheDFDecoder< FR >::support_length [private]
 

The length of the representation of the support.

Definition at line 107 of file CacheDFDecoder.hpp.

Referenced by CacheDFDecoder< FR >::pushItemWithPrevSupport(), and CacheDFDecoder< FR >::write().


The documentation for this class was generated from the following file:
Generated on Sun Sep 17 17:55:13 2006 for FIM environment by  doxygen 1.4.4