/* $Id: ppdentry.h 4928 2009-12-17 22:52:28Z abehm $ Copyright (C) 2007 by The Regents of the University of California Redistribution of this file is permitted under the terms of the BSD license Date: 01/14/2006 Author: Rares Vernica */ #ifndef _ppdentry_h_ #define _ppdentry_h_ #include #include "sepia/simfunc/simdist.h" #include "sepia/simfunc/simvect.h" using namespace std; #if SIM_DIST == 1 const unsigned DIST_THRESHOLD = 5; #elif SIM_DIST == 2 const float DIST_THRESHOLD = static_cast(0.96); #endif class PPDEntry { public: SimVect vect1, vect2; SimType distM; unsigned countE; float fract; PPDEntry(): distM(0), countE(0), fract(0) {} PPDEntry(SimVect v1, SimVect v2, SimType d, unsigned c = 1, float f = 0); bool operator==(const PPDEntry &e) const; operator size_t() const { return static_cast(vect1) * 100000 + static_cast(vect2) * 100 + SimType2size_t(distM); } #if SIM_DIST == 1 && SIM_VECT == 1 void serialize(ofstream &out) const; void deserialize(ifstream &in); #endif friend ostream& operator<<(ostream &out, const PPDEntry &e); friend istream& operator>>(istream &in, PPDEntry &e); friend bool operator<(const PPDEntry &left, const PPDEntry &right); }; typedef set ContPPDEntry; /* !!! FreqEst assumes that ContPPDEntry is an ordered container !!! !!! PPDTable assumes that ContPPDEntry is an ordered container !!! !!! PPDTable assumes that ContPPDEntry is a container where remove does not imvalidate iterators !!! */ typedef ContPPDEntry::iterator ContPPDEntryIt; ostream& operator<<(ostream &out, const ContPPDEntry &c); istream& operator>>(istream &in, ContPPDEntry &c); #endif