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