1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "MEDMEM_define.hxx"
21 #include "MEDMEM_Family.hxx"
22 #include "MEDMEM_MedMeshDriver.hxx"
23 #include "MEDMEM_Mesh.hxx"
24 #include "MEDMEMTest_Utils.hxx"
27 using namespace MEDMEM;
29 int main (int argc, char** argv)
31 string filename = getResourceFile("pointe.med");
32 string meshname = "maa1";
34 MESH * aMesh = new MESH;
35 aMesh->setName(meshname);
36 MED_MESH_RDONLY_DRIVER aMeshDriver (filename, aMesh);
37 aMeshDriver.setMeshName(meshname);
42 const FAMILY * aFamily1 = aMesh->getFamily(MED_EN::MED_NODE, 1);
44 // check default constructor and operator=
45 FAMILY *aFamily4=new FAMILY;
47 // (BUG) Wrong implementation or usage of PointerOf<string>.
48 // Do not use memcpy() with array of std::string!
49 // Impossible to use FAMILY::operator=!
50 *aFamily4 = *aFamily1;
51 aFamily4->removeReference();
55 string * str = new string[nb];
58 for (int i = 0; i < nb; i++) {
59 sprintf(tmp_str, "My String N° %d", i+1);
65 _pointer = new string[3];
66 // This is wrong, because class string is not simple type
67 // and can have pointers to some data, deallocated in it's destructor,
68 // which (data) will not be copied by this operation.
69 memcpy(_pointer, str, 3*sizeof(string));
73 //PointerOf<int> p1 (1);
74 //PointerOf<int> p2 (20);
75 //p2 = newAttributeValue;
79 //PointerOf<string> p1 (1);
80 //PointerOf<string> p2 (20);
88 aMesh->removeReference();