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