1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
20 #ifndef __GEOM_GEN_I_H__
21 #define __GEOM_GEN_I_H__
23 #include "GEOMImpl_Gen.hxx"
26 #include <SALOMEconfig.h>
27 #include CORBA_SERVER_HEADER(GEOM_Gen)
29 #include CORBA_CLIENT_HEADER(SALOMEDS)
30 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
33 #include "SALOME_Component_i.hxx"
34 #include "SALOME_NamingService.hxx"
36 #include "GEOM_IBasicOperations_i.hh"
37 #include "GEOM_ITransformOperations_i.hh"
38 #include "GEOM_I3DPrimOperations_i.hh"
39 #include "GEOM_IShapesOperations_i.hh"
40 #include "GEOM_IBlocksOperations_i.hh"
41 #include "GEOM_IBooleanOperations_i.hh"
42 #include "GEOM_ICurvesOperations_i.hh"
43 #include "GEOM_ILocalOperations_i.hh"
44 #include "GEOM_IHealingOperations_i.hh"
45 #include "GEOM_IInsertOperations_i.hh"
46 #include "GEOM_IMeasureOperations_i.hh"
47 #include "GEOM_IGroupOperations_i.hh"
49 //#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
52 //=====================================================================
53 // GEOM_Gen_i : class definition
54 //=====================================================================
55 class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
59 //-----------------------------------------------------------------------//
60 // Constructor / Destructor //
61 //-----------------------------------------------------------------------//
63 // constructor to be called for servant creation.
65 GEOM_Gen_i(CORBA::ORB_ptr orb,
66 PortableServer::POA_ptr poa,
67 PortableServer::ObjectId * contId,
68 const char *instanceName,
69 const char *interfaceName);
71 // destructor, doing nothing (for now)
72 virtual ~GEOM_Gen_i();
74 // generic method to be put in a super class
75 void register_name(char * name);
78 //-----------------------------------------------------------------------//
79 // Inherited methods from SALOMEDS::Driver //
80 //-----------------------------------------------------------------------//
82 SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
86 SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
90 CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
91 const SALOMEDS::TMPFile& theStream,
95 CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
96 const SALOMEDS::TMPFile& theStream,
100 void Close(SALOMEDS::SComponent_ptr theComponent);
101 char* ComponentDataType();
104 char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
105 const char* IORString,
106 CORBA::Boolean isMultiFile,
107 CORBA::Boolean isASCII);
108 char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
109 const char* aLocalPersistentID,
110 CORBA::Boolean isMultiFile,
111 CORBA::Boolean isASCII);
113 bool CanPublishInStudy(CORBA::Object_ptr theIOR);
114 SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
115 SALOMEDS::SObject_ptr theSObject,
116 CORBA::Object_ptr theObject,
117 const char* theName) throw (SALOME::SALOME_Exception) ;
119 CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
120 SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
121 CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
122 SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
123 CORBA::Long theObjectID,
124 SALOMEDS::SObject_ptr theObject);
126 /*! \brief Adds theObject in the study with a name = theName, if
127 * theFather is not null the object is placed under theFather
129 SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
130 GEOM::GEOM_Object_ptr theObject,
132 GEOM::GEOM_Object_ptr theFather);
134 //-----------------------------------------------------------------------//
135 // Transaction methods //
136 //-----------------------------------------------------------------------//
138 //Undos one transaction in the document associated with theStudyID
139 virtual void Undo(CORBA::Long theStudyID);
141 //Redos one transaction in the document associated with theStudyID
142 virtual void Redo(CORBA::Long theStudyID);
144 //-----------------------------------------------------------------------//
145 // Operations methods //
146 //-----------------------------------------------------------------------//
148 //Returns a pointer to BasicOperations interface
149 virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
150 throw (SALOME::SALOME_Exception);
152 //Returns a pointer to TransformOperations interface
153 virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
154 throw (SALOME::SALOME_Exception);
156 //Returns a pointer to 3DPrimOperations interface
157 virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID)
158 throw (SALOME::SALOME_Exception);
160 //Returns a pointer to ShapesOperations interface
161 virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID)
162 throw (SALOME::SALOME_Exception);
164 //Returns a pointer to BlocksOperations interface
165 virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID)
166 throw (SALOME::SALOME_Exception);
168 //Returns a pointer to BooleanOperations interface
169 virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID)
170 throw (SALOME::SALOME_Exception);
172 //Returns a pointer to CurvesOperations interface
173 virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID)
174 throw (SALOME::SALOME_Exception);
176 //Returns a pointer to LocalOperations interface
177 virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID)
178 throw (SALOME::SALOME_Exception);
180 //Returns a pointer to HealingOperations interface
181 virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID)
182 throw (SALOME::SALOME_Exception);
184 //Returns a pointer to InsertOperations interface
185 virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID)
186 throw (SALOME::SALOME_Exception);
188 //Returns a pointer to MeasureOperations interface
189 virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID)
190 throw (SALOME::SALOME_Exception);
192 //Returns a pointer to GroupOperations interface
193 virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
194 throw (SALOME::SALOME_Exception);
196 //Adds a new sub shape
197 virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
198 const GEOM::ListOfLong& theIndices);
200 virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
202 virtual char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject);
204 virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
206 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
207 CORBA::Boolean isPublished,
208 CORBA::Boolean& isValidScript);
210 char* GetDumpName (const char* theStudyEntry);
212 GEOM::string_array* GetAllDumpNames();
214 //-----------------------------------------------------------------------//
215 // Internal methods //
216 //-----------------------------------------------------------------------//
218 virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
222 ::GEOMImpl_Gen* _impl;
223 SALOME_NamingService * name_service;