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

space/spaceSet.hh
Go to the documentation of this file.
00001 /* Sets for space related classes
00002  */
00003 
00004 #ifndef SpaceSet_hh
00005 #define SpaceSet_hh
00006 
00007 #include "space.hh"
00008 #include "toolbox/set.hh"
00009 
00010 namespace concepts {
00011 
00012   // ******************************************************* Set<IndexRange> **
00013 
00014   template<>
00015   class Set<IndexRange> : public BaseSet<IndexRange> {
00016   public:
00017     Set() : BaseSet<IndexRange>() {}
00018     template<class F>
00019     Set(const F& set) : BaseSet<IndexRange>(set) {}
00020     Set(const IndexRange set) : BaseSet<IndexRange>() { insert(set); }
00021     virtual ~Set() {}
00022 
00026     std::pair<bool, uint> exist(uint i) const;
00030     void insert(const IndexRange& i);
00034     void erase(const IndexRange& i);
00036     uint dim() const;
00038     uint max() const;
00040     uint operator[](uint i) const;
00041 
00042     // Return set union
00043     Set<IndexRange>& operator|=(const Set<IndexRange>& set);
00044 
00045     class index_iterator : public OutputOperator {
00046     public:
00052       index_iterator(const_iterator first, const_iterator last);
00054       index_iterator(const index_iterator& i);
00056       index_iterator& operator++();
00058       index_iterator operator++(int);
00060       bool operator==(const index_iterator i);
00061       bool operator!=(const index_iterator i) { return !(*this == i); }
00063       operator const uint*() const;
00064     protected:
00065       virtual std::ostream& info(std::ostream& os) const;
00066     private:
00067       Set<IndexRange>::const_iterator i_, last_;
00069       uint j_;
00070     };
00071 
00073     index_iterator index_begin(uint i = 0) const;
00075     const index_iterator index_end() const;
00076   protected:
00077     virtual std::ostream& info(std::ostream& os) const;
00078   private:
00079     virtual void union_(const_iterator_ first, const_iterator_ last,
00080       insert_iterator_ i) const;
00081     virtual void intersection_(const_iterator_ first, const_iterator_ last,
00082              insert_iterator_ i) const;
00083     virtual void difference_(const_iterator_ first, const_iterator_ last,
00084            insert_iterator_ i) const;
00085   };
00086 
00087 } // namespace concepts
00088 
00089 #endif // SpaceSet_hh
00090 

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