1 //=============================================================================
2 // File : MEDMEM_Family_i.cxx
4 // Copyright : EDF 2002
6 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Family_i.cxx
7 //=============================================================================
10 #include "Utils_CorbaException.hxx"
11 #include "MEDMEM_Family_i.hxx"
12 #include "MEDMEM_Family.hxx"
13 using namespace MEDMEM;
15 //=============================================================================
19 //=============================================================================
20 FAMILY_i::FAMILY_i(): _family((::FAMILY*)NULL),
23 BEGIN_OF("Default Constructor FAMILY_i");
24 END_OF("Default Constructor FAMILY_i");
26 //=============================================================================
30 //=============================================================================
31 FAMILY_i::FAMILY_i(const FAMILY_i & f): _family(f._family),
34 BEGIN_OF("Default Constructor FAMILY_i");
35 END_OF("Default Constructor FAMILY_i");
37 //=============================================================================
41 //=============================================================================
45 //=============================================================================
49 //=============================================================================
50 FAMILY_i::FAMILY_i(const ::FAMILY * const f): _family(f),
53 BEGIN_OF("Constructor FAMILY_i");
54 END_OF("Constructor FAMILY_i");
56 //=============================================================================
58 * CORBA: Accessor for Family's Identifier
60 //=============================================================================
62 CORBA::Long FAMILY_i::getIdentifier()
63 throw (SALOME::SALOME_Exception)
66 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
67 SALOME::INTERNAL_ERROR);
70 return _family->getIdentifier();
72 catch(MEDEXCEPTION &ex)
74 MESSAGE("Unable to acces Family Identifier");
75 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
79 //=============================================================================
81 * CORBA: Accessor for number of attributes
83 //=============================================================================
84 CORBA::Long FAMILY_i::getNumberOfAttributes()
85 throw (SALOME::SALOME_Exception)
88 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
89 SALOME::INTERNAL_ERROR);
92 return _family->getNumberOfAttributes();
94 catch(MEDEXCEPTION &ex)
96 MESSAGE("Unable to get number of attributes");
97 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
100 //=============================================================================
102 * CORBA: Accessor for attributes identifiers
104 //=============================================================================
105 SALOME_MED::long_array* FAMILY_i::getAttributesIdentifiers()
106 throw (SALOME::SALOME_Exception)
109 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
110 SALOME::INTERNAL_ERROR);
111 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
114 int nbAttribute=_family->getNumberOfAttributes();
115 myseq->length(nbAttribute);
116 int * identifiers=_family->getAttributesIdentifiers();
117 for (int i=0;i<nbAttribute;i++)
119 myseq[i]=identifiers[i];
122 catch(MEDEXCEPTION &ex)
124 MESSAGE("Unable to acces Family Identifiers");
125 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
127 return myseq._retn();
129 //=============================================================================
131 * CORBA: Accessor for attribute identifier I
133 //=============================================================================
134 CORBA::Long FAMILY_i::getAttributeIdentifier(CORBA::Long i)
135 throw (SALOME::SALOME_Exception)
138 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
139 SALOME::INTERNAL_ERROR);
142 return _family->getAttributeIdentifier(i);
144 catch(MEDEXCEPTION &ex)
146 MESSAGE("Unable to acces Family Identifier");
147 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
151 //=============================================================================
153 * CORBA: Accessor for attributes values
155 //=============================================================================
156 SALOME_MED::long_array* FAMILY_i::getAttributesValues()
157 throw (SALOME::SALOME_Exception)
160 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
161 SALOME::INTERNAL_ERROR);
162 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
165 int nbAttribute=_family->getNumberOfAttributes();
166 myseq->length(nbAttribute);
167 int * values=_family->getAttributesValues();
168 for (int i=0;i<nbAttribute;i++)
173 catch(MEDEXCEPTION &ex)
175 MESSAGE("Unable to acces attributs values");
176 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
178 return myseq._retn();
180 //=============================================================================
182 * CORBA: Accessor for attribute value I
184 //=============================================================================
185 CORBA::Long FAMILY_i::getAttributeValue(CORBA::Long i)
186 throw (SALOME::SALOME_Exception)
189 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
190 SALOME::INTERNAL_ERROR);
193 return _family->getAttributeValue(i);
195 catch(MEDEXCEPTION &ex)
197 MESSAGE("Unable to acces specified attribut value");
198 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
201 //=============================================================================
203 * CORBA: Accessor for attributes desriptions
205 //=============================================================================
206 SALOME_MED::string_array * FAMILY_i::getAttributesDescriptions()
207 throw (SALOME::SALOME_Exception)
210 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
211 SALOME::INTERNAL_ERROR);
213 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
216 int nbAttribute=_family->getNumberOfAttributes();
217 myseq->length(nbAttribute);
218 string * descattribute=_family->getAttributesDescriptions();
219 for (int i=0;i<nbAttribute;i++)
221 myseq[i]=CORBA::string_dup(descattribute[i].c_str());
224 catch(MEDEXCEPTION &ex)
226 MESSAGE("Unable to acces attributs descriptions");
227 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
229 return myseq._retn();
232 //=============================================================================
234 * CORBA: Accessor for attribute description i
236 //=============================================================================
237 char * FAMILY_i::getAttributeDescription( CORBA::Long i)
238 throw (SALOME::SALOME_Exception)
241 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
242 SALOME::INTERNAL_ERROR);
245 return CORBA::string_dup(_family->getAttributeDescription(i).c_str());
247 catch(MEDEXCEPTION &ex)
249 MESSAGE("Unable to acces specified attribut description");
250 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
254 //=============================================================================
256 * CORBA: Accessor for number of groups the family belongs to
258 //=============================================================================
259 CORBA::Long FAMILY_i::getNumberOfGroups()
260 throw (SALOME::SALOME_Exception)
263 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
264 SALOME::INTERNAL_ERROR);
267 return _family->getNumberOfGroups();
269 catch (MEDEXCEPTION &ex)
271 MESSAGE("Unable to acces specified attribut value");
272 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
275 //=============================================================================
277 * CORBA: Accessor for groups names
279 //=============================================================================
280 SALOME_MED::string_array * FAMILY_i::getGroupsNames()
281 throw (SALOME::SALOME_Exception)
284 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
285 SALOME::INTERNAL_ERROR);
287 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
290 int nbGroups=_family->getNumberOfGroups();
291 myseq->length(nbGroups);
292 string * descGroups=_family->getGroupsNames();
293 for (int i=0;i<nbGroups;i++)
295 myseq[i]=CORBA::string_dup(descGroups[i].c_str());
298 catch (MEDEXCEPTION &ex)
300 MESSAGE("Unable to acces attributs descriptions");
301 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
303 return myseq._retn();
306 //=============================================================================
308 * CORBA: Accessor for attribute description i
310 //=============================================================================
311 char * FAMILY_i::getGroupName( CORBA::Long i)
312 throw (SALOME::SALOME_Exception)
315 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
316 SALOME::INTERNAL_ERROR);
319 return CORBA::string_dup(_family->getGroupName(i).c_str());
321 catch (MEDEXCEPTION &ex)
323 MESSAGE("Unable to acces specified attribut description");
324 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);