00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_LISTG_LISTG_SPARSE_INTERVAL_HH
00018 # define VCSN_AUTOMATA_IMPLEMENTATION_LISTG_LISTG_SPARSE_INTERVAL_HH
00019 
00026 # include <vaucanson/automata/concept/handlers.hh>
00027 # include <vaucanson/misc/sparse_interval.hh>
00028 
00029 namespace vcsn
00030 {
00031   namespace misc
00032   {
00033 
00036 
00037     template <class T, class ExcludedContainer>
00038     class SparseIterator<vcsn::handler<T, unsigned>, ExcludedContainer>
00039     {
00040       public:
00041         typedef vcsn::handler<T, unsigned>      handler_t;
00042         typedef handler_t               integer_t;
00043         typedef ExcludedContainer       excluded_container_t;
00044         typedef typename excluded_container_t::const_iterator  iterator_t;
00045 
00046         SparseIterator (integer_t, const excluded_container_t&);
00047 
00048         SparseIterator& operator++ ();
00049         SparseIterator  operator++ (int);
00050         SparseIterator& operator-- ();
00051         SparseIterator  operator-- (int);
00052         integer_t       operator* ();
00053         bool            operator!= (const SparseIterator&);
00054         bool            operator== (const SparseIterator&);
00055         SparseIterator& operator= (const SparseIterator&);
00056 
00057       private:
00058         const excluded_container_t* excluded_;
00059         unsigned                    integer_;
00060     };
00061 
00064   } 
00065 } 
00066 
00067 namespace std
00068 {
00069 
00070   template <class T, class ExcludedContainer>
00071   struct iterator_traits<vcsn::misc::SparseIterator
00072                          <vcsn::handler<T, unsigned>, ExcludedContainer> >
00073   {
00074       typedef input_iterator_tag                iterator_category;
00075       typedef vcsn::handler<T, unsigned>                value_type;
00076       typedef int                               difference_type;
00077       typedef int*                              pointer;
00078       typedef int&                              reference;
00079   };
00080 
00081 } 
00082 
00083 namespace vcsn
00084 {
00085   namespace misc
00086   {
00087 
00104     template <class T, class ExcludedContainer>
00105     class SparseInterval<vcsn::handler<T, unsigned>, ExcludedContainer>
00106     {
00107       public:
00108         typedef vcsn::handler<T, unsigned>      handler_t;
00109         typedef handler_t               integer_t;
00110         typedef ExcludedContainer       excluded_container_t;
00111         typedef SparseIterator<integer_t, excluded_container_t> iterator;
00112         typedef SparseIterator<integer_t, excluded_container_t> const_iterator;
00113 
00114         SparseInterval (integer_t, integer_t, const excluded_container_t&);
00115         SparseInterval (const SparseInterval&);
00116 
00117         iterator begin () const;
00118         iterator end () const;
00119         
00120         unsigned size () const;
00121         std::string to_string () const;
00122         
00123         handler_t back() const;
00124 
00125       private:
00126         const excluded_container_t&     excluded_;
00127         unsigned                        from_;
00128         unsigned                        to_;
00129     };
00130 
00131 
00134   } 
00135 } 
00136 
00137 
00138 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00139 #  include <vaucanson/automata/implementation/listg/listg_sparse_interval.hxx>
00140 # endif // VCSN_USE_INTERFACE_ONLY
00141 
00142 
00143 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_LISTG_LISTG_SPARSE_INTERVAL_HH