Salome HOME
88fac75f5978a0eaf3a7c31b02e9f78512e7fb5e
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_Driver.hxx
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/ or email : webmaster.salome@opencascade.com
19 //
20 #ifndef __SALOMEDSIMPL_DRIVER_H__
21 #define __SALOMEDSIMPL_DRIVER_H__
22
23 #include <string>
24 #include <SALOMEDSImpl_SComponent.hxx>
25 #include <SALOMEDSImpl_SObject.hxx>
26 #include <SALOMEDSImpl_TMPFile.hxx>
27
28
29 class SALOMEDSImpl_Driver
30 {
31 public:
32
33   virtual std::string GetIOR() = 0;
34
35   virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
36                                      const std::string& theURL,
37                                      long& theStreamLength,
38                                      bool isMultiFile) = 0;
39
40   virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
41                                           const std::string& theURL,
42                                           long& theStreamLength,
43                                           bool isMultiFile) = 0;
44   
45   virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
46                     const unsigned char* theStream,
47                     const long theStreamLength,
48                     const std::string& theURL,
49                     bool isMultiFile) = 0;
50
51   virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
52                          const unsigned char* theStream,
53                          const long theStreamLength,
54                          const std::string& theURL,
55                          bool isMultiFile) = 0;
56
57   virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0;
58  
59   virtual std::string ComponentDataType() = 0;
60
61
62   virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
63                                                          const std::string& IORString,
64                                                          bool isMultiFile,
65                                                          bool isASCII) = 0;
66
67   virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
68                                                          const std::string& aLocalPersistentID,
69                                                          bool isMultiFile,
70                                                          bool isASCII) = 0;
71
72   virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0;
73
74   virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject, 
75                                          int& theObjectID,
76                                          long& theStreamLength) = 0;
77   
78   virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0;
79
80   virtual std::string PasteInto(const unsigned char* theStream,
81                                             const long theStreamLength,
82                                             int theObjectID,
83                                             const SALOMEDSImpl_SObject& theObject) = 0;
84
85   virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy, 
86                                            bool isPublished, 
87                                            bool& isValidScript,
88                                            long& theStreamLength) = 0;
89 };
90
91 class SALOMEDSImpl_DriverFactory
92 {
93 public:
94   
95   virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType) = 0;
96
97   virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0;
98 };
99
100 #endif