2 //=============================================================================
3 // File : SMESH_MEDFamily_i.cxx
5 // Copyright : EDF 2001
6 //=============================================================================
8 #include "SMESH_MEDFamily_i.hxx"
10 #include "Utils_CorbaException.hxx"
12 //=============================================================================
16 //=============================================================================
17 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
19 BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
20 END_OF("Default Constructor SMESH_MEDFamily_i");
22 //=============================================================================
24 * constructor par recopie
26 //=============================================================================
27 SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f):
28 SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
29 _subMesh_i(f._subMesh_i),
30 _identifier(f._identifier),
31 _numberOfAttribute(f._numberOfAttribute),
32 _numberOfGroup(f._numberOfGroup),
33 _attributeValue(f._attributeValue)
35 BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
36 _attributeDescription=new string[_numberOfAttribute];
37 for (int i=0;i<_numberOfAttribute;i++) {
38 _attributeDescription[i]=f._attributeDescription[i];
40 _groupName=new string[_numberOfGroup];
41 for (int i=0;i<_numberOfAttribute;i++) {
42 _groupName[i]=f._groupName[i];
44 END_OF("Copy Constructor SMESH_MEDFamily_i");
46 //=============================================================================
50 //=============================================================================
51 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
54 //=============================================================================
58 //=============================================================================
59 SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
60 string name, string description, SALOME_MED::medEntityMesh entity):
61 SMESH_MEDSupport_i( sm, name, description, entity ),
64 _identifier(identifier),
65 _numberOfAttribute(0),
66 _attributeIdentifier((int*)NULL),
67 _attributeValue((int*)NULL),
68 _attributeDescription((string*)NULL),
70 _groupName((string*)NULL)
72 BEGIN_OF("Constructor SMESH_MEDFamily_i");
73 END_OF("Constructor SMESH_MEDFamily_i");
75 //=============================================================================
77 * CORBA: Accessor for Family's Identifier
79 //=============================================================================
81 CORBA::Long SMESH_MEDFamily_i::getIdentifier()
82 throw (SALOME::SALOME_Exception)
85 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
86 SALOME::INTERNAL_ERROR);
90 //=============================================================================
92 * CORBA: Accessor for number of attributes
94 //=============================================================================
95 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes()
96 throw (SALOME::SALOME_Exception)
99 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
100 SALOME::INTERNAL_ERROR);
101 return _numberOfAttribute;
103 //=============================================================================
105 * CORBA: Accessor for attributes identifiers
107 //=============================================================================
108 Engines::long_array* SMESH_MEDFamily_i::getAttributesIdentifiers()
109 throw (SALOME::SALOME_Exception)
111 if (_subMeshDS==NULL)
112 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
113 SALOME::INTERNAL_ERROR);
114 if (_numberOfAttribute == 0)
116 MESSAGE("Les familles SMESH n ont pas d attribut");
117 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
121 Engines::long_array_var myseq= new Engines::long_array;
122 myseq->length(_numberOfAttribute);
123 for (int i=0;i<_numberOfAttribute;i++)
125 myseq[i]=_attributeIdentifier[i];
127 return myseq._retn();
130 //=============================================================================
132 * CORBA: Accessor for attribute identifier I
134 //=============================================================================
135 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i)
136 throw (SALOME::SALOME_Exception)
138 if (_subMeshDS==NULL)
139 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
140 SALOME::INTERNAL_ERROR);
141 MESSAGE("Les familles SMESH n ont pas d attribut");
142 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
144 if (_numberOfAttribute = 0)
146 MESSAGE("Les familles SMESH n ont pas d attribut");
147 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
150 ASSERT (i <= _numberOfAttribute);
151 return _attributeIdentifier[i];
153 //=============================================================================
155 * CORBA: Accessor for attributes values
157 //=============================================================================
158 Engines::long_array* SMESH_MEDFamily_i::getAttributesValues()
159 throw (SALOME::SALOME_Exception)
161 if (_subMeshDS==NULL)
162 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
163 SALOME::INTERNAL_ERROR);
165 if (_numberOfAttribute == 0)
167 MESSAGE("Les familles SMESH n ont pas d attribut");
168 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
172 Engines::long_array_var myseq= new Engines::long_array;
173 myseq->length(_numberOfAttribute);
174 for (int i=0;i<_numberOfAttribute;i++)
176 myseq[i]=_attributeValue[i];
178 return myseq._retn();
180 //=============================================================================
182 * CORBA: Accessor for attribute value I
184 //=============================================================================
185 CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i)
186 throw (SALOME::SALOME_Exception)
188 if (_subMeshDS==NULL)
189 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
190 SALOME::INTERNAL_ERROR);
191 if (_numberOfAttribute = 0)
193 MESSAGE("Les familles SMESH n ont pas d attribut");
194 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
198 ASSERT (i <= _numberOfAttribute);
199 return _attributeValue[i];
201 //=============================================================================
203 * CORBA: Accessor for attributes desriptions
205 //=============================================================================
206 Engines::string_array * SMESH_MEDFamily_i::getAttributesDescriptions()
207 throw (SALOME::SALOME_Exception)
209 if (_subMeshDS==NULL)
210 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
211 SALOME::INTERNAL_ERROR);
212 if (_numberOfAttribute = 0)
214 MESSAGE("Les familles SMESH n ont pas d attribut");
215 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
218 Engines::string_array_var myseq = new Engines::string_array;
219 for (int i=0;i<_numberOfAttribute;i++)
221 myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
223 return myseq._retn();
225 //=============================================================================
227 * CORBA: Accessor for attribute description i
229 //=============================================================================
230 char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i)
231 throw (SALOME::SALOME_Exception)
233 if (_subMeshDS==NULL)
234 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
235 SALOME::INTERNAL_ERROR);
236 if (_numberOfAttribute = 0)
238 MESSAGE("Les familles SMESH n ont pas d attribut");
239 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
242 ASSERT (i <= _numberOfAttribute);
243 return CORBA::string_dup(_attributeDescription[i].c_str());