C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
lx_ivector.hpp
00001 /*
00002 **  CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
00003 **
00004 **  Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
00005 **                          Universitaet Karlsruhe, Germany
00006 **            (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
00007 **                          Universitaet Wuppertal, Germany   
00008 **
00009 **  This library is free software; you can redistribute it and/or
00010 **  modify it under the terms of the GNU Library General Public
00011 **  License as published by the Free Software Foundation; either
00012 **  version 2 of the License, or (at your option) any later version.
00013 **
00014 **  This library is distributed in the hope that it will be useful,
00015 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 **  Library General Public License for more details.
00018 **
00019 **  You should have received a copy of the GNU Library General Public
00020 **  License along with this library; if not, write to the Free
00021 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 /* CVS $Id: lx_ivector.hpp,v 1.9 2014/01/30 17:23:47 cxsc Exp $ */
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         //------ Konstruktoren ----------------------------------------------------
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         //--------- Destruktor ----------------------------------------------------
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 //------ Standardfunktionen -----------------------------------------------
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 }; // End of class lx_ivector
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 } // End namespace cxsc
00170  
00171 
00172 #include "lx_ivector.inl"
00173                                         
00174 #endif