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

SSD::RelCount Class Reference

relation count class More...

#include <rel_count.h>

List of all members.

Public Member Functions

 RelCount ()
 make an empty RelCount
 RelCount (hash_map< RelEqClass, int, hash_releqc > &map1, hash_map< RelEqClass, int, hash_releqc > &map2)
 make an initial RelCount by making the difference between two maps
 RelCount (RelCount &rc)
 make a copy of an RelCount dataset
 ~RelCount ()
 delete a RelCount dataset
void operator+= (const RelCount &other)
 add a RelCount dataset to this set
void operator-= (const RelCount &other)
 substract a RelCount dataset to this set
int modify (RelEqClass key, short val)
 modify a single value in the dataset

Static Public Member Functions

static void dumpIndex (std::ostream &out)
 dumping helper

Private Attributes

short * data
 data storage. would be interesting to save the memory for this pointer, too...

Static Private Attributes

static unsigned int len = 0
 number of releqclasses we need to track
static hash_map< RelEqClass,
unsigned int, hash_releqc
cmap
 static map from class to index number

Friends

std::ostream & operator<< (std::ostream &out, const RelCount &rc)
 append to an output stream


Detailed Description

relation count class

This class plays an essential role in the improved cost functions. To find out more about its use, read the algorithm whitepapers.

Basically, this is a map<RelEqClass, int> - mapping node pairs to an estimation on how many relations we are going to lose.

Since each state will have such an object, this is a place worthy of optimization, especially WRT memory usage.

For this we use a static map from RelEqClasses to index numbers, and an short array to store the actual values. This reduces memory waste for duplicate hash maps etc.

Also we do not store entries for the case that there is only one relation of this class at most in one document. Then we can use this as indicator if we have already lost it or not directly.

Definition at line 44 of file rel_count.h.


Constructor & Destructor Documentation

SSD::RelCount::RelCount  ) 
 

make an empty RelCount

Definition at line 65 of file rel_count.cc.

References data, and len.

SSD::RelCount::RelCount hash_map< RelEqClass, int, hash_releqc > &  map1,
hash_map< RelEqClass, int, hash_releqc > &  map2
 

make an initial RelCount by making the difference between two maps

this will initialize the static cmap used as hash. Never process two diffs at the same time! Always use this once and make this the first RelCount object you create!

Parameters:
map1 relation counts in first document
map2 relation counts in second document

Definition at line 21 of file rel_count.cc.

References cmap, data, len, RELCOUNT_ONCE, and RELCOUNT_UNIQUE.

SSD::RelCount::RelCount RelCount rc  ) 
 

make a copy of an RelCount dataset

Definition at line 58 of file rel_count.cc.

References data, and len.

SSD::RelCount::~RelCount  ) 
 

delete a RelCount dataset

Definition at line 71 of file rel_count.cc.

References data.


Member Function Documentation

void SSD::RelCount::dumpIndex std::ostream &  out  )  [static]
 

dumping helper

Parameters:
out stream to be dumped to

Definition at line 127 of file rel_count.cc.

References cmap.

int SSD::RelCount::modify RelEqClass  key,
short  val
 

modify a single value in the dataset

Parameters:
key relation class to be updated
val relative change to be done
Returns:
costs caused

Definition at line 75 of file rel_count.cc.

References cmap, data, len, RELCOUNT_ONCE, and RELCOUNT_UNIQUE.

Referenced by SSD::DiffDijkstra::makeState(), and SSD::process_relations().

void SSD::RelCount::operator+= const RelCount other  ) 
 

add a RelCount dataset to this set

Parameters:
other dataset to be added

Definition at line 108 of file rel_count.cc.

References data, and len.

void SSD::RelCount::operator-= const RelCount other  ) 
 

substract a RelCount dataset to this set

Parameters:
other dataset to be substracted

Definition at line 113 of file rel_count.cc.

References data, and len.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  out,
const RelCount rc
[friend]
 

append to an output stream

Parameters:
out output stream to be appended to
rc RelCount dataset to be dumped

Definition at line 118 of file rel_count.cc.


Member Data Documentation

hash_map< RelEqClass, unsigned int, hash_releqc > SSD::RelCount::cmap [static, private]
 

static map from class to index number

Definition at line 19 of file rel_count.cc.

Referenced by dumpIndex(), modify(), and RelCount().

short* SSD::RelCount::data [private]
 

data storage. would be interesting to save the memory for this pointer, too...

Definition at line 51 of file rel_count.h.

Referenced by modify(), operator+=(), operator-=(), SSD::operator<<(), RelCount(), and ~RelCount().

unsigned int SSD::RelCount::len = 0 [static, private]
 

number of releqclasses we need to track

Definition at line 18 of file rel_count.cc.

Referenced by modify(), operator+=(), operator-=(), SSD::operator<<(), and RelCount().


The documentation for this class was generated from the following files:
Generated on Thu Aug 4 17:59:26 2005 for SSDDiff by  doxygen 1.4.3-20050530