1 # ifndef __MEDSKYLINEARRAY_H__
2 # define __MEDSKYLINEARRAY_H__
4 #include "MEDMEM_Exception.hxx"
6 #include "MEDMEM_PointerOf.hxx"
7 #include "MEDMEM_define.hxx"
9 using MED_EN::med_int ;
16 PointerOf <med_int> _index ; // array of size _count+1 : _index[0]=1 and
17 // _index[_count]=length+1
18 PointerOf <med_int> _value ; // array of size _length
23 MEDSKYLINEARRAY( const MEDSKYLINEARRAY &myArray );
24 MEDSKYLINEARRAY( const med_int count , const med_int length );
26 void setMEDSKYLINEARRAY( const med_int count, const med_int length, med_int* index , med_int* value ) ;
28 inline med_int getNumberOf() const;
29 inline med_int getLength() const;
30 inline med_int* getIndex() ;
31 inline med_int* getValue() ;
32 inline med_int getNumberOfI(int i) const throw (MEDEXCEPTION) ;
33 inline med_int* getI(int i) throw (MEDEXCEPTION) ;
34 inline med_int getIJ(int i, int j) const throw (MEDEXCEPTION) ;
38 // ---------------------------------------
40 // ---------------------------------------
41 inline med_int MEDSKYLINEARRAY::getNumberOf() const
45 inline med_int MEDSKYLINEARRAY::getLength() const
49 inline med_int* MEDSKYLINEARRAY::getIndex()
51 return (med_int*)_index ;
53 inline med_int* MEDSKYLINEARRAY::getValue()
55 return (med_int*)_value ;
57 inline med_int MEDSKYLINEARRAY::getNumberOfI(int i) const throw (MEDEXCEPTION)
60 throw MEDEXCEPTION("MEDSKYLINEARRAY::getNumberOfI : argument must be >= 1");
62 throw MEDEXCEPTION("MEDSKYLINEARRAY::getNumberOfI : argument is out of range");
63 return _index[i]-_index[i-1] ;
65 inline med_int* MEDSKYLINEARRAY::getI(int i) throw (MEDEXCEPTION)
68 throw MEDEXCEPTION("MEDSKYLINEARRAY::getI : argument must be >= 1");
70 throw MEDEXCEPTION("MEDSKYLINEARRAY::getI : argument is out of range");
71 return _value+_index[i-1]-1 ;
73 inline med_int MEDSKYLINEARRAY::getIJ(int i, int j) const throw (MEDEXCEPTION)
76 throw MEDEXCEPTION("MEDSKYLINEARRAY::getIJ : first argument must be >= 1");
78 throw MEDEXCEPTION("MEDSKYLINEARRAY::getIJ : second argument must be >= 1");
80 throw MEDEXCEPTION("MEDSKYLINEARRAY::getIJ : first argument is out of range") ;
82 throw MEDEXCEPTION("MEDSKYLINEARRAY::getIJ : second argument is out of range") ;
83 return _value[_index[i-1]+j-2] ;