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