1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 //=============================================================================
24 // File : MEDMEM_Group_i.cxx
27 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Group_i.cxx
28 //=============================================================================
32 #include "utilities.h"
33 #include "Utils_CorbaException.hxx"
35 #include "MEDMEM_Group_i.hxx"
36 #include "MEDMEM_Family_i.hxx"
38 #include "MEDMEM_Group.hxx"
39 #include "MEDMEM_Family.hxx"
40 using namespace MEDMEM;
42 //=============================================================================
46 //=============================================================================
47 GROUP_i::GROUP_i():_group((::GROUP*)NULL)
50 //=============================================================================
54 //=============================================================================
58 //=============================================================================
62 //=============================================================================
63 GROUP_i::GROUP_i(const ::GROUP * const g):SUPPORT_i(g),_group(g)
66 //=============================================================================
68 * Constructor par recopie
70 //=============================================================================
71 GROUP_i::GROUP_i(const GROUP_i & g):SUPPORT_i(g._group),_group(g._group)
74 //=============================================================================
76 * CORBA: Number of Families existing in the group
78 //=============================================================================
80 CORBA::Long GROUP_i::getNumberOfFamilies()
81 throw (SALOME::SALOME_Exception)
84 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
85 SALOME::INTERNAL_ERROR);
88 return _group->getNumberOfFamilies();
90 catch (MEDEXCEPTION &ex)
92 MESSAGE("Unable to get number of families of the group");
93 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
96 //=============================================================================
98 * CORBA: Returns references for families within the group
100 //=============================================================================
102 SALOME_MED::Family_array* GROUP_i::getFamilies()
103 throw (SALOME::SALOME_Exception)
106 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
107 SALOME::INTERNAL_ERROR);
108 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
111 int nbfam= _group->getNumberOfFamilies();
112 myseq->length(nbfam);
113 vector<FAMILY*> fam(nbfam);
114 fam = _group->getFamilies();
115 for (int i=0;i<nbfam;i++)
117 FAMILY_i * f1=new FAMILY_i(fam[i]);
118 myseq[i] = f1->_this();
121 catch (MEDEXCEPTION &ex)
123 MESSAGE("Unable to access families");
124 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
126 return myseq._retn();
128 //=============================================================================
130 * CORBA: Returns reference for family I within the group
132 //=============================================================================
134 SALOME_MED::FAMILY_ptr GROUP_i::getFamily(CORBA::Long i)
135 throw (SALOME::SALOME_Exception)
138 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
139 SALOME::INTERNAL_ERROR);
142 FAMILY * fam=_group->getFamily(i);
143 FAMILY_i * f1=new FAMILY_i(fam);
146 catch (MEDEXCEPTION &ex)
148 MESSAGE("Unable to acces to the specified family");
149 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);