Salome HOME
updated copyright message
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.hh
index 778d571979149b14dccb2bf0171cd5c4fcf7491d..0525170e14739dba4703d9319a3da6088a66ac6f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -51,6 +51,8 @@
 #include "GEOM_IMeasureOperations_i.hh"
 #include "GEOM_IGroupOperations_i.hh"
 #include "GEOM_IFieldOperations_i.hh"
+#include "GEOM_ITestOperations_i.hh"
+#include "GEOM_ICanonicalRecognition_i.hh"
 #include "GEOMUtils.hxx"
 
 #include <TopTools_IndexedMapOfShape.hxx>
@@ -71,7 +73,6 @@ class GEOM_I_EXPORT GEOM_GenericOperationsCreator
  public:
   // Create operations
   virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA,
-                                      int                     theStudyId,
                                       GEOM::GEOM_Gen_ptr      theEngine,
                                       ::GEOMImpl_Gen*         theGenImpl) = 0;
   // return the name of IDL module
@@ -82,7 +83,7 @@ class GEOM_I_EXPORT GEOM_GenericOperationsCreator
 //=====================================================================
 // GEOM_Gen_i : class definition
 //=====================================================================
-class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
+class GEOM_I_EXPORT GEOM_Gen_i : public POA_GEOM::GEOM_Gen, public Engines_Component_i
 {
  public:
 
@@ -96,19 +97,17 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
              PortableServer::POA_ptr poa,
              PortableServer::ObjectId * contId,
              const char *instanceName,
-             const char *interfaceName);
+             const char *interfaceName,
+             bool withRegistry = true);
 
   // destructor, doing nothing (for now)
   virtual ~GEOM_Gen_i();
 
-  // generic method to be put in a super class
-  void register_name(char * name);
-
   // Get ORB object
   CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
 
-  // Get Naming Service object
-  SALOME_NamingService* GetNS() { return name_service; }
+  // Get Study
+  virtual SALOMEDS::Study_var getStudyServant() = 0;
 
   //-----------------------------------------------------------------------//
   // Inherited methods from SALOMEDS::Driver                               //
@@ -146,13 +145,11 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                                CORBA::Boolean isASCII);
 
   bool CanPublishInStudy(CORBA::Object_ptr theIOR);
-  SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
-                                       SALOMEDS::SObject_ptr theSObject,
+  SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::SObject_ptr theSObject,
                                        CORBA::Object_ptr theObject,
-                                       const char* theName) throw (SALOME::SALOME_Exception) ;
+                                       const char* theName) ;
 
-  GEOM::ListOfGO* PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy,
-                                            CORBA::Object_ptr theObject);
+  GEOM::ListOfGO* PublishNamedShapesInStudy(CORBA::Object_ptr theObject);
 
   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
@@ -164,16 +161,14 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   /*! \brief Adds theObject in the study with a name = theName, if
    *         theFather is not null the object is placed under theFather
    */
-  SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr       theStudy,
-                                    GEOM::GEOM_BaseObject_ptr theObject,
+  SALOMEDS::SObject_ptr AddInStudy (GEOM::GEOM_BaseObject_ptr theObject,
                                     const char*               theName,
                                     GEOM::GEOM_BaseObject_ptr theFather);
 
   /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
    *         To be used from python scripts out of geompy.addToStudy (non-default usage)
    */
