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

node_eqclass.h

Go to the documentation of this file.
00001 /* ===========================================================================
00002  *        Filename:  node_eqclass.h
00003  *     Description:  Node equality class
00004  * 
00005  *         Version:  $Rev: 8 $
00006  *         Changed:  $Date: 2005-08-04 15:05:09 -0400 (Do, 04 Aug 2005) $
00007  *         Licence:  GPL (read COPYING file for details)
00008  * 
00009  *          Author:  Erich Schubert (eS), erich@debian.org
00010  *                   Institut für Informatik, LMU München
00011  * ======================================================================== */
00012 #ifndef  SSD_NODE_EQCLASS_H
00013 #define  SSD_NODE_EQCLASS_H
00014 
00015 #include "config.h"
00016 
00017 #include "ustring.h"
00018 #include "node.h"
00019 
00020 namespace SSD {
00021 
00027 class NodeEqClass {
00028 public:
00030         ustring label;
00032         ustring content;
00033 
00036         NodeEqClass(Node* n);
00039         NodeEqClass(Node& n);
00040 
00049         bool operator<(const NodeEqClass r2) const {
00050                 if (label != r2.label) return label < r2.label;
00051                 return content < r2.content;
00052         }
00057         bool operator==(const NodeEqClass r2) const {
00058                 return (label == r2.label) && (content == r2.content);
00059         }
00060 
00066         size_t hashfun() const {
00067                 size_t h2 = content.hashfun();
00068                 /* avoid certain typical patterns that can occur when
00069                  * using a 1:1 XOR */
00070                 return label.hashfun() ^ (h2 << 16) ^ (h2 >> 16); }
00071 
00077         friend std::ostream &operator<<(std::ostream &out, const SSD::NodeEqClass& cp);
00078 };
00079 
00082 struct hash_NEqC {
00087         size_t operator()(const NodeEqClass neqc) const { return neqc.hashfun(); };
00088 };
00089 
00091 typedef
00092 hash_map< NodeEqClass, NodeVec, hash_NEqC > NodeEqClassVec;
00093 
00094 }
00095 #endif

Generated on Thu Aug 4 17:57:12 2005 for SSDDiff by  doxygen 1.4.3-20050530