00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef INDEX_H
00014 #define INDEX_H
00015
00016 #include "haconst.h"
00017
00018 class Index1D
00019 {
00020 Subscript lbound_;
00021 Subscript ubound_;
00022
00023 public:
00024
00025 Subscript lbound() const { return lbound_; }
00026 Subscript ubound() const { return ubound_; }
00027
00028 Index1D(const Index1D &D) : lbound_(D.lbound_), ubound_(D.ubound_) {}
00029 Index1D(Subscript i1, Subscript i2) : lbound_(i1), ubound_(i2) {}
00030
00031 Index1D & operator=(const Index1D &D)
00032 {
00033 lbound_ = D.lbound_;
00034 ubound_ = D.ubound_;
00035 return *this;
00036 }
00037
00038 };
00039
00040 inline Index1D operator+(const Index1D &D, Subscript i)
00041 {
00042 return Index1D(i+D.lbound(), i+D.ubound());
00043 }
00044
00045 inline Index1D operator+(Subscript i, const Index1D &D)
00046 {
00047 return Index1D(i+D.lbound(), i+D.ubound());
00048 }
00049
00050
00051
00052 inline Index1D operator-(Index1D &D, Subscript i)
00053 {
00054 return Index1D(D.lbound()-i, D.ubound()-i);
00055 }
00056
00057 inline Index1D operator-(Subscript i, Index1D &D)
00058 {
00059 return Index1D(i-D.lbound(), i-D.ubound());
00060 }
00061
00062
00063 #endif
00064