Salome HOME
Copyrights update
[modules/med.git] / src / MEDMEM_I / MEDMEM_Field_i.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 //=============================================================================
21 // File      : MEDMEM_Field_i.cxx
22 // Created   : mer fév 20 15:47:57 CET 2002
23 // Author    : EDF
24 // Project   : SALOME
25 // Copyright : EDF 2002
26 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Field_i.cxx
27 //=============================================================================
28 #include "MEDMEM_Field_i.hxx"
29
30 using namespace MEDMEM;
31 using namespace MED_EN;
32
33 map < int, ::FIELD_ * > FIELD_i::fieldMap ;
34 int  FIELD_i::fieldIndex = 0;
35 //=============================================================================
36 /*!
37  * Default constructor
38  */
39 //=============================================================================
40
41 //FIELD_i::FIELD_i():_fieldTptr(FIELD_i::constructConstField())
42 FIELD_i::FIELD_i():_fieldTptr(constructConstField()),_corbaIndex(FIELD_i::fieldIndex++)
43 {
44         BEGIN_OF("Default Constructor Field_i");
45         END_OF(" Default Constructor Field_i");
46 }
47 //=============================================================================
48 /*!
49  * Destructor
50  */
51 //=============================================================================
52 FIELD_i::~FIELD_i()
53 {
54   if (_ownCppPtr) delete _fieldTptr;
55 }
56 //=============================================================================
57 /*!
58  * Constructor
59  */
60 //=============================================================================
61 FIELD_i::FIELD_i(::FIELD_ * const field, bool ownCppPtr):
62   _fieldTptr(field),
63   _corbaIndex(FIELD_i::fieldIndex++),
64   _FieldId(""),
65   _ownCppPtr(ownCppPtr)
66 {
67   BEGIN_OF("Constructor FIELD_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
68   FIELD_i::fieldMap[_corbaIndex]=_fieldTptr;
69
70   MESSAGE("FIELD_i::FIELD_i  Checking of pointeurs !!!");
71
72   SCRUTE(_fieldTptr);
73
74   END_OF("Constructor FIELD_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
75 }
76
77 //=============================================================================
78 /*!
79  * Constructor par recopie
80  */
81 //=============================================================================
82 FIELD_i::FIELD_i( FIELD_i & f):_fieldTptr(f._fieldTptr),
83                                _corbaIndex(FIELD_i::fieldIndex++),
84                                _FieldId(""), _ownCppPtr(false)
85 {
86         BEGIN_OF("Constructor Field_i");
87         FIELD_i::fieldMap[_corbaIndex]=_fieldTptr;
88         END_OF("Constructor Field_i");
89 }
90 //=============================================================================
91 /*!
92  * Constructor d un pointeur constant 
93  */
94 //=============================================================================
95  ::FIELD_ * FIELD_i::constructConstField() const
96 {
97         ::FIELD_ * const ptrField =new ::FIELD_();
98         return ptrField;
99 }
100 //=============================================================================
101 /*!
102  * CORBA: Accessor for Fields's Name
103  */
104 //=============================================================================
105 char * FIELD_i::getName()
106 throw (SALOME::SALOME_Exception)
107 {
108         if (_fieldTptr==NULL)
109                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
110                                              SALOME::INTERNAL_ERROR);
111         try
112         {
113                 return CORBA::string_dup(_fieldTptr->getName().c_str());
114         }
115         catch (MEDEXCEPTION &ex)
116         {
117                 MESSAGE("Exception en accedant au nom");
118                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
119         }
120 }
121 //=============================================================================
122 /*!
123  * CORBA: Accessor for Fields's Description
124  */
125 //=============================================================================
126 char * FIELD_i::getDescription()
127 throw (SALOME::SALOME_Exception)
128 {
129         if (_fieldTptr==NULL)
130                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
131                                              SALOME::INTERNAL_ERROR);
132         try
133         {
134                 return CORBA::string_dup(_fieldTptr->getDescription().c_str());
135         }
136         catch (MEDEXCEPTION &ex)
137         {
138                 MESSAGE("Exception en accedant a la description");
139                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
140         }
141 }
142 //=============================================================================
143 /*!
144  * CORBA: Accessor for Fields's Support
145  */
146 //=============================================================================
147
148 SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()
149   throw (SALOME::SALOME_Exception)
150 {
151   BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()");
152
153   if (_fieldTptr==NULL)
154     THROW_SALOME_CORBA_EXCEPTION("No associated Field",
155                                  SALOME::INTERNAL_ERROR);
156   
157   SUPPORT_i* servant = new SUPPORT_i(_fieldTptr->getSupport());
158
159   SALOME_MED::SUPPORT_ptr support=servant->_this();
160
161   SCRUTE(_fieldTptr);
162
163   END_OF("SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()");
164
165   return support ;
166 }
167 //=============================================================================
168 /*!
169  * CORBA: Accessor for Fields's Number of components
170  */
171 //=============================================================================
172 CORBA::Long FIELD_i::getNumberOfComponents()
173 throw (SALOME::SALOME_Exception)
174 {
175         if (_fieldTptr==NULL)
176                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
177                                              SALOME::INTERNAL_ERROR);
178         try
179         {
180                 return _fieldTptr->getNumberOfComponents();
181         }
182         catch (MEDEXCEPTION &ex)
183         {
184                 MESSAGE("Exception en accedant au support");
185                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
186         }
187 }
188 //=============================================================================
189 /*!
190  * CORBA: Accessor for names of component I
191  */
192 //=============================================================================
193 char * FIELD_i::getComponentName(CORBA::Long i)
194 throw (SALOME::SALOME_Exception)
195 {
196         if (_fieldTptr==NULL)
197                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
198                                              SALOME::INTERNAL_ERROR);
199         try
200         {
201                 return CORBA::string_dup(_fieldTptr->getComponentName(i).c_str());
202         }
203         catch (MEDEXCEPTION &ex)
204         {
205                 MESSAGE("Exception en accedant au nom d un component");
206                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
207         }
208 }
209 //=============================================================================
210 /*!
211  * CORBA: Accessor for unit of component I
212  */
213 //=============================================================================
214 char * FIELD_i::getComponentUnit(CORBA::Long i)
215 throw (SALOME::SALOME_Exception)
216 {
217         if (_fieldTptr==NULL)
218                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
219                                              SALOME::INTERNAL_ERROR);
220         try
221         {
222                 return CORBA::string_dup(_fieldTptr->getMEDComponentUnit(i).c_str());
223         }
224         catch (MEDEXCEPTION &ex)
225         {
226                 MESSAGE("Exception en accedant au nom d un component");
227                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
228         }
229 }
230 //=============================================================================
231 /*!
232  * CORBA: Accessor for description of component I
233  */
234 //=============================================================================
235 char * FIELD_i::getComponentDescription(CORBA::Long i)
236 throw (SALOME::SALOME_Exception)
237 {
238         if (_fieldTptr==NULL)
239                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
240                                              SALOME::INTERNAL_ERROR);
241         try
242         {
243                 return CORBA::string_dup(_fieldTptr->getComponentDescription(i).c_str());
244         }
245         catch (MEDEXCEPTION &ex)
246         {
247                 MESSAGE("Exception en accedant a la description d un component");
248                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
249         }
250 }
251 //=============================================================================
252 /*!
253  * CORBA: Accessor for iteration number 
254  */
255 //=============================================================================
256 CORBA::Long FIELD_i::getIterationNumber()
257 throw (SALOME::SALOME_Exception)
258 {
259         if (_fieldTptr==NULL)
260                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
261                                              SALOME::INTERNAL_ERROR);
262         try
263         {
264                 return _fieldTptr->getIterationNumber();
265         }
266         catch (MEDEXCEPTION &ex)
267         {
268                 MESSAGE("Exception en accedant au champ");
269                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
270         }
271 }
272 //=============================================================================
273 /*!
274  * CORBA: Accessor for Corba Number 
275  */
276 //=============================================================================
277 CORBA::Long FIELD_i::getCorbaIndex()
278 throw (SALOME::SALOME_Exception)
279 {
280         if (_fieldTptr==NULL)
281                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
282                                              SALOME::INTERNAL_ERROR);
283         return _corbaIndex;
284         
285 }
286 //=============================================================================
287 /*!
288  * CORBA: Accessor for iteration number 
289  */
290 //=============================================================================
291 CORBA::Long FIELD_i::getOrderNumber()
292 throw (SALOME::SALOME_Exception)
293 {
294         if (_fieldTptr==NULL)
295                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
296                                              SALOME::INTERNAL_ERROR);
297         try
298         {
299                 return _fieldTptr->getOrderNumber();
300         }
301         catch (MEDEXCEPTION &ex)
302         {
303                 MESSAGE("Exception en accedant au champ");
304                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
305         }
306 }
307 //=============================================================================
308 /*!
309  * CORBA: Accessor  
310  */
311 //=============================================================================
312 CORBA::Double FIELD_i::getTime()
313 throw (SALOME::SALOME_Exception)
314 {
315         if (_fieldTptr==NULL)
316                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
317                                              SALOME::INTERNAL_ERROR);
318         try
319         {
320                 return _fieldTptr->getTime();
321         }
322         catch (MEDEXCEPTION &ex)
323         {
324                 MESSAGE("Exception en accedant au champ");
325                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
326         }
327 }
328 //=============================================================================
329 /*!
330  * CORBA: Accessor for Fields's Components names
331  */
332 //=============================================================================
333 SALOME_MED::string_array * FIELD_i::getComponentsNames()
334 throw (SALOME::SALOME_Exception)    
335 {
336         if (_fieldTptr==NULL)
337                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
338                                              SALOME::INTERNAL_ERROR);
339         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
340         try
341         {
342                 int nbcom = _fieldTptr->getNumberOfComponents();
343                 myseq->length(nbcom);
344                 const string * namecom=_fieldTptr->getComponentsNames();
345                 for (int i=0;i<nbcom;i++)
346                 {
347                         myseq[i]=CORBA::string_dup(namecom[i].c_str());
348                 }
349         }
350         catch (MEDEXCEPTION &ex)
351         {
352                 MESSAGE("Exception en accedant au champ");
353                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
354         }
355         return myseq._retn();
356 }
357 //=============================================================================
358 /*!
359  * CORBA: Accessor for Fields's Components units
360  */
361 //=============================================================================
362 SALOME_MED::string_array * FIELD_i::getComponentsUnits()
363 throw (SALOME::SALOME_Exception)
364 {
365         if (_fieldTptr==NULL)
366                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
367                                              SALOME::INTERNAL_ERROR);
368         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
369         try
370         {
371                 int nbcom = _fieldTptr->getNumberOfComponents();
372                 myseq->length(nbcom);
373                 const string * unitcom=_fieldTptr->getMEDComponentsUnits();
374                 for (int i=0;i<nbcom;i++)
375                 {
376                         myseq[i]=CORBA::string_dup(unitcom[i].c_str());
377                 }
378         }
379         catch (MEDEXCEPTION &ex)
380         {
381                 MESSAGE("Exception en accedant au champ");
382                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
383         }
384         return myseq._retn();
385 }
386 //=============================================================================
387 /*!
388  * CORBA: Accessor for Fields's Components descriptions
389  */
390 //=============================================================================
391 SALOME_MED::string_array * FIELD_i::getComponentsDescriptions()
392 throw (SALOME::SALOME_Exception)    
393 {
394         if (_fieldTptr==NULL)
395                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
396                                              SALOME::INTERNAL_ERROR);
397         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
398         try
399         {
400                 int nbcom = _fieldTptr->getNumberOfComponents();
401                 myseq->length(nbcom);
402                 const string * namecom=_fieldTptr->getComponentsDescriptions();
403                 for (int i=0;i<nbcom;i++)
404                 {
405                         myseq[i]=CORBA::string_dup(namecom[i].c_str());
406                 }
407         }
408         catch (MEDEXCEPTION &ex)
409         {
410                 MESSAGE("Exception en accedant au champ");
411                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
412         }
413         return myseq._retn();
414 }
415 //=============================================================================
416 /*!
417  * CORBA: Add in Study
418  */
419 //=============================================================================
420 void FIELD_i::addInStudy(SALOMEDS::Study_ptr myStudy, 
421                                                  SALOME_MED::FIELD_ptr myIor )
422                     throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection)
423 {
424         BEGIN_OF(" FIELD_i::addInStudy");
425         if (_fieldTptr==NULL)
426                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
427                                              SALOME::INTERNAL_ERROR);
428         if ( _FieldId != "" )
429         {
430                 MESSAGE("Field already in Study");
431                     THROW_SALOME_CORBA_EXCEPTION("Field already in Study", \
432                                  SALOME::BAD_PARAM);
433         };
434
435
436         SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
437         SALOMEDS::GenericAttribute_var anAttr;
438         SALOMEDS::AttributeName_var    aName;
439         SALOMEDS::AttributeIOR_var     aIOR;
440
441         // Create SComponent labelled 'Med'
442         SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
443         if ( CORBA::is_nil(medfather) )
444           THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'MED' not Found",SALOME::INTERNAL_ERROR);
445
446         // Create SObject labelled 'MEDFIELD' if it doesn't already exit
447         SALOMEDS::SObject_var medfieldfather = myStudy->FindObject("MEDFIELD");
448         if ( CORBA::is_nil(medfieldfather) ) 
449         {
450           MESSAGE("Add Object 'MEDFIELD'");
451           medfieldfather = myBuilder->NewObject(medfather);
452           anAttr = myBuilder->FindOrCreateAttribute(medfieldfather, "AttributeName");
453           aName = SALOMEDS::AttributeName::_narrow(anAttr);
454           aName->SetValue("MEDFIELD");
455           
456         } ;
457
458         string fieldName = _fieldTptr->getName();
459
460         // Create SObject labelled 'FIELDNAME' if it doesn't already exit
461         SALOMEDS::SObject_var medfieldnamefather = myStudy->FindObject(fieldName.c_str());
462         if ( CORBA::is_nil(medfieldnamefather) ) 
463         {
464           MESSAGE("Add Object "<<fieldName);
465           medfieldnamefather = myBuilder->NewObject(medfieldfather);
466           anAttr = myBuilder->FindOrCreateAttribute(medfieldnamefather, "AttributeName");
467           aName = SALOMEDS::AttributeName::_narrow(anAttr);
468           aName->SetValue(fieldName.c_str());
469
470         } ;
471
472         // Create object labelled according to Field's Name
473
474         MESSAGE("Add a Field Object under "<<fieldName);
475         myBuilder->NewCommand();
476         SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfieldnamefather);
477
478         ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
479         ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
480         CORBA::ORB_var &orb = init(0,0);
481
482         int iterationNumber = _fieldTptr->getIterationNumber();
483         SCRUTE(iterationNumber);
484
485         int orderNumber = _fieldTptr->getOrderNumber();
486         SCRUTE(orderNumber);
487
488         ostringstream iterationName ;
489         iterationName<<"(" << iterationNumber << "," << orderNumber << ")";
490         //      string supportName = _support->getName();
491         string supportName = (_fieldTptr->getSupport())->getName();
492         //      string meshName = (_support->getMesh())->getName();
493         string meshName = ((_fieldTptr->getSupport())->getMesh())->getName();
494         string meshNameStudy = meshName;
495
496         char * fieldEntryName;
497         int lenName = strlen(iterationName.str().c_str()) + 4 +
498           strlen(supportName.c_str()) + 4 + strlen(meshName.c_str()) + 1;
499
500         fieldEntryName = new char[lenName];
501         fieldEntryName = strcpy(fieldEntryName,iterationName.str().c_str());
502         fieldEntryName = strcat(fieldEntryName,"_ON_");
503         fieldEntryName = strcat(fieldEntryName,supportName.c_str());
504         fieldEntryName = strcat(fieldEntryName,"_OF_");
505
506         for (string::size_type pos=0; pos<meshNameStudy.size();++pos)
507           {
508             if (isspace(meshNameStudy[pos])) meshNameStudy[pos] = '_';
509           }
510
511         SCRUTE(meshNameStudy);
512
513         fieldEntryName = strcat(fieldEntryName,meshNameStudy.c_str());
514
515         SCRUTE(fieldEntryName);
516
517         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
518         aName = SALOMEDS::AttributeName::_narrow(anAttr);
519 //         aName->SetValue(iterationName.str().c_str());
520         aName->SetValue(fieldEntryName);
521
522         string iorStr = orb->object_to_string(myIor);
523         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
524         aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
525         aIOR->SetValue(iorStr.c_str());
526         myBuilder->CommitCommand();
527         _FieldId = newObj->GetID();
528
529         MESSAGE("Computing path to Support");
530
531         string supportEntryPath = SUPPORT_i::getEntryPath( meshNameStudy,
532                                                            _fieldTptr->getSupport() );
533         SCRUTE(supportEntryPath);
534
535         MESSAGE("supportEntryPath in field " << supportEntryPath /*<< " length " << lenName*/);
536
537 //      SALOMEDS::SObject_var supportObject = myStudy->FindObject(supportName.c_str());
538         SALOMEDS::SObject_var supportObject = myStudy->FindObjectByPath(supportEntryPath.c_str());
539
540         SCRUTE(supportObject);
541
542         if ( CORBA::is_nil(supportObject) ) 
543         {
544           MESSAGE("supportObject is a nil corba object");
545           MESSAGE("FIELD_i::addInStudy : SUPPORT not found") ;
546         } 
547         else 
548         {
549           MESSAGE("supportObject is OK and is now going to be referenced !");
550           SALOMEDS::SObject_var newObjSupport = myBuilder->NewObject(newObj);
551           myBuilder->Addreference(newObjSupport,supportObject);
552           MESSAGE(" OUF !!!");
553         }
554
555         myBuilder->CommitCommand();
556
557         //delete [] supportEntryPath;
558         delete [] fieldEntryName;
559
560         // register the Corba pointer: increase the referrence count
561         MESSAGE("Registering of the Corba Field pointer");
562         Register();
563
564         MESSAGE("FIELD_i::addInStudy");
565
566         //END_OF("FIELD_i::addInStudy");
567 }
568 //=============================================================================
569 /*!
570  * CORBA: write
571  */
572 //=============================================================================
573 void FIELD_i::write (CORBA::Long i, const char* driverFieldName)
574 throw (SALOME::SALOME_Exception)
575 {
576         if (_fieldTptr==NULL)
577                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
578                                              SALOME::INTERNAL_ERROR);
579         try
580         {
581                 _fieldTptr->write(i,driverFieldName);
582         }
583         catch (MEDEXCEPTION &ex)
584         {
585                 MESSAGE("Exception en accedant au champ");
586                 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
587                                                 ,SALOME::INTERNAL_ERROR);
588         }
589 }
590 //=============================================================================
591 /*!
592  * CORBA: read
593  */
594 //=============================================================================
595 void FIELD_i::read (CORBA::Long i)
596 throw (SALOME::SALOME_Exception)
597 {
598         if (_fieldTptr==NULL)
599                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
600                                              SALOME::INTERNAL_ERROR);
601         try
602         {
603                 _fieldTptr->read(i);
604         }
605         catch (MEDEXCEPTION &ex)
606         {
607                 MESSAGE("Exception en accedant au champ");
608                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
609         }
610 }
611 //=============================================================================
612 /*!
613  * CORBA: rmDriver
614  */
615 //=============================================================================
616 void FIELD_i::rmDriver (CORBA::Long i)
617 throw (SALOME::SALOME_Exception)
618 {
619         if (_fieldTptr==NULL)
620                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
621                                              SALOME::INTERNAL_ERROR);
622         try
623         {
624                 _fieldTptr->rmDriver(i);
625         }
626         catch (MEDEXCEPTION &ex)
627         {
628                 MESSAGE("Exception en accedant au champ");
629                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
630         }
631 }
632 //=============================================================================
633 /*!
634  * CORBA: addDriver
635  */
636 //=============================================================================
637 CORBA::Long FIELD_i::addDriver (SALOME_MED::medDriverTypes driverType, 
638                         const char* fileName, const char* fieldName) throw (SALOME::SALOME_Exception)
639 {
640         if (_fieldTptr==NULL)
641                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
642                                              SALOME::INTERNAL_ERROR);
643         try
644         {
645                 int drivernum=_fieldTptr->addDriver(
646                                         convertIdlDriverToMedDriver(driverType),
647                                         fileName,
648                                         fieldName);
649                 return drivernum;
650         }
651         catch (MEDEXCEPTION &ex)
652         {
653                 MESSAGE("Exception en accedant au champ");
654                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
655         }
656 }
657