Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MED / Med_Gen_Driver_i.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  MED MED : implemetation of MED idl descriptions
23 //  File   : Med_Gen_Driver_i.hxx
24 //  Author : Paul RASCLE, EDF
25 //  Module : MED
26 //
27 #ifndef _MED_GEN_DRIVER_I_HXX_
28 #define _MED_GEN_DRIVER_I_HXX_
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(MED_Gen)
32 #include CORBA_SERVER_HEADER(MED)
33 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
34
35 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
36
37 #include "SALOME_Component_i.hxx"
38 #include "SALOME_NamingService.hxx"
39
40 #include <map>
41
42 namespace MEDMEM {
43   class MED_i;
44 }
45
46 class Med_Gen_Driver_i : public virtual POA_SALOME_MED::MED_Gen_Driver
47 {
48 private:
49   Med_Gen_Driver_i();
50
51 public:
52   //  Constructor and Destructor
53   Med_Gen_Driver_i(CORBA::ORB_ptr orb);
54   virtual ~Med_Gen_Driver_i();
55
56   // Get Med object of the study (for persistance)
57   static MEDMEM::MED_i* GetMED(SALOMEDS::SComponent_ptr theStudy);
58
59   // inherited methods from SALOMEDS::Driver
60
61   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
62                           const char* theURL,
63                           bool isMultiFile);
64   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
65                                const char* theURL,
66                                bool isMultiFile);
67
68   CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
69                       const SALOMEDS::TMPFile& theStream,
70                       const char* theURL,
71                       bool isMultiFile);
72   CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
73                            const SALOMEDS::TMPFile& theStream,
74                            const char* theURL,
75                            bool isMultiFile);
76
77   void Close(SALOMEDS::SComponent_ptr theComponent);
78
79   char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
80                                const char* IORString,
81                                CORBA::Boolean isMultiFile,
82                                CORBA::Boolean isASCII);
83   char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
84                                const char* aLocalPersistentID,
85                                CORBA::Boolean isMultiFile,
86                                CORBA::Boolean isASCII)
87     throw(SALOME::SALOME_Exception);
88
89   bool CanPublishInStudy(CORBA::Object_ptr theIOR);
90
91   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
92                                        SALOMEDS::SObject_ptr theSObject,
93                                        CORBA::Object_ptr theObject,
94                                        const char* theName) throw (SALOME::SALOME_Exception);
95
96   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
97   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
98
99   CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
100   SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
101                                   CORBA::Long theObjectID,
102                                   SALOMEDS::SObject_ptr theObject);
103
104   // this method of SALOMEDS::Driver must be implemented in Component
105   //char* ComponentDataType();
106
107   // to be defined in Component
108   virtual Engines::Component_ptr GetComponentInstance() = 0;
109
110 private:
111   static std::map<std::string, MEDMEM::MED_i*> _MedCorbaObj;
112
113   CORBA::ORB_ptr _driver_orb;
114
115 protected:
116   SALOME_NamingService *_NS;
117 };
118
119 #endif