00001
00002
00003 #ifndef _popkey_h
00004 #define _popkey_h
00005
00006 #include "Serializable.h"
00007
00008
00009 #include "hash_map.h"
00010
00011 #include <vector>
00012 using namespace std;
00013
00017 class PopKey: public Serializable
00018 {
00019 private:
00020 unsigned short int z;
00021 vector<unsigned short int> indx;
00022 unsigned char dim;
00023
00024 public:
00025
00027 PopKey();
00028
00030 PopKey(int Z, vector<int>& Indx);
00031
00033 PopKey(const PopKey& t);
00034
00036 ~PopKey();
00037
00039 void reset(int Z, vector<int>& Indx);
00041 int get_Z() const { return z; }
00043 int get_I(int i) const { return indx[i]; }
00045 int get_dim() const { return dim; }
00046
00047
00048 private:
00049 friend class boost::serialization::access;
00050 template<class Archive>
00051 void serialize(Archive & ar, const unsigned int version) {
00052 this->pre_serialize(ar, version);
00053 try {
00054 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Serializable);
00055 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00056 }
00057 try {
00058 ar & BOOST_SERIALIZATION_NVP(z);
00059 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00060 }
00061 try {
00062 ar & BOOST_SERIALIZATION_NVP(indx);
00063 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00064 }
00065 try {
00066 ar & BOOST_SERIALIZATION_NVP(dim);
00067 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00068 }
00069 this->post_serialize(ar, version);
00070 }
00071
00072 };
00073
00074
00075 size_t popkeyHash(PopKey P);
00076
00077
00078 HASHMAP_NAMESPACE_BEGIN
00080 template <>
00081 struct hash<PopKey>
00082 {
00084 size_t operator()(PopKey s) const
00085 {
00086 return popkeyHash(s);
00087 }
00088 };
00089 HASHMAP_NAMESPACE_END
00090
00092 struct eqpopkey
00093 {
00095 bool operator()(PopKey c1, PopKey c2) const
00096 {
00097 if (c1.get_dim() != c2.get_dim()) return false;
00098 if (c1.get_Z() != c2.get_Z()) return false;
00099 for (int i=0; i<c1.get_dim(); i++)
00100 if (c1.get_I(i) != c2.get_I(i)) return false;
00101 return true;
00102 }
00103
00104 };
00105
00106 BIE_CLASS_TYPE_INFO(PopKey)
00107 BIE_CLASS_EXPORT_KEY(PopKey)
00108 #endif