1 //=============================================================================
2 // File : MEDMEM_Group_i.cxx
5 // Copyright : EDF 2002
6 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Group_i.cxx
7 //=============================================================================
11 #include "utilities.h"
12 #include "Utils_CorbaException.hxx"
14 #include "MEDMEM_Group_i.hxx"
15 #include "MEDMEM_Family_i.hxx"
17 #include "MEDMEM_Group.hxx"
18 #include "MEDMEM_Family.hxx"
19 using namespace MEDMEM;
21 //=============================================================================
25 //=============================================================================
26 GROUP_i::GROUP_i():_group((::GROUP*)NULL),
29 BEGIN_OF("Default Constructor GROUP_i");
30 END_OF("Default Constructor GROUP_i");
32 //=============================================================================
36 //=============================================================================
40 //=============================================================================
44 //=============================================================================
45 GROUP_i::GROUP_i(const ::GROUP * const g):_group(g),
48 BEGIN_OF("Constructor GROUP_i");
49 END_OF("Constructor GROUP_i");
51 //=============================================================================
53 * Constructor par recopie
55 //=============================================================================
56 GROUP_i::GROUP_i(const GROUP_i & g):_group(g._group),
59 BEGIN_OF("Constructor GROUP_i");
60 END_OF("Constructor GROUP_i");
62 //=============================================================================
64 * CORBA: Number of Families existing in the group
66 //=============================================================================
68 CORBA::Long GROUP_i::getNumberOfFamilies()
69 throw (SALOME::SALOME_Exception)
72 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
73 SALOME::INTERNAL_ERROR);
76 return _group->getNumberOfFamilies();
78 catch (MEDEXCEPTION &ex)
80 MESSAGE("Unable to get number of families of the group");
81 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
84 //=============================================================================
86 * CORBA: Returns references for families within the group
88 //=============================================================================
90 SALOME_MED::Family_array* GROUP_i::getFamilies()
91 throw (SALOME::SALOME_Exception)
94 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
95 SALOME::INTERNAL_ERROR);
96 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
99 int nbfam= _group->getNumberOfFamilies();
100 myseq->length(nbfam);
101 vector<FAMILY*> fam(nbfam);
102 fam = _group->getFamilies();
103 for (int i=0;i<nbfam;i++)
105 FAMILY_i * f1=new FAMILY_i(fam[i]);
106 myseq[i] = f1->POA_SALOME_MED::FAMILY::_this();
109 catch (MEDEXCEPTION &ex)
111 MESSAGE("Unable to access families");
112 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
114 return myseq._retn();
116 //=============================================================================
118 * CORBA: Returns reference for family I within the group
120 //=============================================================================
122 SALOME_MED::FAMILY_ptr GROUP_i::getFamily(CORBA::Long i)
123 throw (SALOME::SALOME_Exception)
126 THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
127 SALOME::INTERNAL_ERROR);
130 FAMILY * fam=_group->getFamily(i);
131 FAMILY_i * f1=new FAMILY_i(fam);
132 return f1->POA_SALOME_MED::FAMILY::_this();
134 catch (MEDEXCEPTION &ex)
136 MESSAGE("Unable to acces to the specified family");
137 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);