Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM / MEDMEM_SkyLineArray.cxx
1 #include "MEDMEM_SkyLineArray.hxx"
2 #include "MEDMEM_Utilities.hxx"
3
4 using namespace std;
5 using namespace MEDMEM;
6
7 MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0),
8                                 _index((int*)NULL),_value((int*)NULL)
9 {
10   MESSAGE("Constructeur MEDSKYLINEARRAY sans parametre");
11 }
12
13 MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray):
14                                 _count(myArray._count),_length(myArray._length),
15                                 _index(_count+1),_value(_length)
16 {
17         BEGIN_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
18         memcpy(_index,myArray._index,sizeof(int)*(_count+1));
19         memcpy(_value,myArray._value,sizeof(int)*_length);
20         END_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
21 }
22
23 MEDSKYLINEARRAY::~MEDSKYLINEARRAY()
24 {
25   MESSAGE("Destructeur ~MEDSKYLINEARRAY");
26
27   //if (_index != NULL) delete [] _index;
28   //if (_value != NULL) delete [] _value;
29 }
30
31 MEDSKYLINEARRAY::MEDSKYLINEARRAY(const int count, const int length):
32                                 _count(count), _length(length),
33                                 _index(_count+1),_value(_length)
34 {
35         MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
36 }
37
38 MEDSKYLINEARRAY::MEDSKYLINEARRAY(const int count, const int length,
39                                  const int* index, const int* value,bool shallowCopy):
40                                 _count(count), _length(length)
41 {
42 //      MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
43                 if(shallowCopy)
44           {
45             _index.setShallowAndOwnership(index);
46             _value.setShallowAndOwnership(value);
47           }
48         else
49           {
50             _index.set(_count+1,index);
51             _value.set(_length,value);
52           }
53 }
54
55 //  void MEDSKYLINEARRAY::setMEDSKYLINEARRAY( const int count , const int length, int* index , int* value )
56 //  {
57 //    MESSAGE("void MEDSKYLINEARRAY::setMEDSKYLINEARRAY(count, length, index, value)");
58 //    _count  = count  ;
59 //    _length = length ;
60
61 //    //if (_index != NULL) delete [] _index;
62 //    //if (_value != NULL) delete [] _value;
63
64 //        _index.set(index);
65 //        _value.set(value);
66 //  }