00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef LABELMAP_H_
00010 #define LABELMAP_H_
00011
00012 #include <map>
00013 #include <set>
00014 #include <string>
00015 #include "../core/IdGraph.h"
00016
00017 using namespace std;
00018 namespace cosi {
00019
00035 template<class T2> class LabelMap {
00036 public:
00037
00039 LabelMap() {
00040 }
00041 ;
00042
00046 ~LabelMap() {
00047 mV.clear();
00048 mE.clear();
00049 }
00050 ;
00051
00054 void Set(Vertex V, T2 pD) {
00055 mV[V] = pD;
00056 }
00057 ;
00058
00059 void Set(Edge E, T2 pD) {
00060 mE[E] = pD;
00061 }
00062 ;
00063
00064 void Erase(Vertex V) {
00065 mV.erase(V);
00066 }
00067 ;
00068
00069 void Erase(Edge E) {
00070 mE.erase(E);
00071 }
00072 ;
00073
00081 T2& Get(Vertex V) {
00082 if (mV.find(V) != mV.end() )
00083 return mV[V];
00084 else {
00085 mV[V] = T2() ;
00086 return mV[V];
00087 }
00088 }
00089 ;
00090
00091 T2& Get(Edge E) {
00092 if (mE.find(E) != mE.end() )
00093 return mE[E];
00094 else {
00095 mE[E] = T2() ;
00096 return mE[E] ;
00097 }
00098 }
00099 ;
00100
00107 bool Assigned(Vertex V) {
00108 if (mV.find(V) != mV.end() )
00109 return false;
00110 else
00111 return true;
00112 }
00113 ;
00114
00115 bool Assigned(Edge E) {
00116 if (mE.find(E) != mE.end() )
00117 return false;
00118 else
00119 return true;
00120 }
00121 ;
00122
00123 multiset<string> GetQuantityNames() {
00124 T2 Dummy;
00125 return Dummy.GetQuantityNames() ;
00126 }
00127
00128 private:
00129
00131 map<Vertex,T2> mV;
00132 map<Edge,T2> mE;
00133
00134 };
00135
00136 }
00137
00138 #endif
00139