00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_SUBSETMANAGER_H
00032 #define SUNDANCE_SUBSETMANAGER_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMap.hpp"
00036 #include "SundanceSet.hpp"
00037 #include "SundanceCellFilter.hpp"
00038 #include "SundanceCellFilterBase.hpp"
00039 
00040 namespace Sundance
00041 {
00042 
00043 
00044 
00045 
00046 
00047 class SubsetManager
00048 {
00049 public:
00050 
00051   static void registerSubset(const CellFilter& filter, 
00052     const CellFilter& subset)
00053     {
00054       if (!subsetMap().containsKey(filter))
00055         subsetMap().put(filter, Sundance::Set<CellFilter>());
00056       subsetMap().get(filter).put(subset);
00057     }
00058 
00059 
00060   static void registerDisjoint(const CellFilter& filter, 
00061     const CellFilter& subset)
00062     {
00063       if (!disjointMap().containsKey(filter))
00064         disjointMap().put(filter, Sundance::Set<CellFilter>());
00065       disjointMap().get(filter).put(subset);
00066     }
00067 
00068 
00069   static void registerLabeledSubset(const CellFilter& filter, 
00070     const Set<int>& label, const CellFilter& subset)
00071     {
00072       if (!labeledMap().containsKey(filter))
00073         labeledMap().put(filter, Sundance::Map<Set<int>, CellFilter>());
00074       labeledMap().get(filter).put(label, subset);
00075     }
00076 
00077 
00078 
00079   static const Sundance::Set<CellFilter>& getSubsets(const CellFilter& filter)
00080     {
00081       if (!subsetMap().containsKey(filter))
00082         subsetMap().put(filter, Sundance::Set<CellFilter>());
00083       return subsetMap().get(filter);
00084     }
00085 
00086 
00087   static const Sundance::Set<CellFilter>& getDisjoints(const CellFilter& filter)
00088     {
00089       if (!disjointMap().containsKey(filter))
00090         disjointMap().put(filter, Sundance::Set<CellFilter>());
00091       return disjointMap().get(filter);
00092     }
00093 
00094 
00095   static const Sundance::Map<Set<int>, CellFilter>& 
00096   getLabeledSubsets(const CellFilter& filter)
00097     {
00098       if (!labeledMap().containsKey(filter))
00099         labeledMap().put(filter, Sundance::Map<Set<int>, CellFilter>());
00100       return labeledMap().get(filter);
00101     }
00102 
00103 private:
00104   
00105 
00106   static Sundance::Map<CellFilter, Sundance::Set<CellFilter> >& subsetMap()
00107     {
00108       static Sundance::Map<CellFilter, Sundance::Set<CellFilter> > rtn;
00109       return rtn;
00110     }
00111   
00112 
00113   static Sundance::Map<CellFilter, Sundance::Set<CellFilter> >& disjointMap()
00114     {
00115       static Sundance::Map<CellFilter, Sundance::Set<CellFilter> > rtn;
00116       return rtn;
00117     }
00118   
00119 
00120   static Sundance::Map<CellFilter, Sundance::Map<Set<int>, CellFilter> >& labeledMap()
00121     {
00122       static Sundance::Map<CellFilter, Sundance::Map<Set<int>, CellFilter> > rtn;
00123       return rtn;
00124     }
00125 };
00126 
00127 }
00128 
00129 
00130 
00131 #endif