hanglist.h

Go to the documentation of this file.
00001 #ifndef  __hanglist_h
00002 #define  __hanglist_h
00003 
00004 #include  <string>
00005 #include  "edgearray.h"
00006 #include  "hang.h"
00007 
00008 #include  <map>
00009 #ifdef __OLDCOMPILER__
00010 #include  <hash_map>
00011 #define HANGMAP  hash_map<EdgeArray<N>,Hang,EdgeHash>
00012 #else
00013 #include  <ext/hash_map>
00014 #define HANGMAP  __gnu_cxx::hash_map<EdgeArray<N>,Hang,EdgeHash> 
00015 #endif
00016 
00017 
00018 /*------------------------------------------------------*/
00019 
00020 namespace Gascoigne
00021 {
00022 class FixArrayHash
00023 {
00024  public:
00025   template<int N>
00026     int operator()(const fixarray<N,int>& h) const { return h[0];}
00027 };
00028 
00029 /*------------------------------------------------------*/
00030 
00031 //
00034 //
00035 
00036 class EdgeHash
00037 {
00038  public:
00039   template<int N>
00040     int operator()(const EdgeArray<N>& h) const { return h.sum();}
00041 };
00042 
00043 
00044 /*------------------------------------------------------*/
00045 
00046 template<int N>
00047 /* class HangList : public std::map<EdgeArray<N>,Hang,EdgeArrayCompare<N> > */
00048 class HangList : public HANGMAP
00049 {
00050  protected:
00051 
00052  public:
00053 
00054   typedef typename HANGMAP::iterator        iterator;
00055   typedef typename HANGMAP::const_iterator  const_iterator;
00056 
00057   void update(const std::vector<int>&);
00058   void update(const std::vector<int>&, const std::vector<int>&);
00059   void make_consistent(HangList<N>&);
00060   void move(HangList<N>& src, iterator& p);
00061   HangList<N>& operator=(const HangList<N>& A);
00062   void BinWrite(std::ostream &s) const;
00063   void BinRead(std::istream &s);
00064 };
00065 
00066 /*------------------------------------------------------*/
00067 
00068 template<int N>
00069 std::ostream& operator<<(std::ostream &s, const HangList<N>& A);
00070 
00071 template<int N>
00072 std::istream& operator>>(std::istream &s, HangList<N>& A);
00073 }
00074 
00075 /*------------------------------------------------------*/
00076 
00077 #undef HANGMAP
00078 
00079 #endif

Generated on Thu Sep 14 10:34:37 2006 for Gascoigne by  doxygen 1.4.7