1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef __SALOMEDS_DRIVER_I_H__
23 #define __SALOMEDS_DRIVER_I_H__
25 #include <SALOMEconfig.h>
27 #include <omniORB4/CORBA.h>
28 #include "SALOMEDSImpl_Driver.hxx"
29 #include "SALOMEDSImpl_SComponent.hxx"
30 #include "SALOMEDSImpl_SObject.hxx"
32 #include CORBA_SERVER_HEADER(SALOMEDS)
33 #include CORBA_SERVER_HEADER(SALOME_Component)
35 class Standard_EXPORT SALOMEDS_Driver_i : public virtual SALOMEDSImpl_Driver
38 SALOMEDS::Driver_var _driver;
43 SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB)
45 _driver = SALOMEDS::Driver::_duplicate(theDriver);
46 _orb = CORBA::ORB::_duplicate(theORB);
51 virtual std::string GetIOR()
53 CORBA::String_var ior = _orb->object_to_string(_driver);
54 return std::string(ior);
57 virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
58 const std::string& theURL,
59 long& theStreamLength,
62 virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
63 const std::string& theURL,
64 long& theStreamLength,
67 virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
68 const unsigned char* theStream,
69 const long theStreamLength,
70 const std::string& theURL,
73 virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
74 const unsigned char* theStream,
75 const long theStreamLength,
76 const std::string& theURL,
79 virtual void Close(const SALOMEDSImpl_SComponent& theComponent);
81 virtual std::string ComponentDataType()
83 CORBA::String_var ior = _driver->ComponentDataType();
84 return std::string(ior);
88 virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
89 const std::string& IORString,
93 virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
94 const std::string& aLocalPersistentID,
98 virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject);
100 virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
102 long& theStreamLength);
104 virtual bool CanPaste(const std::string& theComponentName, int theObjectID);
106 virtual std::string PasteInto(const unsigned char* theStream,
107 const long theStreamLength,
109 const SALOMEDSImpl_SObject& theObject);
111 virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
114 long& theStreamLength);
117 #include "SALOME_NamingService.hxx"
118 #include "SALOME_LifeCycleCORBA.hxx"
120 class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory
124 SALOME_NamingService* _name_service;
128 SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB)
130 _orb = CORBA::ORB::_duplicate(theORB);
131 _name_service = new SALOME_NamingService(_orb);
135 ~SALOMEDS_DriverFactory_i()
137 delete _name_service;
140 virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType);
142 virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR);