Salome HOME
This commit was generated by cvs2git to create branch 'IMPORT'.
[modules/smesh.git] / src / SMESH_I / SMESH_MEDFamily_i.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : SMESH_MEDFamily_i.cxx
4 // Project   : SALOME
5 // Copyright : EDF 2001
6 //=============================================================================
7
8 #include "SMESH_MEDFamily_i.hxx"
9 #include "utilities.h"
10 #include "Utils_CorbaException.hxx"
11
12 //=============================================================================
13 /*!
14  * Default constructor
15  */
16 //=============================================================================
17 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
18 {
19   BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
20   END_OF("Default Constructor SMESH_MEDFamily_i");
21 }
22 //=============================================================================
23 /*!
24  * constructor par recopie
25  */
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)
34 {
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];
39   };
40   _groupName=new string[_numberOfGroup];
41   for (int i=0;i<_numberOfAttribute;i++) {
42     _groupName[i]=f._groupName[i];
43   };
44   END_OF("Copy Constructor SMESH_MEDFamily_i");
45 }
46 //=============================================================================
47 /*!
48  * Destructor
49  */
50 //=============================================================================
51 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
52 {
53 }
54 //=============================================================================
55 /*!
56  * Constructor
57  */
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 ),
62   
63   _subMesh_i(sm),
64   _identifier(identifier),
65   _numberOfAttribute(0),
66   _attributeIdentifier((int*)NULL),
67   _attributeValue((int*)NULL), 
68   _attributeDescription((string*)NULL),
69   _numberOfGroup(0), 
70   _groupName((string*)NULL)
71 {
72   BEGIN_OF("Constructor SMESH_MEDFamily_i");
73   END_OF("Constructor SMESH_MEDFamily_i");
74 }
75 //=============================================================================
76 /*!
77  * CORBA: Accessor for Family's Identifier
78  */
79 //=============================================================================
80
81 CORBA::Long SMESH_MEDFamily_i::getIdentifier()      
82 throw (SALOME::SALOME_Exception)
83 {
84   if (_subMeshDS==NULL)
85     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
86                                  SALOME::INTERNAL_ERROR); 
87   return _identifier;
88   
89 }
90 //=============================================================================
91 /*!
92  * CORBA: Accessor for number of attributes
93  */
94 //=============================================================================
95 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes() 
96 throw (SALOME::SALOME_Exception)
97 {
98   if (_subMeshDS==NULL)
99     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
100                                  SALOME::INTERNAL_ERROR);
101   return _numberOfAttribute;
102 }
103 //=============================================================================
104 /*!
105  * CORBA: Accessor for attributes identifiers
106  */
107 //=============================================================================
108 Engines::long_array*  SMESH_MEDFamily_i::getAttributesIdentifiers() 
109 throw (SALOME::SALOME_Exception)
110 {
111   if (_subMeshDS==NULL)
112     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
113                                  SALOME::INTERNAL_ERROR);
114   if (_numberOfAttribute == 0)
115     {
116       MESSAGE("Les familles SMESH n ont pas d attribut");
117       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
118                                    ,SALOME::BAD_PARAM);
119     };
120   
121   Engines::long_array_var myseq= new Engines::long_array;
122   myseq->length(_numberOfAttribute);
123   for (int i=0;i<_numberOfAttribute;i++)
124     {
125       myseq[i]=_attributeIdentifier[i];
126     };
127   return myseq._retn();
128
129 }
130 //=============================================================================
131 /*!
132  * CORBA: Accessor for attribute identifier I
133  */
134 //=============================================================================
135 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) 
136   throw (SALOME::SALOME_Exception)
137 {    
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"\
143                                ,SALOME::BAD_PARAM);
144   if (_numberOfAttribute = 0)
145     {
146       MESSAGE("Les familles SMESH n ont pas d attribut");
147       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
148                                    ,SALOME::BAD_PARAM);
149     };
150   ASSERT (i <= _numberOfAttribute);
151   return _attributeIdentifier[i];
152 }
153 //=============================================================================
154 /*!
155  * CORBA: Accessor for attributes values
156  */
157 //=============================================================================
158 Engines::long_array*  SMESH_MEDFamily_i::getAttributesValues() 
159   throw (SALOME::SALOME_Exception)
160 {
161   if (_subMeshDS==NULL)
162     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
163                                  SALOME::INTERNAL_ERROR);
164
165   if (_numberOfAttribute == 0)
166     {
167       MESSAGE("Les familles SMESH n ont pas d attribut");
168       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
169                                    ,SALOME::BAD_PARAM);
170     };
171
172   Engines::long_array_var myseq= new Engines::long_array;
173   myseq->length(_numberOfAttribute);
174   for (int i=0;i<_numberOfAttribute;i++)
175     {
176       myseq[i]=_attributeValue[i];
177     };
178   return myseq._retn();
179 }
180 //=============================================================================
181 /*!
182  * CORBA: Accessor for attribute value I
183  */
184 //=============================================================================
185 CORBA::Long  SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) 
186   throw (SALOME::SALOME_Exception)
187 {   
188   if (_subMeshDS==NULL)
189     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
190                                  SALOME::INTERNAL_ERROR);
191   if (_numberOfAttribute = 0)
192     {
193       MESSAGE("Les familles SMESH n ont pas d attribut");
194       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
195                                    ,SALOME::BAD_PARAM);
196     }
197
198   ASSERT (i <= _numberOfAttribute);
199   return _attributeValue[i];
200 }
201 //=============================================================================
202 /*!
203  * CORBA: Accessor for attributes desriptions
204  */
205 //=============================================================================
206 Engines::string_array * SMESH_MEDFamily_i::getAttributesDescriptions() 
207   throw (SALOME::SALOME_Exception)
208 {
209   if (_subMeshDS==NULL)
210     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
211                                  SALOME::INTERNAL_ERROR);
212   if (_numberOfAttribute = 0)
213     {
214       MESSAGE("Les familles SMESH n ont pas d attribut");
215       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
216                                    ,SALOME::BAD_PARAM);
217     }
218   Engines::string_array_var myseq = new Engines::string_array;
219   for (int i=0;i<_numberOfAttribute;i++)
220     {
221       myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
222     }
223   return myseq._retn();
224 }
225 //=============================================================================
226 /*!
227  * CORBA: Accessor for attribute description i
228  */
229 //=============================================================================
230 char *  SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) 
231   throw (SALOME::SALOME_Exception)
232 {   
233   if (_subMeshDS==NULL)
234     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
235                                  SALOME::INTERNAL_ERROR);
236   if (_numberOfAttribute = 0)
237     {
238       MESSAGE("Les familles SMESH n ont pas d attribut");
239       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
240                                    ,SALOME::BAD_PARAM);
241     }
242   ASSERT (i <= _numberOfAttribute);
243   return CORBA::string_dup(_attributeDescription[i].c_str());
244 }