Salome HOME
Avoid including of SALOMEDS classes; fix pb with objects deletion
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.hh
1 #ifndef __GEOM_GEN_I_H__
2 #define __GEOM_GEN_I_H__
3
4 #include "GEOMImpl_Gen.hxx"
5
6 // IDL headers
7 #include <SALOMEconfig.h>
8 #include CORBA_SERVER_HEADER(GEOM_Gen)
9
10 #include CORBA_CLIENT_HEADER(SALOMEDS)
11 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
12
13
14 #include "SALOME_Component_i.hxx"
15 #include "SALOME_NamingService.hxx"
16
17 #include "GEOM_IBasicOperations_i.hh"
18 #include "GEOM_ITransformOperations_i.hh"
19 #include "GEOM_I3DPrimOperations_i.hh"
20 #include "GEOM_IShapesOperations_i.hh"
21 #include "GEOM_IBlocksOperations_i.hh"
22 #include "GEOM_IBooleanOperations_i.hh"
23 #include "GEOM_ICurvesOperations_i.hh"
24 #include "GEOM_ILocalOperations_i.hh"
25 #include "GEOM_IHealingOperations_i.hh"
26 #include "GEOM_IInsertOperations_i.hh"
27 #include "GEOM_IMeasureOperations_i.hh"
28 #include "GEOM_IGroupOperations_i.hh"
29
30 //#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
31
32
33 //=====================================================================
34 // GEOM_Gen_i : class definition
35 //=====================================================================
36 class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
37 {
38  public:
39
40   //-----------------------------------------------------------------------//
41   // Constructor / Destructor                                              //
42   //-----------------------------------------------------------------------//
43
44   // constructor to be called for servant creation.
45   GEOM_Gen_i();
46   GEOM_Gen_i(CORBA::ORB_ptr orb,
47              PortableServer::POA_ptr poa,
48              PortableServer::ObjectId * contId,
49              const char *instanceName,
50              const char *interfaceName);
51
52   // destructor, doing nothing (for now)
53   virtual ~GEOM_Gen_i();
54
55   // generic method to be put in a super class
56   void register_name(char * name);
57
58
59   //-----------------------------------------------------------------------//
60   // Inherited methods from SALOMEDS::Driver                               //
61   //-----------------------------------------------------------------------//
62
63   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
64                           const char* theURL,
65                           bool isMultiFile);
66
67   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
68                                const char* theURL,
69                                bool isMultiFile);
70
71   CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
72                       const SALOMEDS::TMPFile& theStream,
73                       const char* theURL,
74                       bool isMultiFile);
75
76   CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
77                            const SALOMEDS::TMPFile& theStream,
78                            const char* theURL,
79                            bool isMultiFile);
80
81   void Close(SALOMEDS::SComponent_ptr theComponent);
82   char* ComponentDataType();
83
84
85   char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
86                                const char* IORString,
87                                CORBA::Boolean isMultiFile,
88                                CORBA::Boolean isASCII);
89   char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
90                                const char* aLocalPersistentID,
91                                CORBA::Boolean isMultiFile,
92                                CORBA::Boolean isASCII);
93
94   bool CanPublishInStudy(CORBA::Object_ptr theIOR);
95   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
96                                        SALOMEDS::SObject_ptr theSObject,
97                                        CORBA::Object_ptr theObject,
98                                        const char* theName) throw (SALOME::SALOME_Exception) ;
99
100   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
101   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
102   CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
103   SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
104                                   CORBA::Long theObjectID,
105                                   SALOMEDS::SObject_ptr theObject);
106
107   /*! \brief Adds theObject in the study with a name = theName, if
108    *         theFather is not null the object is placed under theFather
109    */
110   SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
111                                     GEOM::GEOM_Object_ptr theObject,
112                                     const char* theName,
113                                     GEOM::GEOM_Object_ptr theFather);
114
115   //-----------------------------------------------------------------------//
116   // Transaction methods                                                   //
117   //-----------------------------------------------------------------------//
118
119   //Undos one transaction in the document associated with theStudyID
120   virtual void Undo(CORBA::Long theStudyID);
121
122   //Redos one transaction in the document associated with theStudyID
123   virtual void Redo(CORBA::Long theStudyID);
124
125   //-----------------------------------------------------------------------//
126   // Operations methods                                                    //
127   //-----------------------------------------------------------------------//
128
129   //Returns a pointer to BasicOperations interface
130   virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
131     throw (SALOME::SALOME_Exception);
132
133   //Returns a pointer to TransformOperations interface
134   virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
135     throw (SALOME::SALOME_Exception);
136
137   //Returns a pointer to 3DPrimOperations interface
138   virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID)
139     throw (SALOME::SALOME_Exception);
140
141   //Returns a pointer to ShapesOperations interface
142   virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID)
143     throw (SALOME::SALOME_Exception);
144
145   //Returns a pointer to BlocksOperations interface
146   virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID)
147     throw (SALOME::SALOME_Exception);
148
149   //Returns a pointer to BooleanOperations interface
150   virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID)
151     throw (SALOME::SALOME_Exception);
152
153   //Returns a pointer to CurvesOperations interface
154   virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID)
155     throw (SALOME::SALOME_Exception);
156
157   //Returns a pointer to LocalOperations interface
158   virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID)
159     throw (SALOME::SALOME_Exception);
160
161   //Returns a pointer to HealingOperations interface
162   virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID)
163     throw (SALOME::SALOME_Exception);
164
165   //Returns a pointer to InsertOperations interface
166   virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID)
167     throw (SALOME::SALOME_Exception);
168
169   //Returns a pointer to MeasureOperations interface
170   virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID)
171     throw (SALOME::SALOME_Exception);
172
173   //Returns a pointer to GroupOperations interface
174   virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
175     throw (SALOME::SALOME_Exception);
176
177   //Adds a new sub shape
178   virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
179                                              const GEOM::ListOfLong& theIndices);
180
181   virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
182
183   virtual  char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject);
184
185   virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
186
187   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
188                                        CORBA::Boolean isPublished,
189                                        CORBA::Boolean& isValidScript);
190
191   char* GetDumpName (const char* theStudyEntry);
192
193   GEOM::string_array* GetAllDumpNames();
194
195   //-----------------------------------------------------------------------//
196   // Internal methods                                                      //
197   //-----------------------------------------------------------------------//
198
199   virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
200
201  private:
202
203    ::GEOMImpl_Gen* _impl;
204    SALOME_NamingService * name_service;
205    char * _name;
206 };
207
208 #endif