Salome HOME
remove a reference to the $MED_ROOT_DIR in the Makefile.in wich is useless
[modules/med.git] / src / MEDMEM / MEDMEM_SkyLineArray.cxx
index 1604274024530c174fc2b67169a3f25ee1d81ec5..9a6a0bda7e7abe7f3ef98832b2a6cfa4f25810ce 100644 (file)
@@ -1,9 +1,11 @@
-using namespace std;
 #include "MEDMEM_SkyLineArray.hxx"
 #include "utilities.h"
 
+using namespace std;
+using namespace MEDMEM;
+
 MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0),
-                               _index((med_int*)NULL),_value((med_int*)NULL)
+                               _index((int*)NULL),_value((int*)NULL)
 {
   MESSAGE("Constructeur MEDSKYLINEARRAY sans parametre");
 }
@@ -13,8 +15,8 @@ MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray):
                                _index(_count+1),_value(_length)
 {
        BEGIN_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
-       memcpy(_index,myArray._index,sizeof(med_int)*(_count+1));
-       memcpy(_value,myArray._value,sizeof(med_int)*_length);
+       memcpy(_index,myArray._index,sizeof(int)*(_count+1));
+       memcpy(_value,myArray._value,sizeof(int)*_length);
        END_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
 }
 
@@ -26,22 +28,39 @@ MEDSKYLINEARRAY::~MEDSKYLINEARRAY()
   //if (_value != NULL) delete [] _value;
 }
 
-MEDSKYLINEARRAY::MEDSKYLINEARRAY(const med_int count , const med_int length ) :
-                            _count(count), _length(length),
-                            _index(_count+1),_value(_length)
+MEDSKYLINEARRAY::MEDSKYLINEARRAY(const int count, const int length):
+                                _count(count), _length(length),
+                                _index(_count+1),_value(_length)
 {
        MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
 }
 
-void MEDSKYLINEARRAY::setMEDSKYLINEARRAY( const med_int count , const med_int length, med_int* index , med_int* value ) 
+MEDSKYLINEARRAY::MEDSKYLINEARRAY(const int count, const int length,
+                                const int* index, const int* value,bool shallowCopy):
+                                _count(count), _length(length)
 {
-  MESSAGE("void MEDSKYLINEARRAY::setMEDSKYLINEARRAY(count, length, index, value)");
-  _count  = count  ;
-  _length = length ;
+//     MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
+               if(shallowCopy)
+         {
+           _index.setShallowAndOwnership(index);
+           _value.setShallowAndOwnership(value);
+         }
+       else
+         {
+           _index.set(_count+1,index);
+           _value.set(_length,value);
+         }
+}
 
-  //if (_index != NULL) delete [] _index;
-  //if (_value != NULL) delete [] _value;
+//  void MEDSKYLINEARRAY::setMEDSKYLINEARRAY( const int count , const int length, int* index , int* value )
+//  {
+//    MESSAGE("void MEDSKYLINEARRAY::setMEDSKYLINEARRAY(count, length, index, value)");
+//    _count  = count  ;
+//    _length = length ;
 
-         _index.set(index);
-         _value.set(value);
-}
+//    //if (_index != NULL) delete [] _index;
+//    //if (_value != NULL) delete [] _value;
+
+//       _index.set(index);
+//       _value.set(value);
+//  }