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 _CXSC_LX_IVECTOR_HPP_INCLUDED
00027 #define _CXSC_LX_IVECTOR_HPP_INCLUDED
00028
00029 #include <except.hpp>
00030 #include "lx_interval.hpp"
00031 #include <iostream>
00032
00033 namespace cxsc {
00034
00036
00042 class lx_ivector
00043 {
00044 private:
00045 lx_interval *dat;
00046 int l,u,size;
00047
00048 public:
00049
00050
00052 inline lx_ivector () throw();
00053
00058 explicit inline lx_ivector(int i) throw();
00059
00061 explicit inline lx_ivector(int i1, int i2)
00062 #if(CXSC_INDEX_CHECK)
00063 throw(ERROR_IVECTOR_WRONG_BOUNDARIES,ERROR_IVECTOR_NO_MORE_MEMORY);
00064 #else
00065 throw();
00066 #endif
00067
00069 explicit inline lx_ivector(const lx_interval &) throw();
00071 explicit inline lx_ivector(const l_interval &) throw();
00073 explicit inline lx_ivector(const interval &) throw();
00075 explicit inline lx_ivector(const lx_real &) throw();
00077 explicit inline lx_ivector(const l_real &) throw();
00079 explicit inline lx_ivector(const real &) throw();
00080
00082 inline lx_ivector(const lx_ivector &) throw();
00083
00084
00086 inline lx_ivector & operator = (const lx_ivector &) throw();
00088 inline lx_ivector & operator =(const lx_interval &) throw();
00090 inline lx_ivector & operator =(const l_interval &) throw();
00092 inline lx_ivector & operator =(const interval &) throw();
00094 inline lx_ivector & operator =(const lx_real &) throw();
00096 inline lx_ivector & operator =(const l_real &) throw();
00098 inline lx_ivector & operator =(const real &) throw();
00099
00100
00101 inline ~lx_ivector() { delete [] dat; }
00102
00103
00105 inline lx_interval & operator [](const int &i)
00106 #if(CXSC_INDEX_CHECK)
00107 throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
00108 #else
00109 throw();
00110 #endif
00111
00112 inline const lx_interval & operator [](const int &i) const
00113 #if(CXSC_INDEX_CHECK)
00114 throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
00115 #else
00116 throw();
00117 #endif
00118
00119
00120
00122 friend inline int Lb(const lx_ivector &a) throw() { return a.l; }
00124 friend inline int Ub(const lx_ivector &a) throw() { return a.u; }
00126 friend inline int VecLen(const lx_ivector &a) throw() { return a.size; }
00128 friend inline lx_ivector& SetLb(lx_ivector &a, int l) throw()
00129 { a.l=l; a.u=l+a.size-1; return a; }
00131 friend inline lx_ivector & SetUb(lx_ivector &a, int u) throw()
00132 { a.u=u; a.l=u-a.size+1; return a; }
00133
00135 friend inline void Resize(lx_ivector &rv, int lb, int ub)
00136 #if(CXSC_INDEX_CHECK)
00137 throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
00138 #else
00139 throw();
00140 #endif
00141
00143 friend inline void Resize(lx_ivector &rv, int len)
00144 #if(CXSC_INDEX_CHECK)
00145 throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
00146 #else
00147 throw();
00148 #endif
00149
00150 };
00151
00153 inline void DoubleSize(lx_ivector&) throw();
00154
00155 inline void Resize(lx_ivector &rv, int lb, int ub)
00156 #if(CXSC_INDEX_CHECK)
00157 throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
00158 #else
00159 throw();
00160 #endif
00161
00162 inline void Resize(lx_ivector &rv, int len)
00163 #if(CXSC_INDEX_CHECK)
00164 throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
00165 #else
00166 throw();
00167 #endif
00168
00169 }
00170
00171
00172 #include "lx_ivector.inl"
00173
00174 #endif