Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Driver_i.hxx
1 #ifndef __SALOMEDS_DRIVER_I_H__
2 #define __SALOMEDS_DRIVER_I_H__
3
4 #include <CORBA.h>
5 #include <TCollection_AsciiString.hxx>
6 #include "SALOMEDSImpl_Driver.hxx"
7 #include "SALOMEDSImpl_SComponent.hxx"
8 #include "SALOMEDSImpl_SObject.hxx"
9
10 #include <SALOMEconfig.h>   
11 #include CORBA_SERVER_HEADER(SALOMEDS) 
12 #include CORBA_SERVER_HEADER(SALOME_Component)
13
14 class SALOMEDS_Driver_i :  public virtual SALOMEDSImpl_Driver 
15 {
16 protected:
17   SALOMEDS::Driver_var _driver;
18   CORBA::ORB_var _orb;
19
20 public:
21
22   SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB) 
23     {
24       _driver = SALOMEDS::Driver::_duplicate(theDriver);
25       _orb = CORBA::ORB::_duplicate(theORB);        
26     }
27
28   ~SALOMEDS_Driver_i();
29
30   virtual TCollection_AsciiString GetIOR() 
31     {
32       CORBA::String_var ior = _orb->object_to_string(_driver);
33       return TCollection_AsciiString(ior);
34     }
35
36   virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
37                               const TCollection_AsciiString& theURL,
38                               long& theStreamLength,
39                               bool isMultiFile);
40
41   virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
42                                    const TCollection_AsciiString& theURL,
43                                    long& theStreamLength,
44                                    bool isMultiFile);
45   
46   virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
47                     const unsigned char* theStream,
48                     const long theStreamLength,
49                     const TCollection_AsciiString& theURL,
50                     bool isMultiFile);
51
52   virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
53                          const unsigned char* theStream,
54                          const long theStreamLength,
55                          const TCollection_AsciiString& theURL,
56                          bool isMultiFile);
57
58   virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent);
59  
60   virtual TCollection_AsciiString ComponentDataType() 
61     {
62       CORBA::String_var ior = _driver->ComponentDataType();
63       return TCollection_AsciiString(ior);
64     }
65
66
67   virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
68                                                          const TCollection_AsciiString& IORString,
69                                                          bool isMultiFile,
70                                                          bool isASCII);
71
72   virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
73                                                          const TCollection_AsciiString& aLocalPersistentID,
74                                                          bool isMultiFile,
75                                                          bool isASCII);
76
77   virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject);
78
79   virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
80                                   int& theObjectID,
81                                   long& theStreamLength);
82
83   virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID);
84
85   virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
86                                             const long theStreamLength,
87                                             int theObjectID,
88                                             const Handle(SALOMEDSImpl_SObject)& theObject);
89
90   virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
91                                     bool isPublished, 
92                                     bool& isValidScript,
93                                     long& theStreamLength);
94 };
95
96 #include "SALOME_NamingService.hxx"
97 #include "SALOME_LifeCycleCORBA.hxx"
98
99 class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory 
100 {
101 protected:  
102   CORBA::ORB_ptr        _orb;
103   SALOME_NamingService* _name_service;
104
105 public:
106   
107   SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB) 
108     {
109       _orb = CORBA::ORB::_duplicate(theORB);
110       _name_service = new SALOME_NamingService(_orb);
111     }
112
113
114   ~SALOMEDS_DriverFactory_i() 
115   {
116     delete _name_service;
117   }
118    
119   virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType);
120
121   virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR);
122 };
123
124 #endif