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