-  GEOM::ListOfGO* RestoreSubShapesO (SALOMEDS::Study_ptr     theStudy,
-                                     GEOM::GEOM_Object_ptr   theObject,
+  GEOM::ListOfGO* RestoreSubShapesO (GEOM::GEOM_Object_ptr   theObject,
                                      const GEOM::ListOfGO&   theArgs,
                                      GEOM::find_shape_method theFindMethod,
                                      CORBA::Boolean          theInheritFirstArg,
@@ -182,8 +177,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   /*! \brief Publish sub-shapes, standing for given in \a theArgs arguments and sub-shapes.
    *         To be used from python scripts, generated by Dump Python.
    */
-  GEOM::ListOfGO* RestoreGivenSubShapesO (SALOMEDS::Study_ptr     theStudy,
-                                          GEOM::GEOM_Object_ptr   theObject,
+  GEOM::ListOfGO* RestoreGivenSubShapesO (GEOM::GEOM_Object_ptr   theObject,
                                           const GEOM::ListOfGO&   theArgs,
                                           GEOM::find_shape_method theFindMethod,
                                           CORBA::Boolean          theInheritFirstArg,
@@ -192,87 +186,85 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
    *         To be used from GUI and from geompy.addToStudy
    */
-  GEOM::ListOfGO* RestoreSubShapesSO (SALOMEDS::Study_ptr     theStudy,
-                                      SALOMEDS::SObject_ptr   theSObject,
+  GEOM::ListOfGO* RestoreSubShapesSO (SALOMEDS::SObject_ptr   theSObject,
                                       const GEOM::ListOfGO&   theArgs,
                                       GEOM::find_shape_method theFindMethod,
                                       CORBA::Boolean          theInheritFirstArg,
                                       CORBA::Boolean          theAddPrefix);
 
   //Collects dependencies of the given objects from other ones
-  SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy,
-                                       const GEOM::string_array& theObjectEntries);
+  SALOMEDS::TMPFile* GetDependencyTree(const GEOM::string_array& theObjectEntries);
 
   //-----------------------------------------------------------------------//
   // Transaction methods                                                   //
   //-----------------------------------------------------------------------//
 
-  //Undos one transaction in the document associated with theStudyID
-  virtual void Undo(CORBA::Long theStudyID);
+  //Undos one transaction in the document
+  virtual void Undo();
 
-  //Redos one transaction in the document associated with theStudyID
-  virtual void Redo(CORBA::Long theStudyID);
+  //Redos one transaction in the document
+  virtual void Redo();
 
   //-----------------------------------------------------------------------//
   // Operations methods                                                    //
   //-----------------------------------------------------------------------//
 
   //Returns a pointer to BasicOperations interface
-  virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations();
 
   //Returns a pointer to TransformOperations interface
-  virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations();
 
   //Returns a pointer to 3DPrimOperations interface
-  virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations();
 
   //Returns a pointer to ShapesOperations interface
-  virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations();
 
   //Returns a pointer to BlocksOperations interface
-  virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations();
 
   //Returns a pointer to BooleanOperations interface
-  virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations()
+    ;
 
   //Returns a pointer to CurvesOperations interface
-  virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations()
+    ;
 
   //Returns a pointer to LocalOperations interface
-  virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations()
+    ;
 
   //Returns a pointer to HealingOperations interface
-  virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations()
+    ;
 
   //Returns a pointer to InsertOperations interface
-  virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations()
+    ;
 
   //Returns a pointer to MeasureOperations interface
-  virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations()
+    ;
 
   //Returns a pointer to GroupOperations interface
-  virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations()
+    ;
 
   //Returns a pointer to FiedlOperations interface
-  virtual GEOM::GEOM_IFieldOperations_ptr GetIFieldOperations (CORBA::Long theStudyID)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IFieldOperations_ptr GetIFieldOperations()
+    ;
+
+  //Returns a pointer to TestOperations interface
+  virtual GEOM::GEOM_ITestOperations_ptr GetITestOperations()
+    ;
+
+  virtual GEOM::GEOM_ICanonicalRecognition_ptr GetICanonicalRecognition();
 
   //Returns a pointer to corresponding plugin operations interface
-  virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (CORBA::Long theStudyID,
-                                                          const char* theLibName)
-    throw (SALOME::SALOME_Exception);
+  virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (const char* theLibName)
+    ;
 
   //Adds a new sub-shape
   virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
@@ -284,8 +276,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
 
   virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
 
-  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                       CORBA::Boolean isPublished,
+  virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                        CORBA::Boolean isMultiFile,
                                        CORBA::Boolean& isValidScript);
 
@@ -295,7 +286,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
 
   // Object information
   virtual bool hasObjectInfo();
-  virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
+  virtual char* getObjectInfo(const char* entry);
 
   // Version information
   virtual char* getVersion();
@@ -320,8 +311,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   /*! \brief Fills 3 lists that is used to clean study of redundant objects.
    *         To be used from GUI.
    */
-  void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
-                               GEOM::string_array& theSelectedEntries,
+  void GetEntriesToReduceStudy(GEOM::string_array& theSelectedEntries,
                                GEOM::string_array& theParentEntries,
                                GEOM::string_array& theSubEntries,
                                GEOM::string_array& theOtherEntries);
@@ -330,44 +320,41 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   // Internal methods                                                      //
   //-----------------------------------------------------------------------//
 
-  virtual GEOM::GEOM_BaseObject_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
+  virtual GEOM::GEOM_BaseObject_ptr GetObject(const char* theEntry);
 
  private:
-  GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr     theStudy,
-                                    GEOM::GEOM_Object_ptr   theObject,
+  SALOMEDS::SComponent_var findOrCreateComponent();
+
+  GEOM::ListOfGO* RestoreSubShapes (GEOM::GEOM_Object_ptr   theObject,
                                     SALOMEDS::SObject_ptr   theSObject,
                                     const GEOM::ListOfGO&   theArgs,
                                     GEOM::find_shape_method theFindMethod,
                                     CORBA::Boolean          theInheritFirstArg,
                                     CORBA::Boolean          theAddPrefix);
 
-  GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr     theStudy,
-                                            SALOMEDS::SObject_ptr   theOldSO,
+  GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   theOldSO,
                                             SALOMEDS::SObject_ptr   theNewSO,
                                             GEOM::GEOM_Object_ptr   theNewO,
                                             GEOM::ListOfGO&         theOutArgs,
                                             GEOM::find_shape_method theFindMethod,
                                             CORBA::Boolean          theAddPrefix);
 
-  GEOM::ListOfGO* RestoreGivenSubShapes (SALOMEDS::Study_ptr     theStudy,
-                                         GEOM::GEOM_Object_ptr   theObject,
+  GEOM::ListOfGO* RestoreGivenSubShapes (GEOM::GEOM_Object_ptr   theObject,
                                          SALOMEDS::SObject_ptr   theSObject,
                                          const GEOM::ListOfGO&   theArgs,
                                          GEOM::find_shape_method theFindMethod,
                                          CORBA::Boolean          theInheritFirstArg,
                                          CORBA::Boolean          theAddPrefix);
 
-  GEOM::ListOfGO* RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr     theStudy,
-                                                 SALOMEDS::SObject_ptr   theOldSO,
+  GEOM::ListOfGO* RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr   theOldSO,
                                                  SALOMEDS::SObject_ptr   theNewSO,
                                                  GEOM::GEOM_Object_ptr   theNewO,
                                                  std::set<std::string>   theArgs,
                                                  GEOM::find_shape_method theFindMethod,
                                                  CORBA::Boolean          theAddPrefix);
 
-  // auxiliary for PublishNamedShapesInStudy
-  void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
-                             GEOM::GEOM_Object_var theMainShape,
+  // auxilary for PublishNamedShapesInStudy
+  void CreateAndPublishGroup(GEOM::GEOM_Object_var theMainShape,
                              const TopTools_IndexedMapOfShape& anIndices,
                              const TopTools_SequenceOfShape& SeqS,
                              const TColStd_SequenceOfAsciiString& SeqN,
@@ -390,8 +377,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                                  std::set<std::string>& aChildren,
                                  std::set<std::string>& anOthers);
 
-  void includeSubObjects(SALOMEDS::Study_ptr theStudy,
-                         const std::string& aSelectedEntry,
+  void includeSubObjects(const std::string& aSelectedEntry,
                          std::set<std::string>& aSelected,
                          std::set<std::string>& aParents,
                          std::set<std::string>& aChildren,
@@ -399,10 +385,12 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
 
   void LoadPlugin(const std::string& theLibName);
 
+
+  virtual void BreakLink(const char*) {}
+
  private:
 
    ::GEOMImpl_Gen* _impl;
-   SALOME_NamingService * name_service;
    char * _name;
 
    // plugin operations managing