1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __SALOMEDS_DRIVER_I_H__
21 #define __SALOMEDS_DRIVER_I_H__
23 #include <SALOMEconfig.h>
25 #include <omniORB4/CORBA.h>
26 #include "SALOMEDSImpl_Driver.hxx"
27 #include "SALOMEDSImpl_SComponent.hxx"
28 #include "SALOMEDSImpl_SObject.hxx"
30 #include CORBA_SERVER_HEADER(SALOMEDS)
31 #include CORBA_SERVER_HEADER(SALOME_Component)
33 class Standard_EXPORT SALOMEDS_Driver_i : public virtual SALOMEDSImpl_Driver
36 SALOMEDS::Driver_var _driver;
41 SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB)
43 _driver = SALOMEDS::Driver::_duplicate(theDriver);
44 _orb = CORBA::ORB::_duplicate(theORB);
49 virtual std::string GetIOR()
51 CORBA::String_var ior = _orb->object_to_string(_driver);
52 return std::string(ior);
55 virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
56 const std::string& theURL,
57 long& theStreamLength,
60 virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
61 const std::string& theURL,
62 long& theStreamLength,
65 virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
66 const unsigned char* theStream,
67 const long theStreamLength,
68 const std::string& theURL,
71 virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
72 const unsigned char* theStream,
73 const long theStreamLength,
74 const std::string& theURL,
77 virtual void Close(const SALOMEDSImpl_SComponent& theComponent);
79 virtual std::string ComponentDataType()
81 CORBA::String_var ior = _driver->ComponentDataType();
82 return std::string(ior);
86 virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
87 const std::string& IORString,
91 virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
92 const std::string& aLocalPersistentID,
96 virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject);
98 virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
100 long& theStreamLength);
102 virtual bool CanPaste(const std::string& theComponentName, int theObjectID);
104 virtual std::string PasteInto(const unsigned char* theStream,
105 const long theStreamLength,
107 const SALOMEDSImpl_SObject& theObject);
109 virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
112 long& theStreamLength);
115 #include "SALOME_NamingService.hxx"
116 #include "SALOME_LifeCycleCORBA.hxx"
118 class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory
122 SALOME_NamingService* _name_service;
126 SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB)
128 _orb = CORBA::ORB::_duplicate(theORB);
129 _name_service = new SALOME_NamingService(_orb);
133 ~SALOMEDS_DriverFactory_i()
135 delete _name_service;
138 virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType);
140 virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR);