Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

space/elementPairs.hh
Go to the documentation of this file.
00001 // pairs of elements
00002 
00003 #ifndef elementPairs_hh
00004 #define elementPairs_hh
00005 
00006 #include "space/element.hh"
00007 #include "toolbox/scannerConnectors.hh"
00008 
00009 namespace concepts {
00010 
00011   // *********************************************************** ElementPair **
00012 
00022   template<typename F>
00023   class ElementPair {
00024   public:
00025     virtual ~ElementPair() { }
00027     virtual const concepts::Element<F>& elm1() const = 0;
00029     virtual const concepts::Element<F>& elm2() const = 0;
00030   };
00031 
00032   // ******************************************************* ElementPairList **
00033 
00038   template<typename F>
00039   class ElementPairList {
00040   public:
00041     typedef concepts::Scan<ElementPair<F> > Scanner;
00042 
00050     ElementPairList(concepts::Joiner<ElementPair<F>*, 1>* elmPairs = 0,
00051         bool remove = true) :
00052       elmPairs_(elmPairs), remove_(remove) {}
00053 
00054     ~ElementPairList()
00055     { if (remove_)
00056       concepts::Joiner<ElementPair<F>*, 1>::destructor(elmPairs_); }
00057 
00061     void add(ElementPair<F>* elmPair) {
00062       elmPairs_ = new concepts::Joiner<ElementPair<F>*, 1>(elmPair, elmPairs_);
00063     }
00064 
00066     Scanner* scan() const { return new concepts::PListScan<ElementPair<F> >
00067             (*elmPairs_); }
00068   private:
00070     concepts::Joiner<ElementPair<F>*, 1>* elmPairs_;
00071 
00072     const bool remove_;
00073   };
00074 
00075 } // namespace concepts
00076 
00077 #endif // elementPairs_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)