File: splitMap.h

package info (click to toggle)
fastml 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,772 kB
  • sloc: cpp: 48,522; perl: 3,588; ansic: 819; makefile: 386; python: 83; sh: 55
file content (37 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// $Id: splitMap.h 962 2006-11-07 15:13:34Z privmane $

#ifndef ___SPLITMAP
#define ___SPLITMAP

#include "definitions.h"
#include "split.h"
#include <map>
using namespace std;

// splitMap is a map of split to integers used for counting the occurences of each split.
// Questions we want the class to be able to answer:
// 1. What is the occurence a specific split.
// 2. what is the most common split
// 3. Sort the splits according to their frequency.

class splitMap  {
// public:
// typedef pair<int,const split> rMapPair_t;
// typedef multimap<const int,const split> reverse_sMap_t;
// typedef multimap<int,split> reverse_sMap_t;
// reverse_sMap_t reverse() const ;
public:
  explicit splitMap(){};  // empty constractor
  int add(const split & in); // return the new frequency.
  int counts(const split& in) const;  // counts the number of occurances
  void print(ostream& sout = cout) const;
  vector<pair<split,int> > sortSplits() const;
private:
      
  typedef map<split,int> mapSplitInt;
  mapSplitInt _map;
};

ostream& operator<< (ostream &sout,  const splitMap& split_map);
#endif