From ebe3541632797c5fad97573b46655718ddd61444 Mon Sep 17 00:00:00 2001
From: mpa
Date: Wed, 21 Sep 2016 14:52:50 +0300
Subject: [PATCH] 0023299: [CEA] Finalize multi-study removal - remove study
manager - remove study id component - move methods from study manager classes
to study
---
idl/SALOMEDS.idl | 1152 ++++++------
idl/SALOME_Component.idl | 28 +-
idl/SALOME_PACOExtension.idl | 3 +-
idl/SALOME_Session.idl | 2 -
src/Basics/Basics_DirUtils.cxx | 23 +-
src/Basics/Basics_DirUtils.hxx | 6 +-
src/Container/Component_i.cxx | 43 +-
src/Container/Container_i.cxx | 700 ++++----
src/Container/SALOME_Component_i.hxx | 5 +-
src/Container/SALOME_Container.py | 2 +-
src/Container/SALOME_Container_i.hxx | 13 +-
src/KERNEL_PY/salome_ComponentGUI.py | 2 +-
src/KernelHelpers/SALOME_KernelServices.cxx | 38 +-
src/KernelHelpers/SALOME_KernelServices.hxx | 4 +-
src/KernelHelpers/SALOME_StudyEditor.cxx | 12 -
src/KernelHelpers/SALOME_StudyEditor.hxx | 3 -
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 46 +-
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 16 +-
src/MPIContainer/MPIContainer_i.cxx | 37 +-
src/MPIContainer/MPIContainer_i.hxx | 8 +-
.../SALOME_ParallelComponent_i.cxx | 44 +-
.../SALOME_ParallelComponent_i.hxx | 7 +-
.../SALOME_ParallelContainerProxy_i.cxx | 12 +-
.../SALOME_ParallelContainerProxy_i.hxx | 4 +-
.../SALOME_ParallelContainer_i.cxx | 74 +-
.../SALOME_ParallelContainer_i.hxx | 22 +-
src/SALOMEDS/CMakeLists.txt | 4 -
src/SALOMEDS/SALOMEDS.cxx | 118 +-
src/SALOMEDS/SALOMEDS_Driver_i.cxx | 9 +-
src/SALOMEDS/SALOMEDS_Driver_i.hxx | 3 +-
src/SALOMEDS/SALOMEDS_SObject_i.cxx | 2 -
src/SALOMEDS/SALOMEDS_Server.cxx | 20 +-
src/SALOMEDS/SALOMEDS_Study.cxx | 207 ++-
src/SALOMEDS/SALOMEDS_Study.hxx | 22 +-
src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 1 -
src/SALOMEDS/SALOMEDS_StudyManager.cxx | 326 ----
src/SALOMEDS/SALOMEDS_StudyManager.hxx | 74 -
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 535 ------
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 156 --
src/SALOMEDS/SALOMEDS_Study_i.cxx | 394 +++--
src/SALOMEDS/SALOMEDS_Study_i.hxx | 59 +-
src/SALOMEDSClient/SALOMEDSClient.hxx | 1 -
.../SALOMEDSClient_ClientFactory.cxx | 38 -
.../SALOMEDSClient_ClientFactory.hxx | 11 -
src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 20 +-
.../SALOMEDSClient_StudyManager.hxx | 57 -
src/SALOMEDSImpl/CMakeLists.txt | 1 -
src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx | 3 +-
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 1390 ++++++++++++++-
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 64 +-
.../SALOMEDSImpl_StudyManager.cxx | 1568 -----------------
.../SALOMEDSImpl_StudyManager.hxx | 144 --
52 files changed, 2921 insertions(+), 4612 deletions(-)
delete mode 100644 src/SALOMEDS/SALOMEDS_StudyManager.cxx
delete mode 100644 src/SALOMEDS/SALOMEDS_StudyManager.hxx
delete mode 100644 src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
delete mode 100644 src/SALOMEDS/SALOMEDS_StudyManager_i.hxx
delete mode 100644 src/SALOMEDSClient/SALOMEDSClient_StudyManager.hxx
delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx
delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx
diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl
index 3303ac682..4f8ca7ef3 100644
--- a/idl/SALOMEDS.idl
+++ b/idl/SALOMEDS.idl
@@ -41,7 +41,7 @@ module SALOMEDS
{
/*! \brief Name of the file in which the %Study is saved.
*/
- typedef string URL;
+ typedef string URLPath;
/*! \brief Main identifier of an object in %SALOME application
*/
@@ -55,12 +55,6 @@ module SALOMEDS
*/
typedef string SalomeReference;
-/*! \brief List of the names of studies which are currently open in this %SALOME session.
-
-Since %SALOME is a multi-study application, it allows to open a lot of studies
-during each working session.
-*/
- typedef sequence ListOfOpenStudies;
//! List of file names
typedef sequence ListOfFileNames;
//! List of modification dates of a study
@@ -81,7 +75,6 @@ during each working session.
interface GenericAttribute;
interface Study;
- interface StudyManager;
interface StudyBuilder;
interface SObject;
interface SComponent;
@@ -105,899 +98,804 @@ during each working session.
//! Exception indicating that this feature hasn't been implemented in %SALOME application.
exception NotImplemented {};
+ //==========================================================================
+/*! \brief %Study Builder Interface
- //===========================================================================
- /*! \brief %Study Interface
-
- The purpose of the %Study is to manage the data produced by various components of %SALOME platform.
- Most of the %Study operations are handled by the StudyManager and the StudyBuilder.
- What is left in the %Study interface are elementary inquiries.
- (Incidentally, we recall that a CORBA attribute is implemented as a pair of get
- and set methods.) A %Study is explored by a set of tools, mainly iterators
- , which are described further. Nevertheless, the %Study
- interface allows the search of an object by name or by ID.
- \note
-
The Path of an object in %SALOME application is much alike a standard path of a file.
- In general it's a string of names of directories divided by a slash '/'.
-
The Context is the current directory of an object.
+ The purpose of the Builder is to add and/or remove objects and attributes.
+ A %StudyBuilder is linked to a %Study. A
+ command management is provided for the undo/redo functionalities.
+ \note
+
The Tag of an item in %SALOME application is a symbolic description of
+ item's position in the tree-type structure of the browser. In general it has the following
+ form: 0:2:1:1
*/
+ //==========================================================================
- interface Study
+ interface StudyBuilder
{
+/*! \brief %LockProtection Exception
-//! Invalid study reference
- exception StudyInvalidReference {};
-//! Invalid study context
- exception StudyInvalidContext {};
-//! Invalid study component
- exception StudyInvalidComponent {};
-//! Invalid directory of the %study exception
- exception StudyInvalidDirectory {};
-//! Exception pointing that this name of the study has already been used.
- exception StudyNameAlreadyUsed {};
-//! study object already exists
- exception StudyObjectAlreadyExists {};
-//! Invalid name of the %study exception
- exception StudyNameError {};
-//! Invalid study comment
- exception StudyCommentError {};
+ This exception is raised while attempting to modify a locked %study.
+*/
+ exception LockProtection {};
+/*! \brief Creation of a new %SComponent.
-/*! \brief The name of the %Study
+ Creates a new %SComponent
+ \param ComponentDataType Data type of the %SComponent which will be created.
+
+See \ref example17 for an example of this method usage in batchmode of %SALOME application.
- This is equivalent to the methods setName() & getName()
*/
- attribute string Name; // equivalent to setName() & getName()
-/*! \brief The ID of the %Study
+ SComponent NewComponent(in string ComponentDataType) raises(LockProtection);
+/*! \brief Definition of the instance to the %SComponent
- This is equivalent to the methods setID() & getID()
+ Defines the instance to the %SComponent.
*/
- attribute short StudyId;
-//! Sequence containing %SObjects
- typedef sequence ListOfSObject;
-//! Get the persistent reference to the %Study.
- PersistentReference GetPersistentReference() raises(StudyInvalidReference);
-//! Get a transient reference to the %Study.
- SalomeReference GetTransientReference() raises(StudyInvalidReference);
+ void DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR) raises(LockProtection);
-/*! \brief indicate whether the %Study is empty
+/*! \brief Deletion of a %SComponent
- \return True if the %Study is empty
+ Removes a %SComponent.
*/
- boolean IsEmpty() raises(StudyInvalidReference);
-/*! \brief Find a %SComponent by its name.
+ void RemoveComponent(in SComponent aComponent) raises(LockProtection);
- \param aComponentName It's a string value in the Comment Attribute of the Component,
- which is looked for, defining the data type of this Component.
+/*! \brief Creation of a new %SObject
-See \ref example1 for an example of this method usage in batchmode of %SALOME application.
+ Creates a new %SObject under a definite father %SObject.
-*/
- SComponent FindComponent (in string aComponentName) raises(StudyInvalidReference);
+ \param theFatherObject The father %SObject under which this one should be created.
+ \return New %SObject
+
+See \ref example18 for an example of this method usage in batchmode of %SALOME application.
-/*! \brief Find a %SComponent by ID of the according %SObject
*/
- SComponent FindComponentID(in ID aComponentID) raises(StudyInvalidReference);
-/*! \brief Find a %SObject by the Name Attribute of this %SObject
- \param anObjectName String parameter defining the name of the object
- \return The obtained %SObject
+ SObject NewObject (in SObject theFatherObject) raises(LockProtection);
-See \ref example19 for an example of this method usage in batchmode of %SALOME application.
-*/
- SObject FindObject (in string anObjectName) raises(StudyInvalidReference);
-/*! \brief Find a %SObject by its ID
+/*! \brief Creation of a new %SObject with a definite %tag
- \param aObjectID This parameter defines the ID of the required object
- \return The obtained %SObject
-*/
- SObject FindObjectID (in ID aObjectID) raises(StudyInvalidReference);
-/*! \brief Create a %SObject by its ID
+ Creates a new %SObject with a definite %tag.
- \param aObjectID This parameter defines the ID of the required object
- \return The created %SObject
-*/
- SObject CreateObjectID (in ID aObjectID) raises(StudyInvalidReference);
-/*! \brief Find a %SObject by IOR of the object belonging to this %SObject.
+ \param atag Long value corresponding to the tag of the new %SObject.
+ \return New %SObject
- \param anObjectName This parameter defines the IOR of the object
- \return The obtained %SObject
*/
- SObject FindObjectIOR (in ID aObjectIOR) raises(StudyInvalidReference);
-/*! \brief Find in the study all %SObjects produced by a given %Component.
+ SObject NewObjectToTag (in SObject theFatherObject, in long atag) raises(LockProtection);
+/*! \brief Deletion of the %SObject
- \param anObjectName The Name Attribute of the searched %SObjects should correspond to anObjectName.
- \param aComponentName The name of the component, which objects are searched for.
-*/
- ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName) raises(StudyInvalidReference);
-/*! \brief Find a %SObject by the path to it.
+ Removes a %SObject from the %StudyBuilder.
- \param thePath The path to the required %SObject.
- \return The obtained %SObject.
-*/
- SObject FindObjectByPath(in string thePath) raises(StudyInvalidReference);
-/*! \brief Get the path to the %SObject.
+ \param anObject The %SObject to be deleted.
*/
- string GetObjectPath(in Object theObject) raises(StudyInvalidReference);
-
-/*! \brief Set the context of the %Study.
+ void RemoveObject (in SObject anObject) raises(LockProtection);
+/*! \brief Deletion of the %SObject with all his child objects.
- \param thePath String parameter defining the context of the study.
+ Removes the %SObject with all his child objects.
-See \ref example23 for an example of this method usage in batchmode of %SALOME application.
+ \param anObject The %SObject to be deleted with all child objects.
*/
- void SetContext(in string thePath) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get the context of the %Study.
+ void RemoveObjectWithChildren(in SObject anObject) raises(LockProtection);
-See \ref example23 for an example of this method usage in batchmode of %SALOME application.
-*/
- string GetContext() raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of objects corresponding to the context.
+/*!
+ Loads a %SComponent.
- \note If the parameter theContext is empty, then the current context will be used.
-*/
- ListOfStrings GetObjectNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of directories and subdirectories corresponding to the context.
+See \ref example19 for an example of this method usage in batchmode of %SALOME application.
- \note If the parameter theContext is empty, then the current context will be used.
*/
- ListOfStrings GetDirectoryNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of Files corresponding to the context.
+ void LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
+/*!
+ Loads a %SObject.
- \note If the parameter theContext is empty, then the current context will be used.
+ \param sco %SObject to be loaded.
*/
- ListOfStrings GetFileNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of Components corresponding to the context.
+ void Load (in SObject sco);
- \note If the parameter theContext is empty, then the current context will be used.
-*/
- ListOfStrings GetComponentNames(in string theContext) raises(StudyInvalidReference);
-/*! \brief Create a new iterator of child levels of the given %SObject.
+/*! \brief Looking for or creating an attribute assigned to the %SObject
- \param aSO The given %SObject
- \return A new iterator of child levels of the given %SObject.
+ Allows to find or create an attribute of a specific type which is assigned to the object.
+ \param anObject The %SObject corresponding to the attribute which is looked for.
+ \param aTypeOfAttribute Type of the attribute.
+
+See \ref example1 for an example of this method usage in batchmode of %SALOME application.
*/
- ChildIterator NewChildIterator(in SObject aSO) raises(StudyInvalidReference);
-/*! \brief Create a new iterator of the %SComponents.
+ GenericAttribute FindOrCreateAttribute(in SObject anObject,
+ in string aTypeOfAttribute) raises(LockProtection);
- \return A new iterator of the %SComponents.
-*/
- SComponentIterator NewComponentIterator() raises(StudyInvalidReference);
+/*! \brief Looking for an attribute assigned to a %SObject
-/*! \brief Create a new %StudyBuilder to add or modify an object in the study.
+ Allows to find an attribute of a specific type which is assigned to the object.
+ \param anObject The %SObject corresponding to the attribute which is looked for.
+ \param aTypeOfAttribute Type of the attribute.
+ \param anAttribute Where the attribute is placed if it's found.
+ \return True if it finds an attribute.
+ */
- \return A new %StudyBuilder.
+ boolean FindAttribute(in SObject anObject,
+ out GenericAttribute anAttribute,
+ in string aTypeOfAttribute);
+/*! \brief Deleting the attribute assigned to the %SObject
-See \ref example20 for an example of this method usage in batchmode of %SALOME application.
+ Removes the attribute of a specific type which is assigned to the object.
+ \param anObject The %SObject corresponding to the attribute.
+ \param aTypeOfAttribute Type of the attribute.
+
+See \ref example17 for an example of this method usage in batchmode of %SALOME application.
+*/
+ void RemoveAttribute(in SObject anObject,
+ in string aTypeOfAttribute) raises(LockProtection);
+/*!
+ Adds a reference between %anObject and %theReferencedObject.
+ \param anObject The %SObject which will get a reference
+ \param theReferencedObject The %SObject having a reference
*/
- StudyBuilder NewBuilder() raises(StudyInvalidReference);
-/*! \brief Labels dependency
- Updates the map with IOR attribute. It's an inner method used for optimization.
+ void Addreference(in SObject anObject,
+ in SObject theReferencedObject) ;
+
+/*!
+ Removes a reference from %anObject to another object.
+ \param anObject The %SObject which contains a reference
*/
- void UpdateIORLabelMap(in string anIOR, in string anEntry) raises(StudyInvalidReference);
-/*! \brief Getting properties of the study
+ void RemoveReference(in SObject anObject) ;
- Returns the attribute, which contains the properties of this study.
+/*!
+ Adds a directory in the %Study.
+ \param theName String parameter defining the name of the directory.
-See \ref example20 for an example of this method usage in batchmode of %SALOME application.
+See \ref example23 for an example of this method usage in batchmode of %SALOME application.
*/
- AttributeStudyProperties GetProperties() raises(StudyInvalidReference);
-/*! \brief Indicate whether the %study has been saved
-*/
- attribute boolean IsSaved;
-/*! \brief Indicate whether the %study has been modified and not saved.
+ void AddDirectory(in string theName) raises(LockProtection);
- Returns True if the %study has been modified and not saved.
-*/
- boolean IsModified() raises(StudyInvalidReference);
+/*! \brief Identification of the %SObject's substructure.
-/*! \brief Mark the %study as being modified and not saved.
-*/
- void Modified() raises(StudyInvalidReference);
+ Identification of the %SObject's substructure by GUID.
-/*! \brief Indicate the file where the %study has been saved
+
+ \param anObject The %SObject which will be identified
+ \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
*/
- attribute string URL;
-/*! \brief List of %SObjects
+ void SetGUID(in SObject anObject, in string theGUID) raises(LockProtection);
+/*!
+Searches for a definite %SObject with a definite GUID and returns True if it finds it.
- Returns the list of %SObjects which refers to %anObject.
+\param anObject A definite %SObject which will be identified
+\param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
*/
- ListOfSObject FindDependances(in SObject anObject) raises(StudyInvalidReference);
+ boolean IsGUID(in SObject anObject, in string theGUID);
-/*! \brief The date of the last saving of the study
+/*! \brief Creation of a new command
- Returns the date of the last saving of study with format: "DD/MM/YYYY HH:MM"
-*/
- string GetLastModificationDate() raises(StudyInvalidReference);
-/*! \brief The list of modification dates of the study
+ Creates a new command which can contain several different actions.
- Returns the list of modification dates (without creation date) with format "DD/MM/YYYY HH:MM".
- Note : the first modification begins the list.
-*/
- ListOfDates GetModificationsDate() raises(StudyInvalidReference);
-/*! \brief Object conversion.
+See \ref example3 for an example of this method usage in batchmode of %SALOME application.
- Converts an object into IOR.
- \return IOR
*/
- string ConvertObjectToIOR(in Object theObject);
-/*! \brief Object conversion.
+ void NewCommand(); // command management
+/*! \brief Execution of the command
- Converts IOR into an object.
- \return An object
-*/
- Object ConvertIORToObject(in string theIOR);
+ Commits all actions declared within this command.
-/*! \brief Get a new %UseCaseBuilder.
-*/
- UseCaseBuilder GetUseCaseBuilder() raises(StudyInvalidReference);
+ \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
-/*! \brief Close the components in the study, remove itself from the %StudyManager.
-*/
- void Close() raises(StudyInvalidReference);
+See \ref example16 for an example of this method usage in batchmode of %SALOME application.
-/*! \brief Enable (if isEnabled = True)/disable automatic addition of new %SObjects to the use case.
*/
- void EnableUseCaseAutoFilling(in boolean isEnabled) raises(StudyInvalidReference);
-
+ void CommitCommand() raises(LockProtection); // command management
/*!
- Functions for internal usage only
+ Returns True if at this moment there is a command under execution.
*/
- void AddPostponed(in string theIOR) raises(StudyInvalidReference);
-
- void AddCreatedPostponed(in string theIOR) raises(StudyInvalidReference);
-
- void RemovePostponed(in long theUndoLimit) raises(StudyInvalidReference);
-
- void UndoPostponed(in long theWay) raises(StudyInvalidReference);
-
- boolean DumpStudy(in string thePath,
- in string theBaseName,
- in boolean isPublished,
- in boolean isMultiFile) raises(StudyInvalidReference);
+ boolean HasOpenCommand();
+/*! \brief Cancelation of the command
-/*! \brief Get an AttributeParameter used to store common parameters for given %theSavePoint.
+ Cancels all actions declared within the command.
- \param theID identifies a common parameters set (Example: "Interface Applicative")
- \param theSavePoint is number of a set of parameters as there can be several sets
+See \ref example17 for an example of this method usage in batchmode of %SALOME application.
*/
- AttributeParameter GetCommonParameters(in string theID, in long theSavePoint) raises(StudyInvalidReference);
-
-/*! \brief Get an AttributeParameter used to store parameters for given %theModuleName.
+ void AbortCommand(); // command management
+/*! \brief Undolimit
- \param theID identifies a common parameters set (Example: "Interface Applicative")
- \param theModuleName is a name of the module (Example: "Geometry")
- \param theSavePoint is number of a set of parameters as there can be several sets
+ The number of actions which can be undone
*/
- AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint) raises(StudyInvalidReference);
+ attribute long UndoLimit;
+/*! \brief Undo method
+ Cancels all actions of the last command.
-/*! \brief Get a default Python script to restore visual parameters for given %theModuleName.
+ \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
- \param theModuleName is a name of the module (Example: "Geometry")
- \param indent is a string to use for script indentation
-*/
- string GetDefaultScript(in string theModuleName, in string indent) raises(StudyInvalidReference);
+See \ref example16 for an example of this method usage in batchmode of %SALOME application.
-/*!
- Private method, returns an implementation of this Study.
- \param theHostname is a hostname of the caller
- \param thePID is a process ID of the caller
- \param isLocal is set True if the Study is launched locally with the caller
*/
- long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
+ void Undo() raises (LockProtection);
+/*! \brief Redo method
+ Redoes all actions of the last command.
-/*! \brief Mark this Study as being locked by the given locker.
+\exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+
+See \ref example16 for an example of this method usage in batchmode of %SALOME application.
- The lock status can be checked by method IsStudyLocked
- \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locks the study.
*/
- void SetStudyLock(in string theLockerID) raises(StudyInvalidReference);
+ void Redo() raises (LockProtection);
+/*!
+ Returns True if at this moment there are any actions which can be canceled.
-/*! \brief Indicate if the Study is locked
+See \ref example16 for an example of this method usage in batchmode of %SALOME application.
- Returns True if the Study was marked locked.
*/
- boolean IsStudyLocked() raises(StudyInvalidReference);
+ boolean GetAvailableUndos();
+/*!
+ Returns True if at this moment there are any actions which can be redone.
-/*! \brief Mark this Study as being unlocked by the given locker.
+See \ref example3 for an example of this method usage in batchmode of %SALOME application.
- The lock status can be checked by method IsStudyLocked
- \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that unlocks the study.
*/
- void UnLockStudy(in string theLockerID) raises(StudyInvalidReference);
+ boolean GetAvailableRedos();
+/*!
+ Puts name attribute with the given string value to the given %SObject
-/*! \brief Get the list of IDs of the Study's lockers.
+ \param theSO Existing SObject to set name attribute.
+ \param theValue The value to be set to the name attribute.
*/
- ListOfStrings GetLockerID() raises(StudyInvalidReference);
+ void SetName(in SObject theSO, in string theValue) raises (LockProtection);
-/*! \brief Create real variable with Name theVarName and value theValue
+/*!
+ Puts comment attribute with the given string value to the given %SObject
- (or set if variable value into theValue already exists)
- \param theVarName is a name of the variable
- \param theVarName is a value of the variable.
+ \param theSO Existing SObject to set comment attribute.
+ \param theValue The value to be set to the comment attribute.
*/
- void SetReal( in string theVarName, in double theValue ) raises(StudyInvalidReference);
+ void SetComment(in SObject theSO, in string theValue) raises (LockProtection);
-/*! \brief Create integer variable with Name theVarName and value theValue
+/*!
+ Puts IOR attribute with the given string value to the given %SObject
- (or set if variable value into theValue already exists)
- \param theVarName is a name of the variable
- \param theVarName is a value of the variable.
+ \param theSO Existing SObject to set IOR attribute.
+ \param theValue The value to be set to the IOR attribute.
*/
- void SetInteger( in string theVarName, in long theValue ) raises(StudyInvalidReference);
-/*! \brief Create boolean variable with Name theVarName and value theValue
+ void SetIOR(in SObject theSO, in string theValue) raises (LockProtection);
+ };
- (or set if variable value into theValue already exists)
- \param theVarName is a name of the variable
- \param theVarName is a value of the variable.
+ //===========================================================================
+ /*! \brief %Study Interface
+
+ The purpose of the %Study is to manage the data produced by various components of %SALOME platform.
+ Most of the %Study operations are handled by the StudyBuilder.
+ What is left in the %Study interface are elementary inquiries.
+ (Incidentally, we recall that a CORBA attribute is implemented as a pair of get
+ and set methods.) A %Study is explored by a set of tools, mainly iterators
+ , which are described further. Nevertheless, the %Study
+ interface allows the search of an object by name or by ID.
+ \note
+
The Path of an object in %SALOME application is much alike a standard path of a file.
+ In general it's a string of names of directories divided by a slash '/'.
+
The Context is the current directory of an object.
*/
- void SetBoolean( in string theVarName, in boolean theValue ) raises(StudyInvalidReference);
-/*! \brief Create string variable with Name theVarName and value theValue
+ interface Study
+ {
- (or set if variable value into theValue already exists)
- \param theVarName is a name of the variable
- \param theVarName is a value of the variable.
+//! Invalid study reference
+ exception StudyInvalidReference {};
+//! Invalid study context
+ exception StudyInvalidContext {};
+//! Invalid study component
+ exception StudyInvalidComponent {};
+//! Invalid directory of the %study exception
+ exception StudyInvalidDirectory {};
+//! Exception pointing that this name of the study has already been used.
+ exception StudyNameAlreadyUsed {};
+//! study object already exists
+ exception StudyObjectAlreadyExists {};
+//! Invalid name of the %study exception
+ exception StudyNameError {};
+//! Invalid study comment
+ exception StudyCommentError {};
+
+/*!
+ Determines whether the server has already been loaded or not.
*/
- void SetString( in string theVarName, in string theValue ) raises(StudyInvalidReference);
-
-/*! \brief Set current value as double for string variable
+ void ping();
+ void Shutdown();
+/*!
+ Returns the PID of the server
*/
- void SetStringAsDouble( in string theVarName, in double theValue ) raises(StudyInvalidReference);
-
-/*! \brief Get value of a real variable
+ long getPID();
- \param theVarName is a name of the variable.
+/*!
+ Shutdown the Study process.
*/
- double GetReal( in string theVarName ) raises(StudyInvalidReference);
+ oneway void ShutdownWithExit();
-/*! \brief Get value of an integer variable
+/*! \brief The name of the %Study
- \param theVarName is a name of the variable.
+ This is equivalent to the methods setName() & getName()
*/
- long GetInteger( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Get value of a boolean variable
+ readonly attribute string Name; // equivalent to getName()
- \param theVarName is a name of the variable.
-*/
- boolean GetBoolean( in string theVarName ) raises(StudyInvalidReference);
+//! Sequence containing %SObjects
+ typedef sequence ListOfSObject;
+//! Get the persistent reference to the %Study.
+ PersistentReference GetPersistentReference() raises(StudyInvalidReference);
+//! Get a transient reference to the %Study.
+ SalomeReference GetTransientReference() raises(StudyInvalidReference);
-/*! \brief Get value of a string variable
+/*! \brief indicate whether the %Study is empty
- \param theVarName is a name of the variable.
+ \return True if the %Study is empty
*/
- string GetString( in string theVarName ) raises(StudyInvalidReference);
+ boolean IsEmpty() raises(StudyInvalidReference);
+/*! \brief Find a %SComponent by its name.
+ \param aComponentName It's a string value in the Comment Attribute of the Component,
+ which is looked for, defining the data type of this Component.
-/*! \brief Indicate if a variable is real
+See \ref example1 for an example of this method usage in batchmode of %SALOME application.
- Return true if variable is real otherwise return false.
- \param theVarName is a name of the variable.
*/
- boolean IsReal( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Indicate if a variable is integer
+ SComponent FindComponent (in string aComponentName) raises(StudyInvalidReference);
- Return true if variable is integer otherwise return false.
- \param theVarName is a name of the variable.
+/*! \brief Find a %SComponent by ID of the according %SObject
*/
- boolean IsInteger( in string theVarName ) raises(StudyInvalidReference);
+ SComponent FindComponentID(in ID aComponentID) raises(StudyInvalidReference);
+/*! \brief Find a %SObject by the Name Attribute of this %SObject
-/*! \brief Indicate if a variable is boolean
+ \param anObjectName String parameter defining the name of the object
+ \return The obtained %SObject
- Return true if variable is boolean otherwise return false.
- \param theVarName is a name of the variable.
+See \ref example19 for an example of this method usage in batchmode of %SALOME application.
*/
- boolean IsBoolean( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Indicate if a variable is string
+ SObject FindObject (in string anObjectName) raises(StudyInvalidReference);
+/*! \brief Find a %SObject by its ID
- Return true if variable is string otherwise return false.
- \param theVarName is a name of the variable.
+ \param aObjectID This parameter defines the ID of the required object
+ \return The obtained %SObject
*/
- boolean IsString( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Indicate if a variable exists in the study
+ SObject FindObjectID (in ID aObjectID) raises(StudyInvalidReference);
+/*! \brief Create a %SObject by its ID
- Return true if variable exists in the study,
- otherwise return false.
- \param theVarName is a name of the variable.
+ \param aObjectID This parameter defines the ID of the required object
+ \return The created %SObject
*/
- boolean IsVariable( in string theVarName ) raises(StudyInvalidReference);
+ SObject CreateObjectID (in ID aObjectID) raises(StudyInvalidReference);
+/*! \brief Find a %SObject by IOR of the object belonging to this %SObject.
-/*! \brief Get names of all variables from the study.
+ \param anObjectName This parameter defines the IOR of the object
+ \return The obtained %SObject
*/
- ListOfStrings GetVariableNames() raises(StudyInvalidReference);
-
-/*! \brief Remove a variable
-
- Remove variable with the specified name from the study with substitution of its value.
+ SObject FindObjectIOR (in ID aObjectIOR) raises(StudyInvalidReference);
+/*! \brief Find in the study all %SObjects produced by a given %Component.
- \param theVarName Name of the variable.
- \return Status of operation.
+ \param anObjectName The Name Attribute of the searched %SObjects should correspond to anObjectName.
+ \param aComponentName The name of the component, which objects are searched for.
*/
- boolean RemoveVariable( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Rename a variable
-
- Rename variable with the specified name within the study.
+ ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName) raises(StudyInvalidReference);
+/*! \brief Find a %SObject by the path to it.
- \param theVarName Name of the variable.
- \param theNewVarName New name for the variable.
- \return Status of operation.
+ \param thePath The path to the required %SObject.
+ \return The obtained %SObject.
*/
- boolean RenameVariable( in string theVarName, in string theNewVarName ) raises(StudyInvalidReference);
-
-/*! \brief Indicate whether variable is used
-
- Check that variable is used in the study.
-
- \param theVarName Name of the variable.
- \return Variable usage.
+ SObject FindObjectByPath(in string thePath) raises(StudyInvalidReference);
+/*! \brief Get the path to the %SObject.
*/
- boolean IsVariableUsed( in string theVarName ) raises(StudyInvalidReference);
-
-/*! \brief Parse variables used for object creation
+ string GetObjectPath(in Object theObject) raises(StudyInvalidReference);
- \param string with variables, separated by special symbol.
- \return Variables list.
-*/
- ListOfListOfStrings ParseVariables( in string theVars ) raises(StudyInvalidReference);
+/*! \brief Set the context of the %Study.
-/*!
- Attach an observer to the Study
+ \param thePath String parameter defining the context of the study.
- \param theObserver observer being attached
- \param modify when \c true, observer receives any object's modification events;
- otherwise observer receives object's creation events only
+See \ref example23 for an example of this method usage in batchmode of %SALOME application.
*/
- void attach(in SALOMEDS::Observer theObserver, in boolean modify);
-/*!
- Detach an observer from the Study
+ void SetContext(in string thePath) raises (StudyInvalidReference, StudyInvalidContext);
+/*! \brief Get the context of the %Study.
- \param theObserver observer to be detached
+See \ref example23 for an example of this method usage in batchmode of %SALOME application.
*/
- void detach(in SALOMEDS::Observer theObserver);
- };
-
- //==========================================================================
-/*! \brief %Study Builder Interface
+ string GetContext() raises (StudyInvalidReference, StudyInvalidContext);
+/*! \brief Get a list of names of objects corresponding to the context.
- The purpose of the Builder is to add and/or remove objects and attributes.
- A %StudyBuilder is linked to a %Study. A
- command management is provided for the undo/redo functionalities.
- \note
-
The Tag of an item in %SALOME application is a symbolic description of
- item's position in the tree-type structure of the browser. In general it has the following
- form: 0:2:1:1
+ \note If the parameter theContext is empty, then the current context will be used.
*/
- //==========================================================================
-
- interface StudyBuilder
- {
-/*! \brief %LockProtection Exception
+ ListOfStrings GetObjectNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
+/*! \brief Get a list of names of directories and subdirectories corresponding to the context.
- This exception is raised while attempting to modify a locked %study.
+ \note If the parameter theContext is empty, then the current context will be used.
*/
- exception LockProtection {};
-/*! \brief Creation of a new %SComponent.
-
- Creates a new %SComponent
- \param ComponentDataType Data type of the %SComponent which will be created.
-
-See \ref example17 for an example of this method usage in batchmode of %SALOME application.
+ ListOfStrings GetDirectoryNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
+/*! \brief Get a list of names of Files corresponding to the context.
+ \note If the parameter theContext is empty, then the current context will be used.
*/
- SComponent NewComponent(in string ComponentDataType) raises(LockProtection);
-/*! \brief Definition of the instance to the %SComponent
+ ListOfStrings GetFileNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
+/*! \brief Get a list of names of Components corresponding to the context.
- Defines the instance to the %SComponent.
+ \note If the parameter theContext is empty, then the current context will be used.
*/
- void DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR) raises(LockProtection);
-
-/*! \brief Deletion of a %SComponent
+ ListOfStrings GetComponentNames(in string theContext) raises(StudyInvalidReference);
+/*! \brief Create a new iterator of child levels of the given %SObject.
- Removes a %SComponent.
+ \param aSO The given %SObject
+ \return A new iterator of child levels of the given %SObject.
*/
- void RemoveComponent(in SComponent aComponent) raises(LockProtection);
+ ChildIterator NewChildIterator(in SObject aSO) raises(StudyInvalidReference);
-/*! \brief Creation of a new %SObject
+/*! \brief Create a new iterator of the %SComponents.
- Creates a new %SObject under a definite father %SObject.
+ \return A new iterator of the %SComponents.
+*/
+ SComponentIterator NewComponentIterator() raises(StudyInvalidReference);
- \param theFatherObject The father %SObject under which this one should be created.
- \return New %SObject
+/*! \brief Create a new %StudyBuilder to add or modify an object in the study.
-See \ref example18 for an example of this method usage in batchmode of %SALOME application.
+ \return A new %StudyBuilder.
+See \ref example20 for an example of this method usage in batchmode of %SALOME application.
*/
+ StudyBuilder NewBuilder() raises(StudyInvalidReference);
+/*! \brief Labels dependency
- SObject NewObject (in SObject theFatherObject) raises(LockProtection);
+ Updates the map with IOR attribute. It's an inner method used for optimization.
+*/
+ void UpdateIORLabelMap(in string anIOR, in string anEntry) raises(StudyInvalidReference);
-/*! \brief Creation of a new %SObject with a definite %tag
+/*! \brief Getting properties of the study
- Creates a new %SObject with a definite %tag.
+ Returns the attribute, which contains the properties of this study.
- \param atag Long value corresponding to the tag of the new %SObject.
- \return New %SObject
+See \ref example20 for an example of this method usage in batchmode of %SALOME application.
*/
- SObject NewObjectToTag (in SObject theFatherObject, in long atag) raises(LockProtection);
-/*! \brief Deletion of the %SObject
-
- Removes a %SObject from the %StudyBuilder.
-
- \param anObject The %SObject to be deleted.
+ AttributeStudyProperties GetProperties() raises(StudyInvalidReference);
+/*! \brief Indicate whether the %study has been saved
*/
- void RemoveObject (in SObject anObject) raises(LockProtection);
-/*! \brief Deletion of the %SObject with all his child objects.
-
- Removes the %SObject with all his child objects.
+ attribute boolean IsSaved;
+/*! \brief Indicate whether the %study has been modified and not saved.
- \param anObject The %SObject to be deleted with all child objects.
+ Returns True if the %study has been modified and not saved.
*/
- void RemoveObjectWithChildren(in SObject anObject) raises(LockProtection);
-
-/*!
- Loads a %SComponent.
-
-See \ref example19 for an example of this method usage in batchmode of %SALOME application.
+ boolean IsModified() raises(StudyInvalidReference);
+/*! \brief Mark the %study as being modified and not saved.
*/
- void LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
-/*!
- Loads a %SObject.
+ void Modified() raises(StudyInvalidReference);
- \param sco %SObject to be loaded.
+/*! \brief Indicate the file where the %study has been saved
*/
- void Load (in SObject sco);
-
-/*! \brief Looking for or creating an attribute assigned to the %SObject
+ attribute string URL;
- Allows to find or create an attribute of a specific type which is assigned to the object.
- \param anObject The %SObject corresponding to the attribute which is looked for.
- \param aTypeOfAttribute Type of the attribute.
+/*! \brief List of %SObjects
-See \ref example1 for an example of this method usage in batchmode of %SALOME application.
+ Returns the list of %SObjects which refers to %anObject.
*/
+ ListOfSObject FindDependances(in SObject anObject) raises(StudyInvalidReference);
- GenericAttribute FindOrCreateAttribute(in SObject anObject,
- in string aTypeOfAttribute) raises(LockProtection);
+/*! \brief The date of the last saving of the study
-/*! \brief Looking for an attribute assigned to a %SObject
+ Returns the date of the last saving of study with format: "DD/MM/YYYY HH:MM"
+*/
+ string GetLastModificationDate() raises(StudyInvalidReference);
+/*! \brief The list of modification dates of the study
- Allows to find an attribute of a specific type which is assigned to the object.
- \param anObject The %SObject corresponding to the attribute which is looked for.
- \param aTypeOfAttribute Type of the attribute.
- \param anAttribute Where the attribute is placed if it's found.
- \return True if it finds an attribute.
- */
+ Returns the list of modification dates (without creation date) with format "DD/MM/YYYY HH:MM".
+ Note : the first modification begins the list.
+*/
+ ListOfDates GetModificationsDate() raises(StudyInvalidReference);
+/*! \brief Object conversion.
- boolean FindAttribute(in SObject anObject,
- out GenericAttribute anAttribute,
- in string aTypeOfAttribute);
-/*! \brief Deleting the attribute assigned to the %SObject
+ Converts an object into IOR.
+ \return IOR
+*/
+ string ConvertObjectToIOR(in Object theObject);
+/*! \brief Object conversion.
- Removes the attribute of a specific type which is assigned to the object.
- \param anObject The %SObject corresponding to the attribute.
- \param aTypeOfAttribute Type of the attribute.
+ Converts IOR into an object.
+ \return An object
+*/
+ Object ConvertIORToObject(in string theIOR);
-See \ref example17 for an example of this method usage in batchmode of %SALOME application.
+/*! \brief Get a new %UseCaseBuilder.
*/
- void RemoveAttribute(in SObject anObject,
- in string aTypeOfAttribute) raises(LockProtection);
-/*!
- Adds a reference between %anObject and %theReferencedObject.
- \param anObject The %SObject which will get a reference
- \param theReferencedObject The %SObject having a reference
+ UseCaseBuilder GetUseCaseBuilder() raises(StudyInvalidReference);
+
+/*! \brief Clear a study object
*/
+ void Clear();
+
+/*! \brief Open a study by url
- void Addreference(in SObject anObject,
- in SObject theReferencedObject) ;
-
-/*!
- Removes a reference from %anObject to another object.
- \param anObject The %SObject which contains a reference
+ Reads and activates the structure of the study %Objects.
+ \param aStudyUrl The path to the study
*/
+ boolean Open (in URLPath aStudyUrl) raises (SALOME::SALOME_Exception);
+
+/*! \brief Saving the study in a HDF file (or files).
- void RemoveReference(in SObject anObject) ;
-
-/*!
- Adds a directory in the %Study.
- \param theName String parameter defining the name of the directory.
-
-See \ref example23 for an example of this method usage in batchmode of %SALOME application.
-
+ Saves a study.
+ \param theMultiFile If this parameter is True the study will be saved in several files.
*/
- void AddDirectory(in string theName) raises(LockProtection);
-
-/*! \brief Identification of the %SObject's substructure.
-
- Identification of the %SObject's substructure by GUID.
-
+ boolean Save(in boolean theMultiFile);
+
+/*! \brief Saving a study in a ASCII file (or files).
- \param anObject The %SObject which will be identified
- \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
+ Saves a study in an ASCII format file (or files).
+ \param theMultiFile If this parameter is True the study will be saved in several files.
*/
+ boolean SaveASCII(in boolean theMultiFile);
+/*! \brief Saving the study in a specified HDF file (or files).
- void SetGUID(in SObject anObject, in string theGUID) raises(LockProtection);
-/*!
-Searches for a definite %SObject with a definite GUID and returns True if it finds it.
+ Saves the study in a specified file (or files).
+ \param aUrl The path to the definite file in whcih the study will be saved
+ \param aStudy The study which will be saved
+ \param theMultiFile If this parameter is True the study will be saved in several files.
-\param anObject A definite %SObject which will be identified
-\param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
+See \ref example1 for an example of this method usage in batchmode of %SALOME application.
*/
- boolean IsGUID(in SObject anObject, in string theGUID);
-
-/*! \brief Creation of a new command
-
- Creates a new command which can contain several different actions.
+ boolean SaveAs(in URLPath aUrl, // if the file already exists
+ in boolean theMultiFile); // overwrite (as option)
+/*! \brief Saving the study in a specified ASCII file (or files).
-See \ref example3 for an example of this method usage in batchmode of %SALOME application.
+ Saves the study in a specified ASCII file (or files).
+ \param aUrl The path to the definite file in whcih the study will be saved
+ \param aStudy The study which will be saved
+ \param theMultiFile If this parameter is True the study will be saved in several files.
*/
- void NewCommand(); // command management
-/*! \brief Execution of the command
-
- Commits all actions declared within this command.
-
- \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
-
-See \ref example16 for an example of this method usage in batchmode of %SALOME application.
+ boolean SaveAsASCII(in URLPath aUrl, // if the file already exists
+ in boolean theMultiFile); // overwrite (as option)
+/*!
+ Returns True, if the given %SObject can be copied to the clipboard.
*/
- void CommitCommand() raises(LockProtection); // command management
+ boolean CanCopy(in SObject theObject);
/*!
- Returns True if at this moment there is a command under execution.
+ Returns True, if the given %SObject is copied to the clipboard.
+ \param theObject The %SObject which will be copied
*/
- boolean HasOpenCommand();
-/*! \brief Cancelation of the command
-
- Cancels all actions declared within the command.
+ boolean Copy(in SObject theObject);
+/*!
+ Returns True, if the object from the clipboard can be pasted to the given %SObject.
+ \param theObject The %SObject stored in the clipboard.
+*/
+ boolean CanPaste(in SObject theObject);
+/*!
+ Returns the %SObject in which the object from the clipboard was pasted to.
+ \param theObject The %SObject which will be pasted
+ \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
+ an object into a study, which is protected for modifications.
+*/
+ SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
-See \ref example17 for an example of this method usage in batchmode of %SALOME application.
+/*! \brief Enable (if isEnabled = True)/disable automatic addition of new %SObjects to the use case.
*/
- void AbortCommand(); // command management
-/*! \brief Undolimit
+ void EnableUseCaseAutoFilling(in boolean isEnabled) raises(StudyInvalidReference);
- The number of actions which can be undone
+/*!
+ Functions for internal usage only
*/
- attribute long UndoLimit;
-/*! \brief Undo method
+ void AddPostponed(in string theIOR) raises(StudyInvalidReference);
- Cancels all actions of the last command.
+ void AddCreatedPostponed(in string theIOR) raises(StudyInvalidReference);
- \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+ void RemovePostponed(in long theUndoLimit) raises(StudyInvalidReference);
-See \ref example16 for an example of this method usage in batchmode of %SALOME application.
+ void UndoPostponed(in long theWay) raises(StudyInvalidReference);
-*/
- void Undo() raises (LockProtection);
-/*! \brief Redo method
+ boolean DumpStudy(in string thePath,
+ in string theBaseName,
+ in boolean isPublished,
+ in boolean isMultiFile) raises(StudyInvalidReference);
- Redoes all actions of the last command.
+/*! \brief Get an AttributeParameter used to store common parameters for given %theSavePoint.
-\exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+ \param theID identifies a common parameters set (Example: "Interface Applicative")
+ \param theSavePoint is number of a set of parameters as there can be several sets
+*/
+ AttributeParameter GetCommonParameters(in string theID, in long theSavePoint) raises(StudyInvalidReference);
-See \ref example16 for an example of this method usage in batchmode of %SALOME application.
+/*! \brief Get an AttributeParameter used to store parameters for given %theModuleName.
+ \param theID identifies a common parameters set (Example: "Interface Applicative")
+ \param theModuleName is a name of the module (Example: "Geometry")
+ \param theSavePoint is number of a set of parameters as there can be several sets
*/
- void Redo() raises (LockProtection);
-/*!
- Returns True if at this moment there are any actions which can be canceled.
+ AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint) raises(StudyInvalidReference);
-See \ref example16 for an example of this method usage in batchmode of %SALOME application.
+/*! \brief Get a default Python script to restore visual parameters for given %theModuleName.
+
+ \param theModuleName is a name of the module (Example: "Geometry")
+ \param indent is a string to use for script indentation
*/
- boolean GetAvailableUndos();
+ string GetDefaultScript(in string theModuleName, in string indent) raises(StudyInvalidReference);
+
/*!
- Returns True if at this moment there are any actions which can be redone.
+ Private method, returns an implementation of this Study.
+ \param theHostname is a hostname of the caller
+ \param thePID is a process ID of the caller
+ \param isLocal is set True if the Study is launched locally with the caller
+*/
+ long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
-See \ref example3 for an example of this method usage in batchmode of %SALOME application.
-*/
- boolean GetAvailableRedos();
-/*!
- Puts name attribute with the given string value to the given %SObject
+/*! \brief Mark this Study as being locked by the given locker.
- \param theSO Existing SObject to set name attribute.
- \param theValue The value to be set to the name attribute.
+ The lock status can be checked by method IsStudyLocked
+ \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locks the study.
*/
- void SetName(in SObject theSO, in string theValue) raises (LockProtection);
+ void SetStudyLock(in string theLockerID) raises(StudyInvalidReference);
-/*!
- Puts comment attribute with the given string value to the given %SObject
+/*! \brief Indicate if the Study is locked
- \param theSO Existing SObject to set comment attribute.
- \param theValue The value to be set to the comment attribute.
+ Returns True if the Study was marked locked.
*/
- void SetComment(in SObject theSO, in string theValue) raises (LockProtection);
+ boolean IsStudyLocked() raises(StudyInvalidReference);
-/*!
- Puts IOR attribute with the given string value to the given %SObject
+/*! \brief Mark this Study as being unlocked by the given locker.
- \param theSO Existing SObject to set IOR attribute.
- \param theValue The value to be set to the IOR attribute.
+ The lock status can be checked by method IsStudyLocked
+ \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that unlocks the study.
*/
- void SetIOR(in SObject theSO, in string theValue) raises (LockProtection);
- };
-
- //==========================================================================
-/*! \brief %Study Manager interface
+ void UnLockStudy(in string theLockerID) raises(StudyInvalidReference);
- The purpose of the Manager is to manipulate the %Studies. You will find in this
- interface the methods to create, open,
- close, and save a %Study. Since a %SALOME session is multi-document, you will
- also find the methods allowing to navigate
- through the collection of studies present in a session.
+/*! \brief Get the list of IDs of the Study's lockers.
*/
- //==========================================================================
+ ListOfStrings GetLockerID() raises(StudyInvalidReference);
- interface StudyManager
- {
-/*!
- Determines whether the server has already been loaded or not.
+/*! \brief Create real variable with Name theVarName and value theValue
+
+ (or set if variable value into theValue already exists)
+ \param theVarName is a name of the variable
+ \param theVarName is a value of the variable.
*/
- void ping();
+ void SetReal( in string theVarName, in double theValue ) raises(StudyInvalidReference);
- void Shutdown();
+/*! \brief Create integer variable with Name theVarName and value theValue
-/*!
- Returns the PID of the server
+ (or set if variable value into theValue already exists)
+ \param theVarName is a name of the variable
+ \param theVarName is a value of the variable.
*/
- long getPID();
+ void SetInteger( in string theVarName, in long theValue ) raises(StudyInvalidReference);
+/*! \brief Create boolean variable with Name theVarName and value theValue
-/*!
- Shutdown the StudyManager process.
+ (or set if variable value into theValue already exists)
+ \param theVarName is a name of the variable
+ \param theVarName is a value of the variable.
*/
- oneway void ShutdownWithExit();
+ void SetBoolean( in string theVarName, in boolean theValue ) raises(StudyInvalidReference);
-/*! \brief Creation of a new study
+/*! \brief Create string variable with Name theVarName and value theValue
- Creates a new study with a definite name.
+ (or set if variable value into theValue already exists)
+ \param theVarName is a name of the variable
+ \param theVarName is a value of the variable.
+*/
+ void SetString( in string theVarName, in string theValue ) raises(StudyInvalidReference);
- \param study_name String parameter defining the name of the study
+/*! \brief Set current value as double for string variable
+*/
+ void SetStringAsDouble( in string theVarName, in double theValue ) raises(StudyInvalidReference);
-See \ref example17 for an example of this method usage in batchmode of %SALOME application.
+/*! \brief Get value of a real variable
+ \param theVarName is a name of the variable.
*/
- Study NewStudy(in string study_name) raises (SALOME::SALOME_Exception);
-
-/*! \brief Open a study
+ double GetReal( in string theVarName ) raises(StudyInvalidReference);
- Reads and activates the structure of the study %Objects.
- \param aStudyUrl The path to the study
- \warning This method doesn't activate the corba objects. Only a component can do it.
+/*! \brief Get value of an integer variable
-See \ref example1 for an example of this method usage in batchmode of %SALOME application.
+ \param theVarName is a name of the variable.
*/
- Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
+ long GetInteger( in string theVarName ) raises(StudyInvalidReference);
-/*! \brief Closing the study
+/*! \brief Get value of a boolean variable
- Closes a study.
+ \param theVarName is a name of the variable.
*/
- void Close(in Study aStudy);
-/*! \brief Saving the study in a HDF file (or files).
+ boolean GetBoolean( in string theVarName ) raises(StudyInvalidReference);
- Saves a study.
+/*! \brief Get value of a string variable
- \param theMultiFile If this parameter is True the study will be saved in several files.
+ \param theVarName is a name of the variable.
+*/
+ string GetString( in string theVarName ) raises(StudyInvalidReference);
-See \ref example19 for an example of this method usage in batchmode of %SALOME application.
-*/
- boolean Save(in Study aStudy, in boolean theMultiFile);
-/*! \brief Saving a study in a ASCII file (or files).
+/*! \brief Indicate if a variable is real
- Saves a study in an ASCII format file (or files).
- \param theMultiFile If this parameter is True the study will be saved in several files.
+ Return true if variable is real otherwise return false.
+ \param theVarName is a name of the variable.
*/
- boolean SaveASCII(in Study aStudy, in boolean theMultiFile);
-/*! \brief Saving the study in a specified HDF file (or files).
+ boolean IsReal( in string theVarName ) raises(StudyInvalidReference);
- Saves the study in a specified file (or files).
- \param aUrl The path to the definite file in whcih the study will be saved
- \param aStudy The study which will be saved
- \param theMultiFile If this parameter is True the study will be saved in several files.
+/*! \brief Indicate if a variable is integer
-See \ref example1 for an example of this method usage in batchmode of %SALOME application.
+ Return true if variable is integer otherwise return false.
+ \param theVarName is a name of the variable.
*/
- boolean SaveAs(in URL aUrl, // if the file already exists
- in Study aStudy,
- in boolean theMultiFile); // overwrite (as option)
-/*! \brief Saving the study in a specified ASCII file (or files).
+ boolean IsInteger( in string theVarName ) raises(StudyInvalidReference);
- Saves the study in a specified ASCII file (or files).
+/*! \brief Indicate if a variable is boolean
- \param aUrl The path to the definite file in whcih the study will be saved
- \param aStudy The study which will be saved
- \param theMultiFile If this parameter is True the study will be saved in several files.
+ Return true if variable is boolean otherwise return false.
+ \param theVarName is a name of the variable.
*/
- boolean SaveAsASCII(in URL aUrl, // if the file already exists
- in Study aStudy,
- in boolean theMultiFile); // overwrite (as option)
+ boolean IsBoolean( in string theVarName ) raises(StudyInvalidReference);
+/*! \brief Indicate if a variable is string
-/*! \brief List of open studies.
+ Return true if variable is string otherwise return false.
+ \param theVarName is a name of the variable.
+*/
+ boolean IsString( in string theVarName ) raises(StudyInvalidReference);
-Gets the list of open studies
+/*! \brief Indicate if a variable exists in the study
- \return A list of open studies in the current session.
+ Return true if variable exists in the study,
+ otherwise return false.
+ \param theVarName is a name of the variable.
*/
- ListOfOpenStudies GetOpenStudies();
-
-/*! \brief Getting a particular %Study picked by name
+ boolean IsVariable( in string theVarName ) raises(StudyInvalidReference);
- Activates a particular %Study
- among the session collection picking it by name.
- \param aStudyName The name of the study
+/*! \brief Get names of all variables from the study.
*/
- Study GetStudyByName (in string aStudyName);
+ ListOfStrings GetVariableNames() raises(StudyInvalidReference);
-/*! \brief Getting a particular %Study picked by ID
+/*! \brief Remove a variable
+
+ Remove variable with the specified name from the study with substitution of its value.
- Activates a particular %Study
- among the session collection picking it by ID.
- \param aStudyID The ID of the study
+ \param theVarName Name of the variable.
+ \return Status of operation.
*/
- Study GetStudyByID (in short aStudyID);
+ boolean RemoveVariable( in string theVarName ) raises(StudyInvalidReference);
- // copy/paste methods
+/*! \brief Rename a variable
-/*!
- Returns True, if the given %SObject can be copied to the clipboard.
-*/
- boolean CanCopy(in SObject theObject);
-/*!
- Returns True, if the given %SObject is copied to the clipboard.
- \param theObject The %SObject which will be copied
-*/
- boolean Copy(in SObject theObject);
-/*!
- Returns True, if the object from the clipboard can be pasted to the given %SObject.
- \param theObject The %SObject stored in the clipboard.
-*/
- boolean CanPaste(in SObject theObject);
-/*!
- Returns the %SObject in which the object from the clipboard was pasted to.
- \param theObject The %SObject which will be pasted
- \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
- an object into a study, which is protected for modifications.
+ Rename variable with the specified name within the study.
+
+ \param theVarName Name of the variable.
+ \param theNewVarName New name for the variable.
+ \return Status of operation.
*/
- SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
+ boolean RenameVariable( in string theVarName, in string theNewVarName ) raises(StudyInvalidReference);
-/*! \brief Object conversion.
+/*! \brief Indicate whether variable is used
- Converts an object into IOR.
- \return IOR
+ Check that variable is used in the study.
+
+ \param theVarName Name of the variable.
+ \return Variable usage.
*/
- string ConvertObjectToIOR(in Object theObject);
-/*! \brief Object conversion.
+ boolean IsVariableUsed( in string theVarName ) raises(StudyInvalidReference);
- Converts IOR into an object.
- \return An object
+/*! \brief Parse variables used for object creation
+
+ \param string with variables, separated by special symbol.
+ \return Variables list.
*/
- Object ConvertIORToObject(in string theIOR);
+ ListOfListOfStrings ParseVariables( in string theVars ) raises(StudyInvalidReference);
/*!
- Private method, returns an implementation of this StudyManager.
- \param theHostname is a hostname of the caller
- \param thePID is a process ID of the caller
- \param isLocal is set True if the StudyManager is launched locally with the caller
+ Attach an observer to the Study
+
+ \param theObserver observer being attached
+ \param modify when \c true, observer receives any object's modification events;
+ otherwise observer receives object's creation events only
*/
- long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal);
+ void attach(in SALOMEDS::Observer theObserver, in boolean modify);
+/*!
+ Detach an observer from the Study
+ \param theObserver observer to be detached
+*/
+ void detach(in SALOMEDS::Observer theObserver);
};
-
//==========================================================================
/*! \brief %SObject interface
@@ -1374,7 +1272,7 @@ This class represents a common tool for all components integrated into SALOME ap
can be called by any component and which provide the following functionality:
- publishing in the study of the objects created by a definite component
-
- saving/loading of the data created by a definite component. These methods are called by the StudyManager when loading/saving a study containing the data created by a definite component.
+
- saving/loading of the data created by a definite component. These methods are called when loading/saving a study containing the data created by a definite component.
- transforming of the transient references into persistant references (or vice versa) of the SObjects when saving (or loading) a study
- copy/paste common functionality. These methods can be called by any component in order to copy/paste its object created in the study
@@ -1386,7 +1284,7 @@ can be called by any component and which provide the following functionality:
/*! \brief Saving the data produced by a definite component.
- This method is called by the StudyManager when saving a study.
+ This method is called when saving a study.
\param theComponent %SComponent corresponding to this Component
\param theURL The path to the file in which the data will be saved.
\param isMultiFile If the value of this boolean parameter is True, the data will be saved in several files.
@@ -1401,7 +1299,7 @@ can be called by any component and which provide the following functionality:
/*! \brief Saving the data in ASCII format produced by a definite component.
- This method is called by the StudyManager when saving a study in ASCII format.
+ This method is called when saving a study in ASCII format.
\param theComponent %SComponent corresponding to this Component
\param theURL The path to the file in which the data will be saved.
\param isMultiFile If the value of this boolean parameter is True, the data will be saved in several files.
@@ -1414,7 +1312,7 @@ can be called by any component and which provide the following functionality:
/*! \brief Loading the data.
- This method is called by the StudyManager when opening a study.
+ This method is called when opening a study.
\param theComponent %SComponent corresponding to this Component
\param theStream The file which contains all data saved by the component on Save method
\param isMultiFile If the value of this boolean parameter is True, the data will be loaded from several files
@@ -1425,7 +1323,7 @@ can be called by any component and which provide the following functionality:
/*! \brief Loading the data from files in ASCII format.
- This method is called by the StudyManager when opening a study.
+ This method is called when opening a study.
\param theComponent %SComponent corresponding to this Component
\param theStream The file which contains all data saved by the component on Save method
\param isMultiFile If the value of this boolean parameter is True, the data will be loaded from several files
@@ -1436,7 +1334,7 @@ can be called by any component and which provide the following functionality:
/*! \brief Closing of the study
- This method Close is called by the StudyManager when closing a study.
+ This method Close is called when closing a study.
\param aSComponent The according %SComponent
*/
diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl
index 1e6df7625..012cfc644 100644
--- a/idl/SALOME_Component.idl
+++ b/idl/SALOME_Component.idl
@@ -90,12 +90,9 @@ module Engines
\param componentName Name of the component which will be registered
in Registry and Name Service,
(instance number suffix added to the registered name)
- \param studyId 0 if instance is not associated to a study,
- >0 otherwise (== study id)
\return a loaded component
*/
- Engines::EngineComponent create_component_instance(in string componentName,
- in long studyId);
+ Engines::EngineComponent create_component_instance(in string componentName);
//! Create a new Python servant instance of a generic service.
/*!
@@ -118,25 +115,20 @@ module Engines
\param componentName Name of the component which will be registered
in Registry and Name Service,
(instance number suffix added to the registered name)
- \param studyId 0 if instance is not associated to a study,
- >0 otherwise (== study id)
\param env a dict of env variables
\param reason in case of error (return nil) a string explaining the error
\return a loaded component
*/
Engines::EngineComponent create_component_instance_env(in string componentName,
- in long studyId, in FieldsDict env,
+ in FieldsDict env,
out string reason);
//! Find a servant instance of a component
/*!
\param registeredName Name of the component in Registry or Name Service,
without instance suffix number
- \param studyId 0 if instance is not associated to a study,
- >0 otherwise (== study id)
- \return the first instance found with same studyId
+ \return the first instance found
*/
- EngineComponent find_component_instance(in string registeredName,
- in long studyId);
+ EngineComponent find_component_instance(in string registeredName);
//! Find a servant instance of a component, or create a new one.
/*!
@@ -261,15 +253,6 @@ module Engines
//! Determines whether the server has already been loaded or not.
void ping();
- //! Get study associated to component instance
- /*!
- get study associated to component instance
- \return -1: not initialised (Internal Error)
- 0: multistudy component instance
- >0: study id associated to this instance
- */
- long getStudyId();
-
//! Remove component instance from container
/*!
Deactivates the %Component.
@@ -469,11 +452,10 @@ module Engines
It is worth using this method only if hasObjectInfo() method returns true.
\param entry object's entry.
- \param studyId study id
\return an information about the given object.
*/
- string getObjectInfo(in long studyId, in string entry);
+ string getObjectInfo(in string entry);
//! Get version of the component
/*!
diff --git a/idl/SALOME_PACOExtension.idl b/idl/SALOME_PACOExtension.idl
index 855f6f73c..ecedde31a 100644
--- a/idl/SALOME_PACOExtension.idl
+++ b/idl/SALOME_PACOExtension.idl
@@ -39,8 +39,7 @@ module Engines
// Replicated Method used by the proxy to create
// a PACO Component
void create_paco_component_node_instance(in string registeredName,
- in string proxy_containerName,
- in long studyId) raises(SALOME::SALOME_Exception);
+ in string proxy_containerName) raises(SALOME::SALOME_Exception);
void updateInstanceNumber();
};
diff --git a/idl/SALOME_Session.idl b/idl/SALOME_Session.idl
index 90509c0bb..8f1957446 100644
--- a/idl/SALOME_Session.idl
+++ b/idl/SALOME_Session.idl
@@ -94,8 +94,6 @@ module SALOME
long getPID();
//! Returns host name
string getHostname();
-//! Get Active study ID
- long GetActiveStudyId();
//! Restores a state of the study at theSavePoint
boolean restoreVisualState(in long theSavePoint);
diff --git a/src/Basics/Basics_DirUtils.cxx b/src/Basics/Basics_DirUtils.cxx
index 549ebafc2..38020be9a 100644
--- a/src/Basics/Basics_DirUtils.cxx
+++ b/src/Basics/Basics_DirUtils.cxx
@@ -44,14 +44,22 @@
# define _separator_ '/'
#endif
+#define _extension_ ".hdf"
+
namespace Kernel_Utils
{
- std::string GetBaseName( const std::string& file_path )
+ std::string GetBaseName( const std::string& file_path, const bool with_extension )
{
+ std::string tmp_str = file_path;
int pos = file_path.rfind( _separator_ );
if ( pos >= 0 )
- return pos < (int)file_path.size()-1 ? file_path.substr( pos+1 ) : "";
- return file_path;
+ tmp_str = pos < (int)file_path.size()-1 ? file_path.substr( pos+1 ) : "";
+
+ pos = tmp_str.rfind( _extension_ );
+ if( !with_extension && pos >= 0 )
+ tmp_str = pos < (int)file_path.size()-1 ? file_path.substr( 0, pos ) : "";
+
+ return tmp_str;
}
std::string GetDirName( const std::string& file_path )
@@ -157,6 +165,15 @@ namespace Kernel_Utils
return aFilePath;
}
+ std::string AddExtension( const std::string& name )
+ {
+ std::string tmp_str = name;
+ int pos = tmp_str.rfind( _extension_ );
+ if( pos < 0 )
+ return tmp_str.append( _extension_ );
+ return tmp_str;
+ }
+
//============================================================================
// function : IsExists
// purpose : Returns True(False) if the path (not)exists
diff --git a/src/Basics/Basics_DirUtils.hxx b/src/Basics/Basics_DirUtils.hxx
index edc100ebe..787277ad6 100644
--- a/src/Basics/Basics_DirUtils.hxx
+++ b/src/Basics/Basics_DirUtils.hxx
@@ -32,7 +32,7 @@
namespace Kernel_Utils
{
// Extracts and returns the base name of the specified file name.
- BASICS_EXPORT std::string GetBaseName( const std::string& file_path );
+ BASICS_EXPORT std::string GetBaseName( const std::string& file_path, bool with_extension = true );
// Extracts and returns the dir name of the specified file name.
BASICS_EXPORT std::string GetDirName( const std::string& file_path );
@@ -49,11 +49,13 @@ namespace Kernel_Utils
// /tmp/something/ for Unix or c:\something\ for WIN32
BASICS_EXPORT std::string GetTmpDir();
-
// Returns the unique temporary file name without any extension
// /tmp/something/file for Unix or c:\something\file for WIN32
BASICS_EXPORT std::string GetTmpFileName();
+ // Adds extension in the end of the specified file name.
+ BASICS_EXPORT std::string AddExtension( const std::string& name );
+
// Returns True(False) if the path (not)exists
BASICS_EXPORT bool IsExists( const std::string& path );
diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx
index 8a84c67d1..7857a5d10 100644
--- a/src/Container/Component_i.cxx
+++ b/src/Container/Component_i.cxx
@@ -51,7 +51,7 @@ int SIGUSR11 = 1000;
extern bool _Sleeping ;
static Engines_Component_i * theEngines_Component ;
-bool Engines_Component_i::_isMultiStudy = true;
+bool Engines_Component_i::_isMultiStudy = false;
bool Engines_Component_i::_isMultiInstance = false;
/*! \class Engines_Component_i
@@ -101,7 +101,6 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
_Executed(false) ,
_graphName("") ,
_nodeName(""),
- _studyId(-1),
_id(0),
_contId(0),
_CanceledThread(false)
@@ -155,7 +154,6 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
_Executed(false) ,
_graphName("") ,
_nodeName(""),
- _studyId(-1),
_id(0),
_contId(0),
_CanceledThread(false)
@@ -227,20 +225,6 @@ char* Engines_Component_i::interfaceName()
return CORBA::string_dup(_interfaceName.c_str()) ;
}
-//=============================================================================
-/*!
- * CORBA method: Get study Id
- * \return -1: not initialised (Internal Error)
- * 0: multistudy component instance
- * >0: study id associated to this instance
- */
-//=============================================================================
-
-CORBA::Long Engines_Component_i::getStudyId()
-{
- return _studyId;
-}
-
//=============================================================================
/*!
* CORBA method: Test if instance is alive and responds
@@ -606,31 +590,6 @@ Engines_Container_i *Engines_Component_i::GetContainerPtr()
return dynamic_cast(_poa->id_to_servant(contId)) ;
}
-//=============================================================================
-/*!
- * C++ method: set study Id
- * \param studyId 0 if instance is not associated to a study,
- * >0 otherwise (== study id)
- * \return true if the set of study Id is OK
- * must be set once by Container, at instance creation,
- * and cannot be changed after.
- */
-//=============================================================================
-
-CORBA::Boolean Engines_Component_i::setStudyId(CORBA::Long studyId)
-{
- ASSERT( studyId >= 0);
- CORBA::Boolean ret = false;
- if (_studyId < 0) // --- not yet initialized
- {
- _studyId = studyId;
- ret = true;
- }
- else
- if ( _studyId == studyId) ret = true;
- return ret;
-}
-
//=============================================================================
/*!
* C++ method: return CORBA instance id, the id is set in derived class
diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx
index 68373b289..085651006 100644
--- a/src/Container/Container_i.cxx
+++ b/src/Container/Container_i.cxx
@@ -255,17 +255,17 @@ Engines_Container_i::~Engines_Container_i()
if(_NS)
delete _NS;
for(std::map::iterator it=_dftPyNode.begin();it!=_dftPyNode.end();it++)
- {
- Engines::PyNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- tmpVar->UnRegister();
- }
+ {
+ Engines::PyNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ tmpVar->UnRegister();
+ }
for(std::map::iterator it=_dftPyScriptNode.begin();it!=_dftPyScriptNode.end();it++)
- {
- Engines::PyScriptNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- tmpVar->UnRegister();
- }
+ {
+ Engines::PyScriptNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ tmpVar->UnRegister();
+ }
}
//=============================================================================
@@ -370,20 +370,20 @@ void Engines_Container_i::Shutdown()
*/
std::map::iterator itm;
for (itm = _listInstances_map.begin(); itm != _listInstances_map.end(); itm++)
+ {
+ try
+ {
+ itm->second->destroy();
+ }
+ catch(const CORBA::Exception& e)
+ {
+ // ignore this entry and continue
+ }
+ catch(...)
{
- try
- {
- itm->second->destroy();
- }
- catch(const CORBA::Exception& e)
- {
- // ignore this entry and continue
- }
- catch(...)
- {
- // ignore this entry and continue
- }
+ // ignore this entry and continue
}
+ }
_listInstances_map.clear();
_NS->Destroy_FullDirectory(_containerName.c_str());
@@ -414,15 +414,15 @@ Engines_Container_i::load_component_Library(const char* componentName, CORBA::St
//=================================================================
std::string retso;
if(load_component_CppImplementation(componentName,retso))
- {
- reason=CORBA::string_dup("");
- return true;
- }
+ {
+ reason=CORBA::string_dup("");
+ return true;
+ }
else if(retso != "ImplementationNotFound")
- {
- reason=CORBA::string_dup(retso.c_str());
- return false;
- }
+ {
+ reason=CORBA::string_dup(retso.c_str());
+ return false;
+ }
retso="Component ";
retso+=componentName;
@@ -434,15 +434,15 @@ Engines_Container_i::load_component_Library(const char* componentName, CORBA::St
//=================================================================
std::string retpy;
if(load_component_PythonImplementation(componentName,retpy))
- {
- reason=CORBA::string_dup("");
- return true;
- }
+ {
+ reason=CORBA::string_dup("");
+ return true;
+ }
else if(retpy != "ImplementationNotFound")
- {
- reason=CORBA::string_dup(retpy.c_str());
- return false;
- }
+ {
+ reason=CORBA::string_dup(retpy.c_str());
+ return false;
+ }
retpy="Component ";
retpy+=componentName;
@@ -455,15 +455,15 @@ Engines_Container_i::load_component_Library(const char* componentName, CORBA::St
//=================================================================
std::string retex;
if(load_component_ExecutableImplementation(componentName,retex))
- {
- reason=CORBA::string_dup("");
- return true;
- }
+ {
+ reason=CORBA::string_dup("");
+ return true;
+ }
else if(retex != "ImplementationNotFound")
- {
- reason=CORBA::string_dup(retex.c_str());
- return false;
- }
+ {
+ reason=CORBA::string_dup(retex.c_str());
+ return false;
+ }
retex="Component ";
retex+=componentName;
@@ -504,63 +504,63 @@ Engines_Container_i::load_component_CppImplementation(const char* componentName,
// (see decInstanceCnt, finalize_removal))
if (_toRemove_map.count(impl_name) != 0) _toRemove_map.erase(impl_name);
if (_library_map.count(impl_name) != 0)
- {
- MESSAGE("Library " << impl_name << " already loaded");
- _numInstanceMutex.unlock();
- reason="";
- return true;
- }
+ {
+ MESSAGE("Library " << impl_name << " already loaded");
+ _numInstanceMutex.unlock();
+ reason="";
+ return true;
+ }
_numInstanceMutex.unlock();
#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_NOW ) ;
if ( !handle )
+ {
+ //not loadable. Try to find the lib file in LD_LIBRARY_PATH
+ std::string path;
+ char* p=getenv("LD_LIBRARY_PATH");
+ if(p)path=p;
+ path=path+SEP+"/usr/lib"+SEP+"/lib";
+
+ std::string pth;
+ if(findpathof(path, pth, impl_name))
{
- //not loadable. Try to find the lib file in LD_LIBRARY_PATH
- std::string path;
- char* p=getenv("LD_LIBRARY_PATH");
- if(p)path=p;
- path=path+SEP+"/usr/lib"+SEP+"/lib";
-
- std::string pth;
- if(findpathof(path, pth, impl_name))
- {
- //found but not loadable
- reason="Component ";
- reason+=aCompName;
- reason+=": C++ implementation found ";
- reason+=pth;
- reason+=" but it is not loadable. Error:\n";
- reason+=dlerror();
- std::cerr << reason << std::endl;
- return false;
- }
- else
- {
- //not found
- //continue with other implementation
- reason="ImplementationNotFound";
- return false;
- }
+ //found but not loadable
+ reason="Component ";
+ reason+=aCompName;
+ reason+=": C++ implementation found ";
+ reason+=pth;
+ reason+=" but it is not loadable. Error:\n";
+ reason+=dlerror();
+ std::cerr << reason << std::endl;
+ return false;
+ }
+ else
+ {
+ //not found
+ //continue with other implementation
+ reason="ImplementationNotFound";
+ return false;
}
+ }
#else
HINSTANCE handle;
handle = LoadLibrary( impl_name.c_str() );
if ( !handle )
- {
- reason="ImplementationNotFound";
- }
+ {
+ reason="ImplementationNotFound";
+ }
#endif
if ( handle )
- {
- _numInstanceMutex.lock();
- _library_map[impl_name] = handle;
- _numInstanceMutex.unlock();
- reason="";
- return true;
- }
+ {
+ _numInstanceMutex.lock();
+ _library_map[impl_name] = handle;
+ _numInstanceMutex.unlock();
+ reason="";
+ return true;
+ }
return false;
@@ -581,11 +581,11 @@ Engines_Container_i::load_component_PythonImplementation(const char* componentNa
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
if (_library_map.count(aCompName) != 0)
- {
- _numInstanceMutex.unlock() ;
- reason="";
- return true; // Python Component, already imported
- }
+ {
+ _numInstanceMutex.unlock() ;
+ reason="";
+ return true; // Python Component, already imported
+ }
_numInstanceMutex.unlock() ;
PyGILState_STATE gstate = PyGILState_Ensure();
@@ -599,24 +599,24 @@ Engines_Container_i::load_component_PythonImplementation(const char* componentNa
PyGILState_Release(gstate);
if (reason=="")
- {
- //Python component has been loaded (import componentName)
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _library_map[aCompName] = (void *)_pyCont; // any non O value OK
- _numInstanceMutex.unlock() ;
- MESSAGE("import Python: "<< aCompName <<" OK");
- return true;
- }
+ {
+ //Python component has been loaded (import componentName)
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _library_map[aCompName] = (void *)_pyCont; // any non O value OK
+ _numInstanceMutex.unlock() ;
+ MESSAGE("import Python: "<< aCompName <<" OK");
+ return true;
+ }
else if(reason=="ImplementationNotFound")
- {
- //Python implementation has not been found. Continue with other implementation
- reason="ImplementationNotFound";
- }
+ {
+ //Python implementation has not been found. Continue with other implementation
+ reason="ImplementationNotFound";
+ }
else
- {
- //Python implementation has been found but loading has failed
- std::cerr << reason << std::endl;
- }
+ {
+ //Python implementation has been found but loading has failed
+ std::cerr << reason << std::endl;
+ }
return false;
}
@@ -642,27 +642,27 @@ Engines_Container_i::load_component_ExecutableImplementation(const char* compone
if(p)path=p;
if (findpathof(path, pth, executable))
+ {
+ if(checkifexecutable(pth))
{
- if(checkifexecutable(pth))
- {
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _library_map[executable] = (void *)1; // any non O value OK
- _numInstanceMutex.unlock() ;
- MESSAGE("import executable: "<< pth <<" OK");
- reason="";
- return true;
- }
- reason="Component ";
- reason+=aCompName;
- reason+=": implementation found ";
- reason+=pth;
- reason+=" but it is not executable";
- std::cerr << reason << std::endl;
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _library_map[executable] = (void *)1; // any non O value OK
+ _numInstanceMutex.unlock() ;
+ MESSAGE("import executable: "<< pth <<" OK");
+ reason="";
+ return true;
}
+ reason="Component ";
+ reason+=aCompName;
+ reason+=": implementation found ";
+ reason+=pth;
+ reason+=" but it is not executable";
+ std::cerr << reason << std::endl;
+ }
else
- {
- reason="ImplementationNotFound";
- }
+ {
+ reason="ImplementationNotFound";
+ }
return false;
}
@@ -673,19 +673,16 @@ Engines_Container_i::load_component_ExecutableImplementation(const char* compone
* The servant registers itself to naming service and Registry.
* \param genericRegisterName Name of the component instance to register
* in Registry & Name Service (without _inst_n suffix)
-* \param studyId 0 for multiStudy instance,
-* study Id (>0) otherwise
* \return a loaded component
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Container_i::create_component_instance(const char*genericRegisterName,
- CORBA::Long studyId)
+Engines_Container_i::create_component_instance(const char*genericRegisterName)
{
Engines::FieldsDict_var env = new Engines::FieldsDict;
char* reason;
Engines::EngineComponent_ptr compo =
- create_component_instance_env(genericRegisterName, studyId, env, reason);
+ create_component_instance_env(genericRegisterName, env, reason);
CORBA::string_free(reason);
return compo;
}
@@ -697,8 +694,6 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName,
* The servant registers itself to naming service and Registry.
* \param genericRegisterName Name of the component instance to register
* in Registry & Name Service (without _inst_n suffix)
-* \param studyId 0 for multiStudy instance,
-* study Id (>0) otherwise
* \param env dict of env variables
* \param reason explains error when create_component_instance_env fails
* \return a loaded component
@@ -706,44 +701,36 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName,
//=============================================================================
Engines::EngineComponent_ptr
Engines_Container_i::create_component_instance_env(const char*genericRegisterName,
- CORBA::Long studyId,
const Engines::FieldsDict& env,
CORBA::String_out reason)
{
- if (studyId < 0)
- {
- INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
- reason=CORBA::string_dup("studyId must be > 0 for mono study instance, =0 for multiStudy");
- return Engines::EngineComponent::_nil() ;
- }
-
std::string error;
if (_library_map.count(genericRegisterName) != 0)
- {
- // It's a Python component
- Engines::EngineComponent_ptr compo = createPythonInstance(genericRegisterName, studyId, error);
- reason=CORBA::string_dup(error.c_str());
- return compo;
- }
+ {
+ // It's a Python component
+ Engines::EngineComponent_ptr compo = createPythonInstance(genericRegisterName, error);
+ reason=CORBA::string_dup(error.c_str());
+ return compo;
+ }
std::string impl_name = std::string(LIB) + genericRegisterName + ENGINESO;
if (_library_map.count(impl_name) != 0)
- {
- // It's a C++ component
- void* handle = _library_map[impl_name];
- Engines::EngineComponent_ptr compo = createInstance(genericRegisterName, handle, studyId, error);
- reason=CORBA::string_dup(error.c_str());
- return compo;
- }
+ {
+ // It's a C++ component
+ void* handle = _library_map[impl_name];
+ Engines::EngineComponent_ptr compo = createInstance(genericRegisterName, handle, error);
+ reason=CORBA::string_dup(error.c_str());
+ return compo;
+ }
impl_name = std::string(genericRegisterName) + ".exe";
if (_library_map.count(impl_name) != 0)
- {
- //It's an executable component
- Engines::EngineComponent_ptr compo = createExecutableInstance(genericRegisterName, studyId, env, error);
- reason=CORBA::string_dup(error.c_str());
- return compo;
- }
+ {
+ //It's an executable component
+ Engines::EngineComponent_ptr compo = createExecutableInstance(genericRegisterName, env, error);
+ reason=CORBA::string_dup(error.c_str());
+ return compo;
+ }
error="load_component_Library has probably not been called for component: ";
error += genericRegisterName;
@@ -756,8 +743,6 @@ Engines_Container_i::create_component_instance_env(const char*genericRegisterNam
//! Create a new component instance (Executable implementation)
/*!
* \param CompName Name of the component instance
-* \param studyId 0 for multiStudy instance,
-* study Id (>0) otherwise
* \param env dict of env variables
* \param reason explains error when creation fails
* \return a loaded component
@@ -768,7 +753,7 @@ Engines_Container_i::create_component_instance_env(const char*genericRegisterNam
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Container_i::createExecutableInstance(std::string CompName, int studyId,
+Engines_Container_i::createExecutableInstance(std::string CompName,
const Engines::FieldsDict& env,
std::string& reason)
{
@@ -822,35 +807,35 @@ Engines_Container_i::createExecutableInstance(std::string CompName, int studyId,
int status;
pid_t pid = fork();
if(pid == 0) // child
+ {
+ for (CORBA::ULong i=0; i < env.length(); i++)
{
- for (CORBA::ULong i=0; i < env.length(); i++)
- {
- if (env[i].value.type()->kind() == CORBA::tk_string)
- {
- const char* value;
- env[i].value >>= value;
- std::string s(env[i].key);
- s+='=';
- s+=value;
- putenv(strdup(s.c_str()));
- }
- }
-
- execl("/bin/sh", "sh", "-c", command.c_str() , (char *)0);
- status=-1;
+ if (env[i].value.type()->kind() == CORBA::tk_string)
+ {
+ const char* value;
+ env[i].value >>= value;
+ std::string s(env[i].key);
+ s+='=';
+ s+=value;
+ putenv(strdup(s.c_str()));
+ }
}
+
+ execl("/bin/sh", "sh", "-c", command.c_str() , (char *)0);
+ status=-1;
+ }
else if(pid < 0) // failed to fork
- {
- status=-1;
- }
+ {
+ status=-1;
+ }
else //parent
+ {
+ pid_t tpid;
+ do
{
- pid_t tpid;
- do
- {
- tpid = wait(&status);
- } while (tpid != pid);
- }
+ tpid = wait(&status);
+ } while (tpid != pid);
+ }
#else
// launch component with a system call
int status=system(command.c_str());
@@ -920,14 +905,12 @@ Engines_Container_i::createExecutableInstance(std::string CompName, int studyId,
//! Create a new component instance (Python implementation)
/*!
* \param CompName Name of the component instance
-* \param studyId 0 for multiStudy instance,
-* study Id (>0) otherwise
* \param reason explains error when creation fails
* \return a loaded component
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Container_i::createPythonInstance(std::string CompName, int studyId,
+Engines_Container_i::createPythonInstance(std::string CompName,
std::string& reason)
{
Engines::EngineComponent_var iobject = Engines::EngineComponent::_nil() ;
@@ -947,8 +930,7 @@ Engines_Container_i::createPythonInstance(std::string CompName, int studyId,
(char*)"create_component_instance",
(char*)"ssl",
CompName.c_str(),
- instanceName.c_str(),
- studyId);
+ instanceName.c_str());
const char *ior;
const char *error;
PyArg_ParseTuple(result,"ss", &ior, &error);
@@ -958,11 +940,11 @@ Engines_Container_i::createPythonInstance(std::string CompName, int studyId,
PyGILState_Release(gstate);
if( iors!="" )
- {
- CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
- iobject = Engines::EngineComponent::_narrow( obj ) ;
- _listInstances_map[instanceName] = iobject;
- }
+ {
+ CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+ iobject = Engines::EngineComponent::_narrow( obj ) ;
+ _listInstances_map[instanceName] = iobject;
+ }
return iobject._retn();
}
@@ -1009,8 +991,6 @@ Engines_Container_i::create_python_service_instance(const char * CompName,
* in Registry & Name Service,
* (without _inst_n suffix, like "COMPONENT")
* \param handle loaded library handle
-* \param studyId 0 for multiStudy instance,
-* study Id (>0) otherwise
* \param reason explains error when creation fails
* \return a loaded component
*
@@ -1026,7 +1006,6 @@ Engines_Container_i::create_python_service_instance(const char * CompName,
Engines::EngineComponent_ptr
Engines_Container_i::createInstance(std::string genericRegisterName,
void *handle,
- int studyId,
std::string& reason)
{
// --- find the factory
@@ -1080,30 +1059,23 @@ Engines_Container_i::createInstance(std::string genericRegisterName,
id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
aGenRegisterName.c_str() ) ;
if (id == NULL)
- {
- reason="Can't get ObjectId from factory";
- INFOS(reason);
- return iobject._retn();
- }
+ {
+ reason="Can't get ObjectId from factory";
+ INFOS(reason);
+ return iobject._retn();
+ }
- // --- get reference & servant from id
+ // --- get reference from id
CORBA::Object_var obj = _poa->id_to_reference(*id);
iobject = Engines::EngineComponent::_narrow( obj ) ;
- Engines_Component_i *servant =
- dynamic_cast(_poa->reference_to_servant(iobject));
- ASSERT(servant);
- //SCRUTE(servant->_refcount_value());
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
_numInstanceMutex.unlock() ;
SCRUTE(aGenRegisterName);
SCRUTE(_cntInstances_map[aGenRegisterName]);
- servant->setStudyId(studyId);
- servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant)
- //SCRUTE(servant->_refcount_value());
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
@@ -1125,14 +1097,11 @@ Engines_Container_i::createInstance(std::string genericRegisterName,
* CORBA method: Finds a servant instance of a component
* \param registeredName Name of the component in Registry or Name Service,
* without instance suffix number
-* \param studyId 0 if instance is not associated to a study,
-* >0 otherwise (== study id)
-* \return the first instance found with same studyId
+* \return the first found instance
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Container_i::find_component_instance( const char* registeredName,
- CORBA::Long studyId)
+Engines_Container_i::find_component_instance( const char* registeredName)
{
Engines::EngineComponent_var anEngine = Engines::EngineComponent::_nil();
std::map::iterator itm =_listInstances_map.begin();
@@ -1143,10 +1112,7 @@ Engines_Container_i::find_component_instance( const char* registeredName,
if (instance.find(registeredName) == 0)
{
anEngine = (*itm).second;
- if (studyId == anEngine->getStudyId())
- {
- return anEngine._retn();
- }
+ return anEngine._retn();
}
itm++;
}
@@ -1312,29 +1278,11 @@ Engines_Container_i::find_or_create_instance(std::string genericRegisterName,
{
iobject = createInstance(genericRegisterName,
handle,
- 0,
- reason); // force multiStudy instance here !
+ reason);
}
else
{
iobject = Engines::EngineComponent::_narrow( obj ) ;
- Engines_Component_i *servant =
- dynamic_cast
- (_poa->reference_to_servant(iobject));
- ASSERT(servant)
- int studyId = servant->getStudyId();
- ASSERT (studyId >= 0);
- if (studyId == 0) // multiStudy instance, OK
- {
- // No ReBind !
- MESSAGE(component_registerBase.c_str()<<" already bound");
- }
- else // monoStudy instance: NOK
- {
- iobject = Engines::EngineComponent::_nil();
- INFOS("load_impl & find_component_instance methods "
- << "NOT SUITABLE for mono study components");
- }
}
}
catch (...)
@@ -1624,36 +1572,36 @@ void Engines_Container_i::copyFile(Engines::Container_ptr container, const char*
FILE* fp;
if ((fp = fopen(localFile,"wb")) == NULL)
- {
- INFOS("file " << localFile << " cannot be open for writing");
- return;
- }
+ {
+ INFOS("file " << localFile << " cannot be open for writing");
+ return;
+ }
CORBA::Long fileId = fileTransfer->open(remoteFile);
if (fileId > 0)
+ {
+ Engines::fileBlock* aBlock;
+ int toFollow = 1;
+ int ctr=0;
+ while (toFollow)
{
- Engines::fileBlock* aBlock;
- int toFollow = 1;
- int ctr=0;
- while (toFollow)
- {
- ctr++;
- //SCRUTE(ctr);
- aBlock = fileTransfer->getBlock(fileId);
- toFollow = aBlock->length();
- //SCRUTE(toFollow);
- CORBA::Octet *buf = aBlock->get_buffer();
- fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
- delete aBlock;
- }
- fclose(fp);
- MESSAGE("end of transfer");
- fileTransfer->close(fileId);
+ ctr++;
+ //SCRUTE(ctr);
+ aBlock = fileTransfer->getBlock(fileId);
+ toFollow = aBlock->length();
+ //SCRUTE(toFollow);
+ CORBA::Octet *buf = aBlock->get_buffer();
+ fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+ delete aBlock;
}
+ fclose(fp);
+ MESSAGE("end of transfer");
+ fileTransfer->close(fileId);
+ }
else
- {
- INFOS("open reference file for copy impossible");
- }
+ {
+ INFOS("open reference file for copy impossible");
+ }
}
//=============================================================================
@@ -1665,57 +1613,57 @@ void Engines_Container_i::copyFile(Engines::Container_ptr container, const char*
//=============================================================================
Engines::PyNode_ptr Engines_Container_i::createPyNode(const char* nodeName, const char* code)
{
- Engines::PyNode_var node= Engines::PyNode::_nil();
+ Engines::PyNode_var node= Engines::PyNode::_nil();
- PyGILState_STATE gstate = PyGILState_Ensure();
- PyObject *res = PyObject_CallMethod(_pyCont,
- (char*)"create_pynode",
- (char*)"ss",
- nodeName,
- code);
- if(res==NULL)
- {
- //internal error
- PyErr_Print();
- PyGILState_Release(gstate);
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- es.text = "can not create a python node";
- throw SALOME::SALOME_Exception(es);
- }
- long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
- PyObject* result=PyTuple_GetItem(res,1);
- std::string astr=PyString_AsString(result);
- Py_DECREF(res);
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *res = PyObject_CallMethod(_pyCont,
+ (char*)"create_pynode",
+ (char*)"ss",
+ nodeName,
+ code);
+ if(res==NULL)
+ {
+ //internal error
+ PyErr_Print();
PyGILState_Release(gstate);
- if(ierr==0)
- {
- Utils_Locker lck(&_mutexForDftPy);
- CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
- node=Engines::PyNode::_narrow(obj);
- std::map::iterator it(_dftPyNode.find(nodeName));
- if(it==_dftPyNode.end())
- {
- _dftPyNode[nodeName]=node;
- }
- else
- {
- Engines::PyNode_var oldNode((*it).second);
- if(!CORBA::is_nil(oldNode))
- oldNode->UnRegister();
- (*it).second=node;
- }
- if(!CORBA::is_nil(node))
- node->Register();
- return node._retn();
- }
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "can not create a python node";
+ throw SALOME::SALOME_Exception(es);
+ }
+ long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
+ PyObject* result=PyTuple_GetItem(res,1);
+ std::string astr=PyString_AsString(result);
+ Py_DECREF(res);
+ PyGILState_Release(gstate);
+ if(ierr==0)
+ {
+ Utils_Locker lck(&_mutexForDftPy);
+ CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
+ node=Engines::PyNode::_narrow(obj);
+ std::map::iterator it(_dftPyNode.find(nodeName));
+ if(it==_dftPyNode.end())
+ {
+ _dftPyNode[nodeName]=node;
+ }
else
- {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- es.text = astr.c_str();
- throw SALOME::SALOME_Exception(es);
- }
+ {
+ Engines::PyNode_var oldNode((*it).second);
+ if(!CORBA::is_nil(oldNode))
+ oldNode->UnRegister();
+ (*it).second=node;
+ }
+ if(!CORBA::is_nil(node))
+ node->Register();
+ return node._retn();
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = astr.c_str();
+ throw SALOME::SALOME_Exception(es);
+ }
}
//=============================================================================
@@ -1730,13 +1678,13 @@ Engines::PyNode_ptr Engines_Container_i::getDefaultPyNode(const char *nodeName)
if(it==_dftPyNode.end())
return Engines::PyNode::_nil();
else
- {
- Engines::PyNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- return Engines::PyNode::_duplicate(tmpVar);
- else
- return Engines::PyNode::_nil();
- }
+ {
+ Engines::PyNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ return Engines::PyNode::_duplicate(tmpVar);
+ else
+ return Engines::PyNode::_nil();
+ }
}
//=============================================================================
@@ -1748,58 +1696,58 @@ Engines::PyNode_ptr Engines_Container_i::getDefaultPyNode(const char *nodeName)
//=============================================================================
Engines::PyScriptNode_ptr Engines_Container_i::createPyScriptNode(const char* nodeName, const char* code)
{
- Engines::PyScriptNode_var node= Engines::PyScriptNode::_nil();
+ Engines::PyScriptNode_var node= Engines::PyScriptNode::_nil();
- PyGILState_STATE gstate = PyGILState_Ensure();
- PyObject *res = PyObject_CallMethod(_pyCont,
- (char*)"create_pyscriptnode",
- (char*)"ss",
- nodeName,
- code);
- if(res==NULL)
- {
- //internal error
- PyErr_Print();
- PyGILState_Release(gstate);
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- es.text = "can not create a python node";
- throw SALOME::SALOME_Exception(es);
- }
- long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
- PyObject* result=PyTuple_GetItem(res,1);
- std::string astr=PyString_AsString(result);
- Py_DECREF(res);
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *res = PyObject_CallMethod(_pyCont,
+ (char*)"create_pyscriptnode",
+ (char*)"ss",
+ nodeName,
+ code);
+ if(res==NULL)
+ {
+ //internal error
+ PyErr_Print();
PyGILState_Release(gstate);
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "can not create a python node";
+ throw SALOME::SALOME_Exception(es);
+ }
+ long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
+ PyObject* result=PyTuple_GetItem(res,1);
+ std::string astr=PyString_AsString(result);
+ Py_DECREF(res);
+ PyGILState_Release(gstate);
- if(ierr==0)
- {
- Utils_Locker lck(&_mutexForDftPy);
- CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
- node=Engines::PyScriptNode::_narrow(obj);
- std::map::iterator it(_dftPyScriptNode.find(nodeName));
- if(it==_dftPyScriptNode.end())
- {
- _dftPyScriptNode[nodeName]=node;
- }
- else
- {
- Engines::PyScriptNode_var oldNode((*it).second);
- if(!CORBA::is_nil(oldNode))
- oldNode->UnRegister();
- (*it).second=node;
- }
- if(!CORBA::is_nil(node))
- node->Register();
- return node._retn();
- }
+ if(ierr==0)
+ {
+ Utils_Locker lck(&_mutexForDftPy);
+ CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
+ node=Engines::PyScriptNode::_narrow(obj);
+ std::map::iterator it(_dftPyScriptNode.find(nodeName));
+ if(it==_dftPyScriptNode.end())
+ {
+ _dftPyScriptNode[nodeName]=node;
+ }
else
- {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- es.text = astr.c_str();
- throw SALOME::SALOME_Exception(es);
- }
+ {
+ Engines::PyScriptNode_var oldNode((*it).second);
+ if(!CORBA::is_nil(oldNode))
+ oldNode->UnRegister();
+ (*it).second=node;
+ }
+ if(!CORBA::is_nil(node))
+ node->Register();
+ return node._retn();
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = astr.c_str();
+ throw SALOME::SALOME_Exception(es);
+ }
}
//=============================================================================
@@ -1814,13 +1762,13 @@ Engines::PyScriptNode_ptr Engines_Container_i::getDefaultPyScriptNode(const char
if(it==_dftPyScriptNode.end())
return Engines::PyScriptNode::_nil();
else
- {
- Engines::PyScriptNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- return Engines::PyScriptNode::_duplicate(tmpVar);
- else
- return Engines::PyScriptNode::_nil();
- }
+ {
+ Engines::PyScriptNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ return Engines::PyScriptNode::_duplicate(tmpVar);
+ else
+ return Engines::PyScriptNode::_nil();
+ }
}
//=============================================================================
diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx
index 4315da8b3..a69339168 100644
--- a/src/Container/SALOME_Component_i.hxx
+++ b/src/Container/SALOME_Component_i.hxx
@@ -81,7 +81,6 @@ public:
void ping();
void destroy();
- CORBA::Long getStudyId();
Engines::Container_ptr GetContainerRef();
void setProperties(const Engines::FieldsDict& dico);
@@ -118,7 +117,7 @@ public:
// Object information
virtual bool hasObjectInfo() { return false; }
- virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return CORBA::string_dup(""); }
+ virtual char* getObjectInfo(const char* entry) { return CORBA::string_dup(""); }
// Version information
virtual char* getVersion();
@@ -130,7 +129,6 @@ public:
std::string getContainerName();
void setContainerName();
- virtual bool setStudyId(CORBA::Long studyId);
static bool isMultiStudy();
static bool isMultiInstance();
static std::string GetDynLibraryName(const char *componentName);
@@ -150,7 +148,6 @@ public:
Salome_file_i * file);
protected:
- int _studyId; // -1: not initialised; 0: multiStudy; >0: study
static bool _isMultiStudy;
static bool _isMultiInstance;
diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py
index 2d6ee3b75..298e23d17 100644
--- a/src/Container/SALOME_Container.py
+++ b/src/Container/SALOME_Container.py
@@ -102,7 +102,7 @@ class SALOME_Container_i:
#-------------------------------------------------------------------------
- def create_component_instance(self, componentName, instanceName, studyId):
+ def create_component_instance(self, componentName, instanceName):
MESSAGE( "SALOME_Container_i::create_component_instance" )
comp_iors=""
ret=""
diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx
index 197d0def9..1193ec379 100644
--- a/src/Container/SALOME_Container_i.hxx
+++ b/src/Container/SALOME_Container_i.hxx
@@ -69,12 +69,10 @@ public:
virtual bool load_component_Library(const char* componentName, CORBA::String_out reason);
virtual Engines::EngineComponent_ptr
- create_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ create_component_instance( const char* componentName);
virtual Engines::EngineComponent_ptr
create_component_instance_env( const char* componentName,
- CORBA::Long studyId, // 0 for multiStudy
const Engines::FieldsDict& env,
CORBA::String_out reason);
@@ -83,8 +81,7 @@ public:
CORBA::String_out reason);
Engines::EngineComponent_ptr
- find_component_instance( const char* registeredName,
- CORBA::Long studyId); // 0 for multiStudy
+ find_component_instance( const char* registeredName);
Engines::EngineComponent_ptr
load_impl(const char* nameToRegister,
@@ -125,9 +122,9 @@ public:
bool load_component_PythonImplementation(const char* componentName,std::string& reason);
bool load_component_ExecutableImplementation(const char* componentName,std::string& reason);
- Engines::EngineComponent_ptr createPythonInstance(std::string CompName, int studyId, std::string& error);
- Engines::EngineComponent_ptr createExecutableInstance(std::string CompName, int studyId, const Engines::FieldsDict& env, std::string& error);
- Engines::EngineComponent_ptr createInstance(std::string genericRegisterName, void *handle, int studyId, std::string& error);
+ Engines::EngineComponent_ptr createPythonInstance(std::string CompName, std::string& error);
+ Engines::EngineComponent_ptr createExecutableInstance(std::string CompName, const Engines::FieldsDict& env, std::string& error);
+ Engines::EngineComponent_ptr createInstance(std::string genericRegisterName, void *handle, std::string& error);
static bool isPythonContainer(const char* ContainerName);
static void decInstanceCnt(std::string genericRegisterName);
diff --git a/src/KERNEL_PY/salome_ComponentGUI.py b/src/KERNEL_PY/salome_ComponentGUI.py
index 9baeb7d5d..1ec8d1098 100644
--- a/src/KERNEL_PY/salome_ComponentGUI.py
+++ b/src/KERNEL_PY/salome_ComponentGUI.py
@@ -83,7 +83,7 @@ def setNameMode(objId, mode):
#--------------------------------------------------------------------------
-def Init(studyId):
+def Init():
return
#--------------------------------------------------------------------------
diff --git a/src/KernelHelpers/SALOME_KernelServices.cxx b/src/KernelHelpers/SALOME_KernelServices.cxx
index 481c1ac13..4b3a07d70 100644
--- a/src/KernelHelpers/SALOME_KernelServices.cxx
+++ b/src/KernelHelpers/SALOME_KernelServices.cxx
@@ -61,18 +61,17 @@ namespace KERNEL {
/**
- * This returns a static reference to the SALOME study manager. The
- * study manager can be used to retrieve a study or to get
- * informations about a study.
+ * This returns a static reference to the SALOME study. The
+ * study can be used to get informations about it.
*/
- SALOMEDS::StudyManager_ptr getStudyManager() {
- static SALOMEDS::StudyManager_ptr aStudyManager;
- if(CORBA::is_nil(aStudyManager)){
+ SALOMEDS::Study_ptr getStudy() {
+ static SALOMEDS::Study_ptr aStudy;
+ if(CORBA::is_nil(aStudy)){
SALOME_NamingService *aNamingService = getNamingService();
- CORBA::Object_ptr anObject = aNamingService->Resolve("/myStudyManager");
- aStudyManager = SALOMEDS::StudyManager::_narrow(anObject);
+ CORBA::Object_ptr anObject = aNamingService->Resolve("/Study");
+ aStudy = SALOMEDS::Study::_narrow(anObject);
}
- return aStudyManager;
+ return aStudy;
}
/**
@@ -117,27 +116,6 @@ namespace KERNEL {
return resourcesManager;
}
- /**
- * This returns the study with the specified id if it's defined in
- * the SALOME study manager. Returns null otherwise.
- * Please not that it is just a shortcut, and you may prefer use
- * directly the study manager:
- * KERNEL::getStudyManager()->GetStudyByID(aStudyId)
- */
- SALOMEDS::Study_ptr getStudyById(int aStudyId) {
- if ( aStudyId < 0 ) {
- INFOS("ERR: trying to get a study with ID<0");
- return SALOMEDS::Study::_nil();
- }
- return getStudyManager()->GetStudyByID(aStudyId);
- }
-
- int getStudyId(SALOMEDS::Study_ptr study) {
- if( CORBA::is_nil(study) ) return -1;
- return study->StudyId();
- }
-
-
/**
* This function retrieve the CORBA object reference from the study
* object wrapping it.
diff --git a/src/KernelHelpers/SALOME_KernelServices.hxx b/src/KernelHelpers/SALOME_KernelServices.hxx
index 5c0f39edc..9496986b1 100644
--- a/src/KernelHelpers/SALOME_KernelServices.hxx
+++ b/src/KernelHelpers/SALOME_KernelServices.hxx
@@ -41,7 +41,7 @@ namespace KERNEL {
KERNELHELPERS_EXPORT SALOME_NamingService * getNamingService();
KERNELHELPERS_EXPORT SALOME_LifeCycleCORBA * getLifeCycleCORBA();
KERNELHELPERS_EXPORT SALOME::Session_ptr getSalomeSession();
- KERNELHELPERS_EXPORT SALOMEDS::StudyManager_ptr getStudyManager();
+ KERNELHELPERS_EXPORT SALOMEDS::Study_ptr getStudy();
KERNELHELPERS_EXPORT Engines::SalomeLauncher_ptr getSalomeLauncher();
KERNELHELPERS_EXPORT Engines::ResourcesManager_ptr getResourcesManager();
@@ -49,8 +49,6 @@ namespace KERNEL {
// SALOME KERNEL services to deal with a SALOME study, SObject and
// SComponent.
//
- KERNELHELPERS_EXPORT SALOMEDS::Study_ptr getStudyById(int aStudyId);
- KERNELHELPERS_EXPORT int getStudyId(SALOMEDS::Study_ptr study);
KERNELHELPERS_EXPORT CORBA::Object_ptr IORToObject(char * IOR);
KERNELHELPERS_EXPORT CORBA::Object_ptr SObjectToObject(SALOMEDS::SObject_ptr);
diff --git a/src/KernelHelpers/SALOME_StudyEditor.cxx b/src/KernelHelpers/SALOME_StudyEditor.cxx
index 4a0bb4396..fe79af59d 100644
--- a/src/KernelHelpers/SALOME_StudyEditor.cxx
+++ b/src/KernelHelpers/SALOME_StudyEditor.cxx
@@ -30,18 +30,6 @@ void SALOME_StudyEditor::setStudy(SALOMEDS::Study_ptr study) {
_sbuilder = _study->NewBuilder();
}
-void SALOME_StudyEditor::setStudyById(int studyId) {
- this->setStudy(KERNEL::getStudyManager()->GetStudyByID(studyId));
-}
-
-int SALOME_StudyEditor::getStudyId() {
- if ( _study->_is_nil() ) return UNDEFINED;
- return _study->StudyId();
-}
-
-SALOME_StudyEditor::SALOME_StudyEditor(int studyId) {
- this->setStudyById(studyId);
-}
SALOME_StudyEditor::SALOME_StudyEditor(SALOMEDS::Study_ptr study) {
this->setStudy(study);
}
diff --git a/src/KernelHelpers/SALOME_StudyEditor.hxx b/src/KernelHelpers/SALOME_StudyEditor.hxx
index 23329461d..52b98fc5a 100644
--- a/src/KernelHelpers/SALOME_StudyEditor.hxx
+++ b/src/KernelHelpers/SALOME_StudyEditor.hxx
@@ -32,7 +32,6 @@
class KERNELHELPERS_EXPORT SALOME_StudyEditor {
public:
- SALOME_StudyEditor(int studyId);
SALOME_StudyEditor(SALOMEDS::Study_ptr study);
typedef std::vector SObjectList;
@@ -58,8 +57,6 @@ public:
protected:
SALOME_StudyEditor();
void setStudy(SALOMEDS::Study_ptr study);
- void setStudyById(int studyId);
- int getStudyId();
SALOMEDS::Study_var _study;
diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
index 75bf0dd5e..ecc25b84e 100644
--- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
+++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
@@ -132,14 +132,12 @@ SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if not found
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
if (! isKnownComponentClass(componentName))
return Engines::EngineComponent::_nil();
@@ -160,7 +158,6 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_var compo = _FindComponent(new_params,
componentName,
- studyId,
listOfResources);
return compo._retn();
@@ -171,15 +168,13 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
// --- Check if Component Name is known in ModuleCatalog
@@ -203,8 +198,7 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
new_params.resource_params.resList = listOfResources;
Engines::EngineComponent_var compo = _LoadComponent(new_params,
- componentName,
- studyId);
+ componentName);
return compo._retn();
}
@@ -215,7 +209,6 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
@@ -223,8 +216,7 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
FindOrLoad_Component(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
// --- Check if Component Name is known in ModuleCatalog
@@ -247,16 +239,14 @@ FindOrLoad_Component(const Engines::ContainerParameters& params,
}
Engines::EngineComponent_var compo = _FindComponent(new_params,
- componentName,
- studyId,
- listOfResources);
+ componentName,
+ listOfResources);
if(CORBA::is_nil(compo))
{
new_params.resource_params.resList = listOfResources;
compo = _LoadComponent(new_params,
- componentName,
- studyId);
+ componentName);
}
return compo._retn();
@@ -475,10 +465,10 @@ void SALOME_LifeCycleCORBA::shutdownServers()
// 2) SALOMEDS
try
{
- CORBA::Object_var objSDS = _NS->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
- if ( !CORBA::is_nil(studyManager) && ( pid != studyManager->getPID() ) )
- studyManager->Shutdown();
+ CORBA::Object_var objSDS = _NS->Resolve("/Study");
+ SALOMEDS::Study_var study = SALOMEDS::Study::_narrow(objSDS) ;
+ if ( !CORBA::is_nil(study) && ( pid != study->getPID() ) )
+ study->Shutdown();
}
catch(const CORBA::Exception& e)
{
@@ -639,7 +629,6 @@ void SALOME_LifeCycleCORBA::killOmniNames()
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \param listOfMachines list of machine address
* \return a CORBA reference of the component instance, or _nil if not found
*/
@@ -649,7 +638,6 @@ Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
_FindComponent(const Engines::ContainerParameters& params,
const char *componentName,
- int studyId,
const Engines::ResourceList& listOfResources)
{
// --- build the list of machines on which the component is already running
@@ -700,7 +688,6 @@ _FindComponent(const Engines::ContainerParameters& params,
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
@@ -708,8 +695,7 @@ _FindComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
_LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
MESSAGE("_LoadComponent, required " << params.container_name <<
" " << componentName << " " << NbProc(params));
@@ -730,7 +716,7 @@ _LoadComponent(const Engines::ContainerParameters& params,
CORBA::string_free(reason);
Engines::EngineComponent_var myInstance =
- cont->create_component_instance(componentName, studyId);
+ cont->create_component_instance(componentName);
return myInstance._retn();
}
@@ -739,14 +725,12 @@ _LoadComponent(const Engines::ContainerParameters& params,
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the parallel component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
MESSAGE("Entering LoadParallelComponent");
@@ -782,7 +766,7 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters
// @PARALLEL@ permits to identify that the component requested
// is a parallel component.
std::string name = std::string(componentName);
- Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str(), studyId);
+ Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str());
if (CORBA::is_nil(myInstance))
INFOS("create_component_instance returns a NULL component !");
return myInstance._retn();
diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
index 8713d5705..4da31b0d9 100644
--- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
+++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
@@ -66,18 +66,15 @@ public:
Engines::EngineComponent_ptr
FindComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId=0);
+ const char *componentName);
Engines::EngineComponent_ptr
LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId=0);
+ const char *componentName);
Engines::EngineComponent_ptr
FindOrLoad_Component(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId =0);
+ const char *componentName);
Engines::EngineComponent_ptr
FindOrLoad_Component(const char *containerName,
@@ -86,8 +83,7 @@ public:
// Parallel extension
Engines::EngineComponent_ptr
Load_ParallelComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId);
+ const char *componentName);
bool isKnownComponentClass(const char *componentName);
@@ -115,13 +111,11 @@ protected:
Engines::EngineComponent_ptr
_FindComponent(const Engines::ContainerParameters& params,
const char *componentName,
- int studyId,
const Engines::ResourceList& listOfResources);
Engines::EngineComponent_ptr
_LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId);
+ const char *componentName);
SALOME_NamingService *_NS;
SALOME_NamingService *_NSnew;
diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx
index 2c9d5efc3..19f6f8fe0 100644
--- a/src/MPIContainer/MPIContainer_i.cxx
+++ b/src/MPIContainer/MPIContainer_i.cxx
@@ -215,7 +215,6 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName)
// Create an instance of component
Engines::EngineComponent_ptr
Engines_MPIContainer_i::create_component_instance_env( const char* componentName,
- CORBA::Long studyId,
const Engines::FieldsDict& env,
CORBA::String_out reason)
{
@@ -229,12 +228,11 @@ Engines_MPIContainer_i::create_component_instance_env( const char* componentName
st->ip = ip;
st->tior = _tior;
st->compoName = componentName;
- st->studyId = studyId;
pthread_create(&(th[ip]),NULL,th_createcomponentinstance,(void*)st);
}
}
- Engines::EngineComponent_ptr cptr = Lcreate_component_instance(componentName,studyId);
+ Engines::EngineComponent_ptr cptr = Lcreate_component_instance(componentName);
if(_numproc == 0){
for(int ip=1;ip<_nbproc;ip++)
@@ -246,13 +244,8 @@ Engines_MPIContainer_i::create_component_instance_env( const char* componentName
}
Engines::EngineComponent_ptr
-Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterName, CORBA::Long studyId)
+Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterName )
{
- if (studyId < 0) {
- INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
- return Engines::EngineComponent::_nil() ;
- }
-
Engines::EngineComponent_var iobject = Engines::EngineComponent::_nil() ;
Engines::MPIObject_var pobj;
@@ -281,8 +274,7 @@ Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterN
(char*)"create_component_instance",
(char*)"ssl",
aCompName.c_str(),
- instanceName.c_str(),
- studyId);
+ instanceName.c_str());
const char *ior;
const char *error;
PyArg_ParseTuple(result,"ss", &ior, &error);
@@ -308,8 +300,7 @@ Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterN
{
void* handle = _library_map[impl_name];
iobject = createMPIInstance(genericRegisterName,
- handle,
- studyId);
+ handle);
return iobject._retn();
}
@@ -318,8 +309,7 @@ Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterN
Engines::EngineComponent_ptr
Engines_MPIContainer_i::createMPIInstance(std::string genericRegisterName,
- void *handle,
- int studyId)
+ void *handle)
{
Engines::EngineComponent_var iobject;
Engines::MPIObject_var pobj;
@@ -369,27 +359,14 @@ Engines_MPIContainer_i::createMPIInstance(std::string genericRegisterName,
PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
id = (MPIComponent_factory) ( _orb, _poa, _id, instanceName.c_str(), aGenRegisterName.c_str() ) ;
- // --- get reference & servant from id
+ // --- get reference from id
CORBA::Object_var obj = _poa->id_to_reference(*id);
iobject = Engines::EngineComponent::_narrow( obj ) ;
pobj = Engines::MPIObject::_narrow(obj) ;
- Engines_Component_i *servant =
- dynamic_cast(_poa->reference_to_servant(iobject));
- ASSERT(servant);
- //SCRUTE(servant->pd_refCount);
- servant->_remove_ref(); // compensate previous id_to_reference
- //SCRUTE(servant->pd_refCount);
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
- //SCRUTE(servant->pd_refCount);
-#ifndef _DEBUG_
- servant->setStudyId(studyId);
-#else
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
-#endif
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
@@ -608,7 +585,7 @@ void *th_loadcomponentlibrary(void *s)
void *th_createcomponentinstance(void *s)
{
thread_st *st = (thread_st*)s;
- (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId);
+ (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str());
return NULL;
}
diff --git a/src/MPIContainer/MPIContainer_i.hxx b/src/MPIContainer/MPIContainer_i.hxx
index c53cdefd5..3a8ed1deb 100644
--- a/src/MPIContainer/MPIContainer_i.hxx
+++ b/src/MPIContainer/MPIContainer_i.hxx
@@ -41,7 +41,6 @@ typedef struct {
Engines::IORTab* tior;
std::string compoName;
std::string nameToRegister;
- long studyId;
Engines::EngineComponent_ptr cptr;
} thread_st;
@@ -71,7 +70,6 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
// synchronous version for process 0
virtual Engines::EngineComponent_ptr
create_component_instance_env( const char* componentName,
- CORBA::Long studyId, // 0 for multiStudy
const Engines::FieldsDict& env,
CORBA::String_out reason);
@@ -90,15 +88,13 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
private:
bool Lload_component_Library(const char* componentName);
Engines::EngineComponent_ptr
- Lcreate_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ Lcreate_component_instance(const char* componentName);
Engines::EngineComponent_ptr Lload_impl(const char* nameToRegister,
const char* componentName);
Engines::EngineComponent_ptr
createMPIInstance(std::string genericRegisterName,
- void *handle,
- int studyId);
+ void *handle);
};
#endif
diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx
index fd75687f9..112132bab 100644
--- a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx
+++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx
@@ -22,7 +22,7 @@
// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
// File : SALOME_ParallelComponent_i.cxx
-// Author : André RIBES, EDF
+// Author : Andr� RIBES, EDF
// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
//
#include "SALOME_ParallelComponent_i.hxx"
@@ -53,7 +53,7 @@ int SIGUSR11 = 1000;
extern bool _Sleeping ;
static Engines_Parallel_Component_i * theEngines_Component ;
-bool Engines_Parallel_Component_i::_isMultiStudy = true;
+bool Engines_Parallel_Component_i::_isMultiStudy = false;
bool Engines_Parallel_Component_i::_isMultiInstance = false;
//=============================================================================
@@ -90,7 +90,6 @@ Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, c
_Executed(false) ,
_graphName("") ,
_nodeName(""),
- _studyId(-1),
_destroyed(false),
_CanceledThread(false)
{
@@ -160,20 +159,6 @@ char* Engines_Parallel_Component_i::interfaceName()
return CORBA::string_dup(_interfaceName.c_str()) ;
}
-//=============================================================================
-/*!
- * CORBA method: Get study Id
- * \return -1: not initialised (Internal Error)
- * 0: multistudy component instance
- * >0: study id associated to this instance
- */
-//=============================================================================
-
-CORBA::Long Engines_Parallel_Component_i::getStudyId()
-{
- return _studyId;
-}
-
//=============================================================================
/*!
* CORBA method: Test if instance is alive and responds
@@ -517,31 +502,6 @@ Engines_Parallel_Container_i *Engines_Parallel_Component_i::GetContainerPtr()
return dynamic_cast(_poa->id_to_servant(*_contId)) ;
}
-//=============================================================================
-/*!
- * C++ method: set study Id
- * \param studyId 0 if instance is not associated to a study,
- * >0 otherwise (== study id)
- * \return true if the set of study Id is OK
- * must be set once by Container, at instance creation,
- * and cannot be changed after.
- */
-//=============================================================================
-
-CORBA::Boolean Engines_Parallel_Component_i::setStudyId(CORBA::Long studyId)
-{
- ASSERT( studyId >= 0);
- CORBA::Boolean ret = false;
- if (_studyId < 0) // --- not yet initialized
- {
- _studyId = studyId;
- ret = true;
- }
- else
- if ( _studyId == studyId) ret = true;
- return ret;
-}
-
//=============================================================================
/*!
* C++ method: return CORBA instance id, the id is set in derived class
diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx
index a5d41f270..d7bcbf38d 100644
--- a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx
+++ b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx
@@ -22,7 +22,7 @@
// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
// File : SALOME_ParallelComponent_i.hxx
-// Author : André RIBES, EDF
+// Author : Andr� RIBES, EDF
// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
//
#ifndef _SALOME_PARALLEL_COMPONENT_I_HXX_
@@ -80,7 +80,6 @@ public:
void ping();
void destroy();
- CORBA::Long getStudyId();
Engines::Container_ptr GetContainerRef();
void setProperties(const Engines::FieldsDict& dico);
@@ -116,14 +115,13 @@ public:
// Object information
virtual bool hasObjectInfo() { return false; }
- virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return ""; }
+ virtual char* getObjectInfo(const char* entry) { return ""; }
// --- local C++ methods
PortableServer::ObjectId * getId();
Engines_Parallel_Container_i *GetContainerPtr();
- bool setStudyId(CORBA::Long studyId);
static bool isMultiStudy();
static bool isMultiInstance();
static std::string GetDynLibraryName(const char *componentName);
@@ -146,7 +144,6 @@ public:
Engines::Parallel_Salome_file_proxy_impl * file);
protected:
- int _studyId; // -1: not initialised; 0: multiStudy; >0: study
static bool _isMultiStudy;
static bool _isMultiInstance;
diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx
index 53a9ff747..19e5ab33d 100644
--- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx
+++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx
@@ -271,11 +271,11 @@ Container_proxy_impl_final::load_component_Library(const char* componentName, CO
}
Engines::EngineComponent_ptr
-Container_proxy_impl_final::create_component_instance(const char* componentName, ::CORBA::Long studyId)
+Container_proxy_impl_final::create_component_instance(const char* componentName)
{
Engines::FieldsDict_var env = new Engines::FieldsDict;
char* reason;
- Engines::EngineComponent_ptr compo = create_component_instance_env(componentName, studyId, env, reason);
+ Engines::EngineComponent_ptr compo = create_component_instance_env(componentName, env, reason);
CORBA::string_free(reason);
return compo;
}
@@ -285,7 +285,7 @@ Container_proxy_impl_final::create_component_instance(const char* componentName,
// Composant parallèle -> création du proxy ici puis appel de la création de chaque objet participant
// au composant parallèle
Engines::EngineComponent_ptr
-Container_proxy_impl_final::create_component_instance_env(const char* componentName, ::CORBA::Long studyId,
+Container_proxy_impl_final::create_component_instance_env(const char* componentName,
const Engines::FieldsDict& env, CORBA::String_out reason)
{
reason=CORBA::string_dup("");
@@ -305,7 +305,7 @@ Container_proxy_impl_final::create_component_instance_env(const char* componentN
_numInstance++;
_numInstanceMutex.unlock();
Engines::PACO_Container_proxy_impl::updateInstanceNumber();
- return Engines::Container_proxy_impl::create_component_instance(componentName, studyId);
+ return Engines::Container_proxy_impl::create_component_instance(componentName);
}
// Parallel Component !
@@ -353,7 +353,7 @@ Container_proxy_impl_final::create_component_instance_env(const char* componentN
instanceName.c_str(),
_parallel_object_topology.total);
- // --- get reference & servant from id
+ // --- get reference from id
CORBA::Object_var obj = _poa->id_to_reference(*(proxy->proxy_id));
component_proxy = Engines::EngineComponent::_narrow(obj);
proxy->proxy_corba_ref = component_proxy;
@@ -392,7 +392,7 @@ Container_proxy_impl_final::create_component_instance_env(const char* componentN
{
try
{
- node->create_paco_component_node_instance(componentName, _containerName.c_str(), studyId);
+ node->create_paco_component_node_instance(componentName, _containerName.c_str());
MESSAGE("Call create_paco_component_node_instance done on node : " << i);
}
catch (SALOME::SALOME_Exception & ex)
diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx
index 3949f0f82..d825dec45 100644
--- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx
+++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx
@@ -54,10 +54,8 @@ class Container_proxy_impl_final :
virtual void Shutdown();
virtual ::CORBA::Boolean load_component_Library(const char* componentName,CORBA::String_out reason);
- virtual Engines::EngineComponent_ptr create_component_instance (const char* componentName,
- ::CORBA::Long studyId);
+ virtual Engines::EngineComponent_ptr create_component_instance (const char* componentName);
virtual Engines::EngineComponent_ptr create_component_instance_env (const char* componentName,
- CORBA::Long studyId, // 0 for multiStudy
const Engines::FieldsDict& env,
CORBA::String_out reason);
diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx
index 6e75e1a2c..e4852f4f4 100644
--- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx
+++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx
@@ -376,18 +376,15 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName,
* The servant registers itself to naming service and Registry.
* \param genericRegisterName Name of the component instance to register
* in Registry & Name Service (without _inst_n suffix)
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
* \return a loaded component
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Parallel_Container_i::create_component_instance(const char*genericRegisterName,
- CORBA::Long studyId)
+Engines_Parallel_Container_i::create_component_instance(const char*genericRegisterName)
{
Engines::FieldsDict_var env = new Engines::FieldsDict;
char* reason;
- Engines::EngineComponent_ptr compo = create_component_instance_env(genericRegisterName,studyId,env, reason);
+ Engines::EngineComponent_ptr compo = create_component_instance_env(genericRegisterName,env, reason);
CORBA::string_free(reason);
return compo;
}
@@ -399,8 +396,6 @@ Engines_Parallel_Container_i::create_component_instance(const char*genericRegist
* The servant registers itself to naming service and Registry.
* \param genericRegisterName Name of the component instance to register
* in Registry & Name Service (without _inst_n suffix)
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
* \param env dict of environment variables
* \return a loaded component
*/
@@ -408,19 +403,12 @@ Engines_Parallel_Container_i::create_component_instance(const char*genericRegist
Engines::EngineComponent_ptr
Engines_Parallel_Container_i::create_component_instance_env(const char*genericRegisterName,
- CORBA::Long studyId,
const Engines::FieldsDict& env,
CORBA::String_out reason)
{
MESSAGE("Begin of create_component_instance in node : " << getMyRank());
reason=CORBA::string_dup("");
- if (studyId < 0)
- {
- INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
- return Engines::EngineComponent::_nil() ;
- }
-
std::string aCompName = genericRegisterName;
#ifndef WIN32
std::string impl_name = string ("lib") + aCompName +string("Engine.so");
@@ -448,9 +436,9 @@ Engines_Parallel_Container_i::create_component_instance_env(const char*genericRe
Engines::EngineComponent_var iobject = Engines::EngineComponent::_nil();
if (type_of_lib == "cpp")
- iobject = createCPPInstance(aCompName, handle, studyId);
+ iobject = createCPPInstance(aCompName, handle);
else
- iobject = createPythonInstance(aCompName, studyId);
+ iobject = createPythonInstance(aCompName);
_numInstanceMutex.unlock();
return iobject._retn();
@@ -462,14 +450,11 @@ Engines_Parallel_Container_i::create_component_instance_env(const char*genericRe
* CORBA method: Finds a servant instance of a component
* \param registeredName Name of the component in Registry or Name Service,
* without instance suffix number
- * \param studyId 0 if instance is not associated to a study,
- * >0 otherwise (== study id)
- * \return the first instance found with same studyId
+ * \return the first found instance
*/
//=============================================================================
-Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_component_instance( const char* registeredName,
- CORBA::Long studyId)
+Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_component_instance(const char* registeredName)
{
Engines::EngineComponent_var anEngine = Engines::EngineComponent::_nil();
std::map::iterator itm =_listInstances_map.begin();
@@ -480,10 +465,7 @@ Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_component_instan
if (instance.find(registeredName) == 0)
{
anEngine = (*itm).second;
- if (studyId == anEngine->getStudyId())
- {
- return anEngine._retn();
- }
+ return anEngine._retn();
}
itm++;
}
@@ -729,22 +711,11 @@ Engines_Parallel_Container_i::find_or_create_instance(std::string genericRegiste
CORBA::Object_var obj = _NS->ResolveFirst(component_registerBase.c_str());
if (CORBA::is_nil( obj ))
{
- iobject = create_component_instance(genericRegisterName.c_str(),
- 0); // force multiStudy instance here !
+ iobject = create_component_instance(genericRegisterName.c_str());
}
else
{
iobject = Engines::EngineComponent::_narrow(obj) ;
- Engines_Component_i *servant = dynamic_cast(_poa->reference_to_servant(iobject));
- ASSERT(servant)
- int studyId = servant->getStudyId();
- ASSERT (studyId >= 0);
- if (studyId != 0) // monoStudy instance: NOK
- {
- iobject = Engines::EngineComponent::_nil();
- INFOS("load_impl & find_component_instance methods "
- << "NOT SUITABLE for mono study components");
- }
}
}
catch (...)
@@ -762,8 +733,6 @@ Engines_Parallel_Container_i::find_or_create_instance(std::string genericRegiste
* in Registry & Name Service,
* (without _inst_n suffix, like "COMPONENT")
* \param handle loaded library handle
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
* \return a loaded component
*
* example with names:
@@ -776,7 +745,7 @@ Engines_Parallel_Container_i::find_or_create_instance(std::string genericRegiste
*/
//=============================================================================
Engines::EngineComponent_ptr
-Engines_Parallel_Container_i::createPythonInstance(std::string genericRegisterName, int studyId)
+Engines_Parallel_Container_i::createPythonInstance(std::string genericRegisterName)
{
Engines::EngineComponent_var iobject = Engines::EngineComponent::_nil();
@@ -795,8 +764,7 @@ Engines_Parallel_Container_i::createPythonInstance(std::string genericRegisterNa
(char*)"create_component_instance",
(char*)"ssl",
genericRegisterName.c_str(),
- instanceName.c_str(),
- studyId);
+ instanceName.c_str());
const char *ior;
const char *error;
PyArg_ParseTuple(result,"ss", &ior, &error);
@@ -824,8 +792,6 @@ Engines_Parallel_Container_i::createPythonInstance(std::string genericRegisterNa
* in Registry & Name Service,
* (without _inst_n suffix, like "COMPONENT")
* \param handle loaded library handle
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
* \return a loaded component
*
* example with names:
@@ -839,8 +805,7 @@ Engines_Parallel_Container_i::createPythonInstance(std::string genericRegisterNa
//=============================================================================
Engines::EngineComponent_ptr
Engines_Parallel_Container_i::createCPPInstance(std::string genericRegisterName,
- void *handle,
- int studyId)
+ void *handle)
{
MESSAGE("Entering Engines_Parallel_Container_i::createCPPInstance");
@@ -894,22 +859,12 @@ Engines_Parallel_Container_i::createCPPInstance(std::string genericRegisterName,
return iobject._retn();
}
- // --- get reference & servant from id
+ // --- get reference from id
CORBA::Object_var obj = _poa->id_to_reference(*id);
iobject = Engines::EngineComponent::_narrow(obj);
- Engines_Component_i *servant =
- dynamic_cast(_poa->reference_to_servant(iobject));
- ASSERT(servant);
- servant->_remove_ref(); // compensate previous id_to_reference
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
-#if defined(_DEBUG_) || defined(_DEBUG)
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
-#else
- servant->setStudyId(studyId);
-#endif
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
@@ -925,8 +880,7 @@ Engines_Parallel_Container_i::createCPPInstance(std::string genericRegisterName,
void
Engines_Parallel_Container_i::create_paco_component_node_instance(const char* componentName,
- const char* proxy_containerName,
- CORBA::Long studyId)
+ const char* proxy_containerName)
{
// Init de la méthode
char * proxy_ior;
@@ -991,7 +945,7 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co
id = (Component_factory) (_orb, proxy_ior, getMyRank(), _poa, _id, instanceName.c_str(), componentName);
CORBA::string_free(proxy_ior);
- // --- get reference & servant from id
+ // --- get reference from id
CORBA::Object_var obj = _poa->id_to_reference(*id);
work_node = Engines::EngineComponent_PaCO::_narrow(obj) ;
if (CORBA::is_nil(work_node))
diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx
index b99f8f782..52d232dce 100644
--- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx
+++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx
@@ -20,7 +20,7 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SALOME_ParallelContainer_i.hxx
-// Author : André RIBES, EDF
+// Author : Andr� RIBES, EDF
#ifndef _SALOME_PARALLEL_CONTAINER_I_HXX_
#define _SALOME_PARALLEL_CONTAINER_I_HXX_
@@ -73,12 +73,10 @@ public:
virtual bool load_component_Library(const char* componentName, CORBA::String_out reason);
virtual Engines::EngineComponent_ptr
- create_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ create_component_instance( const char* componentName);
virtual Engines::EngineComponent_ptr
create_component_instance_env( const char* componentName,
- CORBA::Long studyId, // 0 for multiStudy
const Engines::FieldsDict& env,
CORBA::String_out reason);
@@ -87,8 +85,7 @@ public:
CORBA::String_out reason);
Engines::EngineComponent_ptr
- find_component_instance( const char* registeredName,
- CORBA::Long studyId); // 0 for multiStudy
+ find_component_instance( const char* registeredName);
Engines::EngineComponent_ptr
load_impl(const char* nameToRegister,
@@ -96,8 +93,7 @@ public:
void
create_paco_component_node_instance(const char* componentName,
- const char* proxy_containerName,
- CORBA::Long studyId); // 0 for multiStudy
+ const char* proxy_containerName);
void updateInstanceNumber();
@@ -123,12 +119,10 @@ public:
Engines::EngineComponent_ptr
createCPPInstance(std::string genericRegisterName,
- void *handle,
- int studyId);
+ void *handle);
Engines::EngineComponent_ptr
- createPythonInstance(std::string genericRegisterName,
- int studyId);
+ createPythonInstance(std::string genericRegisterName);
static bool isPythonContainer(const char* ContainerName);
static void decInstanceCnt(std::string genericRegisterName);
@@ -167,8 +161,8 @@ protected:
_fileRef_map_t _fileRef_map;
_Salome_file_map_t _Salome_file_map;
- // Cette map contient les references vers les différentes
- // instances d'objets parallèles.
+ // Cette map contient les references vers les diff�rentes
+ // instances d'objets parall�les.
std::map _par_obj_inst_map;
typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) (CORBA::ORB_ptr, char *, int,
diff --git a/src/SALOMEDS/CMakeLists.txt b/src/SALOMEDS/CMakeLists.txt
index 894e6f744..68c5a4b8b 100755
--- a/src/SALOMEDS/CMakeLists.txt
+++ b/src/SALOMEDS/CMakeLists.txt
@@ -63,7 +63,6 @@ SET(COMMON_LIBS
SET(SalomeDS_SOURCES
SALOMEDS.cxx
SALOMEDS_Driver_i.cxx
- SALOMEDS_StudyManager_i.cxx
SALOMEDS_UseCaseBuilder_i.cxx
SALOMEDS_UseCaseIterator_i.cxx
SALOMEDS_ChildIterator_i.cxx
@@ -112,7 +111,6 @@ SET(SalomeDS_SOURCES
SALOMEDS_UseCaseBuilder.cxx
SALOMEDS_StudyBuilder.cxx
SALOMEDS_Study.cxx
- SALOMEDS_StudyManager.cxx
SALOMEDS_AttributeStudyProperties.cxx
SALOMEDS_AttributeComment.cxx
SALOMEDS_AttributeDrawable.cxx
@@ -166,9 +164,7 @@ INSTALL(TARGETS SALOMEDS_Server SALOMEDS_Client
SALOME_INSTALL_SCRIPTS(SALOME_DriverPy.py ${SALOME_INSTALL_SCRIPT_PYTHON})
SET(COMMON_HEADERS_HXX
- SALOMEDS_StudyManager_i.hxx
SALOMEDS_Driver_i.hxx
- SALOMEDS_StudyManager.hxx
SALOMEDS_Study_i.hxx
SALOMEDS_Study.hxx
SALOMEDS_SObject_i.hxx
diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx
index 81a3ce56e..42ba79c59 100644
--- a/src/SALOMEDS/SALOMEDS.cxx
+++ b/src/SALOMEDS/SALOMEDS.cxx
@@ -27,7 +27,6 @@
// $Header$
//
#include "SALOMEDS.hxx"
-#include "SALOMEDS_StudyManager.hxx"
#include "SALOMEDS_Study.hxx"
#include "SALOMEDS_StudyBuilder.hxx"
#include "SALOMEDS_SObject.hxx"
@@ -35,7 +34,6 @@
#include "SALOMEDSClient.hxx"
#include "SALOMEDSClient_IParameters.hxx"
#include "SALOMEDS_IParameters.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS_Defines.hxx"
@@ -62,12 +60,10 @@ void SALOMEDS::lock()
void SALOMEDS::unlock()
{
- SALOMEDS::Locker::MutexDS.unlock();
+ SALOMEDS::Locker::MutexDS.unlock();
}
-
-
-// srn: Added new library methods that create basic SALOMEDS objects (StudyManager, Study, SComponent, SObject)
+// srn: Added new library methods that create basic SALOMEDS objects (Study, SComponent, SObject)
//=============================================================================
/*!
@@ -78,86 +74,64 @@ void SALOMEDS::unlock()
extern "C"
{
-SALOMEDS_EXPORT
- SALOMEDSClient_StudyManager* StudyManagerFactory()
-{
- return new SALOMEDS_StudyManager();
-}
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy)
-{
- if(CORBA::is_nil(theStudy)) return NULL;
- return new SALOMEDS_Study(theStudy);
-}
+ {
+ if(CORBA::is_nil(theStudy)) return NULL;
+ return new SALOMEDS_Study(theStudy);
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject)
-{
- if(CORBA::is_nil(theSObject)) return NULL;
- return new SALOMEDS_SObject(theSObject);
-}
+ {
+ if(CORBA::is_nil(theSObject)) return NULL;
+ return new SALOMEDS_SObject(theSObject);
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent)
-{
- if(CORBA::is_nil(theSComponent)) return NULL;
- return new SALOMEDS_SComponent(theSComponent);
-}
+ {
+ if(CORBA::is_nil(theSComponent)) return NULL;
+ return new SALOMEDS_SComponent(theSComponent);
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder)
-{
- if(CORBA::is_nil(theBuilder)) return NULL;
- return new SALOMEDS_StudyBuilder(theBuilder);
-}
-
-SALOMEDS_EXPORT
- SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa)
-{
- SALOME_NamingService namingService(orb);
- CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" );
- SALOMEDS::StudyManager_var theManager = SALOMEDS::StudyManager::_narrow( obj );
- if( CORBA::is_nil(theManager) ) {
- SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa);
- // Activate the objects. This tells the POA that the objects are ready to accept requests.
- PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i);
- //give ownership to the poa : the object will be deleted by the poa
- aStudyManager_i->_remove_ref();
- aStudyManager_i->register_name((char*)"/myStudyManager");
+ {
+ if(CORBA::is_nil(theBuilder)) return NULL;
+ return new SALOMEDS_StudyBuilder(theBuilder);
}
- return new SALOMEDS_StudyManager();
-}
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap)
-{
- return new SALOMEDS_IParameters(ap);
-}
+ {
+ return new SALOMEDS_IParameters(ap);
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject)
-{
-
- SALOMEDS_SObject* so = _CAST(SObject, theSObject);
- if(!theSObject || !so) return SALOMEDS::SObject::_nil();
- return so->GetSObject();
-}
+ {
+ SALOMEDS_SObject* so = _CAST(SObject, theSObject);
+ if ( !theSObject || !so )
+ return SALOMEDS::SObject::_nil();
+ return so->GetSObject();
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy)
-{
- SALOMEDS_Study* study = _CAST(Study, theStudy);
- if(!theStudy || !study) return SALOMEDS::Study::_nil();
- return study->GetStudy();
-}
+ {
+ SALOMEDS_Study* study = _CAST(Study, theStudy);
+ if ( !theStudy || !study )
+ return SALOMEDS::Study::_nil();
+ return study->GetStudy();
+ }
-SALOMEDS_EXPORT
+ SALOMEDS_EXPORT
SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder)
-{
- SALOMEDS_StudyBuilder* builder = _CAST(StudyBuilder, theBuilder);
- if(!theBuilder || !builder) return SALOMEDS::StudyBuilder::_nil();
- return builder->GetBuilder();
-}
-
-
+ {
+ SALOMEDS_StudyBuilder* builder = _CAST(StudyBuilder, theBuilder);
+ if ( !theBuilder || !builder )
+ return SALOMEDS::StudyBuilder::_nil();
+ return builder->GetBuilder();
+ }
}
diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx
index 8c704beef..488b07f74 100644
--- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx
+++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx
@@ -28,6 +28,7 @@
#include "SALOMEDS_Study_i.hxx"
#include "SALOMEDS.hxx"
#include
+#include
#include
#include CORBA_CLIENT_HEADER(SALOME_Session)
@@ -316,14 +317,14 @@ std::string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream,
return entry;
}
-SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy,
- bool isPublished,
+SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(bool isPublished,
bool isMultiFile,
bool& isValidScript,
long& theStreamLength)
{
- SALOMEDS_Study_i * st_servant = SALOMEDS_Study_i::GetStudyServant(theStudy, _orb);//new SALOMEDS_Study_i (theStudy, _orb);
- SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this());
+ SALOME_NamingService* namingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = namingService->Resolve("/Study");
+ SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(obj);
SALOMEDS::unlock();
diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx
index c07c30eb4..1b1809b30 100644
--- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx
+++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx
@@ -98,8 +98,7 @@ public:
int theObjectID,
const SALOMEDSImpl_SObject& theObject);
- virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
- bool isPublished,
+ virtual SALOMEDSImpl_TMPFile* DumpPython(bool isPublished,
bool isMultiFile,
bool& isValidScript,
long& theStreamLength);
diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx
index 210e0fa68..0378e3003 100644
--- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx
+++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx
@@ -28,7 +28,6 @@
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDS_SComponent_i.hxx"
#include "SALOMEDS_GenericAttribute_i.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
@@ -71,7 +70,6 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::
}
}
_orb = CORBA::ORB::_duplicate(orb);
- //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy());
}
diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx
index 17a6583b0..2903a8217 100644
--- a/src/SALOMEDS/SALOMEDS_Server.cxx
+++ b/src/SALOMEDS/SALOMEDS_Server.cxx
@@ -30,7 +30,7 @@
#include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
#include
#include CORBA_SERVER_HEADER(SALOMEDS)
@@ -58,7 +58,8 @@ int main(int argc, char** argv)
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
#else
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
-#endif
+#endif
+ SALOME_NamingService NS;
// Obtain a reference to the root POA.
long TIMESleep = 500000000;
int NumberOfTries = 40;
@@ -108,7 +109,7 @@ int main(int argc, char** argv)
if(EnvL==1)
{
CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
- SALOME_NamingService &NS = *SINGLETON_::Instance() ;
+ NS = *SINGLETON_::Instance() ;
NS.init_orb( orb1 ) ;
for(int j=1; j<=NumberOfTries; j++)
{
@@ -154,13 +155,18 @@ int main(int argc, char** argv)
// We allocate the objects on the heap. Since these are reference
// counted objects, they will be deleted by the POA when they are no
// longer needed.
- SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb,poa);
+ SALOMEDS_Study_i * myStudy_i = new SALOMEDS_Study_i(orb);
// Activate the objects. This tells the POA that the objects are
// ready to accept requests.
- PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i);
- myStudyManager_i->register_name("/myStudyManager");
- myStudyManager_i->_remove_ref();
+ PortableServer::ObjectId_var myStudy_iid = poa->activate_object(myStudy_i);
+ SALOMEDS::Study_var Study = myStudy_i->_this();
+ NS.Register(Study.in(), "/Study");
+ myStudy_i->_remove_ref();
+
+ // Assign the value of the IOR in the study->root
+ CORBA::String_var IORStudy = orb->object_to_string(Study);
+ myStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx
index 63d44b5ac..40894df09 100644
--- a/src/SALOMEDS/SALOMEDS_Study.cxx
+++ b/src/SALOMEDS/SALOMEDS_Study.cxx
@@ -48,6 +48,8 @@
#include "SALOMEDSImpl_GenericVariable.hxx"
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include
+
#include "SALOMEDS_Driver_i.hxx"
#include "SALOMEDS_Study_i.hxx"
@@ -68,7 +70,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy)
_isLocal = true;
_local_impl = theStudy;
_corba_impl = SALOMEDS::Study::_nil();
- init_orb();
+ Init();
}
SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
@@ -89,13 +91,164 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
_corba_impl = SALOMEDS::Study::_duplicate(theStudy);
}
- init_orb();
+ Init();
}
SALOMEDS_Study::~SALOMEDS_Study()
{
}
+void SALOMEDS_Study::Init()
+{
+ ORB_INIT &init = *SINGLETON_::Instance() ;
+ ASSERT(SINGLETON_::IsAlreadyExisting());
+ _orb = init(0 , 0 ) ;
+}
+
+void SALOMEDS_Study::Clear()
+{
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ _local_impl->Clear();
+ }
+ else
+ _corba_impl->Clear();
+}
+
+bool SALOMEDS_Study::Open(const std::string& theStudyUrl)
+{
+ if(CORBA::is_nil(_corba_impl))
+ return false;
+
+ if (!_corba_impl->Open(theStudyUrl.c_str()))
+ return false;
+
+ return true;
+}
+
+bool SALOMEDS_Study::Save(bool theMultiFile)
+{
+ //SRN: Pure CORBA save as the save operation require CORBA in any case
+ return _corba_impl->Save(theMultiFile);
+}
+
+bool SALOMEDS_Study::SaveASCII(bool theMultiFile)
+{
+ //SRN: Pure CORBA save as the save operation require CORBA in any case
+ return _corba_impl->SaveASCII(theMultiFile);
+}
+
+bool SALOMEDS_Study::SaveAs(const std::string& theUrl, bool theMultiFile)
+{
+ //SRN: Pure CORBA save as the save operation require CORBA in any case
+ return _corba_impl->SaveAs((char*)theUrl.c_str(), theMultiFile);
+}
+
+bool SALOMEDS_Study::SaveAsASCII(const std::string& theUrl, bool theMultiFile)
+{
+ //SRN: Pure CORBA save as the save operation require CORBA in any case
+ return _corba_impl->SaveAsASCII((char*)theUrl.c_str(), theMultiFile);
+}
+
+SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb)
+{
+ SALOMEDS_Driver_i* driver = NULL;
+
+ SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent();
+ if(!aSCO.IsNull()) {
+ std::string IOREngine = aSCO.GetIOR();
+ if(!IOREngine.empty()) {
+ CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
+ Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ;
+ driver = new SALOMEDS_Driver_i(Engine, orb);
+ }
+ }
+
+ return driver;
+}
+
+bool SALOMEDS_Study::CanCopy(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
+ bool ret;
+
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
+ SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
+ ret = _local_impl->CanCopy(aSO_impl, aDriver);
+ delete aDriver;
+ }
+ else {
+ ret = _corba_impl->CanCopy(aSO->GetCORBAImpl());
+ }
+
+ return ret;
+}
+
+bool SALOMEDS_Study::Copy(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
+ bool ret;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
+ SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
+ ret = _local_impl->Copy(aSO_impl, aDriver);
+ delete aDriver;
+ }
+ else {
+ ret = _corba_impl->Copy(aSO->GetCORBAImpl());
+ }
+ return ret;
+}
+
+bool SALOMEDS_Study::CanPaste(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
+ bool ret;
+
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
+ SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
+ ret = _local_impl->CanPaste(aSO_impl, aDriver);
+ delete aDriver;
+ }
+ else {
+ ret = _corba_impl->CanPaste(aSO->GetCORBAImpl());
+ }
+
+ return ret;
+}
+
+_PTR(SObject) SALOMEDS_Study::Paste(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
+ SALOMEDSClient_SObject* aResult = NULL;
+
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
+ SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
+ SALOMEDSImpl_SObject aNewSO = _local_impl->Paste(aSO_impl, aDriver);
+ delete aDriver;
+ if(aNewSO.IsNull()) return _PTR(SObject)(aResult);
+ aResult = new SALOMEDS_SObject(aNewSO);
+ }
+ else {
+ SALOMEDS::SObject_ptr aNewSO = _corba_impl->Paste(aSO->GetCORBAImpl());
+ if(CORBA::is_nil(aNewSO)) return _PTR(SObject)(aResult);
+ aResult = new SALOMEDS_SObject(aNewSO);
+ }
+
+ return _PTR(SObject)(aResult);
+}
+
std::string SALOMEDS_Study::GetPersistentReference()
{
std::string aRef;
@@ -446,15 +599,6 @@ std::string SALOMEDS_Study::Name()
return aName;
}
-void SALOMEDS_Study::Name(const std::string& theName)
-{
- if (_isLocal) {
- SALOMEDS::Locker lock;
- _local_impl->Name(theName);
- }
- else _corba_impl->Name((char*)theName.c_str());
-}
-
bool SALOMEDS_Study::IsSaved()
{
bool isSaved;
@@ -516,26 +660,6 @@ void SALOMEDS_Study::URL(const std::string& url)
else _corba_impl->URL((char*)url.c_str());
}
-int SALOMEDS_Study::StudyId()
-{
- int anID;
- if (_isLocal) {
- SALOMEDS::Locker lock;
- anID = _local_impl->StudyId();
- }
- else anID = _corba_impl->StudyId();
- return anID;
-}
-
-void SALOMEDS_Study::StudyId(int id)
-{
- if (_isLocal) {
- SALOMEDS::Locker lock;
- _local_impl->StudyId(id);
- }
- else _corba_impl->StudyId(id);
-}
-
std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)& theSO)
{
std::vector<_PTR(SObject)> aVector;
@@ -614,15 +738,6 @@ _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder()
return _PTR(UseCaseBuilder)(aUB);
}
-void SALOMEDS_Study::Close()
-{
- if (_isLocal) {
- SALOMEDS::Locker lock;
- _local_impl->Close();
- }
- else _corba_impl->Close();
-}
-
void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled)
{
if(_isLocal) _local_impl->EnableUseCaseAutoFilling(isEnabled);
@@ -938,13 +1053,6 @@ CORBA::Object_ptr SALOMEDS_Study::ConvertIORToObject(const std::string& theIOR)
return _orb->string_to_object(theIOR.c_str());
}
-void SALOMEDS_Study::init_orb()
-{
- ORB_INIT &init = *SINGLETON_::Instance() ;
- ASSERT(SINGLETON_::IsAlreadyExisting());
- _orb = init(0 , 0 ) ;
-}
-
SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
{
if (_isLocal) {
@@ -957,8 +1065,9 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str()));
}
else {
- SALOMEDS_Study_i *aStudy_servant = new SALOMEDS_Study_i(_local_impl, _orb);
- aStudy = aStudy_servant->_this();
+ SALOME_NamingService* namingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = namingService->Resolve("/Study");
+ aStudy = SALOMEDS::Study::_narrow(obj);
_local_impl->SetTransientReference(_orb->object_to_string(aStudy));
}
_corba_impl = SALOMEDS::Study::_duplicate(aStudy);
diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx
index af663d633..585487928 100644
--- a/src/SALOMEDS/SALOMEDS_Study.hxx
+++ b/src/SALOMEDS/SALOMEDS_Study.hxx
@@ -52,6 +52,20 @@ public:
SALOMEDS_Study(SALOMEDS::Study_ptr theStudy);
~SALOMEDS_Study();
+ virtual void Clear();
+
+ virtual bool Open(const std::string& theStudyUrl);
+
+ virtual bool Save(bool theMultiFile);
+ virtual bool SaveASCII(bool theMultiFile);
+ virtual bool SaveAs(const std::string& theUrl, bool theMultiFile);
+ virtual bool SaveAsASCII(const std::string& theUrl, bool theMultiFile);
+
+ virtual bool CanCopy(const _PTR(SObject)& theSO);
+ virtual bool Copy(const _PTR(SObject)& theSO);
+ virtual bool CanPaste(const _PTR(SObject)& theSO);
+ virtual _PTR(SObject) Paste(const _PTR(SObject)& theSO);
+
virtual std::string GetPersistentReference();
virtual std::string GetTransientReference();
virtual bool IsEmpty();
@@ -74,21 +88,17 @@ public:
virtual _PTR(SComponentIterator) NewComponentIterator();
virtual _PTR(StudyBuilder) NewBuilder();
virtual std::string Name();
- virtual void Name(const std::string& name);
virtual bool IsSaved();
virtual void IsSaved(bool save);
virtual bool IsModified();
virtual void Modified();
virtual std::string URL();
virtual void URL(const std::string& url);
- virtual int StudyId();
- virtual void StudyId(int id);
virtual std::vector<_PTR(SObject)> FindDependances(const _PTR(SObject)& theSO);
virtual _PTR(AttributeStudyProperties) GetProperties();
virtual std::string GetLastModificationDate();
virtual std::vector GetModificationsDate();
virtual _PTR(UseCaseBuilder) GetUseCaseBuilder();
- virtual void Close();
virtual void EnableUseCaseAutoFilling(bool isEnabled);
virtual bool DumpStudy(const std::string& thePath,const std::string& theBaseName,bool isPublished,bool isMultiFile);
virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint);
@@ -131,9 +141,9 @@ public:
SALOMEDS::Study_ptr GetStudy();
SALOMEDSImpl_Study* GetLocalImpl() { return _local_impl; }
-
+
private:
- void init_orb();
+ void Init();
};
#endif
diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
index 11de3ed7f..c43220b29 100644
--- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
+++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
@@ -32,7 +32,6 @@
#include "SALOMEDS_SObject.hxx"
#include "SALOMEDS_SComponent.hxx"
#include "SALOMEDS_GenericAttribute.hxx"
-#include "SALOMEDS_StudyManager.hxx"
#include "SALOMEDS_StudyBuilder_i.hxx"
#include "SALOMEDS_Driver_i.hxx"
diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx
deleted file mode 100644
index ba0a8f206..000000000
--- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx
+++ /dev/null
@@ -1,326 +0,0 @@
-// Copyright (C) 2007-2016 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
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : SALOMEDSClient_StudyManager.cxx
-// Author : Sergey RUIN
-// Module : SALOME
-//
-#include "SALOMEDS_StudyManager.hxx"
-
-#include "SALOMEDS.hxx"
-#include "SALOMEDS_Study.hxx"
-#include "SALOMEDS_SObject.hxx"
-#include "SALOMEDS_Driver_i.hxx"
-
-#include "SALOMEDSImpl_Study.hxx"
-
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "utilities.h"
-
-#include "Basics_Utils.hxx"
-
-#ifdef WIN32
-#include
-#else
-#include
-#include
-#endif
-
-SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb);
-
-SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager)
-{
-
-#ifdef WIN32
- long pid = (long)_getpid();
-#else
- long pid = (long)getpid();
-#endif
-
- CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
- if(_isLocal) {
- _local_impl = reinterpret_cast(addr);
- _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
- }
- else {
- _local_impl = NULL;
- _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
- }
-
- init_orb();
-}
-
-SALOMEDS_StudyManager::SALOMEDS_StudyManager()
-{
- init_orb();
-
- SALOME_NamingService namingService(_orb);
- CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" );
- SALOMEDS::StudyManager_var theManager = SALOMEDS::StudyManager::_narrow( obj );
- ASSERT( !CORBA::is_nil(theManager) );
-
-#ifdef WIN32
- long pid = (long)_getpid();
-#else
- long pid = (long)getpid();
-#endif
-
- CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
- if(_isLocal) {
- _local_impl = reinterpret_cast(addr);
- _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
- }
- else {
- _local_impl = NULL;
- _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
- }
-}
-
-SALOMEDS_StudyManager::~SALOMEDS_StudyManager()
-{
-}
-
-_PTR(Study) SALOMEDS_StudyManager::NewStudy(const std::string& study_name)
-{
- //SRN: Pure CORBA NewStudy as it does more initialization than the local one
- SALOMEDSClient_Study* aStudy = NULL;
-
- SALOMEDS::Study_var aStudy_impl = _corba_impl->NewStudy((char*)study_name.c_str());
- if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
- aStudy = new SALOMEDS_Study(aStudy_impl);
-
- return _PTR(Study)(aStudy);
-}
-
-_PTR(Study) SALOMEDS_StudyManager::Open(const std::string& theStudyUrl)
-{
- //SRN: Pure CORBA Open as it does more initialization than the local one
- SALOMEDSClient_Study* aStudy = NULL;
-
- SALOMEDS::Study_var aStudy_impl = _corba_impl->Open((char*)theStudyUrl.c_str());
- if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
-
- aStudy = new SALOMEDS_Study(aStudy_impl.in());
-
- return _PTR(Study)(aStudy);
-}
-
-void SALOMEDS_StudyManager::Close(const _PTR(Study)& theStudy)
-{
- //SRN: Pure CORBA close as it does more cleaning than the local one
- SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
- _corba_impl->Close(aStudy);
-}
-
-bool SALOMEDS_StudyManager::Save(const _PTR(Study)& theStudy, bool theMultiFile)
-{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
- SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
- return _corba_impl->Save(aStudy, theMultiFile);
-}
-
-bool SALOMEDS_StudyManager::SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile)
-{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
- SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
- return _corba_impl->SaveASCII(aStudy, theMultiFile);
-}
-
-bool SALOMEDS_StudyManager::SaveAs(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile)
-{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
- SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
- return _corba_impl->SaveAs((char*)theUrl.c_str(), aStudy, theMultiFile);
-}
-
-bool SALOMEDS_StudyManager::SaveAsASCII(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile)
-{
- //SRN: Pure CORBA save as the save operation require CORBA in any case
- SALOMEDS::Study_var aStudy = _corba_impl->GetStudyByID(theStudy->StudyId());
- return _corba_impl->SaveAsASCII((char*)theUrl.c_str(), aStudy, theMultiFile);
-}
-
-std::vector SALOMEDS_StudyManager::GetOpenStudies()
-{
- std::vector aVector;
- int aLength, i;
-
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- std::vector aSeq = _local_impl->GetOpenStudies();
- aLength = aSeq.size();
- for(i = 0; i < aLength; i++)
- aVector.push_back(aSeq[i]->Name());
- }
- else {
- SALOMEDS::ListOfOpenStudies_var aSeq = _corba_impl->GetOpenStudies();
- aLength = aSeq->length();
- for(i = 0; i < aLength; i++)
- aVector.push_back(aSeq[i].in());
- }
- return aVector;
-}
-
-_PTR(Study) SALOMEDS_StudyManager::GetStudyByName(const std::string& theStudyName)
-{
- SALOMEDSClient_Study* aStudy = NULL;
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByName(theStudyName);
- if(!aStudy_impl) return _PTR(Study)(aStudy);
- aStudy = new SALOMEDS_Study(aStudy_impl);
- }
- else {
- SALOMEDS::Study_var aStudy_impl = _corba_impl->GetStudyByName((char*)theStudyName.c_str());
- if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
- aStudy = new SALOMEDS_Study(aStudy_impl);
- }
- return _PTR(Study)(aStudy);
-}
-
-_PTR(Study) SALOMEDS_StudyManager::GetStudyByID(int theStudyID)
-{
- SALOMEDSClient_Study* aStudy = NULL;
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByID(theStudyID);
- if(!aStudy_impl) return _PTR(Study)(aStudy);
- aStudy = new SALOMEDS_Study(aStudy_impl);
- }
- else {
- SALOMEDS::Study_var aStudy_impl = _corba_impl->GetStudyByID(theStudyID);
- if(CORBA::is_nil(aStudy_impl)) return _PTR(Study)(aStudy);
- aStudy = new SALOMEDS_Study(aStudy_impl);
- }
- return _PTR(Study)(aStudy);
-}
-
-bool SALOMEDS_StudyManager::CanCopy(const _PTR(SObject)& theSO)
-{
- SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
- bool ret;
-
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
- SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
- ret = _local_impl->CanCopy(aSO_impl, aDriver);
- delete aDriver;
- }
- else {
- ret = _corba_impl->CanCopy(aSO->GetCORBAImpl());
- }
-
- return ret;
-}
-
-bool SALOMEDS_StudyManager::Copy(const _PTR(SObject)& theSO)
-{
- SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
- bool ret;
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
- SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
- ret = _local_impl->Copy(aSO_impl, aDriver);
- delete aDriver;
- }
- else {
- ret = _corba_impl->Copy(aSO->GetCORBAImpl());
- }
- return ret;
-}
-
-bool SALOMEDS_StudyManager::CanPaste(const _PTR(SObject)& theSO)
-{
- SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
- bool ret;
-
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
- SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
- ret = _local_impl->CanPaste(aSO_impl, aDriver);
- delete aDriver;
- }
- else {
- ret = _corba_impl->CanPaste(aSO->GetCORBAImpl());
- }
-
- return ret;
-}
-
-_PTR(SObject) SALOMEDS_StudyManager::Paste(const _PTR(SObject)& theSO)
-{
- SALOMEDS_SObject* aSO = dynamic_cast(theSO.get());
- SALOMEDSClient_SObject* aResult = NULL;
-
- if (_isLocal) {
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
- SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
- SALOMEDSImpl_SObject aNewSO = _local_impl->Paste(aSO_impl, aDriver);
- delete aDriver;
- if(aNewSO.IsNull()) return _PTR(SObject)(aResult);
- aResult = new SALOMEDS_SObject(aNewSO);
- }
- else {
- SALOMEDS::SObject_ptr aNewSO = _corba_impl->Paste(aSO->GetCORBAImpl());
- if(CORBA::is_nil(aNewSO)) return _PTR(SObject)(aResult);
- aResult = new SALOMEDS_SObject(aNewSO);
- }
-
- return _PTR(SObject)(aResult);
-}
-
-
-void SALOMEDS_StudyManager::init_orb()
-{
- ORB_INIT &init = *SINGLETON_::Instance();
- ASSERT(SINGLETON_::IsAlreadyExisting());
- _orb = init(0 , 0 );
-}
-
-SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb)
-{
- SALOMEDS_Driver_i* driver = NULL;
-
- SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent();
- if(!aSCO.IsNull()) {
- std::string IOREngine = aSCO.GetIOR();
- if(!IOREngine.empty()) {
- CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
- Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ;
- driver = new SALOMEDS_Driver_i(Engine, orb);
- }
- }
-
- return driver;
-}
diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.hxx b/src/SALOMEDS/SALOMEDS_StudyManager.hxx
deleted file mode 100644
index 600676199..000000000
--- a/src/SALOMEDS/SALOMEDS_StudyManager.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2007-2016 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
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : SALOMEDS_StudyManager.hxx
-// Author : Sergey RUIN
-// Module : SALOME
-//
-#ifndef __SALOMEDS_STUDYMANAGER_H__
-#define __SALOMEDS_STUDYMANAGER_H__
-
-#include
-#include
-
-#include "SALOMEDSClient.hxx"
-#include "SALOMEDSImpl_StudyManager.hxx"
-
-// IDL headers
-
-#include
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-class Standard_EXPORT SALOMEDS_StudyManager: public SALOMEDSClient_StudyManager
-{
-private:
- bool _isLocal;
- SALOMEDSImpl_StudyManager* _local_impl;
- SALOMEDS::StudyManager_var _corba_impl;
- CORBA::ORB_var _orb;
-
-public:
-
- SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager);
- SALOMEDS_StudyManager();
- ~SALOMEDS_StudyManager();
-
- virtual _PTR(Study) NewStudy(const std::string& study_name);
- virtual _PTR(Study) Open(const std::string& theStudyUrl);
- virtual void Close(const _PTR(Study)& theStudy);
- virtual bool Save(const _PTR(Study)& theStudy, bool theMultiFile);
- virtual bool SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile);
- virtual bool SaveAs(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile);
- virtual bool SaveAsASCII(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile);
- virtual std::vector GetOpenStudies();
- virtual _PTR(Study) GetStudyByName(const std::string& theStudyName) ;
- virtual _PTR(Study) GetStudyByID(int theStudyID) ;
- virtual bool CanCopy(const _PTR(SObject)& theSO);
- virtual bool Copy(const _PTR(SObject)& theSO);
- virtual bool CanPaste(const _PTR(SObject)& theSO);
- virtual _PTR(SObject) Paste(const _PTR(SObject)& theSO);
-
-private:
- void init_orb();
-};
-
-#endif
diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
deleted file mode 100644
index 6113ccc98..000000000
--- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
+++ /dev/null
@@ -1,535 +0,0 @@
-// Copyright (C) 2007-2016 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
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : SALOMEDS_StudyManager_i.cxx
-// Author : Sergey RUIN
-// Module : SALOME
-//
-#include "utilities.h"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
-#include "SALOMEDS_Study_i.hxx"
-#include "SALOMEDS_SComponent_i.hxx"
-#include "SALOMEDS_Driver_i.hxx"
-#include "SALOMEDS.hxx"
-
-#include "SALOMEDSImpl_Study.hxx"
-#include "SALOMEDSImpl_SObject.hxx"
-#include "SALOMEDSImpl_SComponent.hxx"
-#include "SALOMEDSImpl_AttributeIOR.hxx"
-
-#include "Utils_CorbaException.hxx"
-#include "Utils_ExceptHandlers.hxx"
-#include "Basics_Utils.hxx"
-#include "SALOME_GenericObj_i.hh"
-
-#include
-#include
-#include