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 #ifndef MLN_UTIL_DINDEX_HH
00027 # define MLN_UTIL_DINDEX_HH
00028 
00038 # include <mln/util/index.hh>
00039 # include <mln/literal/zero.hh>
00040 # include <mln/literal/one.hh>
00041 
00042 
00043 namespace mln
00044 {
00045 
00046   namespace util
00047   {
00048 
00049     
00050     template <typename Tag> struct dindex_;
00051 
00052 
00056     template <typename Tag = void>
00057     struct dindex_ 
00058     {
00059       typedef Object<void> category;
00060 
00061       typedef index_<Tag> psite;
00062       typedef index_<Tag> site;
00063 
00064       typedef int coord;
00065       enum { dim = 1 };
00066 
00067       int i_;
00068 
00069       dindex_()
00070       {
00071       }
00072 
00073       dindex_(int i)
00074         : i_(i)
00075       {
00076       }
00077 
00079       dindex_(const literal::zero_t&)
00080         : i_(0)
00081       {
00082       }
00083       dindex_<Tag>& operator=(const literal::zero_t&)
00084       {
00085         i_ = 0;
00086         return *this;
00087       }
00088 
00089       dindex_(const literal::one_t&)
00090         : i_(1)
00091       {
00092       }
00093       dindex_<Tag>& operator=(const literal::one_t&)
00094       {
00095         i_ = 1;
00096         return *this;
00097       }
00099 
00100       bool operator<(const dindex_& rhs) const
00101       {
00102         return i_ < rhs.i_;
00103       }
00104 
00105       operator int() const
00106       {
00107         return i_;
00108       }
00109     };
00110 
00111     typedef dindex_<void> dindex;
00112 
00113 
00114 
00115 # ifndef MLN_INCLUDE_ONLY
00116 
00117     
00118 
00119 # endif // ! MLN_INCLUDE_ONLY
00120 
00121   } 
00122 
00123 } 
00124 
00125 
00126 #endif // ! MLN_UTIL_DINDEX_HH