1 // Copyright (C) 2007-2008 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
22 //=============================================================================
23 // File : MEDMEM_Family_i.cxx
26 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Family_i.cxx
27 //=============================================================================
29 #include "utilities.h"
30 #include "Utils_CorbaException.hxx"
31 #include "MEDMEM_Family_i.hxx"
32 #include "MEDMEM_Family.hxx"
33 using namespace MEDMEM;
35 //=============================================================================
39 //=============================================================================
40 FAMILY_i::FAMILY_i(): _family((::FAMILY*)NULL),
43 const char* LOC = "Default Constructor FAMILY_i";
47 //=============================================================================
51 //=============================================================================
52 FAMILY_i::FAMILY_i(const FAMILY_i & f): _family(f._family),
55 const char* LOC = "Default Constructor FAMILY_i";
59 //=============================================================================
63 //=============================================================================
67 //=============================================================================
71 //=============================================================================
72 FAMILY_i::FAMILY_i(const ::FAMILY * const f): _family(f),
75 const char* LOC = "Constructor FAMILY_i";
79 //=============================================================================
81 * CORBA: Accessor for Family's Identifier
83 //=============================================================================
85 CORBA::Long FAMILY_i::getIdentifier()
86 throw (SALOME::SALOME_Exception)
89 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
90 SALOME::INTERNAL_ERROR);
93 return _family->getIdentifier();
95 catch(MEDEXCEPTION &ex)
97 MESSAGE("Unable to acces Family Identifier");
98 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
102 //=============================================================================
104 * CORBA: Accessor for number of attributes
106 //=============================================================================
107 CORBA::Long FAMILY_i::getNumberOfAttributes()
108 throw (SALOME::SALOME_Exception)
111 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
112 SALOME::INTERNAL_ERROR);
115 return _family->getNumberOfAttributes();
117 catch(MEDEXCEPTION &ex)
119 MESSAGE("Unable to get number of attributes");
120 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
123 //=============================================================================
125 * CORBA: Accessor for attributes identifiers
127 //=============================================================================
128 SALOME_MED::long_array* FAMILY_i::getAttributesIdentifiers()
129 throw (SALOME::SALOME_Exception)
132 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
133 SALOME::INTERNAL_ERROR);
134 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
137 int nbAttribute=_family->getNumberOfAttributes();
138 myseq->length(nbAttribute);
139 const int * identifiers=_family->getAttributesIdentifiers();
140 for (int i=0;i<nbAttribute;i++)
142 myseq[i]=identifiers[i];
145 catch(MEDEXCEPTION &ex)
147 MESSAGE("Unable to acces Family Identifiers");
148 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
150 return myseq._retn();
152 //=============================================================================
154 * CORBA: Accessor for attribute identifier I
156 //=============================================================================
157 CORBA::Long FAMILY_i::getAttributeIdentifier(CORBA::Long i)
158 throw (SALOME::SALOME_Exception)
161 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
162 SALOME::INTERNAL_ERROR);
165 return _family->getAttributeIdentifier(i);
167 catch(MEDEXCEPTION &ex)
169 MESSAGE("Unable to acces Family Identifier");
170 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
174 //=============================================================================
176 * CORBA: Accessor for attributes values
178 //=============================================================================
179 SALOME_MED::long_array* FAMILY_i::getAttributesValues()
180 throw (SALOME::SALOME_Exception)
183 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
184 SALOME::INTERNAL_ERROR);
185 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
188 int nbAttribute=_family->getNumberOfAttributes();
189 myseq->length(nbAttribute);
190 const int * values=_family->getAttributesValues();
191 for (int i=0;i<nbAttribute;i++)
196 catch(MEDEXCEPTION &ex)
198 MESSAGE("Unable to acces attributs values");
199 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
201 return myseq._retn();
203 //=============================================================================
205 * CORBA: Accessor for attribute value I
207 //=============================================================================
208 CORBA::Long FAMILY_i::getAttributeValue(CORBA::Long i)
209 throw (SALOME::SALOME_Exception)
212 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
213 SALOME::INTERNAL_ERROR);
216 return _family->getAttributeValue(i);
218 catch(MEDEXCEPTION &ex)
220 MESSAGE("Unable to acces specified attribut value");
221 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
224 //=============================================================================
226 * CORBA: Accessor for attributes desriptions
228 //=============================================================================
229 SALOME_MED::string_array * FAMILY_i::getAttributesDescriptions()
230 throw (SALOME::SALOME_Exception)
233 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
234 SALOME::INTERNAL_ERROR);
236 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
239 int nbAttribute=_family->getNumberOfAttributes();
240 myseq->length(nbAttribute);
241 const string * descattribute=_family->getAttributesDescriptions();
242 for (int i=0;i<nbAttribute;i++)
244 myseq[i]=CORBA::string_dup(descattribute[i].c_str());
247 catch(MEDEXCEPTION &ex)
249 MESSAGE("Unable to acces attributs descriptions");
250 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
252 return myseq._retn();
255 //=============================================================================
257 * CORBA: Accessor for attribute description i
259 //=============================================================================
260 char * FAMILY_i::getAttributeDescription( CORBA::Long i)
261 throw (SALOME::SALOME_Exception)
264 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
265 SALOME::INTERNAL_ERROR);
268 return CORBA::string_dup(_family->getAttributeDescription(i).c_str());
270 catch(MEDEXCEPTION &ex)
272 MESSAGE("Unable to acces specified attribut description");
273 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
277 //=============================================================================
279 * CORBA: Accessor for number of groups the family belongs to
281 //=============================================================================
282 CORBA::Long FAMILY_i::getNumberOfGroups()
283 throw (SALOME::SALOME_Exception)
286 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
287 SALOME::INTERNAL_ERROR);
290 return _family->getNumberOfGroups();
292 catch (MEDEXCEPTION &ex)
294 MESSAGE("Unable to acces specified attribut value");
295 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
298 //=============================================================================
300 * CORBA: Accessor for groups names
302 //=============================================================================
303 SALOME_MED::string_array * FAMILY_i::getGroupsNames()
304 throw (SALOME::SALOME_Exception)
307 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
308 SALOME::INTERNAL_ERROR);
310 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
313 int nbGroups=_family->getNumberOfGroups();
314 myseq->length(nbGroups);
315 const string * descGroups=_family->getGroupsNames();
316 for (int i=0;i<nbGroups;i++)
318 myseq[i]=CORBA::string_dup(descGroups[i].c_str());
321 catch (MEDEXCEPTION &ex)
323 MESSAGE("Unable to acces attributs descriptions");
324 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
326 return myseq._retn();
329 //=============================================================================
331 * CORBA: Accessor for attribute description i
333 //=============================================================================
334 char * FAMILY_i::getGroupName( CORBA::Long i)
335 throw (SALOME::SALOME_Exception)
338 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
339 SALOME::INTERNAL_ERROR);
342 return CORBA::string_dup(_family->getGroupName(i).c_str());
344 catch (MEDEXCEPTION &ex)
346 MESSAGE("Unable to acces specified attribut description");
347 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);