00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HH
00019 
00020 # include <vaucanson/algebra/concept/letter.hh>
00021 
00022 namespace vcsn {
00023 
00024   namespace algebra {
00025 
00026     template <class T, class Interval>
00027     class static_ranged
00028     {
00029     public:
00030       static_ranged();
00031       static_ranged(const T& v);
00032       static_ranged(const static_ranged& r);
00033       operator T() const;
00034       static_ranged     randomized();
00035       T&                value();
00036       const T&          value() const;
00037 
00038       
00039 
00040     private:
00041       T        value_;
00042     };
00043 
00044     template <char From, char To>
00045     struct static_char_interval
00046     {
00047       static bool check(char c);
00048       static char from();
00049       static char to();
00050       static char random();
00051       enum bounds
00052         {
00053           from_value = From,
00054           to_value = To
00055         };
00056     };
00057 
00058     template <class T, class Interval>
00059     struct letter_traits< static_ranged<T, Interval> >
00060     {
00061       enum
00062         {
00063           cardinal = Interval::to_value - Interval::from_value + 1
00064         };
00065 
00066       
00067       typedef undefined_type first_projection_t;
00068       typedef undefined_type second_projection_t;
00069     };
00070 
00071     
00072     template <class T, class Interval>
00073     bool operator<(const static_ranged<T, Interval>& lhs,
00074                    const static_ranged<T, Interval>& rhs);
00075 
00076     template <class T, class Interval>
00077     bool operator==(const static_ranged<T, Interval>& lhs,
00078                     const static_ranged<T, Interval>& rhs);
00079 
00080     template <class Stream, class T, class Interval>
00081     Stream& operator<<(Stream& s, static_ranged<T, Interval>& sr)
00082     {
00083       s << sr.value ();
00084       return s;
00085     }
00086 
00087   } 
00088 
00089 } 
00090 
00091 
00092 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00093 #  include <vaucanson/algebra/implementation/letter/range.hxx>
00094 # endif // VCSN_USE_INTERFACE_ONLY
00095 
00096 
00097 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HH