Cherrypick from master 2005-12-22 14:01:32 UTC prascle <prascle> 'PR: merge from branch BR_3_1_0deb tag mergeto_trunk_22dec05':
INSTALL
Makefile.in
bin/NSparam.py
bin/VERSION
bin/addToKillList.py
bin/appliskel/README
bin/appliskel/envd
bin/appliskel/killCurrentPort
bin/appliskel/runAppli
bin/appliskel/runConsole
bin/appliskel/runParam
bin/appliskel/runRemote.sh
bin/appliskel/runSession
bin/appliskel/runTests
bin/appliskel/searchFreePort.sh
bin/appliskel/setAppliPath.sh
bin/killSalome.py
bin/killSalomeWithPort.py
bin/launchConfigureParser.py
bin/orbmodule.py
bin/runSalome.py
doc/SALOME_Application.txt
doc/salome/tui/KERNEL/doxyfile
doc/salome/tui/KERNEL/sources/static/tree.js
idl/SALOME_Comm.idl
idl/SALOME_ContainerManager.idl
idl/SALOME_TestMPIComponent.idl
idl/nstest.idl
resources/CatalogResources.xml
resources/KERNELCatalog.xml
salome_adm/unix/config_files/check_cas.m4
salome_adm/unix/config_files/check_lam.m4
salome_adm/unix/config_files/check_omniorb.m4
salome_adm/unix/config_files/check_qt.m4
salome_adm/unix/config_files/check_qwt.m4
salome_adm/unix/make_module.in
salome_adm/unix/pythonbe.py
src/Basics/Test/BasicMainTest.hxx
src/Batch/Batch_APIInternalFailureException.cxx
src/Batch/Batch_APIInternalFailureException.hxx
src/Batch/Batch_BatchManager.cxx
src/Batch/Batch_BatchManager.hxx
src/Batch/Batch_BatchManagerCatalog.cxx
src/Batch/Batch_BatchManagerCatalog.hxx
src/Batch/Batch_BatchManager_LSF.cxx
src/Batch/Batch_BatchManager_LSF.hxx
src/Batch/Batch_BatchManager_PBS.cxx
src/Batch/Batch_BatchManager_PBS.hxx
src/Batch/Batch_BoolType.cxx
src/Batch/Batch_BoolType.hxx
src/Batch/Batch_CharType.cxx
src/Batch/Batch_CharType.hxx
src/Batch/Batch_ConnexionFailureException.cxx
src/Batch/Batch_ConnexionFailureException.hxx
src/Batch/Batch_Couple.cxx
src/Batch/Batch_Couple.hxx
src/Batch/Batch_CoupleType.cxx
src/Batch/Batch_CoupleType.hxx
src/Batch/Batch_Date.cxx
src/Batch/Batch_Date.hxx
src/Batch/Batch_DateType.cxx
src/Batch/Batch_DateType.hxx
src/Batch/Batch_Environnement.cxx
src/Batch/Batch_Environnement.hxx
src/Batch/Batch_FactBatchManager.cxx
src/Batch/Batch_FactBatchManager.hxx
src/Batch/Batch_FactBatchManager_LSF.cxx
src/Batch/Batch_FactBatchManager_LSF.hxx
src/Batch/Batch_FactBatchManager_PBS.cxx
src/Batch/Batch_FactBatchManager_PBS.hxx
src/Batch/Batch_GenericException.cxx
src/Batch/Batch_GenericException.hxx
src/Batch/Batch_GenericType.cxx
src/Batch/Batch_GenericType.hxx
src/Batch/Batch_IntType.cxx
src/Batch/Batch_IntType.hxx
src/Batch/Batch_InvalidArgumentException.cxx
src/Batch/Batch_InvalidArgumentException.hxx
src/Batch/Batch_InvalidKeyException.cxx
src/Batch/Batch_InvalidKeyException.hxx
src/Batch/Batch_Job.cxx
src/Batch/Batch_Job.hxx
src/Batch/Batch_JobId.cxx
src/Batch/Batch_JobId.hxx
src/Batch/Batch_JobInfo.cxx
src/Batch/Batch_JobInfo.hxx
src/Batch/Batch_JobInfo_LSF.cxx
src/Batch/Batch_JobInfo_LSF.hxx
src/Batch/Batch_JobInfo_PBS.cxx
src/Batch/Batch_JobInfo_PBS.hxx
src/Batch/Batch_Job_LSF.cxx
src/Batch/Batch_Job_LSF.hxx
src/Batch/Batch_Job_PBS.cxx
src/Batch/Batch_Job_PBS.hxx
src/Batch/Batch_ListIsFullException.cxx
src/Batch/Batch_ListIsFullException.hxx
src/Batch/Batch_LongType.cxx
src/Batch/Batch_LongType.hxx
src/Batch/Batch_MapKey.cxx
src/Batch/Batch_MapKey.hxx
src/Batch/Batch_NotYetImplementedException.cxx
src/Batch/Batch_NotYetImplementedException.hxx
src/Batch/Batch_Parametre.cxx
src/Batch/Batch_Parametre.hxx
src/Batch/Batch_PyVersatile.cxx
src/Batch/Batch_PyVersatile.hxx
src/Batch/Batch_RunTimeException.cxx
src/Batch/Batch_RunTimeException.hxx
src/Batch/Batch_StringType.cxx
src/Batch/Batch_StringType.hxx
src/Batch/Batch_TypeMismatchException.cxx
src/Batch/Batch_TypeMismatchException.hxx
src/Batch/Batch_Versatile.cxx
src/Batch/Batch_Versatile.hxx
src/Batch_SWIG/libBatch_Swig.i
src/Batch_SWIG/libBatch_Swig_exception.i
src/Batch_SWIG/libBatch_Swig_typemap.i
src/CASCatch/CASCatch_CatchSignals.cxx
src/CASCatch/CASCatch_CatchSignals.hxx
src/CASCatch/CASCatch_ErrorHandler.cxx
src/CASCatch/CASCatch_ErrorHandler.hxx
src/CASCatch/CASCatch_Failure.cxx
src/CASCatch/CASCatch_Failure.hxx
src/CASCatch/Makefile.in
src/Communication/Makefile.in
src/Communication/MultiCommException.cxx
src/Communication/MultiCommException.hxx
src/Communication/Receiver.cxx
src/Communication/Receiver.hxx
src/Communication/ReceiverFactory.cxx
src/Communication/ReceiverFactory.hxx
src/Communication/Receivers.cxx
src/Communication/Receivers.hxx
src/Communication/SALOMEMultiComm.cxx
src/Communication/SALOMEMultiComm.hxx
src/Communication/SALOME_Comm_i.cxx
src/Communication/SALOME_Comm_i.hxx
src/Communication/SenderFactory.cxx
src/Communication/SenderFactory.hxx
src/Communication/libSALOME_Comm.i
src/Communication_SWIG/Makefile.in
src/Communication_SWIG/libSALOME_Comm.i
src/Container/Component_i.cxx
src/Container/Container_i.cxx
src/Container/Makefile.in
src/Container/SALOME_Container.cxx
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/SALOME_ContainerManagerServer.cxx
src/Container/SALOME_ContainerPy.py
src/HDFPersist/HDFascii.cc
src/HDFPersist/HDFascii.hxx
src/HDFPersist/HDFdataset.cc
src/HDFPersist/HDFdataset.hxx
src/HDFPersist/HDFdatasetCreate.c
src/HDFPersist/HDFdatasetGetOrder.c
src/HDFPersist/HDFtypes.h
src/HDFPersist/Makefile.in
src/HDFPersist/hdfi.h
src/KERNEL_PY/Makefile.in
src/KERNEL_PY/kernel_shared_modules.py
src/KERNEL_PY/omnipatch.py
src/KERNEL_PY/salome.py
src/KERNEL_PY/salome_shared_modules.py
src/KERNEL_PY/salome_test.py
src/LifeCycleCORBA/Launchers.cxx
src/LifeCycleCORBA/Launchers.hxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx
src/LifeCycleCORBA/Test/LifeCycleCORBATest.hxx
src/LifeCycleCORBA/Test/Makefile.in
src/LifeCycleCORBA/Test/TestLifeCycleCORBA.cxx
src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/MPIObject_i.cxx
src/MPIContainer/Makefile.in
src/MPIContainer/SALOME_MPIContainer.cxx
src/Makefile.in
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/NamingService/SALOME_NamingService.cxx
src/NamingService/SALOME_NamingService.hxx
src/NamingService/SALOME_NamingServicePy.py
src/NamingService/Test/Makefile.in
src/NamingService/Test/NamingServiceTest.cxx
src/NamingService/Test/NamingServiceTest.hxx
src/NamingService/Test/TestNamingService.cxx
src/NamingService/Test/TestNamingService.py
src/ResourcesManager/SALOME_LoadRateManager.cxx
src/ResourcesManager/SALOME_LoadRateManager.hxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx
src/SALOMEDS/Makefile.in
src/SALOMEDS/SALOMEDS.cdl
src/SALOMEDS/SALOMEDS_AttributeComment.cxx
src/SALOMEDS/SALOMEDS_AttributeComment.hxx
src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx
src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx
src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx
src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx
src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx
src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx
src/SALOMEDS/SALOMEDS_AttributeFileType.cxx
src/SALOMEDS/SALOMEDS_AttributeFileType.hxx
src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx
src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx
src/SALOMEDS/SALOMEDS_AttributeFlags.cxx
src/SALOMEDS/SALOMEDS_AttributeFlags.hxx
src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx
src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx
src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx
src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx
src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx
src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx
src/SALOMEDS/SALOMEDS_AttributeIOR.cxx
src/SALOMEDS/SALOMEDS_AttributeIOR.hxx
src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx
src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx
src/SALOMEDS/SALOMEDS_AttributeInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeInteger.hxx
src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx
src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx
src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx
src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx
src/SALOMEDS/SALOMEDS_AttributeName.cxx
src/SALOMEDS/SALOMEDS_AttributeName.hxx
src/SALOMEDS/SALOMEDS_AttributeName_i.cxx
src/SALOMEDS/SALOMEDS_AttributeName_i.hxx
src/SALOMEDS/SALOMEDS_AttributeOpened.cxx
src/SALOMEDS/SALOMEDS_AttributeOpened.hxx
src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx
src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx
src/SALOMEDS/SALOMEDS_AttributePixMap.cxx
src/SALOMEDS/SALOMEDS_AttributePixMap.hxx
src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx
src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx
src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx
src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx
src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx
src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx
src/SALOMEDS/SALOMEDS_AttributeReal.cxx
src/SALOMEDS/SALOMEDS_AttributeReal.hxx
src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx
src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx
src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTarget.cxx
src/SALOMEDS/SALOMEDS_AttributeTarget.hxx
src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx
src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx
src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx
src/SALOMEDS/SALOMEDS_AttributeUserID.cxx
src/SALOMEDS/SALOMEDS_AttributeUserID.hxx
src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx
src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx
src/SALOMEDS/SALOMEDS_Attributes.hxx
src/SALOMEDS/SALOMEDS_ChildIterator.cxx
src/SALOMEDS/SALOMEDS_ChildIterator.hxx
src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx
src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx
src/SALOMEDS/SALOMEDS_ClientAttributes.hxx
src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl
src/SALOMEDS/SALOMEDS_Driver_i.cxx
src/SALOMEDS/SALOMEDS_Driver_i.hxx
src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl
src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl
src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx
src/SALOMEDS/SALOMEDS_FileType.cdl
src/SALOMEDS/SALOMEDS_FileType.jxx
src/SALOMEDS/SALOMEDS_GenericAttribute.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute.hxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx
src/SALOMEDS/SALOMEDS_IORAttribute.cdl
src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl
src/SALOMEDS/SALOMEDS_OCAFApplication.cdl
src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl
src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl
src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl
src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl
src/SALOMEDS/SALOMEDS_SComponent.cxx
src/SALOMEDS/SALOMEDS_SComponent.hxx
src/SALOMEDS/SALOMEDS_SComponentIterator.cxx
src/SALOMEDS/SALOMEDS_SComponentIterator.hxx
src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx
src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx
src/SALOMEDS/SALOMEDS_SComponent_i.cxx
src/SALOMEDS/SALOMEDS_SComponent_i.hxx
src/SALOMEDS/SALOMEDS_SObject.cxx
src/SALOMEDS/SALOMEDS_SObject.hxx
src/SALOMEDS/SALOMEDS_SObject_i.cxx
src/SALOMEDS/SALOMEDS_SObject_i.hxx
src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl
src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl
src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_Study.hxx
src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder.hxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx
src/SALOMEDS/SALOMEDS_StudyManager.cxx
src/SALOMEDS/SALOMEDS_StudyManager.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx
src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/SALOMEDS_TargetAttribute.cdl
src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl
src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl
src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx
src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx
src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx
src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx
src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx
src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx
src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx
src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx
src/SALOMEDS/SALOME_DriverPy.py
src/SALOMEDSClient/SALOMEDSClient.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeComment.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeDrawable.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeExpandable.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeExternalFileDef.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeFileType.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeFlags.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeGraphic.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeIOR.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeInteger.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeLocalID.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeName.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeOpened.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributePersistentRef.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributePixMap.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributePythonObject.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeReal.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeSelectable.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeSequenceOfInteger.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeSequenceOfReal.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeStudyProperties.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTableOfInteger.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTableOfReal.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTableOfString.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTarget.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTextColor.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTextHighlightColor.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeUserID.hxx
src/SALOMEDSClient/SALOMEDSClient_ChildIterator.hxx
src/SALOMEDSClient/SALOMEDSClient_GenericAttribute.hxx
src/SALOMEDSClient/SALOMEDSClient_SComponent.hxx
src/SALOMEDSClient/SALOMEDSClient_SComponentIterator.hxx
src/SALOMEDSClient/SALOMEDSClient_SObject.hxx
src/SALOMEDSClient/SALOMEDSClient_Study.hxx
src/SALOMEDSClient/SALOMEDSClient_StudyBuilder.hxx
src/SALOMEDSClient/SALOMEDSClient_StudyManager.hxx
src/SALOMEDSClient/SALOMEDSClient_UseCaseBuilder.hxx
src/SALOMEDSClient/SALOMEDSClient_UseCaseIterator.hxx
src/SALOMEDSClient/SALOMEDSClient_definitions.hxx
src/SALOMEDSImpl/Makefile.in
src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx
src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx
src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx
src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx
src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx
src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx
src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx
src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx
src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx
src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx
src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx
src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx
src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx
src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx
src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx
src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx
src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx
src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx
src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx
src/SALOMEDSImpl/testDS.cxx
src/SALOMELocalTrace/FileTraceCollector.cxx
src/SALOMELocalTrace/LocalTraceBufferPool.cxx
src/SALOMELocalTrace/LocalTraceCollector.cxx
src/SALOMELocalTrace/Test/SALOMELocalTraceTest.cxx
src/SALOMELocalTrace/Test/SALOMELocalTraceTest.hxx
src/SALOMELocalTrace/Test/TestSALOMELocalTrace.cxx
src/SALOMETraceCollector/SALOMETraceCollector.cxx
src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.cxx
src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.hxx
src/SALOMETraceCollector/Test/TestSALOMETraceCollector.cxx
src/TOOLSDS/Makefile.in
src/TOOLSDS/SALOMEDS_Tool.cxx
src/TOOLSDS/SALOMEDS_Tool.hxx
src/TestMPIContainer/Makefile.in
src/TestMPIContainer/TestMPIComponentEngine.cxx
src/TestMPIContainer/TestMPIComponentEngine.hxx
src/TestMPIContainer/TestMPIContainer.cxx
src/UnitTests/Makefile.in
src/UnitTests/UnitTests.cxx
src/Utils/Test/TestUtils.cxx
src/Utils/Test/UtilsTest.cxx
src/Utils/Test/UtilsTest.hxx
src/Utils/Utils_ExceptHandlers.cxx
--- /dev/null
+This is the version 3.1.0 of KERNEL
+Previous versions :
+ - 3.0.0
+ - 2.2.4
+ - 2.2.3
+ - 2.2.2
+ - 2.2.1
+ - 2.2.0
+ - 2.1.1
+ - 2.1.0
+ - 2.0.0
+ - 1.4.1
+ - 1.3.0
+ - 1.2.1
+
--- /dev/null
+# -* Makefile *-
+#
+# Author : Patrick GOLDBRONN (CEA)
+# Date : 28/06/2001
+# $Header$
+#
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=.
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/bin:./bin/salome:@top_srcdir@/resources:./bin:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+SUBDIRS = idl src doc salome_adm
+
+RESOURCES_FILES = \
+CatalogDataType.xml \
+KERNELCatalog.xml \
+CatalogResources.xml \
+close.png \
+config \
+channel.cfg \
+SALOMEDS_Resources
+
+BIN_SCRIPT= \
+runIDLparser \
+VERSION \
+orbmodule.py \
+runSalome.py \
+killSalome.py \
+killSalomeWithPort.py \
+runSalome \
+runSalome.csh \
+runNS.sh \
+createAppli.sh \
+launchConfigureParser.py \
+salome.launch \
+envSalome.py \
+salomeConsole.py \
+showNS.py \
+addToKillList.py \
+NSparam.py
+
+# copy header files in common directory
+OWN_CONFIG_H=@OWN_CONFIG_H@
+
+ifeq ($(OWN_CONFIG_H),yes)
+ ifeq ($(HAVE_SSTREAM),yes)
+ include_list=include/salome/SALOMEconfig.h include/salome/config.h
+ else
+ include_list=include/salome/SALOMEconfig.h include/salome/config.h include/salome/sstream
+ endif
+else
+ ifeq ($(HAVE_SSTREAM),yes)
+ include_list=include/salome/SALOMEconfig.h
+ else
+ include_list=include/salome/SALOMEconfig.h include/salome/sstream
+ endif
+endif
+
+inc: idl $(include_list)
+
+include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref
+ -$(RM) $@
+ $(LN_S) ../../$< $@
+
+# test if SALOMEconfig.h has changed (contents)
+salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h
+ @if ! [ -a $@ ]; then \
+ cp -p $< $@; \
+ fi; \
+ if ! cmp $< $@; then \
+ cp -p $< $@; \
+ fi; \
+
+include/salome/config.h: salome_adm/unix/config.h
+ -$(RM) $@
+ $(LN_S) ../../$< $@
+
+include/salome/sstream: salome_adm/unix/sstream
+ -$(RM) $@
+ $(LN_S) ../../$< $@
+
+depend: depend_idl
+
+depend_idl:
+ (cd idl ; $(MAKE) $@) || exit 1
+
+# doc is already build : if you want to had documents, go manually to doc and run 'make doc'
+#doc:
+# (cd doc && $(MAKE) $@) || exit 1
+
+# Install make_commence make_conclude ... for other modules
+install-make:
+ ($(INSTALL) -d $(incmakedir) || exit 1);
+ (sed 's/^prefix=/#prefix=/' $(top_builddir)/salome_adm/unix/make_commence > $(incmakedir)/make_commence || exit 1);
+ (sed 's/^prefix=/#prefix=/' $(top_builddir)/salome_adm/unix/make_conclude > $(incmakedir)/make_conclude || exit 1);
+
+
+install-end:
+# finish libtool install
+# @$(LT) --mode=finish $(libdir)
+
+install-include: $(include_list)
+ $(INSTALL) -d $(includedir)
+ @for f in X $(include_list); do \
+ if test $$f != X; then \
+ (cp -p $$f $(includedir) || exit 1); \
+ fi; \
+ done
+
+# install script in $(bindir) :
+install-appliskel:
+ $(INSTALL) -d $(bindir)
+ if test -d $(top_builddir)/bin/salome/appliskel; then \
+ cp -rp $(top_builddir)/bin/salome/appliskel $(bindir); \
+ fi;
+
+install-bin: $(BIN_SCRIPT)
+ $(INSTALL) -d $(bindir)
+ $(INSTALL_PROGRAM) $^ $(bindir)
+
+# install Plugin file
+install-plugin: $(top_builddir)/share/salome/resources/Plugin
+ ($(INSTALL_DATA) $^ $(datadir)/resources/. || exit 1); \
+
+uninstall: uninstall-idl
+
+uninstall-idl:
+ $(RM) $(idldir)/*.idl
+
+distclean: distclean-other
+
+distclean-other:
+ -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old
+ -$(RM) salome_adm/unix/make_*
+ -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h salome_adm/unix/config.h
+ -$(RM) config.cache config.log config.status
+
+@MODULE@
+
+$(top_builddir)/share/salome/resources/Plugin: resources/Plugin
+ cp -f $< $@ ; \
+
+resources: $(top_builddir)/share/salome/resources/Plugin
+
+install: install-bin install-appliskel install-include install-make install-plugin install-end
--- /dev/null
+#!/usr/bin/env python
+
+import sys,os
+import string
+
+def getNSparams(info=""):
+ """
+ check environment for omniORB configuration file.
+ parse the file to find the line defining naming service host and port,
+ set environment variables NSPORT and NSHOST,
+ get host and port,
+ if info==host print host
+ elif info==port print host
+ else print 2 strings on stdout on one line: host port
+ """
+ my_port=""
+ my_host=""
+ if os.environ.has_key("OMNIORB_CONFIG"):
+ file = open(os.environ["OMNIORB_CONFIG"], "r")
+ s = file.read()
+ while len(s):
+ l = string.split(s, ":")
+ if string.split(l[0], " ")[0] == "ORBInitRef" or \
+ string.split(l[0], " ")[0] == "InitRef" :
+ my_port = l[len(l)-1]
+ if my_port[-1] == '\n':
+ my_port = my_port[:-1]
+ pass
+ my_host = l[len(l)-2]
+ break;
+ pass
+ s = file.read()
+ pass
+ pass
+ if info=='host':
+ # keep print, stdout used in shell
+ print my_host
+ os.environ['NSHOST']=my_host
+ return my_host
+ pass
+ elif info=='port':
+ # keep print, stdout used in shell
+ print my_port
+ os.environ['NSPORT']=my_port
+ return my_port
+ pass
+ else:
+ # keep print, stdout used in shell
+ print my_host, my_port
+ return my_host, my_port
+ pass
+
+# ------------------------------------------------------------------------
+
+if __name__ == "__main__":
+ if len(sys.argv) >1:
+ if sys.argv[1]=='host':
+ getNSparams('host')
+ pass
+ elif sys.argv[1]=='port':
+ getNSparams('port')
+ pass
+ else:
+ getNSparams('')
+ pass
+ pass
+ else:
+ getNSparams('')
+ pass
--- /dev/null
+THIS IS SALOME - KERNEL VERSION: 3.1.0
--- /dev/null
+#!/usr/bin/env python
+
+import os, sys, pickle, string, signal
+
+########## adds to the kill list of SALOME one more process ##########
+
+def findFileDict():
+ if os.environ.has_key('NSPORT'):
+ my_port = os.environ['NSPORT']
+ pass
+ else:
+ my_port = 2809
+ try:
+ file = open(os.environ["OMNIORB_CONFIG"], "r")
+ s = file.read()
+ while len(s):
+ l = string.split(s, ":")
+ if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" :
+ my_port = int(l[len(l)-1])
+ pass
+ s = file.read()
+ pass
+ pass
+ except:
+ pass
+ pass
+ print "myport = ", my_port
+ return my_port
+
+def addToKillList(command_pid, command):
+ my_port = findFileDict()
+ from killSalomeWithPort import getPiDict
+ filedict=getPiDict(my_port)
+ try:
+ fpid=open(filedict, 'r')
+ process_ids=pickle.load(fpid)
+ fpid.close()
+ except:
+ process_ids=[{}]
+ pass
+
+ already_in=0
+ for process_id in process_ids:
+ print process_id
+ for pid, cmd in process_id.items():
+ #print "see process %s : %s"% (pid, cmd[0])
+ if pid == command_pid:
+ already_in=1
+ pass
+ pass
+ pass
+
+ command=(command.split(" "))[0]
+ if already_in == 0:
+ try:
+ process_ids.append({command_pid: [command]})
+ fpid=open(filedict,'w')
+ pickle.dump(process_ids, fpid)
+ fpid.close()
+ except:
+ print "addToKillList: can not add command %s to the kill list"% filedict
+ pass
+ pass
+ pass
+
+def killList():
+ my_port = findFileDict()
+ from killSalomeWithPort import getPiDict
+ filedict=getPiDict(my_port)
+ try:
+ fpid=open(filedict, 'r')
+ process_ids=pickle.load(fpid)
+ fpid.close()
+ except:
+ process_ids=[{}]
+ pass
+
+ for process_id in process_ids:
+ print process_id
+ for pid, cmd in process_id.items():
+ print "stop process %s : %s"% (pid, cmd[0])
+ try:
+ os.kill(int(pid),signal.SIGKILL)
+ except:
+ print " ------------------ process %s : %s inexistant"% (pid, cmd[0])
+ pass
+ pass
+ pass
+ os.remove(filedict)
+ pass
+
+
+
+if __name__ == "__main__":
+ print sys.argv
+ addToKillList(sys.argv[1], sys.argv[2])
--- /dev/null
+=======================================
+Set of scripts for a SALOME application
+=======================================
+*html version of this document is produced with docutils*::
+
+ rest2html < doc.txt > doc.html
+
+This document corresponds to SALOME2 3.1. (alpha version)
+
++-------------------------------------------+
+| **WORK in PROGRESS, INCOMPLETE DOCUMENT** |
++-------------------------------------------+
+
+SALOME Application concept
+--------------------------
+
+See SALOME_Application_ to define your own configuration of SALOME and run it
+on one or several computers. This is the recommended way of configuration.
+
+.. _SALOME_Application: ../../doc/SALOME_Application.html
+
+
+User run scripts
+----------------
+
+The SALOME user can use the following scripts:
+
+runAppli
+ Launches a SALOME Session
+ (similar to ${KERNEL_ROOT_DIR}/bin/salome/runSalome but with a different
+ name to avoid confusions).
+
+runSession
+ Launches a shell script in the SALOME application environment, with access
+ to the current SALOME session (naming service), if any.
+ Without arguments, the script is interactive. With arguments, the script
+ executes the command in the SALOME application environment.
+
+runConsole
+ Gives a python console connected to the current SALOME Session.
+ It is also possible to use runSession, then python.
+
+runTests
+ Similar to runSession, used for unit testing. runTests defines a new
+ configuration for naming service (new port number) to avoid interferences
+ with a running SALOME session. runSession tries to use an already existing
+ naming service definition from a running session (hostname & port number).
+
+killCurrentPort
+ Kills the last SALOME session corresponding to this application, and
+ intially launched from this computer.
+ Cleans associated config files.
+
+SALOME internal run scripts
+---------------------------
+
+envd
+ Sets SALOME application environment, envd is sourced by other scripts.
+
+setAppliPath.sh
+ Used by other scripts to define the Application Path.
+
+searchFreePort.sh
+ Used by other scripts to find a free port for naming service.
+
+For remote calls, SALOME uses one script.
+
+runRemote.sh
+ This script is mainly used to launch containers. The first 2 arguments
+ define the hostname and port userd for naming service, the remaining
+ arguments define the command to execute.
+
+
+The following files must be adapted to your environment and SALOME Application
+------------------------------------------------------------------------------
+
+- CatalogResources.xml
+- SalomeApp.xml
+- env.d/atFirst.sh
+- env.d/envProducts.sh
+- env.d/envSalome.sh
+
+CatalogRessources.xml
+ This files describes all the computer the application can use. The given
+ example is minimal and suppose ${APPLI} is the same relative path
+ to ${HOME}, on all the computers. A different directory can be set on a
+ particular computer with a line::
+
+ appliPath="my/specific/path/on/this/computer"
+
+SalomeApp.xml
+ This file is similar to the default given
+ in ${GUI_ROOT_DIR}/share/salome/resources
+
+
+Proposal for env.d scripts
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Each user **must define** his own configuration for these scripts, following
+the above rules. **The following is only an example not working as it is**.
+
+atFirst.sh
+ Sets the computer configuration not directly related to SALOME,
+ like useful tools, default PATH.
+
+envProducts.sh
+ Sets the SALOME prerequisites.
+
+envSALOME.sh
+ Sets all the MODULE_ROOT_DIR that can be used in the SALOME application.
+
+ SalomeAppConfig is also defined by::
+
+ export SalomeAppConfig=${HOME}/${APPLI}
+
+ where SalomeAppConfig designates the directory containing SalomeApp.xml.
+ Note that ${APPLI} is already defined by the calling scripts when
+ env.d/envSalome.sh is sourced.
--- /dev/null
+#!/bin/bash
+
+for i in $1/env.d/*.sh; do source ${i}; done
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- find omniORB configuration relative to current session if any
+
+myhost=`hostname`
+fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+
+if [ -f $fileOmniConfig ]; then
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+fi
+
+currentPort=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+echo $currentPort
+
+# --- kill current salome session
+
+${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py $currentPort
+
+# --- delete config files
+
+if [ -s $fileOmniConfig ]; then
+ refConfig=`ls -l $fileOmniConfig | awk '{print \$NF}'`
+ if [ -f $refConfig ]; then
+ rm $refConfig
+ fi
+ rm $fileOmniConfig
+fi
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- define port for CORBA naming service
+
+. `dirname $0`/searchFreePort.sh
+searchFreePort
+
+# --- if mpi lam, start lam (seems safe to be done several times)
+# arret manuel avec lamhalt
+
+if [ "$LAMBHOST" ]; then
+ lamboot
+fi
+
+# --- run SALOME
+# (default arguments defined in local salome.launch could be completed
+# by arguments to this command)
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
+
+else
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
+fi
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- open a Python interpreter with SALOME environment
+
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/salomeConsole.py $*
--- /dev/null
+#!/bin/bash
+
+./KillCurrentPort
+
+./runAppli --logger
+
--- /dev/null
+#!/bin/bash
+#
+# --- run command in SALOME environment from remote call, ssh or rsh
+# - SALOME configuration is defined by :
+# - list of MODULE_ROOT_DIR
+# - prerequisite environment
+# - specific configuration for a particular SALOME application
+# - These elements of configuration are defined locally on each computer
+# in the directory APPLI:
+# - A SALOME application distributed on several computers needs APPLI
+# directories on the same path ($APPLI) relative to $HOME directory
+# of the user, on each computer.
+#
+# --- call example (from cli76cd to cli76ce):
+# ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName
+#
+# --- local arguments
+# $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable
+# $1 : computer name for CORBA name service (where SALOME was launched)
+# $2 : port for CORBA name service
+# $3 and following : local command to execute, with args
+#
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
+
+export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_$1_$2.cfg
+export NSHOST=$1
+export NSPORT=$2
+initref="NameService=corbaname::"$1":$2"
+echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+
+# --- execute the command in the SALOME environment
+
+shift 2
+
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile $HOME/$APPLI/.bashrc -c "$*"
--- /dev/null
+#!/bin/bash
+#
+# Useful shell to run executable progs or shells under Salome env
+# Use it with args to run a program : runSession python -i myprog.py
+# Use it without args to run an interactive shell under Salome env
+#
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- set omniORB configuration to current session if any
+
+myhost=`hostname`
+fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+
+if [ -f $fileOmniConfig ]; then
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+
+ # --- set environment variables for port and hostname of NamingService
+
+ export NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
+ export NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+fi
+
+# --- invoque shell with or without args
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
+else
+
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
+fi
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+. `dirname $0`/setAppliPath.sh
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- define port for CORBA naming service
+
+searchFreePort() {
+ echo -n "Searching for a free port for naming service: "
+ export NSPORT=2810
+ local limit=$NSPORT
+ let limit=limit+100
+ while [ 1 ]
+ do
+ aRes=`netstat -ltn | grep -E :${NSPORT}`
+ if [ -z "$aRes" ]; then
+ echo ${NSPORT} - Ok
+ local myhost=`hostname`
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
+ export NSPORT
+ export NSHOST=${myhost}
+ local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ echo "InitRef = $initref" > $OMNIORB_CONFIG
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_test.cfg
+ rm ${LAST_RUNNING_CONFIG}
+ ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
+ break
+ fi
+ echo -n "${NSPORT} "
+ if [[ $NSPORT -eq $limit ]] ; then
+ echo
+ echo "Can't find a free port to launch omniNames"
+ echo "Try to kill the running servers and then launch SALOME again."
+ exit
+ fi
+ let NSPORT=NSPORT+1
+ done
+}
+
+# --- if mpi lam, start lam (seems safe to be done several times)
+# arret manuel avec lamhalt
+
+if [ "$LAMBHOST" ]; then
+ lamboot
+fi
+
+# --- invoque shell with or without args
+
+searchFreePort
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
+else
+
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
+fi
+
+rm ${OMNIORB_CONFIG}
+rm ${LAST_RUNNING_CONFIG}
--- /dev/null
+#!/bin/bash
+
+# --- define port for CORBA naming service
+
+searchFreePort() {
+ echo -n "Searching for a free port for naming service: "
+ export NSPORT=2810
+ local limit=$NSPORT
+ let limit=limit+100
+ while [ 1 ]
+ do
+ aRes=`netstat -ltn | grep -E :${NSPORT}`
+ if [ -z "$aRes" ]; then
+ echo ${NSPORT} - Ok
+ local myhost=`hostname`
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
+ export NSPORT
+ export NSHOST=${myhost}
+ local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ echo "InitRef = $initref" > $OMNIORB_CONFIG
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+ rm ${LAST_RUNNING_CONFIG}
+ ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
+ break
+ fi
+ echo -n "${NSPORT} "
+ if [[ $NSPORT -eq $limit ]] ; then
+ echo
+ echo "Can't find a free port to launch omniNames"
+ echo "Try to kill the running servers and then launch SALOME again."
+ exit
+ fi
+ let NSPORT=NSPORT+1
+ done
+}
+
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
--- /dev/null
+#!/usr/bin/env python
+import os, string, sys, re
+
+from killSalomeWithPort import killMyPort, getPiDict
+
+def killAllPorts():
+ user = os.getenv('USER')
+ filedict = "^%s$"%(getPiDict('(\d*)',full=False))
+ fnamere = re.compile(filedict)
+ for file in os.listdir(os.getenv("HOME")):
+ mo = re.match(fnamere,file)
+ if mo and len(mo.groups()):
+ killMyPort(mo.groups()[0])
+ pass
+
+if __name__ == "__main__":
+ killAllPorts()
--- /dev/null
+#!/usr/bin/env python
+import os, sys, pickle, signal, commands
+
+def getPiDict(port,appname='salome',full=True):
+ from Utils_Identity import getShortHostName
+
+ host = os.getenv("HOSTNAME")
+ if not host:
+ host = os.getenv("HOST")
+ if not host:
+ host = getShortHostName()
+
+ filedict = []
+ filedict.append( os.getenv('USER') ) # user name
+ filedict.append( host ) # host name
+ filedict.append( str(port) ) # port number
+ filedict.append( appname.upper() ) # application name
+ filedict.append( 'pidict' ) # constant part
+
+ filedict = '_'.join(filedict)
+ if full:
+ filedict = os.getenv("HOME") + '/' + filedict
+ return filedict
+
+########## kills all salome processes with the given port ##########
+def killMyPort(port):
+ filedict=getPiDict(port)
+ found = 0
+ try:
+ fpid=open(filedict, 'r')
+ found = 1
+ except:
+ print "le fichier %s des process SALOME n'est pas accessible"% filedict
+ pass
+
+ if found:
+ a = os.system("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid >& /dev/null")
+ try:
+ process_ids=pickle.load(fpid)
+ fpid.close()
+ for process_id in process_ids:
+
+ for pid, cmd in process_id.items():
+ print "stop process %s : %s"% (pid, cmd[0])
+ try:
+ os.kill(int(pid),signal.SIGKILL)
+ except:
+ print " ------------------ process %s : %s inexistant"% (pid, cmd[0])
+ pass
+ pass
+ except:
+ pass
+ os.remove(filedict)
+ pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"")
+ a = ""
+ while pid != "" and len(a.split(" ")) < 2:
+ a = commands.getoutput("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid")
+ pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"")
+ print pid
+
+
+if __name__ == "__main__":
+ for port in sys.argv[1:]:
+ killMyPort(port)
--- /dev/null
+import os, glob, string, sys, re
+import xml.sax
+
+# names of tags in XML configuration file
+doc_tag = "document"
+sec_tag = "section"
+par_tag = "parameter"
+
+# names of attributes in XML configuration file
+nam_att = "name"
+val_att = "value"
+
+# certain values in XML configuration file ("launch" section)
+lanch_nam = "launch"
+gui_nam = "gui"
+splash_nam = "splash"
+logger_nam = "logger"
+xterm_nam = "xterm"
+file_nam = "file"
+portkill_nam = "portkill"
+killall_nam = "killall"
+modules_nam = "modules"
+pyModules_nam = "pyModules"
+embedded_nam = "embedded"
+standalone_nam = "standalone"
+containers_nam = "containers"
+key_nam = "key"
+interp_nam = "interp"
+except_nam = "noexcepthandler"
+
+# values in XML configuration file giving specific module parameters (<module_name> section)
+# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
+plugins_nam = "plugins"
+
+# values passed as arguments, NOT read from XML config file, but set from within this script
+appname_nam = "appname"
+port_nam = "port"
+appname = "SalomeApp"
+
+# values of boolean type (must be '0' or '1').
+# xml_parser.boolValue() is used for correct setting
+boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, interp_nam, except_nam )
+
+# values of list type
+listKeys = ( containers_nam, embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam )
+
+# return application version (uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION)
+def version():
+ root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found
+ root_dir = os.environ.get( 'GUI_ROOT_DIR', root_dir ) # GUI_ROOT_DIR or KERNEL_ROOT_DIR or "" if both not found
+ filename = root_dir+'/bin/salome/VERSION'
+ str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0"
+ match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str )
+ if match :
+ return match.group( 1 )
+ return ''
+
+# -----------------------------------------------------------------------------
+
+### xml reader for launch configuration file usage
+
+section_to_skip = ""
+
+class xml_parser:
+ def __init__(self, fileName, _opts ):
+ print "Processing ",fileName
+ self.space = []
+ self.opts = _opts
+ self.section = section_to_skip
+ parser = xml.sax.make_parser()
+ parser.setContentHandler(self)
+ parser.parse(fileName)
+ pass
+
+ def boolValue( self, str ):
+ if str in ("yes", "y", "1"):
+ return 1
+ elif str in ("no", "n", "0"):
+ return 0
+ else:
+ return str
+ pass
+
+ def startElement(self, name, attrs):
+ self.space.append(name)
+ self.current = None
+
+ # if we are analyzing "section" element and its "name" attribute is
+ # either "launch" or module name -- set section_name
+ if self.space == [doc_tag, sec_tag] and nam_att in attrs.getNames():
+ section_name = attrs.getValue( nam_att )
+ if section_name == lanch_nam:
+ self.section = section_name # launch section
+ elif self.opts.has_key( modules_nam ) and \
+ section_name in self.opts[ modules_nam ]:
+ self.section = section_name # <module> section
+ else:
+ self.section = section_to_skip # any other section
+ pass
+
+ # if we are analyzing "parameter" elements - children of either
+ # "section launch" or "section "<module>"" element, then store them
+ # in self.opts assiciative array (key = [<module>_ + ] value of "name" attribute)
+ elif self.section != section_to_skip and \
+ self.space == [doc_tag, sec_tag, par_tag] and \
+ nam_att in attrs.getNames() and \
+ val_att in attrs.getNames():
+ nam = attrs.getValue( nam_att )
+ val = attrs.getValue( val_att )
+ if self.section == lanch_nam: # key for launch section
+ key = nam
+ else: # key for <module> section
+ key = self.section + "_" + nam
+ if nam in boolKeys:
+ self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1
+ elif nam in listKeys:
+ self.opts[key] = val.split( ',' ) # assign list value: []
+ else:
+ self.opts[key] = val;
+ pass
+ pass
+
+ def endElement(self, name):
+ p = self.space.pop()
+ self.current = None
+ if self.section != section_to_skip and name == sec_tag:
+ self.section = section_to_skip
+ pass
+
+ def characters(self, content):
+ pass
+
+ def processingInstruction(self, target, data):
+ pass
+
+ def setDocumentLocator(self, locator):
+ pass
+
+ def startDocument(self):
+ self.read = None
+ pass
+
+ def endDocument(self):
+ self.read = None
+ pass
+
+# -----------------------------------------------------------------------------
+
+### searching for launch configuration files
+# the rule:
+# - environment variable {'appname'+'Config'} (SalomeAppConfig) contains list of directories (';' as devider)
+# - these directories contain 'appname'+'.xml' (SalomeApp.xml) configuration files
+# - these files are analyzed beginning with the last one (last directory in the list)
+# - if a key is found in next analyzed cofiguration file - it will be replaced
+# - the last configuration file to be analyzed - ~/.'appname'+'rc' (~/SalomeApprc) (if it exists)
+# - but anyway, if user specifies a certain option in a command line - it will replace the values
+# - specified in configuration file(s)
+# - once again the order of settings (next setting replaces the previous ones):
+# - SalomeApp.xml files in directories specified by SalomeAppConfig env variable
+# - .SalomeApprc file in user's catalogue
+# - command line
+
+config_var = appname+'Config'
+dirs = os.environ[config_var]
+dirs = re.split('[;|:]', dirs )
+dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
+
+_opts = {} # assiciative array of options to be filled
+
+# SalomeApp.xml files in directories specified by SalomeAppConfig env variable
+for dir in dirs:
+ filename = dir+'/'+appname+'.xml'
+ try:
+ p = xml_parser(filename, _opts)
+ _opts = p.opts
+ except:
+ print 'Can not read launch configuration file ', filename
+ continue
+
+# SalomeApprc file in user's catalogue
+filename = os.environ['HOME']+'/.'+appname+'rc.'+version()
+try:
+ p = xml_parser(filename, _opts)
+ _opts = p.opts
+except:
+ print 'Can not read launch configuration file ', filename
+
+
+args = _opts
+
+# --- setting default values of keys if they were NOT set in config files ---
+for aKey in listKeys:
+ if not args.has_key( aKey ):
+ args[aKey]=[]
+
+for aKey in boolKeys:
+ if not args.has_key( aKey ):
+ args[aKey]=0
+
+if args[file_nam]:
+ afile=args[file_nam]
+ args[file_nam]=[afile]
+
+args[appname_nam] = appname
+
+### searching for my port
+
+my_port = 2809
+try:
+ file = open(os.environ["OMNIORB_CONFIG"], "r")
+ s = file.read()
+ while len(s):
+ l = string.split(s, ":")
+ if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" :
+ my_port = int(l[len(l)-1])
+ pass
+ s = file.read()
+ pass
+except:
+ pass
+
+args[port_nam] = my_port
+
+# -----------------------------------------------------------------------------
+
+### command line options reader
+
+def options_parser(line):
+ source = line
+ list = []
+ for delimiter in [" ", ",", "="]:
+ for o in source:
+ list += string.split(o, delimiter)
+ pass
+ source = list
+ list = []
+ pass
+
+ #print "source=",source
+
+ result = {}
+ i = 0
+ while i < len(source):
+ if source[i][0] != '-':
+ key = None
+ elif source[i][1] == '-':
+ key = source[i][2]
+ else:
+ key = source[i][1]
+ pass
+
+ result[key] = []
+ if key:
+ i += 1
+ pass
+ while i < len(source) and source[i][0] != '-':
+ result[key].append(source[i])
+ i += 1
+ pass
+ pass
+ return result
+
+# -----------------------------------------------------------------------------
+
+### read command-line options : each arg given in command line supersedes arg from xml config file
+cmd_opts = {}
+try:
+ cmd_opts = options_parser(sys.argv[1:])
+ #print "opts=",cmd_opts
+ kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+except:
+ cmd_opts["h"] = 1
+ pass
+
+### check all options are right
+
+opterror=0
+for opt in cmd_opts:
+ if not opt in ("h","g","l","f","x","m","e","s","c","p","k","t","i","r"):
+ print "command line error: -", opt
+ opterror=1
+
+if opterror == 1:
+ cmd_opts["h"] = 1
+
+if cmd_opts.has_key("h"):
+ print """USAGE: runSalome.py [options]
+ [command line options] :
+ --help or -h : print this help
+ --gui or -g : launching with GUI
+ --terminal -t : launching without gui (to deny --gui)
+ --logger or -l : redirect messages in a CORBA collector
+ --file=filename or -f=filename: redirect messages in a log file
+ --xterm or -x : execute servers in xterm console (messages appear in xterm windows)
+ --modules=module1,module2,... : salome module list (modulen is the name of Salome module to load)
+ or -m=module1,module2,...
+ --embedded=registry,study,moduleCatalog,cppContainer
+ or -e=registry,study,moduleCatalog,cppContainer
+ : embedded CORBA servers (default: registry,study,moduleCatalog,cppContainer)
+ : (logger,pyContainer,supervContainer can't be embedded
+ --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer
+ or -s=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer
+ : standalone CORBA servers (default: pyContainer,supervContainer)
+ --containers=cpp,python,superv: (obsolete) launching of containers cpp, python and supervision
+ or -c=cpp,python,superv : = get default from -e and -s
+ --portkill or -p : kill the salome with current port
+ --killall or -k : kill all salome sessions
+ --interp=n or -i=n : number of additional xterm to open, with session environment
+ -z : display splash screen
+ -r : disable centralized exception handling mechanism
+
+ For each Salome module, the environment variable <modulen>_ROOT_DIR must be set.
+ The module name (<modulen>) must be uppercase.
+ KERNEL_ROOT_DIR is mandatory.
+ """
+ sys.exit(1)
+ pass
+
+### apply command-line options to the arguments
+for opt in cmd_opts:
+ if opt == 'g':
+ args[gui_nam] = 1
+ elif opt == 'z':
+ args[splash_nam] = 1
+ elif opt == 'r':
+ args[except_nam] = 1
+ elif opt == 'l':
+ args[logger_nam] = 1
+ elif opt == 'f':
+ args[file_nam] = cmd_opts['f']
+ elif opt == 'x':
+ args[xterm_nam] = 1
+ elif opt == 'i':
+ args[interp_nam] = cmd_opts['i']
+ elif opt == 'm':
+ args[modules_nam] = cmd_opts['m']
+ elif opt == 'e':
+ args[embedded_nam] = cmd_opts['e']
+ elif opt == 's':
+ args[standalone_nam] = cmd_opts['s']
+ elif opt == 'c':
+ args[containers_nam] = cmd_opts['c']
+ elif opt == 'p':
+ args[portkill_nam] = 1
+ elif opt == 'k':
+ args[killall_nam] = 1
+ pass
+ pass
+
+# 'terminal' must be processed in the end: to deny any 'gui' options
+if 't' in cmd_opts:
+ args[gui_nam] = 0
+ pass
+
+#print "args=",args
--- /dev/null
+import sys,os,time
+import string
+from omniORB import CORBA
+
+# Import the stubs for the Naming service
+import CosNaming
+
+# -----------------------------------------------------------------------------
+
+class Server:
+ XTERM="/usr/bin/X11/xterm -iconic -e "
+ CMD=""
+
+ def run(self):
+ commande=self.XTERM+self.CMD
+ print commande
+ ier=os.system(commande)
+ if ier:print "Commande failed"
+
+# -----------------------------------------------------------------------------
+
+class NamingServer(Server):
+ XTERM=""
+ USER=os.getenv('USER')
+ if USER is None:
+ USER='anonymous'
+ os.system("mkdir -m 777 -p /tmp/logs")
+ LOGDIR="/tmp/logs/" + USER
+ os.system("mkdir -m 777 -p " + LOGDIR)
+ CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1"
+
+# -----------------------------------------------------------------------------
+
+class client:
+
+ def __init__(self):
+ # Initialise the ORB
+ self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+ # Initialise the Naming Service
+ self.initNS()
+
+ # --------------------------------------------------------------------------
+
+ def initNS(self):
+ # Obtain a reference to the root naming context
+ obj = self.orb.resolve_initial_references("NameService")
+ try:
+ self.rootContext = obj._narrow(CosNaming.NamingContext)
+ return
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ self.rootContext = None
+ print "Lancement du Naming Service",
+
+ # On lance le Naming Server (doit etre dans le PATH)
+ NamingServer().run()
+ print "Searching Naming Service ",
+ ncount=0
+ delta=0.1
+ while(ncount < 10):
+ ncount += 1
+ try:
+ obj = self.orb.resolve_initial_references("NameService")
+ self.rootContext = obj._narrow(CosNaming.NamingContext)
+ break
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ self.rootContext = None
+ sys.stdout.write('+')
+ sys.stdout.flush()
+ time.sleep(delta)
+
+ if self.rootContext is None:
+ print "Failed to narrow the root naming context"
+ sys.exit(1)
+ print " found in %s seconds " % ((ncount-1)*delta)
+
+ # --------------------------------------------------------------------------
+
+ def showNScontext(self,context,dec=''):
+ bl,bi=context.list(0)
+ if bi is not None:
+ ok,b=bi.next_one()
+ while(ok):
+ for s in b.binding_name :
+ print "%s%s.%s" %(dec,s.id,s.kind)
+ if s.kind == "dir":
+ obj=context.resolve([s])
+ scontext = obj._narrow(CosNaming.NamingContext)
+ self.showNScontext(scontext,dec=dec+' ')
+ ok,b=bi.next_one()
+
+ # --------------------------------------------------------------------------
+
+ def showNS(self):
+ """ Show the content of NS"""
+ self.showNScontext(self.rootContext)
+
+ # --------------------------------------------------------------------------
+
+ def Resolve(self, Path):
+ resolve_path=string.split(Path,'/')
+ if resolve_path[0] == '': del resolve_path[0]
+ dir_path=resolve_path[:-1]
+ context_name=[]
+ for e in dir_path:
+ context_name.append(CosNaming.NameComponent(e,"dir"))
+ context_name.append(CosNaming.NameComponent(resolve_path[-1],"object"))
+
+ try:
+ obj = self.rootContext.resolve(context_name)
+ except CosNaming.NamingContext.NotFound, ex:
+ obj = None
+ except CosNaming.NamingContext.InvalidName, ex:
+ obj = None
+ except CosNaming.NamingContext.CannotProceed, ex:
+ obj = None
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ obj = None
+ return obj
+
+ # --------------------------------------------------------------------------
+
+ def waitNS(self,name,typobj=None,maxcount=60):
+ count=0
+ delta=0.5
+ print "Searching %s in Naming Service " % name,
+ while(1):
+ count += 1
+ if count > maxcount : raise "Impossible de trouver %s" % name
+ obj=self.Resolve(name)
+ if obj :
+ print " found in %s seconds " % ((count-1)*delta)
+ break
+ else:
+ sys.stdout.write('+')
+ sys.stdout.flush()
+ time.sleep(delta)
+
+ if typobj is None:return obj
+
+ nobj = obj._narrow(typobj)
+ if nobj is None:
+ print "%s exists but is not a %s" % (name,typobj)
+ return nobj
+ def waitNSPID(self, theName, thePID, theTypObj = None):
+ aCount = 0
+ aDelta = 0.5
+ anObj = None
+ print "Searching %s in Naming Service " % theName,
+ while(1):
+ try:
+ aPid, aStatus = os.waitpid(thePID,os.WNOHANG)
+ except Exception, exc:
+ raise "Impossible de trouver %s" % theName
+ aCount += 1
+ anObj = self.Resolve(theName)
+ if anObj:
+ print " found in %s seconds " % ((aCount-1)*aDelta)
+ break
+ else:
+ sys.stdout.write('+')
+ sys.stdout.flush()
+ time.sleep(aDelta)
+ pass
+ pass
+
+ if theTypObj is None:
+ return anObj
+
+ anObject = anObj._narrow(theTypObj)
+ if anObject is None:
+ print "%s exists but is not a %s" % (theName,theTypObj)
+ return anObject
+
+
+ # --------------------------------------------------------------------------
+
+ def ResolveLogger(self, name):
+ context_name=[]
+ context_name.append(CosNaming.NameComponent(name,""))
+
+ try:
+ obj = self.rootContext.resolve(context_name)
+ except CosNaming.NamingContext.NotFound, ex:
+ obj = None
+ except CosNaming.NamingContext.InvalidName, ex:
+ obj = None
+ except CosNaming.NamingContext.CannotProceed, ex:
+ obj = None
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ obj = None
+ return obj
+
+ # --------------------------------------------------------------------------
+
+ def waitLogger(self,name,typobj=None,maxcount=40):
+ count=0
+ delta=0.5
+ print "Searching %s in Naming Service " % name,
+ while(1):
+ count += 1
+ if count > maxcount : raise "Impossible de trouver %s" % name
+ obj=self.ResolveLogger(name)
+ if obj :
+ print " found in %s seconds " % ((count-1)*delta)
+ break
+ else:
+ sys.stdout.write('+')
+ sys.stdout.flush()
+ time.sleep(delta)
+
+ if typobj is None:return obj
+
+ nobj = obj._narrow(typobj)
+ if nobj is None:
+ print "%s exists but is not a %s" % (name,typobj)
+ return nobj
+
--- /dev/null
+#!/usr/bin/env python
+
+import sys, os, string, glob, time, pickle
+import orbmodule
+
+process_id = {}
+
+# salome_subdir variable is used for composing paths like $KERNEL_ROOT_DIR/share/salome/resources, etc.
+# before moving to SUIT-based gui, instead of salome_subdir there was args['appname'] used.
+# but after - 'appname' = "SalomeApp", so using it in making the subdirectory is an error.
+salome_subdir = "salome"
+
+# -----------------------------------------------------------------------------
+
+def add_path(directory, variable_name):
+ """Function helper to add environment variables"""
+ if not os.environ.has_key(variable_name):
+ os.environ[variable_name] = ""
+ pass
+ if os.path.exists(directory):
+ newpath=[]
+ for _dir in os.environ[variable_name].split(":"):
+ if os.path.exists(_dir):
+ if not os.path.samefile(_dir, directory):
+ newpath.append(_dir)
+ else:
+ if os.path.abspath(_dir) != os.path.abspath(directory):
+ newpath.append(_dir)
+ pass
+ import string
+ newpath[:0] = [ directory ]
+ newpath = string.join(newpath,":")
+ os.environ[variable_name] = newpath
+ if variable_name == "PYTHONPATH":
+ sys.path[:0] = [directory]
+
+# -----------------------------------------------------------------------------
+
+def get_config():
+ """
+ Get list of modules, paths.
+
+ Read args from launch configure xml file and command line options.
+ Check variables <module>_ROOT_DIR and set list of used modules.
+ Return args, modules_list, modules_root_dir
+ """
+
+ # read args from launch configure xml file and command line options
+
+ import launchConfigureParser
+ args = launchConfigureParser.args
+
+ # Check variables <module>_ROOT_DIR
+ # and set list of used modules (without KERNEL)
+
+ modules_list = []
+ if args.has_key("modules"):
+ modules_list += args["modules"]
+ # KERNEL must be last in the list to locate it at the first place in PATH
+ modules_list[:0] = ["GUI"]
+ modules_list[:0] = ["KERNEL"]
+ modules_list.reverse()
+
+ modules_root_dir = {}
+
+ to_remove_list=[]
+ for module in modules_list :
+ module_variable=module.upper()+"_ROOT_DIR"
+ if not os.environ.has_key(module_variable):
+ print "*******************************************************"
+ print "*"
+ print "* Environment variable",module_variable,"must be set"
+ print "* Module", module, "will be not available"
+ print "*"
+ print "********************************************************"
+ to_remove_list.append(module)
+ continue
+ pass
+ module_root_dir = os.environ[module_variable]
+ modules_root_dir[module]=module_root_dir
+
+ for to_remove in to_remove_list:
+ modules_list.remove(to_remove)
+
+ while "KERNEL" in modules_list:
+ modules_list.remove("KERNEL")
+ pass
+
+ while "GUI" in modules_list:
+ modules_list.remove("GUI")
+ pass
+
+ if "SUPERV" in modules_list and not 'superv' in args['standalone']:
+ args['standalone'].append("superv")
+ pass
+
+ return args, modules_list, modules_root_dir
+
+# -----------------------------------------------------------------------------
+
+def set_env(args, modules_list, modules_root_dir):
+ """Add to the PATH-variables modules specific paths"""
+
+ python_version="python%d.%d" % sys.version_info[0:2]
+ modules_root_dir_list = []
+ modules_list = modules_list[:] + ["GUI"]
+ modules_list = modules_list[:] + ["KERNEL"]
+ for module in modules_list :
+ if modules_root_dir.has_key(module):
+ module_root_dir = modules_root_dir[module]
+ modules_root_dir_list[:0] = [module_root_dir]
+ add_path(os.path.join(module_root_dir,"lib",salome_subdir),
+ "LD_LIBRARY_PATH")
+ add_path(os.path.join(module_root_dir,"bin",salome_subdir),
+ "PATH")
+ if os.path.exists(module_root_dir + "/examples") :
+ add_path(os.path.join(module_root_dir,"examples"),
+ "PYTHONPATH")
+ pass
+ add_path(os.path.join(module_root_dir,"bin",salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(module_root_dir,"lib",
+ python_version,"site-packages",
+ salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(module_root_dir,"lib",salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(module_root_dir,"lib",
+ python_version,"site-packages",
+ salome_subdir,
+ "shared_modules"),
+ "PYTHONPATH")
+ pass
+ pass
+
+
+ os.environ["SALOMEPATH"]=":".join(modules_root_dir_list)
+
+ # set trace environment variable
+
+ if not os.environ.has_key("SALOME_trace"):
+ os.environ["SALOME_trace"]="local"
+ if args['file']:
+ os.environ["SALOME_trace"]="file:"+args['file'][0]
+ if args['logger']:
+ os.environ["SALOME_trace"]="with_logger"
+
+ # set environment for SMESH plugins
+
+ if "SMESH" in modules_list:
+ os.environ["SMESH_MeshersList"]="StdMeshers"
+ if not os.environ.has_key("SALOME_StdMeshersResources"):
+ os.environ["SALOME_StdMeshersResources"] \
+ = modules_root_dir["SMESH"]+"/share/"+args["appname"]+"/resources"
+ pass
+ if args.has_key("SMESH_plugins"):
+ for plugin in args["SMESH_plugins"]:
+ if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+ os.environ["SMESH_MeshersList"] \
+ = os.environ["SMESH_MeshersList"]+":"+plugin
+ plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
+ if not os.environ.has_key("SALOME_"+plugin+"Resources"):
+ os.environ["SALOME_"+plugin+"Resources"] \
+ = plugin_root+"/share/"+args["appname"]+"/resources"
+ add_path(os.path.join(plugin_root,"lib",python_version,
+ "site-packages",salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(plugin_root,"lib",salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(plugin_root,"lib",salome_subdir),
+ "LD_LIBRARY_PATH")
+ add_path(os.path.join(plugin_root,"bin",salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(plugin_root,"bin",salome_subdir),
+ "PATH")
+ pass
+ pass
+
+ # set environment for SUPERV module
+ os.environ["ENABLE_MACRO_NODE"]="1"
+ # set resources variables if not yet set
+ if os.getenv("GUI_ROOT_DIR"):
+ if not os.getenv("SUITRoot"): os.environ["SUITRoot"] = os.getenv("GUI_ROOT_DIR") + "/share/salome"
+ if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources"
+ pass
+
+ # set CSF_PluginDefaults variable only if it is not customized
+ # by the user
+ if not os.getenv("CSF_PluginDefaults"):
+ os.environ["CSF_PluginDefaults"] \
+ = os.path.join(modules_root_dir["KERNEL"],"share",
+ salome_subdir,"resources")
+ os.environ["CSF_SALOMEDS_ResourcesDefaults"] \
+ = os.path.join(modules_root_dir["KERNEL"],"share",
+ salome_subdir,"resources")
+
+ if "GEOM" in modules_list:
+ print "GEOM OCAF Resources"
+ os.environ["CSF_GEOMDS_ResourcesDefaults"] \
+ = os.path.join(modules_root_dir["GEOM"],"share",
+ salome_subdir,"resources")
+ print "GEOM Shape Healing Resources"
+ os.environ["CSF_ShHealingDefaults"] \
+ = os.path.join(modules_root_dir["GEOM"],"share",
+ salome_subdir,"resources")
+
+# -----------------------------------------------------------------------------
+
+from killSalome import killAllPorts
+
+def killLocalPort():
+ """
+ kill servers from a previous SALOME exection, if needed,
+ on the CORBA port given in args of runSalome
+ """
+
+ from killSalomeWithPort import killMyPort
+ my_port=str(args['port'])
+ try:
+ killMyPort(my_port)
+ except:
+ print "problem in killLocalPort()"
+ pass
+ pass
+
+def givenPortKill(port):
+ """
+ kill servers from a previous SALOME exection, if needed,
+ on the same CORBA port
+ """
+
+ from killSalomeWithPort import killMyPort
+ my_port=port
+ try:
+ killMyPort(my_port)
+ except:
+ print "problem in LocalPortKill(), killMyPort("<<port<<")"
+ pass
+ pass
+
+def kill_salome(args):
+ """
+ Kill servers from previous SALOME executions, if needed;
+ depending on args 'killall' or 'portkill', kill all executions,
+ or only execution on the same CORBA port
+ """
+
+ if args['killall']:
+ killAllPorts()
+ elif args['portkill']:
+ givenPortKill(str(args['port']))
+
+# -----------------------------------------------------------------------------
+#
+# Definition des classes d'objets pour le lancement des Server CORBA
+#
+
+class Server:
+ """Generic class for CORBA server launch"""
+
+ def initArgs(self):
+ self.PID=None
+ self.CMD=[]
+ self.ARGS=[]
+ if self.args['xterm']:
+ self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold']
+
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+
+
+ def run(self):
+ global process_id
+ myargs=self.ARGS
+ if self.args['xterm']:
+ # (Debian) send LD_LIBRARY_PATH to children shells (xterm)
+ env_ld_library_path=['env', 'LD_LIBRARY_PATH='
+ + os.getenv("LD_LIBRARY_PATH")]
+ myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
+ command = myargs + self.CMD
+ print "command = ", command
+ pid = os.spawnvp(os.P_NOWAIT, command[0], command)
+ process_id[pid]=self.CMD
+ self.PID = pid
+
+
+class InterpServer(Server):
+ def __init__(self,args):
+ self.args=args
+ env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
+ self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
+ #self.CMD=['xterm', '-e', 'python']
+
+ def run(self):
+ global process_id
+ command = self.CMD
+ #print "command = ", command
+ pid = os.spawnvp(os.P_NOWAIT, command[0], command)
+ process_id[pid]=self.CMD
+ self.PID = pid
+
+# ---
+
+class CatalogServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.SCMD1=['SALOME_ModuleCatalog_Server','-common']
+ self.SCMD2=[]
+ home_dir=os.getenv('HOME')
+ if home_dir is not None:
+ self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
+
+ def setpath(self,modules_list,modules_root_dir):
+ cata_path=[]
+ list_modules = modules_list[:]
+ list_modules.reverse()
+ for module in ["KERNEL", "GUI"] + list_modules:
+ if modules_root_dir.has_key(module):
+ module_root_dir=modules_root_dir[module]
+ module_cata=module+"Catalog.xml"
+ #print " ", module_cata
+ cata_path.extend(
+ glob.glob(os.path.join(module_root_dir,
+ "share",salome_subdir,
+ "resources",module_cata)))
+ pass
+ pass
+ self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+
+# ---
+
+class SalomeDSServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOMEDS_Server']
+
+# ---
+
+class RegistryServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+
+# ---
+
+class ContainerCPPServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_Container','FactoryServer']
+
+# ---
+
+class ContainerPYServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_ContainerPy.py','FactoryServerPy']
+
+# ---
+
+class ContainerSUPERVServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_Container','SuperVisionContainer']
+
+# ---
+
+class LoggerServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_Logger_Server', 'logger.log']
+
+# ---
+
+class SessionServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.SCMD1=['SALOME_Session_Server']
+ self.SCMD2=[]
+ if 'registry' in self.args['embedded']:
+ self.SCMD1+=['--with','Registry',
+ '(','--salome_session','theSession',')']
+ if 'moduleCatalog' in self.args['embedded']:
+ self.SCMD1+=['--with','ModuleCatalog','(','-common']
+ home_dir=os.getenv('HOME')
+ if home_dir is not None:
+ self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
+ self.SCMD2+=[')']
+ if 'study' in self.args['embedded']:
+ self.SCMD2+=['--with','SALOMEDS','(',')']
+ if 'cppContainer' in self.args['embedded']:
+ self.SCMD2+=['--with','Container','(','FactoryServer',')']
+ if 'SalomeAppEngine' in self.args['embedded']:
+ self.SCMD2+=['--with','SalomeAppEngine','(',')']
+
+ if 'cppContainer' in self.args['standalone'] or 'cppContainer' in self.args['embedded']:
+ self.SCMD2+=['CPP']
+ if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']:
+ self.SCMD2+=['PY']
+ if 'supervContainer' in self.args['containers'] or 'supervContainer' in self.args['standalone']:
+ self.SCMD2+=['SUPERV']
+ if self.args['gui']:
+ self.SCMD2+=['GUI']
+ if self.args['splash']:
+ self.SCMD2+=['SPLASH']
+ if self.args['noexcepthandler']:
+ self.SCMD2+=['noexcepthandler']
+ if self.args.has_key('modules'):
+ self.SCMD2+=['--modules (']
+ for mod in self.args['modules']:
+ self.SCMD2+=[mod + ':']
+ self.SCMD2+=[')']
+
+ def setpath(self,modules_list,modules_root_dir):
+ cata_path=[]
+ list_modules = modules_list[:]
+ list_modules.reverse()
+ for module in ["KERNEL", "GUI"] + list_modules:
+ module_root_dir=modules_root_dir[module]
+ module_cata=module+"Catalog.xml"
+ #print " ", module_cata
+ cata_path.extend(
+ glob.glob(os.path.join(module_root_dir,"share",
+ salome_subdir,"resources",
+ module_cata)))
+ if 'moduleCatalog' in self.args['embedded']:
+ self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+ else:
+ self.CMD=self.SCMD1 + self.SCMD2
+
+# ---
+
+class ContainerManagerServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.SCMD1=['SALOME_ContainerManagerServer']
+ self.SCMD2=[]
+ if 'registry' in self.args['embedded']:
+ self.SCMD1+=['--with','Registry',
+ '(','--salome_session','theSession',')']
+ if 'moduleCatalog' in self.args['embedded']:
+ self.SCMD1+=['--with','ModuleCatalog','(','-common']
+ self.SCMD2+=['-personal',
+ '${HOME}/Salome/resources/CatalogModulePersonnel.xml',')']
+ if 'study' in self.args['embedded']:
+ self.SCMD2+=['--with','SALOMEDS','(',')']
+ if 'cppContainer' in self.args['embedded']:
+ self.SCMD2+=['--with','Container','(','FactoryServer',')']
+
+ def setpath(self,modules_list,modules_root_dir):
+ cata_path=[]
+ list_modules = modules_list[:]
+ list_modules.reverse()
+ for module in ["KERNEL", "GUI"] + list_modules:
+ if modules_root_dir.has_key(module):
+ module_root_dir=modules_root_dir[module]
+ module_cata=module+"Catalog.xml"
+ #print " ", module_cata
+ cata_path.extend(
+ glob.glob(os.path.join(module_root_dir,"share",
+ self.args['appname'],"resources",
+ module_cata)))
+ pass
+ pass
+ if 'moduleCatalog' in self.args['embedded']:
+ self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+ else:
+ self.CMD=self.SCMD1 + self.SCMD2
+
+class NotifyServer(Server):
+ def __init__(self,args,modules_root_dir):
+ self.args=args
+ self.initArgs()
+ self.modules_root_dir=modules_root_dir
+ myLogName = os.environ["LOGNAME"]
+ self.CMD=['notifd','-c',
+ self.modules_root_dir["KERNEL"] +'/share/salome/resources/channel.cfg',
+ '-DFactoryIORFileName=/tmp/'+myLogName+'_rdifact.ior',
+ '-DChannelIORFileName=/tmp/'+myLogName+'_rdichan.ior',
+ '-DReportLogFile=/tmp/'+myLogName+'_notifd.report',
+ '-DDebugLogFile=/tmp/'+myLogName+'_notifd.debug',
+ ]
+
+#
+# -----------------------------------------------------------------------------
+
+def startGUI():
+ """Salome Session Graphic User Interface activation"""
+ import SALOME
+ import SALOME_Session_idl
+ session=clt.waitNS("/Kernel/Session",SALOME.Session)
+ session.GetInterface()
+
+# -----------------------------------------------------------------------------
+
+def startSalome(args, modules_list, modules_root_dir):
+ """Launch all SALOME servers requested by args"""
+ init_time = os.times()
+
+ print "startSalome ", args
+
+ #
+ # Initialisation ORB et Naming Service
+ #
+
+ clt=orbmodule.client()
+
+ # (non obligatoire) Lancement Logger Server
+ # et attente de sa disponibilite dans le naming service
+ #
+
+ if args['logger']:
+ myServer=LoggerServer(args)
+ myServer.run()
+ clt.waitLogger("Logger")
+
+ # Notify Server launch
+ #
+
+ print "Notify Server to launch"
+
+ myServer=NotifyServer(args,modules_root_dir)
+ myServer.run()
+
+ #
+ # Lancement Registry Server,
+ # attente de la disponibilite du Registry dans le Naming Service
+ #
+
+ if 'registry' not in args['embedded']:
+ myServer=RegistryServer(args)
+ myServer.run()
+ clt.waitNSPID("/Registry",myServer.PID)
+
+ #
+ # Lancement Catalog Server,
+ # attente de la disponibilite du Catalog Server dans le Naming Service
+ #
+
+
+ if 'moduleCatalog' not in args['embedded']:
+ cataServer=CatalogServer(args)
+ cataServer.setpath(modules_list,modules_root_dir)
+ cataServer.run()
+ import SALOME_ModuleCatalog
+ clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)
+
+ #
+ # Lancement SalomeDS Server,
+ # attente de la disponibilite du SalomeDS dans le Naming Service
+ #
+
+ #print "ARGS = ",args
+ if 'study' not in args['embedded']:
+ print "RunStudy"
+ myServer=SalomeDSServer(args)
+ myServer.run()
+ clt.waitNSPID("/myStudyManager",myServer.PID)
+
+ #
+ # Lancement ContainerManagerServer
+ #
+
+ myCmServer = ContainerManagerServer(args)
+ myCmServer.setpath(modules_list,modules_root_dir)
+ myCmServer.run()
+
+
+ from Utils_Identity import getShortHostName
+
+ if os.getenv("HOSTNAME") == None:
+ if os.getenv("HOST") == None:
+ os.environ["HOSTNAME"]=getShortHostName()
+ else:
+ os.environ["HOSTNAME"]=os.getenv("HOST")
+
+ theComputer = getShortHostName()
+
+ #
+ # Lancement Container C++ local,
+ # attente de la disponibilite du Container C++ local dans le Naming Service
+ #
+
+ if 'cppContainer' in args['standalone']:
+ myServer=ContainerCPPServer(args)
+ myServer.run()
+ clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)
+
+ #
+ # Lancement Container Python local,
+ # attente de la disponibilite du Container Python local
+ # dans le Naming Service
+ #
+
+ if 'pyContainer' in args['standalone']:
+ myServer=ContainerPYServer(args)
+ myServer.run()
+ clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID)
+
+ #
+ # Lancement Container Supervision local,
+ # attente de la disponibilite du Container Supervision local
+ # dans le Naming Service
+ #
+
+ if 'supervContainer' in args['standalone']:
+ myServer=ContainerSUPERVServer(args)
+ myServer.run()
+ clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID)
+
+ #
+ # Lancement Session Server
+ #
+
+ mySessionServ = SessionServer(args)
+ mySessionServ.setpath(modules_list,modules_root_dir)
+ mySessionServ.run()
+##----------------
+
+ # Attente de la disponibilite du Session Server dans le Naming Service
+ #
+
+ import SALOME
+ import SALOME_Session_idl
+ session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session)
+
+ end_time = os.times()
+ print
+ print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4]
+ - init_time[4])
+
+ # ASV start GUI without Loader
+ #if args['gui']:
+ # session.GetInterface()
+
+ #
+ # additionnal external python interpreters
+ #
+ nbaddi=0
+
+ try:
+ if 'interp' in args:
+ if args['interp']:
+ nbaddi = int(args['interp'][0])
+ except:
+ import traceback
+ traceback.print_exc()
+ print "-------------------------------------------------------------"
+ print "-- to get an external python interpreter:runSalome --interp=1"
+ print "-------------------------------------------------------------"
+
+ print "additional external python interpreters: ", nbaddi
+ if nbaddi:
+ for i in range(nbaddi):
+ print "i=",i
+ anInterp=InterpServer(args)
+ anInterp.run()
+
+ return clt
+
+# -----------------------------------------------------------------------------
+
+def useSalome(args, modules_list, modules_root_dir):
+ """
+ Launch all SALOME servers requested by args,
+ save list of process, give info to user,
+ show registered objects in Naming Service.
+ """
+
+ clt=None
+ try:
+ clt = startSalome(args, modules_list, modules_root_dir)
+ except:
+ import traceback
+ traceback.print_exc()
+ print
+ print
+ print "--- erreur au lancement Salome ---"
+
+ #print process_id
+
+ from killSalomeWithPort import getPiDict
+ filedict = getPiDict(args['port'])
+
+ process_ids = []
+ try:
+ fpid=open(filedict, 'r')
+ process_ids=pickle.load(fpid)
+ fpid.close()
+ except:
+ pass
+
+ fpid=open(filedict, 'w')
+ process_ids.append(process_id)
+ pickle.dump(process_ids,fpid)
+ fpid.close()
+
+ print """
+ Saving of the dictionary of Salome processes in %s
+ To kill SALOME processes from a console (kill all sessions from all ports):
+ python killSalome.py
+ To kill SALOME from the present interpreter, if it is not closed :
+ killLocalPort() --> kill this session
+ (use CORBA port from args of runSalome)
+ givenPortKill(port) --> kill a specific session with given CORBA port
+ killAllPorts() --> kill all sessions
+
+ runSalome, with --killall option, starts with killing
+ the processes resulting from the previous execution.
+ """%filedict
+
+ #
+ # Impression arborescence Naming Service
+ #
+
+ if clt != None:
+ print
+ print " --- registered objects tree in Naming Service ---"
+ clt.showNS()
+
+ return clt
+
+# -----------------------------------------------------------------------------
+
+def registerEnv(args, modules_list, modules_root_dir):
+ """
+ Register args, modules_list, modules_root_dir in a file
+ for further use, when SALOME is launched embedded in an other application.
+ """
+ fileEnv = '/tmp/' + os.getenv('USER') + "_" + str(args['port']) \
+ + '_' + args['appname'].upper() + '_env'
+ fenv=open(fileEnv,'w')
+ pickle.dump((args, modules_list, modules_root_dir),fenv)
+ fenv.close()
+ os.environ["SALOME_LAUNCH_CONFIG"] = fileEnv
+
+# -----------------------------------------------------------------------------
+
+def no_main():
+ """Salome Launch, when embedded in other application"""
+ fileEnv = os.environ["SALOME_LAUNCH_CONFIG"]
+ fenv=open(fileEnv,'r')
+ args, modules_list, modules_root_dir = pickle.load(fenv)
+ fenv.close()
+ kill_salome(args)
+ clt = useSalome(args, modules_list, modules_root_dir)
+ return clt
+
+# -----------------------------------------------------------------------------
+
+def main():
+ """Salome launch as a main application"""
+ args, modules_list, modules_root_dir = get_config()
+ kill_salome(args)
+ set_env(args, modules_list, modules_root_dir)
+ clt = useSalome(args, modules_list, modules_root_dir)
+ return clt,args
+
+# -----------------------------------------------------------------------------
+
+if __name__ == "__main__":
+ import user
+ clt,args = main()
--- /dev/null
+
+======================================================================
+SALOME Application Concept. Configuration for one or more computers
+======================================================================
+
+*html version of this document is produced with docutils*::
+
+ rest2html < doc.txt > doc.html
+
+This document corresponds to SALOME2 3.1. (alpha version)
+
++-------------------------------------------+
+| **WORK in PROGRESS, INCOMPLETE DOCUMENT** |
++-------------------------------------------+
+
+The following explains how to configure your own application with your list of
+modules, how to define and run this application on one or more computers.
+
+Summary
+-------
+
+`1. General principles`_
+
+`2. Application Directory`_
+
+`2.1 Proposal for env.d scripts`_
+
+`2.2 User run scripts`_
+
+`2.3 SALOME internal run script`_
+
+`2.4 Other configuration files`_
+
+1. General principles
+---------------------
+
+A SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...).
+
+A SALOME User can define several SALOME Applications. These applications are
+runnable from the same user account. These applications may share the same
+KERNEL and modules. Thus, the application configuration is independant of
+KERNEL and must not be put in KERNEL_ROOT_DIR.
+
+Furthermore, prerequisites may not be the same on all the applications.
+
+A SALOME Session can run on a several computers.
+
+Binary modules and prerequisites are installed on the different computers.
+There is no need to have all the modules on each computer (the minimum is
+KERNEL).
+
+There is no need of standardization or centralised information on the details
+of configuration on each computer (PATH, LD_LIBRARY_PATH, environment
+variables) provided the application modules are version - compatible. Details
+of configuration stay private to the computer, and are held by scripts on each
+computer.
+
+There is no hierarchy between the computers (for example only one master
+computer used to launch application).
+
+The SALOME user has an account on all the computers. Access between
+account@computer is via rsh or ssh and must be configured for use without
+password (key exchange for ssh). Account may be different on each
+computer.
+
+2. Application Directory
+------------------------
+
+The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/salome creates an
+application directory with the given path in parameter. ${APPLI} is a path
+relative to ${HOME}.
+
+The directory is only a skeleton, the user has to edit several files to
+configure his own application. These files are described after, the list is:
+
+- env.d/atFirst.sh
+- env.d/envProducts.sh
+- env.d/envSalome.sh
+- CatalogResources.xml
+- SalomeApp.xml
+
+Directory ${APPLI} must be created on each computer of the application.
+The easiest way is to use the same relative path (to ${HOME}) on each computer.
+(Sometimes it is not possible to use the same path everywhere, for instance
+when ${HOME} is shared with NFS, so it is possible to define different path
+following the computers).
+
+The ${APPLI} directory contains scripts for environment and runs. Environment
+scripts must be configured (by the user) on each computer. All the environment
+scripts are in the ${APPLI}/env.d directory.
+
+The script ${APPLI}/envd sources **all** the files in ${APPLI}/env.d in
+alphanumeric order (after edition, think to remove backup files). the envd
+script is used by run scripts.
+
+
+2.1 Proposal for env.d scripts
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Each user **must define** his own configuration for these scripts, following
+the above rules. **The following is only an example not working as it is**.
+
+atFirst.sh
+ Sets the computer configuration not directly related to SALOME,
+ like useful tools, default PATH.
+
+envProducts.sh
+ Sets the SALOME prerequisites.
+
+envSALOME.sh
+ Sets all the MODULE_ROOT_DIR that can be used in the SALOME application.
+
+ SalomeAppConfig is also defined by::
+
+ export SalomeAppConfig=${HOME}/${APPLI}
+
+ where SalomeAppConfig designates the directory containing SalomeApp.xml.
+ Note that ${APPLI} is already defined by the calling scripts when
+ env.d/envSalome.sh is sourced.
+
+2.2 User run scripts
+~~~~~~~~~~~~~~~~~~~~
+
+The SALOME user can use 4 scripts:
+
+runAppli
+ Launches a SALOME Session
+ (similar to ${KERNEL_ROOT_DIR}/bin/salome/runSalome but with a different
+ name to avoid confusions).
+
+runSession
+ Launches a shell script in the SALOME application environment, with access
+ to the current SALOME session (naming service), if any.
+ Without arguments, the script is interactive. With arguments, the script
+ executes the command in the SALOME application environment.
+
+runConsole
+ Gives a python console connected to the current SALOME Session.
+ It is also possible to use runSession, then python.
+
+runTests
+ Similar to runSession, used for unit testing. runSession tries to use an
+ already existing naming service definition from a running session (hostname
+ and port number), runTests defines a new configuration for naming service
+ (new port number).
+
+2.3 SALOME internal run scripts
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+envd
+ Sets SALOME application environment, envd is sourced by other scripts.
+
+For remote calls, SALOME uses one script.
+
+runRemote.sh
+ This script is mainly used to launch containers. The first 2 arguments
+ define the hostname and port userd for naming service, the remaining
+ arguments define the command to execute.
+
+2.4 Other configuration files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+SalomeApp.xml
+ This file is similar to the default given
+ in ${GUI_ROOT_DIR}/share/salome/resources
+
+CatalogRessources.xml
+ This files describes all the computer the application can use. The given
+ example is minimal and suppose ${APPLI} is the same relative path
+ to ${HOME}, on all the computers. A different directory can be set on a
+ particular computer with a line::
+
+ appliPath="my/specific/path/on/this/computer"
+
+
+
--- /dev/null
+# Doxyfile 1.3-rc1
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "SALOME v.3.1.0"
+PROJECT_NUMBER = id#1.1
+OUTPUT_DIRECTORY = ../
+OUTPUT_LANGUAGE = English
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = NO
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+SHORT_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+VERBATIM_HEADERS = YES
+SHOW_INCLUDE_FILES = YES
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 5
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES =
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 25
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = YES
+SHOW_USED_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE = log.txt
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../../../share/salome/idl/SALOME_ModuleCatalog.idl \
+ ../../../share/salome/idl/SALOMEDS.idl \
+ ../../../share/salome/idl/SALOME_Exception.idl \
+ ../../../share/salome/idl/SALOMEDS_Attributes.idl \
+ ../../../share/salome/idl/SALOME_Component.idl \
+ ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx \
+ ../../../share/salome/src/NamingService/SALOME_NamingService.hxx \
+ ../../../share/salome/src/NamingService/SALOME_NamingService.cxx \
+ ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
+FILE_PATTERNS =
+RECURSIVE = NO
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH = sources/
+INPUT_FILTER =
+FILTER_SOURCE_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = KERNEL
+HTML_FILE_EXTENSION = .html
+HTML_HEADER = sources/myheader.html
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = YES
+TOC_EXPAND = YES
+DISABLE_INDEX = YES
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_SCHEMA =
+XML_DTD =
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = NO
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = jpg
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1200
+GENERATE_LEGEND = NO
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
+CGI_NAME = search.cgi
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
+BIN_ABSPATH = /usr/local/bin/
+EXT_DOC_PATHS =
--- /dev/null
+foldersTree = gFld("<b>SALOME v.3.1.0 </b>", "", "")
+ insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
+
+aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
+ aux2 = insFld(aux1, gFld("Modules", ""))
+ aux3 = insFld(aux2, gFld("SALOME STUDY module", ""))
+ insDoc(aux3, gLnk("Overview", "", "overview_Study.html"))
+ aux4 = insFld(aux3, gFld("Packages", ""))
+ insDoc(aux4, gLnk("SALOMEDS", "", "namespaceSALOMEDS.html"))
+ insDoc(aux3, gLnk("Examples", "", "examples_Study.html"))
+ aux3 = insFld(aux2, gFld("SALOME KERNEL module", ""))
+ insDoc(aux3, gLnk("Overview", "", "overview_Kernel.html"))
+ aux4 = insFld(aux3, gFld("Packages", ""))
+ insDoc(aux4, gLnk("SALOME_ModuleCatalog", "", "namespaceSALOME__ModuleCatalog.html"))
+ insDoc(aux4, gLnk("SALOME", "", "namespaceSALOME.html"))
+ insDoc(aux4, gLnk("Engines", "", "namespaceEngines.html"))
+ insDoc(aux3, gLnk("Examples", "", "examples_Kernel.html"))
+
+
+/*! Data structures
+*/
+ insDoc(aux1, gLnk("Data Structures", "", "annotated.html"))
+
+/*! insDoc(aux1, gLnk("SALOME_ModuleCatalog::Acomponent", "", "interfaceSALOME__ModuleCatalog_1_1Acomponent.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeComment", "", "interfaceSALOMEDS_1_1AttributeComment.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeDrawable", "", "interfaceSALOMEDS_1_1AttributeDrawable.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeExpandable", "", "interfaceSALOMEDS_1_1AttributeExpandable.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeInteger", "", "interfaceSALOMEDS_1_1AttributeInteger.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeIOR", "", "interfaceSALOMEDS_1_1AttributeIOR.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeLocalID", "", "interfaceSALOMEDS_1_1AttributeLocalID.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeName", "", "interfaceSALOMEDS_1_1AttributeName.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeOpened", "", "interfaceSALOMEDS_1_1AttributeOpened.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributePersistentRef", "", "interfaceSALOMEDS_1_1AttributePersistentRef.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributePixMap", "", "interfaceSALOMEDS_1_1AttributePixMap.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributePythonObject", "", "interfaceSALOMEDS_1_1AttributePythonObject.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeReal", "", "interfaceSALOMEDS_1_1AttributeReal.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeSelectable", "", "interfaceSALOMEDS_1_1AttributeSelectable.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeSequenceOfInteger", "", "interfaceSALOMEDS_1_1AttributeSequenceOfInteger.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeSequenceOfReal", "", "interfaceSALOMEDS_1_1AttributeSequenceOfReal.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeStudyProperties", "", "interfaceSALOMEDS_1_1AttributeStudyProperties.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfInteger", "", "interfaceSALOMEDS_1_1AttributeTableOfInteger.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfInteger_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfInteger::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfInteger_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfReal", "", "interfaceSALOMEDS_1_1AttributeTableOfReal.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfReal_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfReal::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfReal_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfString", "", "interfaceSALOMEDS_1_1AttributeTableOfString.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfString::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfString_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfString::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfString_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTarget", "", "interfaceSALOMEDS_1_1AttributeTarget.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTextColor", "", "interfaceSALOMEDS_1_1AttributeTextColor.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTextHighlightColor", "", "interfaceSALOMEDS_1_1AttributeTextHighlightColor.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTreeNode", "", "interfaceSALOMEDS_1_1AttributeTreeNode.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeUserID", "", "interfaceSALOMEDS_1_1AttributeUserID.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Callback", "", "interfaceSALOMEDS_1_1Callback.html"))
+ insDoc(aux1, gLnk("SALOMEDS::ChildIterator", "", "interfaceSALOMEDS_1_1ChildIterator.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Color", "", "structSALOMEDS_1_1Color.html"))
+ insDoc(aux1, gLnk("Engines::Component", "", "interfaceEngines_1_1Component.html"))
+ insDoc(aux1, gLnk("Engines::Container", "", "interfaceEngines_1_1Container.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::DefinitionInterface", "", "structSALOME__ModuleCatalog_1_1DefinitionInterface.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Driver", "", "interfaceSALOMEDS_1_1Driver.html"))
+ insDoc(aux1, gLnk("SALOME::ExceptionStruct", "", "structSALOME_1_1ExceptionStruct.html"))
+ insDoc(aux1, gLnk("SALOMEDS::GenericAttribute", "", "interfaceSALOMEDS_1_1GenericAttribute.html"))
+ insDoc(aux1, gLnk("SALOMEDS::GenericAttribute::LockProtection", "", "exceptionSALOMEDS_1_1GenericAttribute_1_1LockProtection.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::IAPP_Affich", "", "structSALOME__ModuleCatalog_1_1IAPP__Affich.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::ModuleCatalog", "", "interfaceSALOME__ModuleCatalog_1_1ModuleCatalog.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::NotFound", "", "exceptionSALOME__ModuleCatalog_1_1NotFound.html"))
+ insDoc(aux1, gLnk("SALOMEDS::NotImplemented", "", "exceptionSALOMEDS_1_1NotImplemented.html"))
+ insDoc(aux1, gLnk("SALOME::SALOME_Exception", "", "exceptionSALOME_1_1SALOME__Exception.html"))
+ insDoc(aux1, gLnk("SALOMEDS::SComponent", "", "interfaceSALOMEDS_1_1SComponent.html"))
+ insDoc(aux1, gLnk("SALOMEDS::SComponentIterator", "", "interfaceSALOMEDS_1_1SComponentIterator.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::Service", "", "structSALOME__ModuleCatalog_1_1Service.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::ServicesParameter", "", "structSALOME__ModuleCatalog_1_1ServicesParameter.html"))
+ insDoc(aux1, gLnk("SALOME::Session", "", "interfaceSALOME_1_1Session.html"))
+ insDoc(aux1, gLnk("SALOME::Session::GUIActive", "", "exceptionSALOME_1_1Session_1_1GUIActive.html"))
+ insDoc(aux1, gLnk("SALOME::Session::RunningStudies", "", "exceptionSALOME_1_1Session_1_1RunningStudies.html"))
+ insDoc(aux1, gLnk("SALOMEDS::SObject", "", "interfaceSALOMEDS_1_1SObject.html"))
+ insDoc(aux1, gLnk("SALOME::StatSession", "", "structSALOME_1_1StatSession.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study", "", "interfaceSALOMEDS_1_1Study.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyCommentError", "", "exceptionSALOMEDS_1_1Study_1_1StudyCommentError.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidComponent", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidComponent.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidContext", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidContext.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidDirectory", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidDirectory.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyNameAlreadyUsed", "", "exceptionSALOMEDS_1_1Study_1_1StudyNameAlreadyUsed.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyNameError", "", "exceptionSALOMEDS_1_1Study_1_1StudyNameError.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyObjectAlreadyExists", "", "exceptionSALOMEDS_1_1Study_1_1StudyObjectAlreadyExists.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyBuilder", "", "interfaceSALOMEDS_1_1StudyBuilder.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyBuilder::LockProtection", "", "exceptionSALOMEDS_1_1StudyBuilder_1_1LockProtection.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyManager", "", "interfaceSALOMEDS_1_1StudyManager.html"))
+ insDoc(aux1, gLnk("SALOMEDS::UseCaseBuilder", "", "interfaceSALOMEDS_1_1UseCaseBuilder.html"))
+ insDoc(aux1, gLnk("SALOMEDS::UseCaseIterator", "", "interfaceSALOMEDS_1_1UseCaseIterator.html"))
+*/
+ insDoc(aux1, gLnk("Class Hierarchy", "", "hierarchy.html"))
+
+/*! insDoc(aux1, gLnk("SALOME_ModuleCatalog::Acomponent", "", "interfaceSALOME__ModuleCatalog_1_1Acomponent.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfInteger_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfInteger::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfInteger_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfReal_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfReal::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfReal_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfString::IncorrectArgumentLength", "", "exceptionSALOMEDS_1_1AttributeTableOfString_1_1IncorrectArgumentLength.html"))
+ insDoc(aux1, gLnk("SALOMEDS::AttributeTableOfString::IncorrectIndex", "", "exceptionSALOMEDS_1_1AttributeTableOfString_1_1IncorrectIndex.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Callback", "", "interfaceSALOMEDS_1_1Callback.html"))
+ insDoc(aux1, gLnk("SALOMEDS::ChildIterator", "", "interfaceSALOMEDS_1_1ChildIterator.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Color", "", "structSALOMEDS_1_1Color.html"))
+ aux2 = insFld(aux1, gFld("Engines::Component", "", "interfaceEngines_1_1Component.html"))
+ insDoc(aux1, gLnk("Engines::Container", "", "interfaceEngines_1_1Container.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::DefinitionInterface", "", "structSALOME__ModuleCatalog_1_1DefinitionInterface.html"))
+ aux2 = insFld(aux1, gFld("SALOMEDS::Driver", "", "interfaceSALOMEDS_1_1Driver.html"))
+ insDoc(aux1, gLnk("SALOME::ExceptionStruct", "", "structSALOME_1_1ExceptionStruct.html"))
+ aux2 = insFld(aux1, gFld("SALOMEDS::GenericAttribute", "", "interfaceSALOMEDS_1_1GenericAttribute.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeComment", "", "interfaceSALOMEDS_1_1AttributeComment.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeDrawable", "", "interfaceSALOMEDS_1_1AttributeDrawable.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeExpandable", "", "interfaceSALOMEDS_1_1AttributeExpandable.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeInteger", "", "interfaceSALOMEDS_1_1AttributeInteger.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeIOR", "", "interfaceSALOMEDS_1_1AttributeIOR.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeLocalID", "", "interfaceSALOMEDS_1_1AttributeLocalID.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeName", "", "interfaceSALOMEDS_1_1AttributeName.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeOpened", "", "interfaceSALOMEDS_1_1AttributeOpened.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributePersistentRef", "", "interfaceSALOMEDS_1_1AttributePersistentRef.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributePixMap", "", "interfaceSALOMEDS_1_1AttributePixMap.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributePythonObject", "", "interfaceSALOMEDS_1_1AttributePythonObject.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeReal", "", "interfaceSALOMEDS_1_1AttributeReal.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeSelectable", "", "interfaceSALOMEDS_1_1AttributeSelectable.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeSequenceOfInteger", "", "interfaceSALOMEDS_1_1AttributeSequenceOfInteger.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeSequenceOfReal", "", "interfaceSALOMEDS_1_1AttributeSequenceOfReal.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeStudyProperties", "", "interfaceSALOMEDS_1_1AttributeStudyProperties.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTableOfInteger", "", "interfaceSALOMEDS_1_1AttributeTableOfInteger.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTableOfReal", "", "interfaceSALOMEDS_1_1AttributeTableOfReal.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTableOfString", "", "interfaceSALOMEDS_1_1AttributeTableOfString.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTarget", "", "interfaceSALOMEDS_1_1AttributeTarget.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTextColor", "", "interfaceSALOMEDS_1_1AttributeTextColor.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTextHighlightColor", "", "interfaceSALOMEDS_1_1AttributeTextHighlightColor.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeTreeNode", "", "interfaceSALOMEDS_1_1AttributeTreeNode.html"))
+ insDoc(aux2, gLnk("SALOMEDS::AttributeUserID", "", "interfaceSALOMEDS_1_1AttributeUserID.html"))
+ insDoc(aux1, gLnk("SALOMEDS::GenericAttribute::LockProtection", "", "exceptionSALOMEDS_1_1GenericAttribute_1_1LockProtection.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::IAPP_Affich", "", "structSALOME__ModuleCatalog_1_1IAPP__Affich.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::ModuleCatalog", "", "interfaceSALOME__ModuleCatalog_1_1ModuleCatalog.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::NotFound", "", "exceptionSALOME__ModuleCatalog_1_1NotFound.html"))
+ insDoc(aux1, gLnk("SALOMEDS::NotImplemented", "", "exceptionSALOMEDS_1_1NotImplemented.html"))
+ insDoc(aux1, gLnk("SALOME::SALOME_Exception", "", "exceptionSALOME_1_1SALOME__Exception.html"))
+ insDoc(aux1, gLnk("SALOMEDS::SComponentIterator", "", "interfaceSALOMEDS_1_1SComponentIterator.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::Service", "", "structSALOME__ModuleCatalog_1_1Service.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog::ServicesParameter", "", "structSALOME__ModuleCatalog_1_1ServicesParameter.html"))
+ insDoc(aux1, gLnk("SALOME::Session", "", "interfaceSALOME_1_1Session.html"))
+ insDoc(aux1, gLnk("SALOME::Session::GUIActive", "", "exceptionSALOME_1_1Session_1_1GUIActive.html"))
+ insDoc(aux1, gLnk("SALOME::Session::RunningStudies", "", "exceptionSALOME_1_1Session_1_1RunningStudies.html"))
+ aux2 = insFld(aux1, gFld("SALOMEDS::SObject", "", "interfaceSALOMEDS_1_1SObject.html"))
+ insDoc(aux2, gLnk("SALOMEDS::SComponent", "", "interfaceSALOMEDS_1_1SComponent.html"))
+ insDoc(aux1, gLnk("SALOME::StatSession", "", "structSALOME_1_1StatSession.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study", "", "interfaceSALOMEDS_1_1Study.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyCommentError", "", "exceptionSALOMEDS_1_1Study_1_1StudyCommentError.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidComponent", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidComponent.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidContext", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidContext.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyInvalidDirectory", "", "exceptionSALOMEDS_1_1Study_1_1StudyInvalidDirectory.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyNameAlreadyUsed", "", "exceptionSALOMEDS_1_1Study_1_1StudyNameAlreadyUsed.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyNameError", "", "exceptionSALOMEDS_1_1Study_1_1StudyNameError.html"))
+ insDoc(aux1, gLnk("SALOMEDS::Study::StudyObjectAlreadyExists", "", "exceptionSALOMEDS_1_1Study_1_1StudyObjectAlreadyExists.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyBuilder", "", "interfaceSALOMEDS_1_1StudyBuilder.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyBuilder::LockProtection", "", "exceptionSALOMEDS_1_1StudyBuilder_1_1LockProtection.html"))
+ insDoc(aux1, gLnk("SALOMEDS::StudyManager", "", "interfaceSALOMEDS_1_1StudyManager.html"))
+ insDoc(aux1, gLnk("SALOMEDS::UseCaseBuilder", "", "interfaceSALOMEDS_1_1UseCaseBuilder.html"))
+ insDoc(aux1, gLnk("SALOMEDS::UseCaseIterator", "", "interfaceSALOMEDS_1_1UseCaseIterator.html"))
+*/
+ insDoc(aux1, gLnk("Class methods list", "", "functions.html"))
+/*!
+aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html"))
+ insDoc(aux1, gLnk("Engines", "", "namespaceEngines.html"))
+ insDoc(aux1, gLnk("SALOME", "", "namespaceSALOME.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog", "", "namespaceSALOME__ModuleCatalog.html"))
+ insDoc(aux1, gLnk("SALOMEDS", "", "namespaceSALOMEDS.html"))
+*/
+ insDoc(aux1, gLnk("Namespace Members", "", "namespacemembers.html"))
+
+ insDoc(aux1, gLnk("File List", "", "files.html"))
+
+/*!
+ insDoc(aux1, gLnk("SALOME_Component.idl", "", "SALOME__Component_8idl.html"))
+ insDoc(aux1, gLnk("SALOME_Exception.idl", "", "SALOME__Exception_8idl.html"))
+ insDoc(aux1, gLnk("SALOME_ModuleCatalog.idl", "", "SALOME__ModuleCatalog_8idl.html"))
+ insDoc(aux1, gLnk("SALOME_Session.idl", "", "SALOME__Session_8idl.html"))
+ insDoc(aux1, gLnk("SALOMEDS.idl", "", "SALOMEDS_8idl.html"))
+ insDoc(aux1, gLnk("SALOMEDS_Attributes.idl", "", "SALOMEDS__Attributes_8idl.html"))
+*/
+
+aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
+ insDoc(aux1, gLnk("Mapping of IDL definitions to Python language", "", "mapping.html"))
+ insDoc(aux1, gLnk("Mapping of SALOME IDL definitions to Python language", "", "page2.html"))
+
+/*! insDoc(foldersTree, gLnk("Graphical Class Hierarchy", "", "inherits.html"))
+*/
+aux1 = insFld(foldersTree, gFld("Naming service", ""))
+ insDoc(aux1, gLnk("Naming Service Description ", "", "overview_Naming.html"))
+ insDoc(aux1, gLnk("Salome_NamingService Class Reference", "", "classSALOME__NamingService.html"))
+ insDoc(aux1, gLnk("Examples", "", "examples_Naming.html"))
+aux1 = insFld(foldersTree, gFld("Life Cycle", ""))
+ insDoc(aux1, gLnk("Life Cycle Service Description ", "", "overview_Life_Cycle.html"))
+ insDoc(aux1, gLnk("Salome_LifeCycleCorba Class Reference", "", "classSALOME__LifeCycleCORBA.html"))
+ insDoc(aux1, gLnk("Examples", "", "examples_Life_cycle.html"))
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _SALOME_COMM_IDL_
+#define _SALOME_COMM_IDL_
+
+#include "SALOME_Exception.idl"
+
+module SALOME {
+
+ enum TypeOfDataTransmitted { _DOUBLE_,_INT_ };
+
+ enum TypeOfCommunication { CORBA_ , MPI_ , SOCKET_ };
+
+ typedef sequence<double> vectorOfDouble;
+
+ typedef sequence<long> vectorOfLong;
+
+ interface MultiCommClass {
+ void setProtocol(in TypeOfCommunication typ);
+ };
+
+ interface ServantLifeCycle {
+ void release();
+ };
+
+ interface Sender {
+ TypeOfDataTransmitted getTypeOfDataTransmitted();
+ void release();
+ };
+
+ interface SenderDouble : Sender {
+ SenderDouble buildOtherWithProtocol(in TypeOfCommunication type);
+ };
+
+ interface SenderInt : Sender {
+ SenderInt buildOtherWithProtocol(in TypeOfCommunication type);
+ };
+
+ //No compulsory copy between double and CORBA::Double
+ interface CorbaDoubleNCSender : SenderDouble {
+ unsigned long getSize();
+ vectorOfDouble sendPart(in unsigned long n1,in unsigned long n2);
+ vectorOfDouble send();
+ };
+
+ //Compulsory copy between double and CORBA::Double
+ interface CorbaDoubleCSender : SenderDouble {
+ unsigned long getSize();
+ //unsigned long getSize2();
+ vectorOfDouble sendPart(in unsigned long n1,in unsigned long n2);
+ };
+
+ //No compulsory copy between int and CORBA::Long
+ interface CorbaLongNCSender : SenderInt {
+ unsigned long getSize();
+ vectorOfLong sendPart(in unsigned long n1,in unsigned long n2);
+ vectorOfLong send();
+ };
+
+ //Compulsory copy between int and CORBA::Long
+ interface CorbaLongCSender : SenderInt {
+ unsigned long getSize();
+ vectorOfLong sendPart(in unsigned long n1,in unsigned long n2);
+ };
+
+ interface MPISender : Sender {
+ typedef struct Parameter {
+ unsigned long myproc;
+ unsigned long tag1;
+ unsigned long tag2;
+ string service;
+ } param;
+ param getParam();
+ void send();
+ void close(in param p);
+ };
+
+ interface MPISenderDouble : SenderDouble,MPISender {
+ };
+
+ interface MPISenderInt : SenderInt,MPISender {
+ };
+
+ interface SocketSender : Sender {
+ typedef struct Parameter {
+ unsigned long lstart;
+ unsigned long lend;
+ unsigned long myport;
+ string internet_address;
+ } param;
+ param getParam();
+ void initCom() raises(SALOME_Exception);
+ void acceptCom() raises(SALOME_Exception);
+ void closeCom();
+ void endOfCom() raises(SALOME_Exception);
+ void send();
+ };
+
+ interface SocketSenderDouble : SenderDouble,SocketSender {
+ };
+
+ interface SocketSenderInt : SenderInt,SocketSender {
+ };
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _SALOME_CONTAINERMANAGER_IDL_
+#define _SALOME_CONTAINERMANAGER_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+
+module Engines
+{
+
+/*!
+ Type to describe properties of wanted resource.
+*/
+struct MachineParameters
+{
+ string container_name;
+ string hostname;
+ string OS;
+ long mem_mb;
+ long cpu_clock;
+ long nb_proc_per_node;
+ long nb_node;
+ boolean isMPI;
+};
+
+/*!
+ Type to transmit list of machines.
+*/
+ typedef sequence<string> MachineList;
+
+/*!
+ exception thrown if a computer is not found in the catalog
+*/
+ exception NotFound {};
+
+
+/*! \brief Interface of the %containerManager
+ This interface is used for interaction with the unique instance
+ of ContainerManager
+*/
+ interface ContainerManager
+ {
+ Container FindOrStartContainer( in MachineParameters params,
+ in MachineList possibleComputers);
+
+ string FindBest(in MachineList possibleComputers);
+
+ MachineList GetFittingResources( in MachineParameters params,
+ in string componentName )
+ raises (SALOME::SALOME_Exception);
+
+ void Shutdown();
+
+ void ShutdownContainers();
+ } ;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+//=============================================================================
+// File : SALOME_MPITestComponent.idl
+// Created : mer jui 04 12:08:17 CEST 2003
+// Author : Bernard SECHER, CEA
+// Project : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+
+#include "SALOME_Component.idl"
+#include "SALOME_MPIObject.idl"
+
+module Engines
+{
+
+ interface TestMPIComponent : Component, MPIObject
+ {
+ // version synchrone (process 0)
+ void Coucou(in long L);
+ // version asynchrone (autres process)
+ oneway void SPCoucou(in long L);
+ };
+
+};
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef NSTEST_IDL
+#define NSTEST_IDL
+
+module NSTEST
+{
+ interface echo
+ {
+ long getId();
+ };
+
+ interface aFactory
+ {
+ echo createInstance();
+ };
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+<!DOCTYPE ResourcesCatalog>
+<resources>
+
+<machine hostname="is111790" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+<modules modulePath="/export/home/LGLS/Products/MED_3.1.0" moduleName="MED" />
+<modules modulePath="/export/home/LGLS/Products/GEOM_3.1.0" moduleName="GEOM" />
+<modules modulePath="/export/home/LGLS/Products/SMESH_3.1.0" moduleName="SMESH" />
+<modules modulePath="/export/home/LGLS/Products/SUPERV_3.1.0" moduleName="SUPERV" />
+<modules modulePath="/export/home/LGLS/Products/VISU_3.1.0" moduleName="VISU" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+</machine>
+
+<machine hostname="is111915" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+<modules modulePath="/export/home/LGLS/Products/MED_3.1.0" moduleName="MED" />
+<modules modulePath="/export/home/LGLS/Products/GEOM_3.1.0" moduleName="GEOM" />
+<modules modulePath="/export/home/LGLS/Products/SMESH_3.1.0" moduleName="SMESH" />
+<modules modulePath="/export/home/LGLS/Products/SUPERV_3.1.0" moduleName="SUPERV" />
+<modules modulePath="/export/home/LGLS/Products/VISU_3.1.0" moduleName="VISU" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+</machine>
+
+<machine hostname="is111918" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+<modules modulePath="/export/home/LGLS/Products/MED_3.1.0" moduleName="MED" />
+<modules modulePath="/export/home/LGLS/Products/GEOM_3.1.0" moduleName="GEOM" />
+<modules modulePath="/export/home/LGLS/Products/SMESH_3.1.0" moduleName="SMESH" />
+<modules modulePath="/export/home/LGLS/Products/SUPERV_3.1.0" moduleName="SUPERV" />
+<modules modulePath="/export/home/LGLS/Products/VISU_3.1.0" moduleName="VISU" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+</machine>
+
+<machine hostname="is111996" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+<modules modulePath="/export/home/LGLS/Products/MED_3.1.0" moduleName="MED" />
+<modules modulePath="/export/home/LGLS/Products/GEOM_3.1.0" moduleName="GEOM" />
+<modules modulePath="/export/home/LGLS/Products/SMESH_3.1.0" moduleName="SMESH" />
+<modules modulePath="/export/home/LGLS/Products/SUPERV_3.1.0" moduleName="SUPERV" />
+<modules modulePath="/export/home/LGLS/Products/VISU_3.1.0" moduleName="VISU" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
+<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+</machine>
+
+</resources>
--- /dev/null
+<?xml version='1.0' encoding='us-ascii' ?>
+
+<!-- XML component catalog -->
+<begin-catalog>
+
+<!-- Path prefix information -->
+
+<path-prefix-list>
+</path-prefix-list>
+
+<!-- Component list -->
+<component-list>
+ <component>
+ <!-- Component identification -->
+ <component-name>KERNEL</component-name>
+ <component-username>Salome</component-username>
+ <component-type>Other</component-type>
+ <component-author>NRI</component-author>
+ <component-version>3.1.0</component-version>
+ <component-comment>GUI Neutral Context</component-comment>
+ <component-multistudy>1</component-multistudy>
+
+ <constraint>hostname = muna</constraint>
+ </component>
+ <component>
+ <component-name>SalomeTestComponent</component-name>
+ <component-username>SalomeTestComponent</component-username>
+ <component-type>Other</component-type>
+ <component-author>NRI</component-author>
+ <component-version>3.1.0</component-version>
+ <component-comment>GUI Neutral Context</component-comment>
+ <component-multistudy>1</component-multistudy>
+ <constraint>'linux' ~ OS</constraint>
+ </component>
+ <component>
+ <component-name>SALOME_TestComponentPy</component-name>
+ <component-username>SALOME_TestComponentPy</component-username>
+ <component-type>Other</component-type>
+ <component-author>NRI</component-author>
+ <component-version>3.1.0</component-version>
+ <component-comment>GUI Neutral Context</component-comment>
+ <component-multistudy>1</component-multistudy>
+ <constraint>'linux' ~ OS</constraint>
+ </component>
+</component-list>
+</begin-catalog>
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+AC_DEFUN([CHECK_CAS],[
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+
+AC_CHECKING(for OpenCascade)
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_SUBST(CAS_CPPFLAGS)
+AC_SUBST(CAS_CXXFLAGS)
+AC_SUBST(CAS_KERNEL)
+AC_SUBST(CAS_MATH)
+AC_SUBST(CAS_VIEWER)
+AC_SUBST(CAS_TKTopAlgo)
+AC_SUBST(CAS_MODELER)
+AC_SUBST(CAS_OCAF)
+AC_SUBST(CAS_OCAFVIS)
+AC_SUBST(CAS_DATAEXCHANGE)
+AC_SUBST(CAS_LDFLAGS)
+AC_SUBST(CAS_LDPATH)
+AC_SUBST(CAS_STDPLUGIN)
+
+OWN_CONFIG_H=no
+
+CAS_CPPFLAGS=""
+CAS_CXXFLAGS=""
+CAS_LDFLAGS=""
+occ_ok=no
+own_config_h=no
+
+dnl libraries directory location
+case $host_os in
+ linux*)
+ casdir=Linux
+ ;;
+ freebsd*)
+ casdir=Linux
+ ;;
+ irix5.*)
+ casdir=Linux
+ ;;
+ irix6.*)
+ casdir=Linux
+ ;;
+ osf*)
+ casdir=Linux
+ ;;
+ solaris2.*)
+ casdir=Linux
+ ;;
+ *)
+ casdir=Linux
+ ;;
+esac
+
+AC_MSG_CHECKING(for OpenCascade directories)
+
+if test -z $CASROOT; then
+ AC_MSG_RESULT(CASROOT not defined)
+ for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
+ if test -f $d/libTKernel.so ; then
+ AC_MSG_RESULT(libTKernel.so detected in $d)
+ CASROOT=$d
+ CASROOT=`echo ${CASROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+ break
+ fi
+ done
+fi
+
+if test -d ${CASROOT}/${casdir}/lib; then
+ CAS_LDPATH="-L$CASROOT/$casdir/lib "
+ AC_MSG_RESULT(yes)
+else
+ if test -d ${CASROOT}/lib; then
+ CAS_LDPATH="-L$CASROOT/lib "
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+
+dnl were is OCC ?
+if test -z $CASROOT; then
+ AC_MSG_WARN(You must provide CASROOT variable : see OCC installation manual)
+else
+ occ_ok=yes
+ OCC_VERSION_MAJOR=0
+ OCC_VERSION_MINOR=0
+ ff=$CASROOT/inc/Standard_Version.hxx
+ if test -f $ff ; then
+ grep "define OCC_VERSION_MAJOR" $ff > /dev/null
+ if test $? = 0 ; then
+ OCC_VERSION_MAJOR=`grep "define OCC_VERSION_MAJOR" $ff | awk '{i=3 ; print $i}'`
+ fi
+ grep "define OCC_VERSION_MINOR" $ff > /dev/null
+ if test $? = 0 ; then
+ OCC_VERSION_MINOR=`grep "define OCC_VERSION_MINOR" $ff | awk '{i=3 ; print $i}'`
+ fi
+ fi
+fi
+
+if test "x$occ_ok" = "xyes"; then
+
+dnl test c++ compiler flag for unsigned character
+ for opt in -funsigned-char -unsigned ; do
+ AC_CXX_OPTION($opt,CAS_CXXFLAGS,flag=yes,flag=no)
+ if test "$flag" = "yes"; then
+ break
+ fi
+ done
+
+dnl cascade headers
+
+ CPPFLAGS_old="$CPPFLAGS"
+case $host_os in
+ linux*)
+ CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc"
+ ;;
+ osf*)
+ CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc"
+ ;;
+esac
+ CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS"
+
+ if test -n $KERNEL_ROOT_DIR; then
+ if test -d $KERNEL_ROOT_DIR/include/salome; then
+ CAS_CPPFLAGS="$CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
+ CPPFLAGS="$CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
+ fi
+ fi
+ CAS_CPPFLAGS="$CAS_CPPFLAGS -I${ROOT_BUILDDIR}/include/salome"
+ CPPFLAGS="$CPPFLAGS -I${ROOT_BUILDDIR}/salome_adm/unix"
+
+ echo
+ echo
+ echo testing config.h
+ echo
+ echo
+
+ AC_CHECK_HEADER(config.h, own_config_h=no, [
+ echo
+ echo
+ echo "config.h file not found! Generating it..."
+ echo
+ echo
+ mv confdefs.h backup_confdefs.h
+ ${ROOT_SRCDIR}/make_config
+ rm -rf ${ROOT_BUILDDIR}/*.log
+ rm -rf ${ROOT_BUILDDIR}/*.status
+ mv backup_confdefs.h confdefs.h
+ rm -f backup_confdefs.h
+ own_config_h=yes
+ echo
+ echo
+ ])
+
+ if test "x$own_config_h" = xyes ; then
+ OWN_CONFIG_H=yes
+ fi
+
+ AC_CHECK_HEADER(Standard_Type.hxx,occ_ok=yes ,occ_ok=no)
+
+fi
+
+AC_SUBST(OWN_CONFIG_H)
+
+if test "x$occ_ok" = xyes ; then
+
+ AC_MSG_CHECKING(for OpenCascade libraries)
+
+ LIBS_old="$LIBS"
+ LIBS="$LIBS $CAS_LDPATH -lTKernel"
+
+ AC_CACHE_VAL(salome_cv_lib_occ,[
+ AC_TRY_LINK(
+#include <Standard_Type.hxx>
+, size_t size;
+ const Standard_CString aName="toto";
+ Standard_Type myST(aName) ;
+ myST.Find(aName);,
+ eval "salome_cv_lib_occ=yes",eval "salome_cv_lib_occ=no")
+ ])
+ occ_ok="$salome_cv_lib_occ"
+
+fi
+CPPFLAGS="$CPPFLAGS_old"
+LIBS="$LIBS_old"
+
+if test "x$occ_ok" = xno ; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(Opencascade libraries not found)
+else
+ AC_MSG_RESULT(yes)
+ CAS_KERNEL="$CAS_LDPATH -lTKernel"
+ CAS_MATH="$CAS_LDPATH -lTKMath"
+
+ if test -f $CASROOT/$casdir/lib/libStdPlugin.so ; then
+ # this libraries are only for CASCADE 5.2.3
+ CAS_STDPLUGIN="StdPlugin"
+ fi
+
+ CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema"
+ CAS_OCAFVIS="$CAS_LDPATH -lTKCAF -lStdPlugin -lStdLPlugin -lTKPLCAF -lTKPShape -lTKStdLSchema -lTKShapeSchema"
+
+ CAS_TKV3d="$CAS_LDPATH -lTKV3d"
+ CAS_VIEWER="$CAS_TKV3d -lTKService"
+
+ CAS_TKBRep="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep"
+
+ CAS_TKTopAlgo="$CAS_TKBRep -lTKGeomAlgo -lTKTopAlgo"
+ CAS_TKPrim="$CAS_TKTopAlgo -lTKPrim"
+
+ CAS_MODELER="$CAS_TKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat"
+
+ CAS_DATAEXCHANGE="$CAS_LDPATH -lTKIGES -lTKSTEP"
+
+ CAS_LDFLAGS="$CAS_KERNEL $CAS_MATH $CAS_OCAF $CAS_OCAFVIS $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE"
+
+fi
+
+AC_LANG_RESTORE
+
+])dnl
+
+
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+
+AC_DEFUN([CHECK_LAM],[
+
+AC_REQUIRE([AC_PROG_CC])dnl
+
+AC_ARG_WITH(lam,
+ --with-lam=DIR root directory path of LAM installation,
+ WITHLAM="yes",WITHLAM="no")
+
+MPI_INCLUDES=""
+MPI_LIBS=""
+if test "$WITHLAM" = yes; then
+
+ echo
+ echo ---------------------------------------------
+ echo testing lam
+ echo ---------------------------------------------
+ echo
+ LAM_HOME=$withval
+
+ if test "$LAM_HOME"; then
+ MPI_INCLUDES="-I$LAM_HOME/include"
+ if test "x$LAM_HOME" = "x/usr"
+ then
+ MPI_LIBS=""
+ else
+ MPI_LIBS="-L$LAM_HOME/lib"
+ fi
+ fi
+
+ CPPFLAGS_old="$CPPFLAGS"
+ CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
+ AC_CHECK_HEADER(mpi.h,WITHLAM="yes",WITHLAM="no")
+
+ if test "$WITHLAM" = "yes";then
+ AC_CHECK_LIB(util,openpty,,WITHLAM="no")
+ LIBS_old="$LIBS"
+ LDFLAGS_old="$LDFLAGS"
+ LDFLAGS="$MPI_LIBS $LDFLAGS"
+ fi
+
+ if test "$WITHLAM" = "yes";then
+
+ LIBS="$LIBS -lmpi++"
+ AC_MSG_CHECKING(for MPI_Init in -lmpi++)
+ AC_TRY_LINK([
+ #include <mpi.h>
+ ], [int argc=0; char **argv=0; MPI_Init(&argc,&argv);],
+ WITHLAM="yes",WITHLAM="no")
+
+ if test "$WITHLAM" = "yes";then
+
+ AC_MSG_RESULT(yes)
+ MPI_LIBS="$MPI_LIBS -lmpi++"
+ AC_CHECK_LIB(mpi++,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
+
+ else
+ AC_MSG_RESULT(no)
+
+ LIBS="$LIBS_old"
+ AC_CHECK_LIB(lam,lam_mp_init,WITHLAM="yes",WITHLAM="no")
+ if test "$WITHLAM" = "yes";then
+ MPI_LIBS="$MPI_LIBS -llam"
+ LIBS="$LIBS -llam"
+ fi
+
+ AC_CHECK_LIB(mpi,MPI_Init,WITHLAM="yes",WITHLAM="no")
+ if test "$WITHLAM" = "yes";then
+ MPI_LIBS="-lmpi $MPI_LIBS"
+ fi
+
+ AC_CHECK_LIB(mpi,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
+
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_old"
+ LDFLAGS="$LDFLAGS_old"
+ LIBS="$LIBS_old"
+
+ if test "$WITHLAM" = "yes";then
+ WITHMPI="yes"
+ mpi_ok=yes
+ CPPFLAGS="-DWITHLAM $CPPFLAGS"
+ else
+ mpi_ok=no
+ fi
+
+fi
+
+
+])dnl
--- /dev/null
+
+AC_DEFUN([CHECK_OMNIORB],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+
+AC_CHECKING(for omniORB)
+omniORB_ok=yes
+
+if test "x$PYTHON" = "x"
+then
+ CHECK_PYTHON
+fi
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_PATH_PROG(OMNIORB_IDL, omniidl)
+if test "xOMNIORB_IDL" = "x"
+then
+ omniORB_ok=no
+ AC_MSG_RESULT(omniORB binaries not in PATH variable)
+else
+ omniORB_ok=yes
+fi
+
+if test "x$omniORB_ok" = "xyes"
+then
+ AC_SUBST(OMNIORB_IDL)
+
+ OMNIORB_BIN=`echo ${OMNIORB_IDL} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+ OMNIORB_ROOT=${OMNIORB_BIN}
+ # one-level up
+ OMNIORB_ROOT=`echo ${OMNIORB_ROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+ #
+ #
+ if test -d $OMNIORB_ROOT/include ; then
+ # if $OMNIORB_ROOT/include exists, there are a lot of chance that
+ # this is omniORB4.x installed via configure && make && make install
+ OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin\$,lib,"`
+ OMNIORB_VERSION=4
+ else
+ # omniORB has been installed old way
+ OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin/,lib/,"`
+ # one-level up again
+ OMNIORB_ROOT=`echo ${OMNIORB_ROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+ if test -d $OMNIORB_ROOT/include/omniORB4 ; then
+ OMNIORB_VERSION=4
+ else
+ OMNIORB_VERSION=3
+ fi
+ fi
+ AC_SUBST(OMNIORB_ROOT)
+
+ OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB${OMNIORB_VERSION} -I$OMNIORB_ROOT/include/COS"
+ AC_SUBST(OMNIORB_INCLUDES)
+
+ ENABLE_PTHREADS
+
+ OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION"
+ case $build_cpu in
+ sparc*)
+ AC_DEFINE(__sparc__)
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__"
+ ;;
+ *86*)
+ AC_DEFINE(__x86__)
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__"
+ ;;
+ esac
+ case $build_os in
+ solaris*)
+ AC_DEFINE(__sunos__)
+ __OSVERSION__=5
+ AC_DEFINE(__OSVERSION__)
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__"
+ ;;
+ linux*)
+ AC_DEFINE(__linux__)
+ __OSVERSION__=2
+ AC_DEFINE(__OSVERSION__)
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__"
+ ;;
+ esac
+ AC_SUBST(OMNIORB_CXXFLAGS)
+
+ CPPFLAGS_old=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+ AC_LANG_CPLUSPLUS
+ AC_CHECK_HEADER(CORBA.h,omniORB_ok="yes",omniORB_ok="no")
+
+ CPPFLAGS=$CPPFLAGS_old
+
+fi
+
+dnl omniORB_ok=yes
+
+if test "x$omniORB_ok" = "xyes"
+then
+ if test "x$OMNIORB_LIB" = "x/usr/lib"
+ then
+ OMNIORB_LDFLAGS=""
+ else
+ OMNIORB_LDFLAGS="-L$OMNIORB_LIB"
+ fi
+
+ LIBS_old=$LIBS
+ LIBS="$LIBS $OMNIORB_LDFLAGS -lomnithread"
+
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+ AC_MSG_CHECKING(whether we can link with omnithreads)
+ AC_CACHE_VAL(salome_cv_lib_omnithreads,[
+ AC_TRY_LINK(
+#include <omnithread.h>
+, omni_mutex my_mutex,
+ eval "salome_cv_lib_omnithreads=yes",eval "salome_cv_lib_omnithreads=no")
+ ])
+
+ omniORB_ok="$salome_cv_lib_omnithreads"
+ if test "x$omniORB_ok" = "xno"
+ then
+ AC_MSG_RESULT(omnithreads not found)
+ else
+ AC_MSG_RESULT(yes)
+ fi
+
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
+fi
+
+
+dnl omniORB_ok=yes
+if test "x$omniORB_ok" = "xyes"
+then
+
+ AC_CHECK_LIB(socket,socket, LIBS="-lsocket $LIBS",,)
+ AC_CHECK_LIB(nsl,gethostbyname, LIBS="-lnsl $LIBS",,)
+
+ LIBS_old=$LIBS
+ OMNIORB_LIBS="$OMNIORB_LDFLAGS"
+ OMNIORB_LIBS="$OMNIORB_LIBS -lomniORB${OMNIORB_VERSION}"
+ OMNIORB_LIBS="$OMNIORB_LIBS -lomniDynamic${OMNIORB_VERSION}"
+ OMNIORB_LIBS="$OMNIORB_LIBS -lCOS${OMNIORB_VERSION}"
+ OMNIORB_LIBS="$OMNIORB_LIBS -lCOSDynamic${OMNIORB_VERSION}"
+ OMNIORB_LIBS="$OMNIORB_LIBS -lomnithread"
+ if test $OMNIORB_VERSION = 3 ; then
+ OMNIORB_LIBS="$OMNIORB_LIBS -ltcpwrapGK"
+ fi
+ AC_SUBST(OMNIORB_LIBS)
+
+ LIBS="$OMNIORB_LIBS $LIBS"
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+ AC_MSG_CHECKING(whether we can link with omniORB)
+ AC_CACHE_VAL(salome_cv_lib_omniorb,[
+ AC_TRY_LINK(
+#include <CORBA.h>
+, CORBA::ORB_var orb,
+ eval "salome_cv_lib_omniorb3=yes",eval "salome_cv_lib_omniorb3=no")
+ ])
+ omniORB_ok="$salome_cv_lib_omniorb3"
+
+ omniORB_ok=yes
+ if test "x$omniORB_ok" = "xno"
+ then
+ AC_MSG_RESULT(omniORB library linking failed)
+ omniORB_ok=no
+ else
+ AC_MSG_RESULT(yes)
+ fi
+ LIBS="$LIBS_old"
+ CXXFLAGS=$CXXFLAGS_old
+fi
+
+
+if test "x$omniORB_ok" = "xyes"
+then
+
+ OMNIORB_IDLCXXFLAGS="-nf -I${OMNIORB_ROOT}/idl"
+ OMNIORB_IDLPYFLAGS_1='-bpythonbe -p ${top_srcdir}/salome_adm/unix'
+ OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl"
+ OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2}
+
+ AC_SUBST(OMNIORB_IDLCXXFLAGS)
+ AC_SUBST(OMNIORB_IDLPYFLAGS)
+
+ OMNIORB_IDL_CLN_H=.hh
+ OMNIORB_IDL_CLN_CXX=SK.cc
+ OMNIORB_IDL_CLN_OBJ=SK.o
+ AC_SUBST(OMNIORB_IDL_CLN_H)
+ AC_SUBST(OMNIORB_IDL_CLN_CXX)
+ AC_SUBST(OMNIORB_IDL_CLN_OBJ)
+
+ OMNIORB_IDL_SRV_H=.hh
+ OMNIORB_IDL_SRV_CXX=SK.cc
+ OMNIORB_IDL_SRV_OBJ=SK.o
+ AC_SUBST(OMNIORB_IDL_SRV_H)
+ AC_SUBST(OMNIORB_IDL_SRV_CXX)
+ AC_SUBST(OMNIORB_IDL_SRV_OBJ)
+
+ OMNIORB_IDL_TIE_H=
+ OMNIORB_IDL_TIE_CXX=
+ AC_SUBST(OMNIORB_IDL_TIE_H)
+ AC_SUBST(OMNIORB_IDL_TIE_CXX)
+
+ AC_DEFINE(OMNIORB)
+
+ CORBA_HAVE_POA=1
+ AC_DEFINE(CORBA_HAVE_POA)
+
+ CORBA_ORB_INIT_HAVE_3_ARGS=1
+ AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS)
+ CORBA_ORB_INIT_THIRD_ARG='"omniORB"'
+ AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB")
+
+fi
+
+omniORBpy_ok=no
+if test "x$omniORB_ok" = "xyes"
+then
+ AC_MSG_CHECKING(omniORBpy)
+ $PYTHON -c "import omniORB" &> /dev/null
+ if test $? = 0 ; then
+ AC_MSG_RESULT(yes)
+ omniORBpy_ok=yes
+ else
+ AC_MSG_RESULT(no, check your installation of omniORBpy)
+ omniORBpy_ok=no
+ fi
+fi
+
+dnl AC_LANG_RESTORE
+
+AC_MSG_RESULT(for omniORBpy: $omniORBpy_ok)
+AC_MSG_RESULT(for omniORB: $omniORB_ok)
+
+# Save cache
+AC_CACHE_SAVE
+
+dnl AC_LANG_CPLUSPLUS
+
+CXXFLAGS_old=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+LIBS_old=$LIBS
+LIBS="$LIBS $OMNIORB_LDFLAGS $OMNIORB_LIBS"
+AC_MSG_CHECKING(whether we have double and CORBA::Double compatibility)
+AC_TRY_RUN(
+#include <stdlib.h>
+#include <CORBA.h>
+int main ()
+{
+ CORBA::Double *a=new CORBA::Double(2.5);
+ double c=2.5;
+ double *b;
+ b=(double *)a;
+
+ if( (c==*b) && (sizeof(double)==sizeof(CORBA::Double)) ){
+ delete a;
+ exit(0);
+ }
+ else{
+ delete a;
+ exit(1);
+ }
+}
+,DOUBLECOMP="yes",DOUBLECOMP="no")
+if test "$DOUBLECOMP" = yes; then
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_DOUBLE"
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_MSG_CHECKING(whether we have int and CORBA::Long compatibility)
+AC_TRY_RUN(
+#include <stdlib.h>
+#include <CORBA.h>
+int main ()
+{
+ CORBA::Long *a=new CORBA::Long(2);
+ int c=2;
+ int *b;
+ b=(int *)a;
+
+ if( (c==*b) && (sizeof(int)==sizeof(CORBA::Long)) )
+ exit(0);
+ else
+ exit(1);
+}
+,LONGCOMP="yes",LONGCOMP="no")
+if test "$LONGCOMP" = yes; then
+ OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_LONG"
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+CXXFLAGS=$CXXFLAGS_old
+LIBS=$LIBS_old
+
+AC_LANG_RESTORE
+
+AC_SUBST(OMNIORB_CXXFLAGS)
+
+])dnl
+dnl
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+
+AC_DEFUN([CHECK_QT],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+AC_REQUIRE([CHECK_OPENGL])dnl
+
+AC_CHECKING(for QT)
+qt_ok=yes
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+if test "x$QTDIR" = "x"
+then
+ AC_MSG_RESULT(please define QTDIR variable)
+ qt_ok=no
+else
+ AC_MSG_RESULT(QTDIR is $QTDIR)
+ qt_inc_ok=no
+ QTINC=""
+ AC_CHECK_FILE(${QTDIR}/include/qt3/qglobal.h,QTINC="/qt3",QTINC="")
+ QT_VERS=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'`
+ AC_MSG_RESULT(Qt version is $QT_VERS)
+ QT_VERS="Qt_"`echo $QT_VERS | sed -e 's%\"%%g' -e 's%\.%_%g'`
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ if test -f ${QTDIR}/bin/moc
+ then
+ MOC=${QTDIR}/bin/moc
+ else
+ AC_PATH_PROG(MOC, moc)
+ fi
+ if test "x$MOC" = "x"
+ then
+ qt_ok=no
+ AC_MSG_RESULT(moc qt-compiler not in PATH variable)
+ else
+ qt_ok=yes
+ AC_MSG_RESULT(moc found)
+ fi
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ if test -f ${QTDIR}/bin/uic
+ then
+ UIC=${QTDIR}/bin/uic
+ else
+ AC_PATH_PROG(UIC, uic)
+ fi
+ if test "x$UIC" = "x"
+ then
+ qt_ok=no
+ AC_MSG_RESULT(uic qt-interface compiler not in PATH variable)
+ else
+ qt_ok=yes
+ AC_MSG_RESULT(uic found)
+ fi
+fi
+
+AC_SUBST(QTDIR)
+QT_ROOT=$QTDIR
+
+if test "x$qt_ok" = "xyes"
+then
+ CPPFLAGS_old=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -I$QTDIR/include${QTINC}"
+
+ AC_LANG_CPLUSPLUS
+ AC_CHECK_HEADER(qaction.h,qt_ok=yes ,qt_ok=no)
+
+ CPPFLAGS=$CPPFLAGS_old
+
+ AC_MSG_CHECKING(include of qt headers)
+
+ if test "x$qt_ok" = "xno"
+ then
+ AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include)
+ AC_MSG_RESULT(QTDIR environment variable may be wrong)
+ else
+ AC_MSG_RESULT(yes)
+ QT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE"
+ QT_MT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE"
+ fi
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ AC_MSG_CHECKING(linking qt library)
+ LIBS_old=$LIBS
+ if test "x$QTDIR" = "x/usr"
+ then
+ LIBS="$LIBS -lqt-mt $OGL_LIBS"
+ else
+ LIBS="$LIBS -L$QTDIR/lib -lqt-mt $OGL_LIBS"
+ fi
+
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
+
+ AC_CACHE_VAL(salome_cv_lib_qt,[
+ AC_TRY_LINK(
+#include <qapplication.h>
+, int n;
+ char **s;
+ QApplication a(n, s);
+ a.exec();,
+ eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no")
+ ])
+ qt_ok="$salome_cv_lib_qt"
+
+ if test "x$qt_ok" = "xno"
+ then
+ AC_MSG_RESULT(unable to link with qt library)
+ AC_MSG_RESULT(QTDIR environment variable may be wrong)
+ else
+ AC_MSG_RESULT(yes)
+ if test "x$QTDIR" = "x/usr"
+ then
+ QT_LIBS=" -lqt-mt"
+ QT_MT_LIBS=" -lqt-mt"
+ else
+ QT_LIBS="-L$QTDIR/lib -lqt-mt"
+ QT_MT_LIBS="-L$QTDIR/lib -lqt-mt"
+ fi
+ fi
+
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
+
+fi
+
+AC_SUBST(MOC)
+AC_SUBST(UIC)
+
+AC_SUBST(QT_ROOT)
+AC_SUBST(QT_INCLUDES)
+AC_SUBST(QT_LIBS)
+AC_SUBST(QT_MT_LIBS)
+AC_SUBST(QT_VERS)
+
+AC_LANG_RESTORE
+
+AC_MSG_RESULT(for qt: $qt_ok)
+
+# Save cache
+AC_CACHE_SAVE
+
+])dnl
+dnl
--- /dev/null
+dnl Copyright (C) 2003 CEA/DEN, EDF R&D
+
+AC_DEFUN([CHECK_QWT],[
+AC_REQUIRE([CHECK_QT])dnl
+
+AC_CHECKING(for qwt)
+
+qwt_ok=yes
+
+dnl were is qwt ?
+
+AC_ARG_WITH(qwt,
+ [ --with-qwt=DIR directory path to QWT installation ],
+ [QWTHOME="$withval"
+ AC_MSG_RESULT("select $withval as path to QWT")
+ ])
+
+AC_ARG_WITH(qwt_inc,
+ [ --with-qwt_inc=DIR directory path to QWT includes ],
+ [QWT_INCLUDES="$withval"
+ AC_MSG_RESULT("select $withval as path to QWT includes")
+ ])
+
+if test -z $QWTHOME; then
+ AC_MSG_RESULT(QWTHOME not defined)
+ exits_ok=no
+ if test "x$exits_ok" = "xno"; then
+ for d in /usr/local /usr ; do
+ AC_CHECK_FILE(${d}/lib/libqwt.so,exits_ok=yes,exits_ok=no)
+ if test "x$exits_ok" = "xyes"; then
+ QWTHOME=$d
+ AC_MSG_RESULT(libqwt.so detected in $d/lib)
+ fi
+ done
+ fi
+ if test "x$exits_ok" = "xno"; then
+ for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
+ if test -f $d/libqwt.so ; then
+ AC_MSG_RESULT(libqwt.so detected in $d)
+ QWTHOME=$d
+ QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+ exits_ok=yes
+ break
+ fi
+ done
+ fi
+ if test "x$exits_ok" = "xyes"; then
+ if test -z $QWT_INCLUDES; then
+ QWT_INCLUDES=$QWTHOME"/include/qwt"
+ if test ! -f $QWT_INCLUDES/qwt.h ; then
+ QWT_INCLUDES=$QWTHOME"/include"
+ fi
+ if test ! -f $QWT_INCLUDES/qwt.h ; then
+ QWT_INCLUDES=/usr/lib/qt3/include/qwt
+ fi
+ fi
+ fi
+else
+ if test -z $QWT_INCLUDES; then
+ QWT_INCLUDES="$QWTHOME/include"
+ fi
+fi
+
+if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(qwt not found)
+ qwt_ok=no
+else
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ CPPFLAGS_old=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -I$QWT_INCLUDES"
+ CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
+
+ AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
+
+ CPPFLAGS=$CPPFLAGS_old
+
+ if test "x$qwt_ok" = xno ; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(qwt not found)
+ else
+ qwt_ok=yes
+ fi
+
+if test "x$qwt_ok" = "xyes"
+then
+ AC_MSG_CHECKING(linking qwt library)
+ LIBS_old=$LIBS
+ if test "x$QTDIR" = "x/usr"
+ then
+ LIBS="$LIBS -lqt-mt"
+ else
+ LIBS="$LIBS -L$QTDIR/lib -lqt-mt"
+ fi
+ if test "x$QWTHOME" = "x/usr"
+ then
+ LIBS="$LIBS -lqwt"
+ else
+ LIBS="$LIBS -L$QWTHOME/lib -lqwt"
+ fi
+
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$QWT_INCLUDES"
+
+ AC_CACHE_VAL(salome_cv_lib_qwt,[
+ AC_TRY_LINK(
+#include <qapplication.h>
+#include <qwt_plot.h>
+, int n;
+ char **s;
+ QApplication a(n, s);
+ QwtPlot* p;
+ a.setMainWidget(p);
+ a.exec();,
+ eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
+ ])
+ qwt_ok="$salome_cv_lib_qwt"
+
+ if test "x$qwt_ok" = "xno"
+ then
+ AC_MSG_RESULT(unable to link with qwt library)
+ AC_MSG_RESULT(QWTHOME environment variable may be wrong)
+ else
+ QWT_INCLUDES="-I$QWT_INCLUDES"
+ if test "x$QWTHOME" = "x/usr"
+ then
+ QWT_LIBS=" -lqwt"
+ else
+ QWT_LIBS="-L$QWTHOME/lib -lqwt"
+ fi
+
+ AC_SUBST(QWT_INCLUDES)
+ AC_SUBST(QWT_LIBS)
+
+ AC_MSG_RESULT(yes)
+ fi
+
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
+
+fi
+
+
+ AC_LANG_RESTORE
+
+fi
+
+
+])dnl
+dnl
--- /dev/null
+# generic rule to put in top module Makefile
+# (for example with module SALOME, SALOME/Makefile.in and SALOME/src/Makefile.in)
+
+# build all lib in all subdir
+lib:$(SUBDIRS:%=lib_%)
+
+$(SUBDIRS:%=lib_%):lib_%:%
+ cd $< ; $(MAKE) lib
+
+# build all bin in all subdir
+bin:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+# launch check in all subdir
+check: tests
+tests:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+# copy all header files in common directory
+inc:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+exportinc:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+# copy all idl files in common directory
+idl:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+dep: depend
+
+depend:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+# copy all resources files in common directory
+RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
+RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
+RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
+RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
+
+resources: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%)
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : %
+ cp -fr $< $@;
+
+#data:
+# @if test "X$(top_builddir)" = "X."; then \
+# ((cd examples && $(MAKE) $@) || exit 1); \
+# fi;
+# Commented because we need not to make docs when we make BUILD
+# docs:
+# @if test "X$(top_builddir)" = "X."; then \
+# ((cd doc && $(MAKE) $@) || exit 1); \
+# fi;
+
+install: install-resources
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+ @if test "X$(top_builddir)" = "X."; then \
+ $(LT) --mode=finish $(libdir) ; \
+ fi
+
+uninstall: uninstall-resources
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+cleandep:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+mostlyclean:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+clean:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+ -$(RM) .depend *~ *% core *.core *.bak *.new *.old
+
+distclean: clean
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+ -$(RM) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%)
+ -$(RM) Makefile
+
+install-resources:
+# one resources directory for all salome modules
+ $(INSTALL) -d $(datadir)/resources
+ for f in X $(RESOURCES_FILES:%=$(srcdir)/resources/%); do \
+ if test $$f != X; then \
+ ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \
+ fi; \
+ done
+
+# Uninstall resources files
+uninstall-resources:
+ @for f in X $(RESOURCES_FILES); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(datadir)/resources/$$f ; \
+ fi; \
+ done
+
--- /dev/null
+
+pymodule_template = """\
+# DO NOT EDIT THIS FILE!
+#
+# Python module @module@ generated by omniidl
+
+import omnipatch
+omnipatch.updateModule("@module@")
+
+# ** 1. Stub files contributing to this module
+
+# ** 2. Sub-modules
+
+# ** 3. End"""
+
+import omniidl_be.python
+omniidl_be.python.pymodule_template=pymodule_template
+
+def run(tree, args):
+ omniidl_be.python.run(tree, args)
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _BASICMAINTEST_HXX_
+#define _BASICMAINTEST_HXX_
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TextTestProgressListener.h>
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestRunner.h>
+#include <stdexcept>
+
+#include <iostream>
+#include <fstream>
+
+// ============================================================================
+/*!
+ * Main program source for Unit Tests with cppunit package does not depend
+ * on actual tests, so we use the same for all partial unit tests.
+ */
+// ============================================================================
+
+int main(int argc, char* argv[])
+{
+ // --- Create the event manager and test controller
+ CPPUNIT_NS::TestResult controller;
+
+ // --- Add a listener that colllects test result
+ CPPUNIT_NS::TestResultCollector result;
+ controller.addListener( &result );
+
+ // --- Add a listener that print dots as test run.
+#ifdef WIN32
+ CPPUNIT_NS::TextTestProgressListener progress;
+#else
+ CPPUNIT_NS::BriefTestProgressListener progress;
+#endif
+ controller.addListener( &progress );
+
+ // --- Get the top level suite from the registry
+
+ CPPUNIT_NS::Test *suite =
+ CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+
+ // --- Adds the test to the list of test to run
+
+ CPPUNIT_NS::TestRunner runner;
+ runner.addTest( suite );
+ runner.run( controller);
+
+ // --- Print test in a compiler compatible format.
+
+ std::ofstream testFile;
+ testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc);
+ //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
+ CPPUNIT_NS::CompilerOutputter outputter( &result, testFile );
+ outputter.write();
+
+ // --- Run the tests.
+
+ bool wasSucessful = result.wasSuccessful();
+ testFile.close();
+
+ // --- Return error code 1 if the one of test failed.
+
+ return wasSucessful ? 0 : 1;
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * APIInternalFailureException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 20 15:15:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_APIInternalFailureException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * APIInternalFailureException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 20 15:15:41 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _APIINTERNALFAILUREEXCEPTION_H_
+#define _APIINTERNALFAILUREEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class APIInternalFailureException : public GenericException
+ {
+ public:
+ // Constructeur
+ APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {}
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <netdb.h>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_Job.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_JobInfo.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+#include "Batch_FactBatchManager.hxx"
+#include "Batch_BatchManager.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeur
+// BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map()
+// {
+// // On verifie que le hostname est correct
+// if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
+// string msg = "hostname \"";
+// msg += _hostname;
+// msg += "\" unknown from the network";
+// throw InvalidArgumentException(msg.c_str());
+// }
+// }
+ BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent)
+ {
+ // On verifie que le hostname est correct
+ if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
+ string msg = "hostname \"";
+ msg += _hostname;
+ msg += "\" unknown from the network";
+ throw InvalidArgumentException(msg.c_str());
+ }
+ }
+
+ // Destructeur
+ BatchManager::~BatchManager()
+ {
+ // Nothing to do
+ }
+
+ string BatchManager::__repr__() const
+ {
+ ostringstream oss;
+ oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
+ return oss.str();
+ }
+
+ // Recupere le l'identifiant d'un job deja soumis au BatchManager
+// const JobId BatchManager::getJobIdByReference(const string & ref)
+// {
+// return JobId(this, ref);
+// }
+ const JobId BatchManager::getJobIdByReference(const char * ref)
+ {
+ return JobId(this, ref);
+ }
+
+// // Methode pour le controle des jobs : soumet un job au gestionnaire
+// const JobId BatchManager::submitJob(const Job & job)
+// {
+// static int idx = 0;
+// //MEDMEM::STRING sst;
+// ostringstream sst;
+// sst << "Jobid_" << idx++;
+// JobId id(this, sst.str());
+// return id;
+// }
+
+// // Methode pour le controle des jobs : retire un job du gestionnaire
+// void BatchManager::deleteJob(const JobId & jobid)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : suspend un job en file d'attente
+// void BatchManager::holdJob(const JobId & jobid)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : relache un job suspendu
+// void BatchManager::releaseJob(const JobId & jobid)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : modifie un job en file d'attente
+// void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : modifie un job en file d'attente
+// void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : modifie un job en file d'attente
+// void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
+// {
+// // Nothing to do
+// }
+
+// // Methode pour le controle des jobs : renvoie l'etat du job
+// JobInfo BatchManager::queryJob(const JobId & jobid)
+// {
+// return JobInfo();
+// }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _BATCHMANAGER_H_
+#define _BATCHMANAGER_H_
+
+#include <string>
+#include <map>
+#include "Batch_Job.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_JobInfo.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+
+namespace Batch {
+
+ class Job;
+ class JobId;
+ class JobInfo;
+ class FactBatchManager;
+
+ class BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ //BatchManager(std::string host="localhost") throw(InvalidArgumentException); // connexion a la machine host
+ BatchManager(const Batch::FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException); // connexion a la machine host
+ virtual ~BatchManager();
+ virtual std::string __repr__() const;
+
+ // Recupere le l'identifiant d'un job deja soumis au BatchManager
+ //virtual const JobId getJobIdByReference(const std::string & ref);
+ virtual const Batch::JobId getJobIdByReference(const char * ref);
+
+ // Methodes pour le controle des jobs : virtuelles pures
+ virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire
+ virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire
+ virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente
+ virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu
+ virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
+ virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente
+ virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
+ virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job
+
+ protected:
+ std::string _hostname; // serveur ou tourne le BatchManager
+ // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
+ std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
+ const Batch::FactBatchManager * _parent;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManagerCatalog.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <map>
+#include "Batch_BatchManagerCatalog.hxx"
+#include "Batch_FactBatchManager.hxx"
+using namespace std;
+
+namespace Batch {
+
+ pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER;
+ std::map<string, FactBatchManager *> * BatchManagerCatalog::_p_catalog = 0;
+
+ // Constructeur
+ BatchManagerCatalog::BatchManagerCatalog()
+ {
+ // Nothing to do
+ }
+
+ // Destructeur
+ BatchManagerCatalog::~BatchManagerCatalog()
+ {
+ // Nothing to do
+ }
+
+ // Functor
+ FactBatchManager * BatchManagerCatalog::getFactBatchManager(const char * type)
+ {
+ return (* BatchManagerCatalog::_p_catalog)[type];
+ }
+
+ void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM)
+ {
+ if (pFBM) { // *** section critique ***
+ pthread_mutex_lock(&_mutex);
+
+ if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new std::map<string, FactBatchManager *>;
+ (*BatchManagerCatalog::_p_catalog)[type] = pFBM;
+
+ pthread_mutex_unlock(&_mutex);
+ }
+ }
+
+ FactBatchManager * BatchManagerCatalog::operator() (const char * type) const
+ {
+ return BatchManagerCatalog::getFactBatchManager(type);
+ }
+
+ std::map<string, FactBatchManager *> * BatchManagerCatalog::dict() const
+ {
+ return _p_catalog;
+ }
+
+ string BatchManagerCatalog::__repr__() const
+ {
+ ostringstream oss;
+ oss << "<BatchManagerCatalog contains {";
+ string sep;
+ for(std::map<string, FactBatchManager *>::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") {
+ oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'";
+ }
+ oss << "}>";
+ return oss.str();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManagerCatalog.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _CATALOG_H_
+#define _CATALOG_H_
+
+#include <string>
+#include <map>
+#include <pthread.h>
+
+namespace Batch {
+
+ class FactBatchManager;
+
+ class BatchManagerCatalog
+ {
+ public:
+ // Constructeur
+ BatchManagerCatalog();
+ // Destructeur
+ virtual ~BatchManagerCatalog();
+
+ static Batch::FactBatchManager * getFactBatchManager(const char * type);
+ static void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM);
+ virtual Batch::FactBatchManager * operator() (const char * type) const;
+
+ virtual std::map<std::string, FactBatchManager *> * dict() const;
+ virtual std::string __repr__() const;
+
+ protected:
+ static std::map<std::string, FactBatchManager *> * _p_catalog;
+ static pthread_mutex_t _mutex;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager_LSF.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:17:22 2003
+ * Projet : Salome 2
+ *
+ */
+
+extern "C" {
+#include <lsf/lsf.h>
+#include <lsf/lsbatch.h>
+}
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include "Batch_BatchManager_LSF.hxx"
+
+namespace Batch {
+
+ BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
+ {
+ // On se connecte au serveur LSF
+ _connect = lsb_init("Salome2 Batch library");
+ if (_connect < 0) { // si erreur
+ char * errmsg = lsb_sysmsg();
+ string msg = "LSF Server on host \"";
+ msg += _hostname;
+ msg += "\" : ";
+ msg += errmsg ? errmsg : "Reason unknown";
+ throw ConnexionFailureException(msg.c_str());
+ }
+ }
+
+ // Destructeur
+ BatchManager_LSF::~BatchManager_LSF()
+ {
+ // Nothing to do
+ }
+
+ // Methode pour le controle des jobs : soumet un job au gestionnaire
+ const JobId BatchManager_LSF::submitJob(const Job & job)
+ {
+ Job_LSF joblsf = job;
+ struct submitReply reply;
+ int ref = lsb_submit(joblsf.getSubmitStruct(),
+ &reply);
+ if (ref < 0) { // si erreur
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("LSF submit error. Reason : ") + msg);
+ }
+
+ ostringstream oss;
+ oss << ref;
+ JobId id(this, oss.str());
+ return id;
+ }
+
+ // Methode pour le controle des jobs : retire un job du gestionnaire
+ void BatchManager_LSF::deleteJob(const JobId & jobid)
+ {
+ int ref;
+ istringstream iss(jobid.getReference());
+ iss >> ref;
+ int rc = lsb_deletejob(ref, 0, 0);
+ if (rc < 0) { // si erreur
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("LSF deljob error. Reason : ") + msg);
+ }
+ }
+
+ // Methode pour le controle des jobs : suspend un job en file d'attente
+ void BatchManager_LSF::holdJob(const JobId & jobid)
+ {
+ int ref;
+ istringstream iss(jobid.getReference());
+ iss >> ref;
+ int rc = lsb_signaljob(ref, SIGSTOP);
+ if (rc < 0) { // si erreur
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg);
+ }
+ }
+
+ // Methode pour le controle des jobs : relache un job suspendu
+ void BatchManager_LSF::releaseJob(const JobId & jobid)
+ {
+ int ref;
+ istringstream iss(jobid.getReference());
+ iss >> ref;
+ int rc = lsb_signaljob(ref, SIGCONT);
+ if (rc < 0) { // si erreur
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg);
+ }
+ }
+
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+ {
+ int ref;
+ istringstream iss(jobid.getReference());
+ iss >> ref;
+
+ Job_LSF joblsf = Job(param, env);
+ struct submitReply reply;
+ ref = lsb_modify(joblsf.getSubmitStruct(),
+ &reply,
+ ref);
+ if (ref < 0) { // si erreur
+ ostringstream msg_sst;
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ msg_sst << msg << endl;
+// msg_sst << "BadJobId = " << (long) reply.badJobId << endl
+// << "BadJobName = " << reply.badJobName << endl
+// << "BadReqIndx = " << reply.badReqIndx << endl;
+ throw APIInternalFailureException(string("LSF modify error. Reason : ") + msg_sst.str());
+ }
+ }
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param)
+ {
+ alterJob(jobid, param, Environnement());
+ }
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_LSF::alterJob(const JobId & jobid, const Environnement & env)
+ {
+ alterJob(jobid, Parametre(), env);
+ }
+
+
+
+ // Methode pour le controle des jobs : renvoie l'etat du job
+ JobInfo BatchManager_LSF::queryJob(const JobId & jobid)
+ {
+ int id;
+ istringstream iss(jobid.getReference());
+ iss >> id;
+
+ JobInfo_LSF ji = JobInfo_LSF(id);
+
+ return ji;
+ }
+
+
+
+ // Methode pour le controle des jobs : teste si un job est present en machine
+ bool BatchManager_LSF::isRunning(const JobId & jobid)
+ {
+ int id;
+ istringstream iss(jobid.getReference());
+ iss >> id;
+
+ JobInfo_LSF ji = JobInfo_LSF(id);
+
+ return ji.isRunning();
+ }
+
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager_LSF.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:17:22 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _BATCHMANAGER_LSF_H_
+#define _BATCHMANAGER_LSF_H_
+
+
+#include "Batch_Job.hxx"
+#include "Batch_Job.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_JobInfo.hxx"
+#include "Batch_JobInfo_LSF.hxx"
+#include "Batch_Job_LSF.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+#include "Batch_ConnexionFailureException.hxx"
+#include "Batch_APIInternalFailureException.hxx"
+#include "Batch_NotYetImplementedException.hxx"
+#include "Batch_BatchManager.hxx"
+
+namespace Batch {
+
+ class Job;
+ class JobId;
+ class JobInfo;
+ class FactBatchManager;
+
+ class BatchManager_LSF : public BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ BatchManager_LSF(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
+ virtual ~BatchManager_LSF();
+
+ // Recupere le nom du serveur par defaut
+ // static string BatchManager_LSF::getDefaultServer();
+
+ // Methodes pour le controle des jobs
+ virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+ virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+ virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+ virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+ virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+ virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+ virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+ virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+ virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+ virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+ virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+
+ protected:
+ int _connect; // LSF connect id
+
+ private:
+
+#ifdef SWIG
+ public:
+ // Recupere le l'identifiant d'un job deja soumis au BatchManager
+ //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+ virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager_PBS.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:17:22 2003
+ * Projet : Salome 2
+ *
+ */
+
+extern "C" {
+#include <pbs_error.h>
+#include <pbs_ifl.h>
+}
+#include <iostream>
+#include <fstream>
+#include <sstream>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_BatchManager_PBS.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Recupere le nom du serveur par defaut
+// string BatchManager_PBS::getDefaultServer() {
+// string server_name = "localhost";
+
+// const char * server_name_path = "@openpbsspooldir@/server_name";
+// ifstream server_name_file(server_name_path);
+// if (server_name_file) {
+// server_name_file >> server_name;
+// server_name_file.close();
+// }
+
+// return server_name;
+// }
+
+ // Constructeur
+// BatchManager_PBS::BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(BatchManager_PBS::getDefaultServer())
+// {
+// // On se connecte au serveur PBS
+// _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
+// if (_connect < 0) { // si erreur
+// char * errmsg = pbs_geterrmsg(_connect);
+// string msg = "PBS Server on host \"";
+// msg += _hostname;
+// msg += "\" : ";
+// msg += errmsg ? errmsg : "Reason unknown";
+// throw ConnexionFailureException(msg.c_str());
+// }
+// }
+
+ // Constructeur
+// BatchManager_PBS::BatchManager_PBS(string host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(host)
+// {
+// // On se connecte au serveur PBS
+// _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
+// if (_connect < 0) { // si erreur
+// char * errmsg = pbs_geterrmsg(_connect);
+// string msg = "PBS Server on host \"";
+// msg += _hostname;
+// msg += "\" : ";
+// msg += errmsg ? errmsg : "Reason unknown";
+// throw ConnexionFailureException(msg.c_str());
+// }
+// }
+ BatchManager_PBS::BatchManager_PBS(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
+ {
+ // On se connecte au serveur PBS
+ _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
+ if (_connect < 0) { // si erreur
+ char * errmsg = pbs_geterrmsg(_connect);
+ string msg = "PBS Server on host \"";
+ msg += _hostname;
+ msg += "\" : ";
+ msg += errmsg ? errmsg : "Reason unknown";
+ throw ConnexionFailureException(msg.c_str());
+ }
+ }
+
+ // Destructeur
+ BatchManager_PBS::~BatchManager_PBS()
+ {
+ // On se deconnecte du serveur PBS
+ int rc = pbs_disconnect(_connect);
+ if (rc < 0) { // si erreur
+ string msg = "PBS Server on host \"";
+ msg += _hostname;
+ msg += "\" : ";
+ msg += pbs_geterrmsg(_connect);
+ throw ConnexionFailureException(msg.c_str());
+ }
+ }
+
+ // Methode pour le controle des jobs : soumet un job au gestionnaire
+ const JobId BatchManager_PBS::submitJob(const Job & job)
+ {
+ Job_PBS jobpbs = job;
+ char * ref = pbs_submit(_connect,
+ jobpbs.getAttributesOP(),
+ jobpbs.getScript(),
+ jobpbs.getDestination(),
+ NULL);
+ if (!ref) { // si erreur
+ char * msg = pbs_geterrmsg(_connect);
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("PBS submit error. Reason : ") + msg);
+ }
+
+ JobId id(this, string(ref));
+ free(ref);
+ return id;
+ }
+
+ // Methode pour le controle des jobs : retire un job du gestionnaire
+ void BatchManager_PBS::deleteJob(const JobId & jobid)
+ {
+ char * ref = const_cast< char * >(jobid.getReference().c_str());
+ int rc = pbs_deljob(_connect, ref, 0);
+ if (rc) { // si erreur
+ char * msg = pbs_geterrmsg(_connect);
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("PBS deljob error. Reason : ") + msg);
+ }
+ }
+
+ // Methode pour le controle des jobs : suspend un job en file d'attente
+ void BatchManager_PBS::holdJob(const JobId & jobid)
+ {
+ char * ref = const_cast< char * >(jobid.getReference().c_str());
+ int rc = pbs_holdjob(_connect, ref, USER_HOLD, 0);
+ if (rc) { // si erreur
+ char * msg = pbs_geterrmsg(_connect);
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("PBS holdjob error. Reason : ") + msg);
+ }
+ }
+
+ // Methode pour le controle des jobs : relache un job suspendu
+ void BatchManager_PBS::releaseJob(const JobId & jobid)
+ {
+ char * ref = const_cast< char * >(jobid.getReference().c_str());
+ int rc = pbs_rlsjob(_connect, ref, USER_HOLD, 0);
+ if (rc) { // si erreur
+ char * msg = pbs_geterrmsg(_connect);
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("PBS rlsjob error. Reason : ") + msg);
+ }
+ }
+
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+ {
+ Job job(param, env);
+ Job_PBS jobpbs(job);
+
+ char * ref = const_cast< char * >(jobid.getReference().c_str());
+ int rc = pbs_alterjob(_connect,
+ ref,
+ jobpbs.getAttributes(),
+ NULL);
+ if (rc) { // si erreur
+ char * msg = pbs_geterrmsg(_connect);
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("PBS alterjob error. Reason : ") + msg);
+ }
+
+ }
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param)
+ {
+ alterJob(jobid, param, Environnement());
+ }
+
+ // Methode pour le controle des jobs : modifie un job en file d'attente
+ void BatchManager_PBS::alterJob(const JobId & jobid, const Environnement & env)
+ {
+ alterJob(jobid, Parametre(), env);
+ }
+
+
+
+ // Methode pour le controle des jobs : renvoie l'etat du job
+ JobInfo BatchManager_PBS::queryJob(const JobId & jobid)
+ {
+ char * id = const_cast< char * >(jobid.getReference().c_str());
+ JobInfo_PBS ji = JobInfo_PBS(pbs_statjob(_connect, id, 0, 0), true);
+ return ji;
+ }
+
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BatchManager_PBS.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:17:22 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _BATCHMANAGER_PBS_H_
+#define _BATCHMANAGER_PBS_H_
+
+
+#include "Batch_Job.hxx"
+#include "Batch_Job.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_JobInfo.hxx"
+#include "Batch_JobInfo_PBS.hxx"
+#include "Batch_Job_PBS.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+#include "Batch_ConnexionFailureException.hxx"
+#include "Batch_APIInternalFailureException.hxx"
+#include "Batch_NotYetImplementedException.hxx"
+#include "Batch_BatchManager.hxx"
+
+namespace Batch {
+
+ class Job;
+ class JobId;
+ class JobInfo;
+ class FactBatchManager;
+
+ class BatchManager_PBS : public BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ //BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException); // connexion au serveur par defaut
+ //BatchManager_PBS(std::string host) throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
+ BatchManager_PBS(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
+ virtual ~BatchManager_PBS();
+
+ // Recupere le nom du serveur par defaut
+ // static std::string BatchManager_PBS::getDefaultServer();
+
+ // Methodes pour le controle des jobs
+ virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+ virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+ virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+ virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+ virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+ virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+ virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+ virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+
+ virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+ virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+
+ protected:
+ int _connect; // PBS connect id
+
+ private:
+
+#ifdef SWIG
+ public:
+ // Recupere le l'identifiant d'un job deja soumis au BatchManager
+ //virtual const JobId getJobIdByReference(const std::string & ref) { return BatchManager::getJobIdByReference(ref); }
+ virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BoolType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <assert.h>
+#include "Batch_BoolType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string BoolType::affiche() const
+ {
+ return _data ? string("true") : string("false");
+ }
+
+ // Operateur d'affectation
+ BoolType & BoolType::operator =(bool b)
+ {
+ _data = b;
+ return *this;
+ }
+
+ // Conversion en bool
+ BoolType::operator bool() const
+ {
+ return this->_data;
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * BoolType::clone() const
+ {
+ BoolType * pB = new BoolType(this->_data);
+ assert(pB != 0);
+ return pB;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * BoolType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _BOOLTYPE_H_
+#define _BOOLTYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+
+namespace Batch {
+
+ class BoolType : public GenericType
+ {
+ public:
+ // Constructeur
+ BoolType(const bool b=false) : _data(b) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Operateur d'affectation
+ virtual BoolType & operator =(bool);
+
+ // Conversion en bool
+ virtual operator bool() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ bool _data;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * CharType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <assert.h>
+#include "Batch_CharType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string CharType::affiche() const
+ {
+ return string(1, _data);
+ }
+
+ // Operateur d'affectation
+ CharType & CharType::operator =(char c)
+ {
+ _data = c;
+ return *this;
+ }
+
+ // Conversion en char
+ CharType::operator char() const
+ {
+ return this->_data;
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * CharType::clone() const
+ {
+ CharType * pC = new CharType(this->_data);
+ assert(pC != 0);
+ return pC;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * CharType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _CHARTYPE_H_
+#define _CHARTYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+
+namespace Batch {
+
+ class CharType : public GenericType
+ {
+ public:
+ // Constructeur
+ CharType(const char c=0) : _data(c) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Operateur d'affectation
+ virtual CharType & operator =(char);
+
+ // Conversion en char
+ virtual operator char() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ char _data;
+
+ private:
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * ConnexionFailureException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 13 11:24:31 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_ConnexionFailureException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * ConnexionFailureException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 13 11:24:31 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _CONNEXIONFAILUREEXCEPTION_H_
+#define _CONNEXIONFAILUREEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class ConnexionFailureException : public GenericException
+ {
+ public:
+ // Constructeur
+ ConnexionFailureException(std::string ch = "undefined") : GenericException("ConnexionFailureException", ch) {}
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Couple.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Dec 9 15:00:35 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_Couple.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Operateur d'affectation
+ Couple & Couple::operator =(const Couple & C)
+ {
+ _local = C._local;
+ _remote = C._remote;
+ return *this;
+ }
+
+ // Conversion en chaine
+ string Couple::str() const
+ {
+ string res;
+ res = "Couple(local : ";
+ res += _local;
+ res += ", remote : ";
+ res += _remote;
+ res += ")";
+ return res;
+ }
+
+ // Operateur pour l'affichage sur un stream
+ ostream & operator << (ostream & os, const Couple & cp)
+ {
+ return os << cp.str();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Couple.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Dec 9 15:00:35 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _COUPLE_H_
+#define _COUPLE_H_
+
+#include <string>
+
+namespace Batch {
+
+ class Couple
+ {
+ public:
+ // Constructeur standard
+ Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {}
+
+ // Constructeur par recopie
+ Couple(const Couple & C) : _local(C._local), _remote(C._remote) {}
+
+ // Operateur pour l'affichage sur un stream
+ friend std::ostream & operator << (std::ostream & os, const Couple & cp);
+
+ // Operateur d'affectation
+ virtual Couple & operator =(const Couple &);
+
+ // Conversion en chaine
+ virtual std::string str() const;
+
+ // Accesseurs
+ virtual std::string getLocal() const { return _local; }
+ virtual std::string getRemote() const { return _remote; }
+
+ protected:
+ std::string _local; // chemin d'acces au fichier local
+ std::string _remote; // chemin d'acees au fichier distant
+
+ private:
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * CoupleType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Dec 9 14:51:53 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <assert.h>
+#include "Batch_CoupleType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string CoupleType::affiche() const
+ {
+ return _data.str();
+ }
+
+ // Operateur d'affectation
+ CoupleType & CoupleType::operator =(const Couple & C)
+ {
+ _data = C;
+ return *this;
+ }
+
+ // Conversion en char
+ CoupleType::operator Couple() const
+ {
+ return _data;
+ }
+
+ // Conversion en chaine
+ CoupleType::operator string() const
+ {
+ return _data.str();
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * CoupleType::clone() const
+ {
+ CoupleType * pC = new CoupleType(this->_data);
+ assert(pC != 0);
+ return pC;
+ }
+
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * CoupleType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Dec 9 14:51:53 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _COUPLETYPE_H_
+#define _COUPLETYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+#include "Batch_Couple.hxx"
+
+namespace Batch {
+
+ class CoupleType : public GenericType
+ {
+ public:
+ // Constructeur
+ CoupleType(const Couple & C) : _data(C) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+ virtual operator std::string() const;
+
+ // Operateur d'affectation
+ virtual CoupleType & operator =(const Couple & C);
+
+ // Conversion en char
+ virtual operator Couple() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ Couple _data;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Date.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 14:11:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <cstdio>
+#include <ctime>
+#include "Batch_Date.hxx"
+using namespace std;
+
+namespace Batch {
+
+ Date::Date(const long l)
+ {
+ time_t l_t = l;
+ struct tm * p_tm = localtime(&l_t);
+ _day = p_tm->tm_mday;
+ _month = p_tm->tm_mon + 1;
+ _year = p_tm->tm_year + 1900;
+ _hour = p_tm->tm_hour;
+ _min = p_tm->tm_min;
+ _sec = p_tm->tm_sec;
+ }
+
+ Date::Date(const string s)
+ {
+ if ((s == "now") || (s == "Now") || (s == "NOW")) {
+ long l = time(0);
+ time_t l_t = l;
+ struct tm * p_tm = localtime(&l_t);
+ _day = p_tm->tm_mday;
+ _month = p_tm->tm_mon + 1;
+ _year = p_tm->tm_year + 1900;
+ _hour = p_tm->tm_hour;
+ _min = p_tm->tm_min;
+ _sec = p_tm->tm_sec;
+
+ } else {
+ char c;
+// istringstream ist(s);
+// ist >> _day >> c
+// >> _month >> c
+// >> _year >> c
+// >> _hour >> c
+// >> _min >> c
+// >> _sec;
+ sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec);
+ }
+ }
+
+ Date & Date::operator =(long l)
+ {
+ time_t l_t = l;
+ struct tm * p_tm = localtime(&l_t);
+ _day = p_tm->tm_mday;
+ _month = p_tm->tm_mon + 1;
+ _year = p_tm->tm_year + 1900;
+ _hour = p_tm->tm_hour;
+ _min = p_tm->tm_min;
+ _sec = p_tm->tm_sec;
+
+ return *this;
+ }
+
+ Date & Date::operator +(long l)
+ {
+ *this = epoch() + l;
+ return *this;
+ }
+
+ Date & Date::operator -(long l)
+ {
+ *this = epoch() - l;
+ return *this;
+ }
+
+ Date & Date::operator +=(long l)
+ {
+ *this = epoch() + l;
+ return *this;
+ }
+
+ Date & Date::operator -=(long l)
+ {
+ *this = epoch() - l;
+ return *this;
+ }
+
+ Date & Date::operator =(const string & s)
+ {
+ if ((s == "now") || (s == "Now") || (s == "NOW")) {
+ long l = time(0);
+ time_t l_t = l;
+ struct tm * p_tm = localtime(&l_t);
+ _day = p_tm->tm_mday;
+ _month = p_tm->tm_mon + 1;
+ _year = p_tm->tm_year + 1900;
+ _hour = p_tm->tm_hour;
+ _min = p_tm->tm_min;
+ _sec = p_tm->tm_sec;
+
+ } else {
+ char c;
+// istringstream ist(s);
+// ist >> _day >> c
+// >> _month >> c
+// >> _year >> c
+// >> _hour >> c
+// >> _min >> c
+// >> _sec;
+ sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec);
+ }
+
+ return *this;
+ }
+
+ string Date::str() const
+ {
+ char buf[64];
+ string datestr;
+
+ // _day to char *
+ sprintf(buf, "%02ld", _day);
+ datestr += buf;
+ datestr += "/";
+
+ // _month to char *
+ sprintf(buf, "%02ld", _month);
+ datestr += buf;
+ datestr += "/";
+
+ // _year to char *
+ sprintf(buf, "%04ld", _year);
+ datestr += buf;
+ datestr += "-";
+
+ // _hour to char *
+ sprintf(buf, "%02ld", _hour);
+ datestr += buf;
+ datestr += ":";
+
+ // _min to char *
+ sprintf(buf, "%02ld", _min);
+ datestr += buf;
+ datestr += ":";
+
+ // _sec to char *
+ sprintf(buf, "%02ld", _sec);
+ datestr += buf;
+
+ return datestr;
+ }
+
+ long Date::epoch() const
+ {
+ struct tm T;
+ T.tm_mday = _day;
+ T.tm_mon = _month - 1;
+ T.tm_year = _year - 1900;
+ T.tm_hour = _hour;
+ T.tm_min = _min;
+ T.tm_sec = _sec;
+ return mktime(&T);
+ }
+
+}
+
+
+// COMMENTS
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Date.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 14:11:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _DATE_H_
+#define _DATE_H_
+
+#include <string>
+
+namespace Batch {
+
+ class Date
+ {
+ public:
+ Date(const long l=0);
+ Date(const std::string s);
+ virtual Date & operator =(long l);
+ virtual Date & operator +(long l);
+ virtual Date & operator -(long l);
+ virtual Date & operator +=(long l);
+ virtual Date & operator -=(long l);
+ virtual Date & operator =(const std::string & s);
+ virtual std::string str() const;
+ virtual long epoch() const;
+
+ protected:
+ int _day, _month, _year;
+ int _hour, _min, _sec;
+
+ private:
+
+ };
+
+}
+
+#endif
+
+// COMMENTS
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * DateType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 11:15:34 2003
+ * Projet : Salome 2
+ *
+ */
+extern "C" {
+#include <time.h>
+}
+#include <assert.h>
+#include "Batch_DateType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string DateType::affiche() const
+ {
+ return _data.str();
+ }
+
+ // Operateur d'affectation
+ DateType & DateType::operator =(const Date & d)
+ {
+ _data = d;
+ return *this;
+ }
+
+ // Conversion en Date
+ DateType::operator Date() const
+ {
+ return _data;
+ }
+
+ // Conversion en long
+ DateType::operator long() const
+ {
+ return _data.epoch();
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * DateType::clone() const
+ {
+ DateType * pD = new DateType(this->_data);
+ assert(pD != 0);
+ return pD;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * DateType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 11:15:34 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _DATETYPE_H_
+#define _DATETYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+#include "Batch_Date.hxx"
+
+namespace Batch {
+
+ class DateType : public GenericType
+ {
+ public:
+ // Constructeur
+ DateType(const Date & d) : _data(d) {};
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Operateur d'affectation
+ virtual DateType & operator =(const Date &);
+
+ // Conversion en Date
+ virtual operator Date() const;
+
+ // Conversion en long
+ virtual operator long() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ Date _data;
+
+ private:
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Environnement.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Oct 16 11:37:47 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_Environnement.hxx"
+using namespace std;
+
+namespace Batch {
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Environnement.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Oct 16 11:37:47 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _ENVIRONNEMENT_H_
+#define _ENVIRONNEMENT_H_
+
+
+#include <string>
+#include <map>
+
+namespace Batch {
+
+ typedef std::map < std::string, std::string > Environnement;
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include "Batch_BatchManagerCatalog.hxx"
+#include "Batch_FactBatchManager.hxx"
+#include "utilities.h"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeur
+ FactBatchManager::FactBatchManager(const string & _t) : type(_t)
+ {
+ BatchManagerCatalog::addFactBatchManager(type.c_str(), this);
+ ostringstream msg;
+ msg << "FactBatchManager of type '" << type << "' inserted into catalog";
+ MESSAGE(msg.str().c_str());
+ }
+
+ // Destructeur
+ FactBatchManager::~FactBatchManager()
+ {
+ // Nothing to do
+ }
+
+ // Accesseur
+ string FactBatchManager::getType() const
+ {
+ return type;
+ }
+
+ string FactBatchManager::__repr__() const
+ {
+ ostringstream oss;
+ oss << "<FactBatchManager of type '" << type << "'>";
+ return oss.str();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_H_
+#define _FACTBATCHMANAGER_H_
+
+#include <string>
+#include <map>
+
+namespace Batch {
+
+ class BatchManager;
+
+ class FactBatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ FactBatchManager(const std::string & type);
+ virtual ~FactBatchManager();
+
+ virtual Batch::BatchManager * operator() (const char * hostname) const = 0;
+ std::string getType() const;
+ std::string __repr__() const;
+
+ protected:
+ std::string type;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager_LSF.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include "Batch_BatchManager_LSF.hxx"
+#include "Batch_FactBatchManager_LSF.hxx"
+//#include "utilities.h"
+
+namespace Batch {
+
+ static FactBatchManager_LSF sFBM_LSF;
+
+ // Constructeur
+ FactBatchManager_LSF::FactBatchManager_LSF() : FactBatchManager("LSF")
+ {
+ // Nothing to do
+ }
+
+ // Destructeur
+ FactBatchManager_LSF::~FactBatchManager_LSF()
+ {
+ // Nothing to do
+ }
+
+ // Functor
+ BatchManager * FactBatchManager_LSF::operator() (const char * hostname) const
+ {
+ // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
+ return new BatchManager_LSF(this, hostname);
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager_LSF.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_LSF_H_
+#define _FACTBATCHMANAGER_LSF_H_
+
+using namespace std;
+#include <string>
+#include <map>
+#include "Batch_FactBatchManager.hxx"
+
+namespace Batch {
+
+ class BatchManager_LSF;
+
+ class FactBatchManager_LSF : public FactBatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ FactBatchManager_LSF();
+ virtual ~FactBatchManager_LSF();
+
+ virtual BatchManager * operator() (const char * hostname) const;
+
+ protected:
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager_PBS.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include "Batch_BatchManager_PBS.hxx"
+#include "Batch_FactBatchManager_PBS.hxx"
+#include "utilities.h"
+using namespace std;
+
+namespace Batch {
+
+ static FactBatchManager_PBS sFBM_PBS;
+
+ // Constructeur
+ FactBatchManager_PBS::FactBatchManager_PBS() : FactBatchManager("PBS")
+ {
+ // Nothing to do
+ }
+
+ // Destructeur
+ FactBatchManager_PBS::~FactBatchManager_PBS()
+ {
+ // Nothing to do
+ }
+
+ // Functor
+ BatchManager * FactBatchManager_PBS::operator() (const char * hostname) const
+ {
+ MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'");
+ return new BatchManager_PBS(this, hostname);
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * FactBatchManager_PBS.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_PBS_H_
+#define _FACTBATCHMANAGER_PBS_H_
+
+#include "Batch_FactBatchManager.hxx"
+
+namespace Batch {
+
+ class BatchManager_PBS;
+
+ class FactBatchManager_PBS : public FactBatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ FactBatchManager_PBS();
+ virtual ~FactBatchManager_PBS();
+
+ virtual BatchManager * operator() (const char * hostname) const;
+
+ protected:
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * GenericException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 10:15:57 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_GenericException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * GenericException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Nov 26 10:15:56 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _GENERICEXCEPTION_H_
+#define _GENERICEXCEPTION_H_
+
+
+#include <string>
+
+namespace Batch {
+
+ class GenericException
+ {
+ public:
+ const std::string type; // la nature de l'exception
+ const std::string message; // la raison de l'exception
+
+ // Constructeur
+ GenericException(const std::string tp = "GenericException", const std::string ch = "undefined") : type(tp), message(ch) {}
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * GenericType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+
+#include <iostream>
+#include <string>
+#include <assert.h>
+#include "Batch_GenericType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // nombre total d'objet GenericType et al.
+ int GenericType::_nb = 0;
+
+ // Operateur pour l'affichage sur un stream
+ ostream & operator << (ostream & os, const GenericType & obj)
+ {
+ return os << obj.affiche();
+ }
+
+ // Conversion en chaine
+ string GenericType::affiche() const
+ {
+ return string("(GenericType : si ce message apparait, vous devez avoir un probleme)");
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * GenericType::clone() const
+ {
+ GenericType * pG = new GenericType;
+ assert(pG != 0);
+ return pG;
+ }
+
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * GenericType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _GENERICTYPE_H_
+#define _GENERICTYPE_H_
+
+
+#include <iostream>
+#include <string>
+
+namespace Batch {
+
+ class GenericType
+ {
+ public:
+ // Constructeur et destructeur
+ GenericType() { _nb++; }
+ virtual ~GenericType() { _nb--; }
+
+ // Operateur pour l'affichage sur un stream
+ friend std::ostream & operator << (std::ostream & os, const GenericType & obj);
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ // Retourne le nombre d'objets GenericType et al.
+ static int getNb() { return _nb; }
+
+ protected:
+
+ private:
+ static int _nb; // nombre total d'objets GenericType et al.
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * IntType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_IntType.hxx"
+using namespace std;
+
+
+namespace Batch {
+
+ // Conversion en chaine
+ string IntType::affiche() const
+ {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << _data;
+ return sst.str();
+ }
+
+ // Operateur d'affectation
+ IntType & IntType::operator =(int i)
+ {
+ _data = i;
+ return *this;
+ }
+
+ // Conversion en int
+ IntType::operator int() const
+ {
+ return this->_data;
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * IntType::clone() const
+ {
+ IntType * pI = new IntType(this->_data);
+ assert(pI != 0);
+ return pI;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * IntType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _INTTYPE_H_
+#define _INTTYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+
+namespace Batch {
+
+ class IntType : public GenericType
+ {
+ public:
+ // Constructeur
+ IntType(const int i=0) : _data(i) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Operateur d'affectation
+ virtual IntType & operator =(int);
+
+ // Conversion en int
+ virtual operator int() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ int _data;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * InvalidArgumentException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Oct 16 16:18:00 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_InvalidArgumentException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * InvalidArgumentException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Oct 16 16:18:00 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _INVALIDARGUMENTEXCEPTION_H_
+#define _INVALIDARGUMENTEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class InvalidArgumentException : public GenericException
+ {
+ public:
+ // Constructeur
+ InvalidArgumentException(std::string ch = "undefined") : GenericException("InvalidArgumentException", ch) {}
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * InvalidKeyException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Oct 15 10:39:51 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_InvalidKeyException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * InvalidKeyException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Wed Oct 15 10:39:51 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _INVALIDKEYEXCEPTION_H_
+#define _INVALIDKEYEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class InvalidKeyException : public GenericException
+ {
+ public:
+ // Constructeur
+ InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {}
+
+ protected:
+
+ private:
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Batch_Job.hxx"
+#include "Batch_Parametre.hxx"
+#include <sstream>
+//#include "MEDMEM_STRING.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeur
+ Job::Job() : _param(), _env()
+ {
+ // Nothing to do
+ }
+
+
+ // Constructeur
+ Job::Job(Parametre param) : _param(param), _env()
+ {
+ // Nothing to do
+ }
+
+
+ // Constructeur
+ Job::Job(Environnement env) : _param(), _env(env)
+ {
+ // Nothing to do
+ }
+
+
+ // Constructeur
+ Job::Job(Parametre param, Environnement env) : _param(param), _env(env)
+ {
+ // Nothing to do
+ }
+
+ // Operateur pour l'affichage sur un stream
+ ostream & operator <<(ostream & os, const Job & job)
+ {
+ return os << job.__str__();
+ }
+
+ // Accesseur
+ Parametre Job::getParametre() const
+ {
+ return _param;
+ }
+
+ // Accesseur
+ void Job::setParametre(const Parametre & param)
+ {
+ _param = param;
+ }
+
+ // Accesseur
+ Environnement Job::getEnvironnement() const
+ {
+ return _env;
+ }
+
+ // Accesseur
+ void Job::setEnvironnement(const Environnement & env)
+ {
+ _env = env;
+ }
+
+
+ // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+ string Job::__str__() const {
+ //MEDMEM::STRING str;
+ ostringstream str;
+ str << "<Job (" << this << ") :" << endl;
+ str << " Parametre :" << endl;
+ Parametre::const_iterator itp;
+ for(itp=_param.begin(); itp!=_param.end(); itp++) {
+ str << " * " << (*itp).first << " : " << (*itp).second << endl;
+ }
+ str << " Environnement :" << endl;
+ Environnement::const_iterator ite;
+ for(ite=_env.begin(); ite!=_env.end(); ite++) {
+ str << " * " << (*ite).first << " : " << (*ite).second << endl;
+ }
+ str << " >";
+ return str.str();
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _JOB_H_
+#define _JOB_H_
+
+
+#include "Batch_Parametre.hxx"
+#include "Batch_Environnement.hxx"
+
+namespace Batch {
+
+ class Job
+ {
+ public:
+ // Constructeurs et destructeur
+ Job();
+ Job(Batch::Parametre param);
+ Job(Batch::Environnement env);
+ Job(Batch::Parametre param, Batch::Environnement env);
+ virtual ~Job() {}
+
+ // Operateur pour l'affichage sur un stream
+ friend std::ostream & operator <<(std::ostream & os, const Job & job);
+
+ // Accesseurs
+ Batch::Parametre getParametre() const;
+ void setParametre(const Batch::Parametre &);
+
+ // Accesseurs
+ Batch::Environnement getEnvironnement() const;
+ void setEnvironnement(const Batch::Environnement &);
+
+ // Methodes pour l'interfacage avec Python (SWIG)
+ // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+ protected:
+ Batch::Parametre _param; // table des parametres batch du job
+ Batch::Environnement _env; // table des variables d'environnement
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobId.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Batch_JobId.hxx"
+#include "Batch_BatchManager.hxx"
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeur standard
+ JobId::JobId() : _p_batchmanager(), _reference("undefined")
+ {
+ // Nothing to do
+ }
+
+ // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
+ JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref)
+ {
+ // Nothing to do
+ }
+
+ // Destructeur
+ JobId::~JobId()
+ {
+ // Nothing to do
+ }
+
+ // Operateur d'affectation entre objets
+ JobId & JobId::operator =(const JobId & jobid)
+ {
+ _p_batchmanager = jobid._p_batchmanager;
+ _reference = jobid._reference;
+
+ return *this;
+ }
+
+ // Constructeur par recopie
+ JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference)
+ {
+ // Nothing to do
+ }
+
+ // Accesseur pour la reference interne
+ string JobId::getReference() const
+ {
+ return _reference;
+ }
+
+ // Methode pour le controle du job : retire le job du gestionnaire
+ void JobId::deleteJob() const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->deleteJob(*this);
+ }
+
+ // Methode pour le controle du job : suspend le job en file d'attente
+ void JobId::holdJob() const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->holdJob(*this);
+ }
+
+ // Methode pour le controle du job : relache le job suspendu
+ void JobId::releaseJob() const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->releaseJob(*this);
+ }
+
+ // Methode pour le controle du job : modifie le job en file d'attente
+ void JobId::alterJob(const Parametre & param, const Environnement & env) const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->alterJob(*this, param, env);
+ }
+
+ // Methode pour le controle du job : modifie le job en file d'attente
+ void JobId::alterJob(const Parametre & param) const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->alterJob(*this, param);
+ }
+
+ // Methode pour le controle du job : modifie le job en file d'attente
+ void JobId::alterJob(const Environnement & env) const
+ {
+ assert(_p_batchmanager != 0);
+ _p_batchmanager->alterJob(*this, env);
+ }
+
+ // Methode pour le controle du job : renvoie l'etat du job
+ JobInfo JobId::queryJob() const
+ {
+ assert(_p_batchmanager != 0);
+ return _p_batchmanager->queryJob(*this);
+ }
+
+
+ // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+ string JobId::__str__() const {
+ //MEDMEM::STRING str;
+ ostringstream str;
+ str << "<JobId (" << this << ") : referenced '" << _reference << "'>";
+ return str.str();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobId.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _JOBID_H_
+#define _JOBID_H_
+
+
+#include "Batch_JobInfo.hxx"
+#include "Batch_BatchManager.hxx"
+
+namespace Batch {
+
+ class BatchManager;
+
+ class JobId
+ {
+ friend class BatchManager;
+
+ public:
+ // Constructeur standard et destructeur
+ JobId();
+ virtual ~JobId();
+
+ // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
+ JobId(Batch::BatchManager *, std::string ref);
+
+ // Operateur d'affectation entre objets
+ virtual JobId & operator =(const Batch::JobId &);
+
+ // Constructeur par recopie
+ JobId(const Batch::JobId &);
+
+ // Accesseur pour la reference interne
+ virtual std::string getReference() const;
+
+ // Methodes pour le controle du job
+ virtual void deleteJob() const; // retire un job du gestionnaire
+ virtual void holdJob() const; // suspend un job en file d'attente
+ virtual void releaseJob() const; // relache un job suspendu
+ virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente
+ virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente
+ virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente
+ virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente
+ virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente
+ virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job
+
+ // Methodes pour l'interfacage avec Python (SWIG)
+ // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+ protected:
+ Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job
+ std::string _reference; // reference du job au sein du BatchManager
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:05:30 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <iostream>
+#include <string>
+#include <sstream>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_JobInfo.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Destructeur
+ JobInfo::~JobInfo()
+ {
+ // Nothing to do
+ }
+
+
+ // Operateur pour l'affichage sur un stream
+ ostream & operator <<(ostream & os, const JobInfo & ji)
+ {
+ return os << ji.__str__();
+ }
+
+
+ // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python
+ string JobInfo::__str__() const
+ {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "<JobInfo (" << this << ") :" << endl;
+ sst << " ID = " <<_param[ID] << endl;
+
+ sst << " + Parametre :" << endl;
+ Parametre::const_iterator itp;
+ for(itp=_param.begin(); itp!=_param.end(); itp++) {
+ if ( (*itp).first != ID ) {
+ sst << " * " << (*itp).first << " = " << (*itp).second << endl;
+ }
+ }
+
+ sst << " + Environnement :" << endl;
+ Environnement::const_iterator ite;
+ for(ite=_env.begin(); ite!=_env.end(); ite++) {
+ sst << " * " << (*ite).first << " = " << (*ite).second << endl;
+ }
+
+ sst << " >";
+
+ return sst.str();
+ }
+
+ // Accesseur
+ Parametre JobInfo::getParametre() const
+ {
+ return _param;
+ }
+
+ // Accesseur
+ Environnement JobInfo::getEnvironnement() const
+ {
+ return _env;
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Thu Nov 6 10:05:30 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOBINFO_H_
+#define _JOBINFO_H_
+
+#include <iostream>
+#include <string>
+#include "Batch_Parametre.hxx"
+#include "Batch_Environnement.hxx"
+
+namespace Batch {
+
+ class JobInfo
+ {
+ public:
+ // Constructeur standard et destructeur
+ JobInfo() : _param(), _env() {};
+ virtual ~JobInfo();
+
+ // Constructeur par recopie
+ JobInfo(const Batch::JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
+
+ // Operateur pour l'affichage sur un stream
+ friend std::ostream & operator <<(std::ostream & os, const Batch::JobInfo & ji);
+
+ // Accesseurs
+ virtual Batch::Parametre getParametre() const;
+ virtual Batch::Environnement getEnvironnement() const;
+
+ // Methodes pour l'interfacage avec Python (SWIG)
+ // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+ protected:
+ Batch::Parametre _param; // parametres du job
+ Batch::Environnement _env; // variables d'environnement du job
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo_LSF.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 21 09:42:06 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <cstdio>
+#include <sstream>
+#include "Batch_Parametre.hxx"
+#include "Batch_Environnement.hxx"
+#include "Batch_RunTimeException.hxx"
+#include "Batch_APIInternalFailureException.hxx"
+#include "Batch_JobInfo_LSF.hxx"
+
+namespace Batch {
+
+
+
+ // Constructeurs
+ JobInfo_LSF::JobInfo_LSF(int id) : JobInfo()
+ {
+ struct loadIndexLog * p_ld = new struct loadIndexLog;
+ struct jobInfoHead * p_jInfoHead = lsb_openjobinfo_a(id, NULL, NULL, NULL, NULL, ALL_JOB);
+
+ int more = p_jInfoHead->numJobs;
+ if (more != 1) {
+ char * msg = lsb_sysmsg();
+ if (!msg) msg = "unknown";
+ throw APIInternalFailureException(string("LSF lsb_openjobinfo error. Reason : ") + msg);
+ }
+
+ // on remplit une structure contenant <more> elements
+ struct jobInfoEnt & jobInfo = * lsb_readjobinfo(&more);
+
+
+ // On remplit les membres _param et _env
+ _param[ACCOUNT] = jobInfo.submit.projectName;
+ _param[CHECKPOINT] = jobInfo.submit.chkpntPeriod != 0;
+ _param[CKPTINTERVAL] = jobInfo.submit.chkpntPeriod;
+ _param[CREATIONTIME] = jobInfo.submitTime;
+ // _param[EGROUP] = jobInfo.;
+ _param[ELIGIBLETIME] = jobInfo.reserveTime;
+ _param[ENDTIME] = jobInfo.endTime;
+ _param[EUSER] = jobInfo.execUsername;
+ _param[EXECUTABLE] = jobInfo.submit.command;
+ _param[EXITCODE] = jobInfo.exitStatus;
+ _param[HOLD] = jobInfo.status & (JOB_STAT_PSUSP | JOB_STAT_SSUSP | JOB_STAT_USUSP);
+ _param[MAIL] = jobInfo.submit.mailUser;
+ _param[MAXCPUTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_CPU];
+ _param[MAXDISKSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_FSIZE];
+ _param[MAXRAMSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_SWAP];
+ _param[MAXWALLTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_RUN];
+ _param[MODIFICATIONTIME] = jobInfo.lastEvent;
+ _param[NAME] = jobInfo.jName;
+ _param[NBPROC] = jobInfo.submit.numProcessors;
+ _param[PID] = jobInfo.jobPid;
+ _param[QUEUE] = jobInfo.submit.queue;
+ _param[QUEUEDTIME] = jobInfo.submitTime;
+ // _param[SERVER] = jobInfo.;
+ _param[STARTTIME] = jobInfo.startTime;
+ _param[TEXT] = jobInfo.numReasons ? lsb_pendreason(jobInfo.numReasons,
+ jobInfo.reasonTb,
+ p_jInfoHead,
+ p_ld) : "";
+ // _param[TMPDIR] = jobInfo.;
+ _param[USEDCPUTIME] = static_cast<long>(jobInfo.cpuTime);
+ // _param[USEDDISKSIZE] = jobInfo.;
+ _param[USEDRAMSIZE] = jobInfo.runRusage.mem;
+ _param[USEDWALLTIME] = jobInfo.duration * 60L;
+ _param[USER] = jobInfo.user;
+
+
+ ostringstream oss;
+ int jobid = jobInfo.jobId;
+ oss << jobid;
+ _param[ID] = oss.str();
+
+
+ string hosts, sep;
+ for(int i=0; i < jobInfo.numExHosts; i++, sep="+") {
+ hosts += jobInfo.exHosts[i];
+ hosts += sep;
+ }
+ _param[EXECUTIONHOST] = hosts;
+
+ ostringstream status;
+
+ if (IS_PEND(jobInfo.status))
+ status << " Job is pending;";
+ if (IS_START(jobInfo.status))
+ status << " Job is started;";
+ if (IS_FINISH(jobInfo.status))
+ status << " Job is finished;";
+ if (IS_SUSP(jobInfo.status))
+ status << " Job is suspended;";
+ if (IS_POST_DONE(jobInfo.status))
+ status << " Job is post-done;";
+ if (IS_POST_ERR(jobInfo.status))
+ status << " Job is post-error;";
+
+ _param[STATE] = status.str();
+ _running = IS_FINISH(jobInfo.status) ? false : true;
+
+
+ if (strlen(jobInfo.submit.inFile))
+ _param[INFILE] += Couple(jobInfo.submit.inFile, "stdin");
+ if (strlen(jobInfo.submit.outFile))
+ _param[OUTFILE] += Couple(jobInfo.submit.outFile, "stdout");
+ if (strlen(jobInfo.submit.errFile))
+ _param[OUTFILE] += Couple(jobInfo.submit.errFile, "stderr");
+
+ for(int i=0; i < jobInfo.submit.nxf; i++) {
+ switch (jobInfo.submit.xf[i].options) {
+ case XF_OP_SUB2EXEC:
+ _param[INFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn);
+ break;
+
+ case XF_OP_EXEC2SUB:
+ _param[OUTFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+ lsb_closejobinfo();
+ delete p_ld;
+ }
+
+
+
+ // Teste si un job est present en machine
+ bool JobInfo_LSF::isRunning() const
+ {
+ return _running;
+ }
+
+
+ // Destructeur
+ JobInfo_LSF::~JobInfo_LSF()
+ {
+ // Nothing to do
+ }
+
+
+
+ // Convertit une date HH:MM:SS en secondes
+ long JobInfo_LSF::HMStoLong(const string & s)
+ {
+ long hour, min, sec;
+
+ sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+ return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+ }
+
+ // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+ string JobInfo_LSF::__str__() const
+ {
+ ostringstream sst;
+ sst << "<JobInfo_LSF (" << this << ") :" << endl;
+ sst << " ID = " <<_param[ID] << endl;
+
+ sst << " + Parametre :" << endl;
+ Parametre::const_iterator itp;
+ for(itp=_param.begin(); itp!=_param.end(); itp++) {
+ if ( (*itp).first != ID ) {
+ sst << " * " << (*itp).first << " = " << (*itp).second << endl;
+ }
+ }
+ return sst.str();
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo_LSF.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 21 09:42:05 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOBINFO_LSF_H_
+#define _JOBINFO_LSF_H_
+
+extern "C" {
+
+#include <lsf/lsf.h>
+#include <lsf/lsbatch.h>
+}
+#include <string>
+#include "Batch_RunTimeException.hxx"
+#include "Batch_JobInfo.hxx"
+
+namespace Batch {
+
+ class JobInfo_LSF : public JobInfo
+ {
+ public:
+ // Constructeurs et destructeur
+ JobInfo_LSF() : _running(false) {};
+ JobInfo_LSF(int id);
+ virtual ~JobInfo_LSF();
+
+ // Constructeur par recopie
+ JobInfo_LSF(const JobInfo_LSF & jinfo) : JobInfo(jinfo) {};
+
+ // Teste si un job est present en machine
+ virtual bool isRunning() const;
+
+ // Methodes pour l'interfacage avec Python (SWIG)
+ // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+ string __str__() const; // SWIG : affichage en Python
+ string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+ protected:
+ bool _running; // etat du job en machine
+
+ private:
+ // Convertit une date HH:MM:SS en secondes
+ long HMStoLong(const string &);
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo_PBS.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 21 09:42:06 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <cstdio>
+#include <sstream>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_Parametre.hxx"
+#include "Batch_Environnement.hxx"
+#include "Batch_RunTimeException.hxx"
+#include "Batch_JobInfo_PBS.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeurs
+ JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : JobInfo()
+ {
+ // On ne considere que le premier element de la liste
+ // Si tout est OK, la liste ne devrait contenir qu'un element
+ // Sinon on leve une exception.
+ struct batch_status * p_job = list;
+ int i;
+ for(i=0; p_job; p_job = p_job->next) i++;
+ if (i == 0) throw RunTimeException("Liste vide (le job est absent de la file)");
+ if (i > 1) {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : la liste contient "
+ << i << " elements" << " (1 seul requis)" << endl;
+ throw RunTimeException(sst.str());
+ }
+ p_job = list;
+
+ // On remplit les membres _param et _env
+
+ if (p_job->name && strlen(p_job->name)) _param[ID] = p_job->name;
+ if (p_job->text && strlen(p_job->text)) _param[TEXT] = p_job->text;
+
+ for(struct attrl * p_attr = p_job->attribs; p_attr; p_attr = p_attr->next) {
+
+ string name, res, value;
+ if (p_attr->name && strlen(p_attr->name)) name = p_attr->name;
+ if (p_attr->resource && strlen(p_attr->resource)) res = p_attr->resource;
+ if (p_attr->value && strlen(p_attr->value)) value = p_attr->value;
+
+ if (name == ATTR_N) {
+ _param[NAME] = value;
+
+ } else if (name == ATTR_owner) {
+ _param[USER] = value;
+
+ } else if (name == ATTR_state) {
+ _param[STATE] = value;
+
+ } else if (name == ATTR_queue) {
+ _param[QUEUE] = value;
+
+ } else if (name == ATTR_A) {
+ _param[ACCOUNT] = value;
+
+ } else if (name == ATTR_M) {
+ _param[MAIL] = value;
+
+ } else if (name == ATTR_c) {
+ if (!strcmp(value.c_str(), CHECKPOINT_UNSPECIFIED)) _param[CHECKPOINT] = 1L;
+ else _param[CHECKPOINT] = 0L;
+
+ } else if (name == ATTR_h) {
+ if (!strcmp(value.c_str(), NO_HOLD)) _param[HOLD] = 0L;
+ else _param[HOLD] = 1L;
+
+ } else if (name == ATTR_ctime) {
+ _param[CREATIONTIME] = atol(value.c_str());
+
+ } else if (name == ATTR_etime) {
+ _param[ELIGIBLETIME] = atol(value.c_str());
+
+ } else if (name == ATTR_mtime) {
+ _param[MODIFICATIONTIME] = atol(value.c_str());
+
+ } else if (name == ATTR_qtime) {
+ _param[QUEUEDTIME] = atol(value.c_str());
+
+ } else if (name == ATTR_exechost) {
+ _param[EXECUTIONHOST] = value;
+
+ } else if (name == ATTR_session) {
+ _param[PID] = atol(value.c_str());
+
+ } else if (name == ATTR_euser) {
+ _param[EUSER] = value;
+
+ } else if (name == ATTR_egroup) {
+ _param[EGROUP] = value;
+
+ } else if (name == ATTR_l) {
+ if (res == "cput") {
+ _param[MAXCPUTIME] = HMStoLong(value);
+
+ } else if (res == "walltime") {
+ _param[MAXWALLTIME] = HMStoLong(value);
+
+ }
+
+ } else if (name == ATTR_used) {
+ if (res == "cput") {
+ _param[USEDCPUTIME] = HMStoLong(value);
+
+ } else if (res == "walltime") {
+ _param[USEDWALLTIME] = HMStoLong(value);
+
+ }
+
+ } else if (name == ATTR_v) {
+ int deb = 0;
+ int pos = 0;
+ bool ok = true;
+
+ while (ok) {
+ pos = value.find(",", deb);
+ string sub = value.substr(deb, pos-deb);
+ deb = pos + 1;
+ if (pos < 0) ok = false;
+
+ int eq = sub.find("=");
+ _env[sub.substr(0, eq)] = sub.substr(eq+1);
+ }
+
+ }
+ }
+
+
+ if (tobedeleted) pbs_statfree(list);
+ }
+
+ // Destructeur
+ JobInfo_PBS::~JobInfo_PBS()
+ {
+ // Nothing to do
+ }
+
+ // Convertit une date HH:MM:SS en secondes
+ long JobInfo_PBS::HMStoLong(const string & s)
+ {
+ long hour, min, sec;
+
+ sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+ return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+ }
+
+ // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+ string JobInfo_PBS::__str__() const
+ {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "<JobInfo_PBS (" << this << ") :" << endl;
+ sst << " ID = " <<_param[ID] << endl;
+
+ sst << " + Parametre :" << endl;
+ Parametre::const_iterator itp;
+ for(itp=_param.begin(); itp!=_param.end(); itp++) {
+ if ( (*itp).first != ID ) {
+ sst << " * " << (*itp).first << " = " << (*itp).second << endl;
+ }
+ }
+ return sst.str();
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * JobInfo_PBS.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 21 09:42:05 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOBINFO_PBS_H_
+#define _JOBINFO_PBS_H_
+
+extern "C" {
+
+#include <pbs_error.h>
+#include <pbs_ifl.h>
+}
+#include <string>
+#include "Batch_RunTimeException.hxx"
+#include "Batch_JobInfo.hxx"
+
+namespace Batch {
+
+ class JobInfo_PBS : public JobInfo
+ {
+ public:
+ // Constructeurs et destructeur
+ JobInfo_PBS() : JobInfo() {};
+ JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false);
+ virtual ~JobInfo_PBS();
+
+ // Constructeur par recopie
+ JobInfo_PBS(const JobInfo_PBS & jinfo) : JobInfo(jinfo) {};
+
+ // Methodes pour l'interfacage avec Python (SWIG)
+ // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+ protected:
+
+ private:
+ // Convertit une date HH:MM:SS en secondes
+ long HMStoLong(const std::string &);
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job_LSF.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <vector>
+#include "Batch_Job_LSF.hxx"
+
+namespace Batch {
+
+
+ // Constructeur
+ Job_LSF::Job_LSF(const Job & job) : _p_submit(0)
+ {
+ Parametre P = job.getParametre();
+ _p_submit = ParametreToSubmitStruct(P);
+ }
+
+
+ // Destructeur
+ Job_LSF::~Job_LSF()
+ {
+ if (_p_submit) {
+ if (_p_submit->jobName) delete [] _p_submit->jobName;
+ if (_p_submit->queue) delete [] _p_submit->queue;
+ if (_p_submit->askedHosts) {
+ delete [] *(_p_submit->askedHosts);
+ delete [] _p_submit->askedHosts;
+ }
+ if (_p_submit->resReq) delete [] _p_submit->resReq;
+ if (_p_submit->hostSpec) delete [] _p_submit->hostSpec;
+ if (_p_submit->dependCond) delete [] _p_submit->dependCond;
+ if (_p_submit->timeEvent) delete [] _p_submit->timeEvent;
+ if (_p_submit->inFile) delete [] _p_submit->inFile;
+ if (_p_submit->outFile) delete [] _p_submit->outFile;
+ if (_p_submit->errFile) delete [] _p_submit->errFile;
+ if (_p_submit->command) delete [] _p_submit->command;
+ if (_p_submit->newCommand) delete [] _p_submit->newCommand;
+ if (_p_submit->chkpntDir) delete [] _p_submit->chkpntDir;
+ if (_p_submit->xf) delete [] _p_submit->xf;
+ if (_p_submit->preExecCmd) delete [] _p_submit->preExecCmd;
+ if (_p_submit->mailUser) delete [] _p_submit->mailUser;
+ if (_p_submit->projectName) delete [] _p_submit->projectName;
+ if (_p_submit->loginShell) delete [] _p_submit->loginShell;
+ if (_p_submit->exceptList) delete [] _p_submit->exceptList;
+ delete _p_submit;
+ }
+ }
+
+
+ // Accesseur
+ struct submit * Job_LSF::getSubmitStruct()
+ {
+ return _p_submit;
+ }
+
+
+ char * Job_LSF::string2char(const string & s)
+ {
+ char * ch = new char [s.size() + 1];
+ memset(ch, 0, s.size() + 1);
+ strncat(ch, s.c_str(), s.size());
+ return ch;
+ }
+
+
+ struct submit * Job_LSF::ParametreToSubmitStruct(const Parametre & P)
+ {
+ if (! _p_submit) _p_submit = new struct submit;
+
+ memset( (void *) _p_submit, 0, sizeof(struct submit));
+
+ struct submit & sub = * _p_submit;
+ sub.options = 0;
+ sub.options2 = 0;
+
+ sub.beginTime = 0; // job can run as soon as possible (default)
+ sub.termTime = 0; // job can run as long as it wishes (default)
+
+ sub.numProcessors = 1; // job can run on one single processor (default)
+ sub.maxNumProcessors = 1; // job can run on one single processor (default)
+
+ for(int i = 0; i< LSF_RLIM_NLIMITS; i++) sub.rLimits[i] = DEFAULT_RLIMIT;
+
+ typedef std::vector< struct xFile > XFTAB;
+ XFTAB xf_tab;
+
+ string st_second;
+ for(Parametre::const_iterator it = P.begin(); it != P.end(); it++) {
+ if ( (*it).first == ACCOUNT ) {
+ sub.options |= SUB_PROJECT_NAME;
+ st_second = (*it).second.str();
+ sub.projectName = string2char(st_second);
+
+ } else if ( (*it).first == CHECKPOINT ) {
+ if (static_cast< long >((*it).second))
+ sub.options |= SUB_CHKPNT_PERIOD;
+ else
+ sub.options &= ~ SUB_CHKPNT_PERIOD;
+
+ } else if ( (*it).first == CKPTINTERVAL ) {
+ sub.chkpntPeriod = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == EXECUTABLE ) {
+ st_second = (*it).second.str();
+ sub.command = string2char(st_second);
+
+ } else if ( (*it).first == EXECUTIONHOST ) {
+ sub.options |= SUB_HOST;
+ if (! sub.numAskedHosts) {
+ sub.numAskedHosts = 1;
+ sub.askedHosts = new char* [1];
+ }
+ st_second = (*it).second.str();
+ sub.askedHosts[0] = string2char(st_second);
+
+ } else if ( (*it).first == HOLD ) {
+ if (static_cast< long >((*it).second))
+ sub.options2 |= SUB2_HOLD;
+ else
+ sub.options2 &= ~ SUB2_HOLD;
+
+ } else if ( (*it).first == INFILE ) {
+ Versatile V = (*it).second;
+ Versatile::iterator Vit;
+
+ for(Vit=V.begin(); Vit!=V.end(); Vit++) {
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
+ if (remote == "stdin"){
+ sub.options |= SUB_IN_FILE;
+ sub.inFile = string2char(local);
+
+ } else {
+ struct xFile xf;
+ strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0;
+ strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0;
+ xf.options = XF_OP_SUB2EXEC;
+ xf_tab.push_back(xf);
+ }
+ }
+
+ } else if ( (*it).first == MAIL ) {
+ sub.options |= SUB_MAIL_USER;
+ st_second = (*it).second.str();
+ sub.mailUser = string2char(st_second);
+
+ } else if ( (*it).first == MAXCPUTIME ) {
+ sub.rLimits[LSF_RLIMIT_CPU] = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == MAXDISKSIZE ) {
+ sub.rLimits[LSF_RLIMIT_FSIZE] = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == MAXRAMSIZE ) {
+ sub.rLimits[LSF_RLIMIT_SWAP] = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == MAXWALLTIME ) {
+ sub.rLimits[LSF_RLIMIT_RUN] = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == NAME ) {
+ sub.options |= SUB_JOB_NAME;
+ st_second = (*it).second.str();
+ sub.jobName = string2char(st_second);
+
+ } else if ( (*it).first == NBPROC ) {
+ sub.numProcessors = static_cast< long >((*it).second);
+ sub.maxNumProcessors = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == OUTFILE ) {
+ Versatile V = (*it).second;
+ Versatile::iterator Vit;
+
+ for(Vit=V.begin(); Vit!=V.end(); Vit++) {
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
+ if (remote == "stdout"){
+ sub.options |= SUB_OUT_FILE;
+ sub.outFile = string2char(local);
+
+ } else if (remote == "stderr"){
+ sub.options |= SUB_ERR_FILE;
+ sub.errFile = string2char(local);
+
+ } else {
+ struct xFile xf;
+ strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0;
+ strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0;
+ xf.options = XF_OP_EXEC2SUB;
+ xf_tab.push_back(xf);
+ }
+ }
+
+
+ } else if ( (*it).first == QUEUE ) {
+ sub.options |= SUB_QUEUE;
+ st_second = (*it).second.str();
+ sub.queue = string2char(st_second);
+
+ } else if ( (*it).first == STARTTIME ) {
+ sub.beginTime = static_cast< long >((*it).second);
+
+ } else if ( (*it).first == TMPDIR ) {
+ // TODO
+
+ } else if ( (*it).first == USER ) {
+ // TODO
+
+ }
+ }
+
+
+ // Transfert de fichiers en entree et sortie
+ sub.options |= SUB_OTHER_FILES;
+ sub.nxf = xf_tab.size();
+ sub.xf = new struct xFile [sub.nxf];
+ int ixf = 0;
+ for(XFTAB::const_iterator it_xf=xf_tab.begin(); it_xf != xf_tab.end(); it_xf++, ixf++)
+ sub.xf[ixf] = *it_xf; // *it_xf == xf_tab[ixf]
+
+
+ return _p_submit;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job_LSF.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOB_LSF_H_
+#define _JOB_LSF_H_
+
+extern "C" {
+
+#include <lsf/lsf.h>
+#include <lsf/lsbatch.h>
+}
+#include "Batch_Job.hxx"
+
+namespace Batch {
+
+ class Job_LSF
+ {
+ public:
+ // Constructeur et destructeur
+ Job_LSF(const Job & job);
+ virtual ~Job_LSF();
+
+ // Accesseurs
+ struct submit * getSubmitStruct();
+
+ protected:
+ struct submit * _p_submit; // structure pour soumettre les jobs
+
+ private:
+ struct submit * ParametreToSubmitStruct(const Parametre & P);
+ char * string2char(const string &);
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job_PBS.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "Batch_Job_PBS.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur
+ void Job_PBS::setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value)
+ {
+ // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0
+ struct attropl * ptr = findResourceAttributeOP(*attr_list, attr_name, attr_resource);
+
+ if (!ptr) { // L'element n'existe pas, il faut le creer
+ if (ptr = lastAttributeOP(*attr_list)) { // la liste n'est pas vide
+ ptr->next = new struct attropl;
+ ptr = ptr->next;
+ ptr->next = 0;
+
+ } else { // la liste est completement vide
+ ptr = *attr_list = new struct attropl;
+ ptr->next = 0;
+ }
+
+ // On remplit les champs (name,resource,value)
+ ptr->name = new char[strlen(attr_name) + 1];
+ strncpy(ptr->name, attr_name, strlen(attr_name));
+ ptr->name[strlen(attr_name)] = 0;
+
+ ptr->resource = new char[strlen(attr_resource) + 1];
+ strncpy(ptr->resource, attr_resource, strlen(attr_resource));
+ ptr->resource[strlen(attr_resource)] = 0;
+
+ ptr->value = new char[strlen(attr_value) + 1];
+ strncpy(ptr->value, attr_value, strlen(attr_value));
+ ptr->value[strlen(attr_value)] = 0;
+
+ } else { // L'attribut existe, on change sa valeur
+ delete[] ptr->value; // On efface la valeur precedente
+ ptr->value = new char[strlen(attr_value) + 1];
+ strncpy(ptr->value, attr_value, strlen(attr_value));
+ ptr->value[strlen(attr_value)] = 0;
+
+ }
+ }
+
+
+ // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur
+ struct attropl * Job_PBS::findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource)
+ {
+ // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident
+ struct attropl * ptr = attr_list;
+ while (ptr) {
+ if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break;
+ ptr = ptr->next;
+ }
+ return ptr;
+ }
+
+
+ // Recherche le dernier element de la liste chainee d'attributs + operateur
+ struct attropl * Job_PBS::lastAttributeOP(struct attropl * attr_list)
+ {
+ struct attropl * ptr = attr_list;
+ while (ptr && ptr->next) {
+ ptr = ptr->next;
+ }
+ return ptr;
+ }
+
+
+ // Convertit un objet Parametre en liste chainee d'attributs + operateur
+ struct attropl * Job_PBS::ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & P)
+ {
+ Parametre::iterator it;
+ string st_second;
+ for(it=P.begin(); it!=P.end(); it++) {
+ if ( (*it).first == ACCOUNT ) {
+ st_second = (*it).second.str();
+ setResourceAttributeOP(_p_attr_list, ATTR_A, "", st_second.c_str());
+
+
+ } else if ( (*it).first == CHECKPOINT ) {
+ setResourceAttributeOP(_p_attr_list, ATTR_c, "", "u");
+
+
+ } else if ( (*it).first == CKPTINTERVAL ) {
+ // Not significant
+
+ } else if ( (*it).first == EXECUTABLE ) {
+ // Already done
+
+ } else if ( (*it).first == HOLD ) {
+ if (static_cast< long >((*it).second))
+ setResourceAttributeOP(_p_attr_list, ATTR_h, "", USER_HOLD);
+ else
+ setResourceAttributeOP(_p_attr_list, ATTR_h, "", NO_HOLD);
+
+ } else if ( (*it).first == INFILE ) {
+ Versatile V = (*it).second;
+ Versatile::iterator Vit;
+
+ string sep = "";
+ string stagein;
+
+ for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") {
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
+ stagein += sep + remote + "@" + local;
+ }
+
+ if (stagein.size())
+ setResourceAttributeOP(_p_attr_list, ATTR_stagein, "", stagein.c_str());
+
+
+ } else if ( (*it).first == MAIL ) {
+ st_second = (*it).second.str();
+ setResourceAttributeOP(_p_attr_list, ATTR_M, "", st_second.c_str());
+
+ } else if ( (*it).first == MAXCPUTIME ) {
+ char attr_value[32];
+ long secondes = (*it).second;
+ long heures = secondes / 3600L;
+ long minutes = (secondes - 3600L * heures) / 60L;
+ secondes = secondes % 60L;
+ sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes);
+
+ setResourceAttributeOP(_p_attr_list, ATTR_l, "cput", attr_value);
+
+
+ } else if ( (*it).first == MAXDISKSIZE ) {
+
+ } else if ( (*it).first == MAXRAMSIZE ) {
+
+ } else if ( (*it).first == MAXWALLTIME ) {
+ char attr_value[32];
+ long secondes = (*it).second;
+ long heures = secondes / 3600L;
+ long minutes = (secondes - 3600L * heures) / 60L;
+ secondes = secondes % 60L;
+ sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes);
+
+ setResourceAttributeOP(_p_attr_list, ATTR_l, "walltime", attr_value);
+
+
+ } else if ( (*it).first == NAME ) {
+ st_second = (*it).second.str();
+ setResourceAttributeOP(_p_attr_list, ATTR_N, "", st_second.c_str());
+
+
+ } else if ( (*it).first == OUTFILE ) {
+ Versatile V = (*it).second;
+ Versatile::iterator Vit;
+
+ string sep = "";
+ string stageout;
+
+ for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") {
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ if (remote == "stdout")
+ setResourceAttributeOP(_p_attr_list, ATTR_o, "", local.c_str());
+
+ else if (remote == "stderr")
+ setResourceAttributeOP(_p_attr_list, ATTR_e, "", local.c_str());
+
+ else
+ // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
+ stageout += sep + remote + "@" + local;
+ }
+
+ if (stageout.size())
+ setResourceAttributeOP(_p_attr_list, ATTR_stageout, "", stageout.c_str());
+
+ } else if ( (*it).first == QUEUE ) {
+ // Already done
+
+ } else if ( (*it).first == STARTTIME ) {
+
+ } else if ( (*it).first == TMPDIR ) {
+
+ } else if ( (*it).first == USER ) {
+ st_second = (*it).second.str();
+ setResourceAttributeOP(_p_attr_list, ATTR_u, "", st_second.c_str());
+
+ }
+ }
+ return *_p_attr_list;
+ }
+
+
+ // Convertit un objet Environnement en liste chainee d'attributs + operateur
+ struct attropl * Job_PBS::EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & E)
+ {
+ Environnement::iterator it;
+ for(it=E.begin(); it!=E.end(); it++) {
+ setResourceAttributeOP(_p_attr_list, ATTR_v, (*it).first.c_str(), ( (*it).first + "=" + (*it).second ).c_str());
+ }
+ return *_p_attr_list;
+ }
+
+
+ // Ajoute les variables d'environnement presentes dans tout job PBS
+ void Job_PBS::addPBSEnvironnement(Environnement & E)
+ {
+ char * c;
+
+ c = getenv("HOME");
+ if (c) E["PBS_O_HOME"] = c;
+
+ c = getenv("LANG");
+ if (c) E["PBS_O_LANG"] = c;
+
+ c = getenv("LOGNAME");
+ if (c) E["PBS_O_LOGNAME"] = c;
+
+ c = getenv("PATH");
+ if (c) E["PBS_O_PATH"] = c;
+
+ c = getenv("LD_LIBRARY_PATH");
+ if (c) E["PBS_O_LD_LIBRARY_PATH"] = c;
+
+ c = getenv("MAIL");
+ if (c) E["PBS_O_MAIL"] = c;
+
+ c = getenv("SHELL");
+ if (c) E["PBS_O_SHELL"] = c;
+
+ c = getenv("TZ");
+ if (c) E["PBS_O_TZ"] = c;
+
+ /* Recuperation du working directory */
+ size_t size = 256;
+ char * buf = 0;
+ char * rc = 0;
+ do {
+ if (buf) delete[] buf;
+ buf = new char[size];
+ rc = getcwd(buf, size);
+ size += size;
+ } while (!rc);
+ E["PBS_O_WORKDIR"] = buf;
+ delete[] buf;
+ }
+
+
+ // Ajoute un element (name,resource,value) a la liste chainee d'attributs
+ void Job_PBS::setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value)
+ {
+ // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0
+ struct attrl * ptr = findResourceAttribute(*attr_list, attr_name, attr_resource);
+
+ if (!ptr) { // L'attribut n'existe pas, il faut le creer
+ if (ptr = lastAttribute(*attr_list)) { // la liste n'est pas vide
+ ptr->next = new struct attrl;
+ ptr = ptr->next;
+ ptr->next = 0;
+
+ } else { // la liste est completement vide
+ ptr = *attr_list = new struct attrl;
+ ptr->next = 0;
+ }
+
+ // On remplit les champs (name,resource,value)
+ ptr->name = new char[strlen(attr_name) + 1];
+ strncpy(ptr->name, attr_name, strlen(attr_name));
+ ptr->name[strlen(attr_name)] = 0;
+
+ ptr->resource = new char[strlen(attr_resource) + 1];
+ strncpy(ptr->resource, attr_resource, strlen(attr_resource));
+ ptr->resource[strlen(attr_resource)] = 0;
+
+ ptr->value = new char[strlen(attr_value) + 1];
+ strncpy(ptr->value, attr_value, strlen(attr_value));
+ ptr->value[strlen(attr_value)] = 0;
+
+ } else { // L'attribut existe, on change sa valeur
+ delete[] ptr->value; // On efface la valeur precedente
+ ptr->value = new char[strlen(attr_value) + 1];
+ strncpy(ptr->value, attr_value, strlen(attr_value));
+ ptr->value[strlen(attr_value)] = 0;
+
+ }
+ }
+
+ // Recherche un element (name,resource,value) dans la liste chainee d'attributs
+ struct attrl * Job_PBS::findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource)
+ {
+ // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident
+ struct attrl * ptr = attr_list;
+ while (ptr) {
+ if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break;
+ ptr = ptr->next;
+ }
+ return ptr;
+ }
+
+
+ // Recherche le dernier element de la liste chainee d'attributs
+ struct attrl * Job_PBS::lastAttribute(struct attrl * attr_list)
+ {
+ struct attrl * ptr = attr_list;
+ while (ptr && ptr->next) {
+ ptr = ptr->next;
+ }
+ return ptr;
+ }
+
+
+ // Constructeur
+ Job_PBS::Job_PBS(const Job & job) : _p_attropl(0), _p_attrl(0), _script(0), _destination(0)
+ {
+ Parametre P = job.getParametre();
+ Parametre::iterator it;
+
+ // On extrait de l'objet Parametre le champ EXECUTABLE qui deviendra le script PBS
+ if ( (it=P.find(EXECUTABLE)) != P.end()) {
+ Versatile V = (*it).second;
+ string st_exe = V.str();
+ const char * exe = st_exe.c_str();
+ int lg = strlen(exe);
+ _script = new char[lg + 1];
+ for (int ii=0; ii<lg+1; ii++) _script[ii] = 0;
+ strcpy(_script, exe);
+ _script[lg] = 0;
+
+ } else {
+ _script = new char[1];
+ _script[0] = 0;
+ }
+
+ // On extrait de l'objet Parametre le champ QUEUE qui deviendra la destination
+ if ( (it=P.find(QUEUE)) != P.end()) {
+ Versatile V = (*it).second;
+ string st_dest = V.str();
+ const char * dest = st_dest.c_str();
+ _destination = new char[strlen(dest) + 2 + 1];
+ _destination[0] = 0;
+ strcat(_destination, dest);
+ _destination[strlen(dest)] = 0;
+ } else {
+ _destination = new char[1];
+ _destination[0] = 0;
+ }
+
+ // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur
+ Environnement E = job.getEnvironnement();
+ addPBSEnvironnement(E);
+
+ _p_attropl = ParametreToAttributeOPList(&_p_attropl, P);
+ _p_attropl = EnvironnementToAttributeOPList(&_p_attropl, E);
+
+ }
+
+
+ // Destructeur
+ Job_PBS::~Job_PBS()
+ {
+ // On detruit la liste chainee d'attributs + operateur
+ struct attropl * current_p_attropl = _p_attropl;
+ while (current_p_attropl) {
+ struct attropl * next = current_p_attropl->next;
+ delete[] current_p_attropl->name;
+ delete[] current_p_attropl->resource;
+ delete[] current_p_attropl->value;
+ delete current_p_attropl;
+ current_p_attropl = next;
+ }
+
+ // On detruit la liste chainee d'attributs
+ struct attrl * current_p_attrl = _p_attrl;
+ while (current_p_attrl) {
+ struct attrl * next = current_p_attrl->next;
+ delete[] current_p_attrl->name;
+ delete[] current_p_attrl->resource;
+ delete[] current_p_attrl->value;
+ delete current_p_attrl;
+ current_p_attrl = next;
+ }
+
+ // On detruit les champs alloues
+ delete[] _script;
+ delete[] _destination;
+ }
+
+
+ // Accesseur
+ struct attropl * Job_PBS::getAttributesOP()
+ {
+ return _p_attropl;
+ }
+
+ // Accesseur
+ // Cette methode sert pour les pbs_alter de PBS
+ // Pbs_alter est buggé par rapport a la specification ers_all.ps car les
+ // variables d'environnement ne sont pas supportees (ATTR_v)
+ struct attrl * Job_PBS::getAttributes()
+ {
+ if (_p_attrl == 0) {
+
+ // On remplit la structure attrl a partir de la strucuture attropl
+ // (elles ne different que par le parametre op, mais elles ne sont pas interchangeables
+ // dans les appels)
+
+ struct attropl * current_p_attropl = _p_attropl;
+ while (current_p_attropl) {
+ if (strcmp(current_p_attropl->name, ATTR_v)) // Bug fix for ATTR_v
+ setResourceAttribute(&_p_attrl,
+ current_p_attropl->name,
+ current_p_attropl->resource,
+ current_p_attropl->value);
+
+ current_p_attropl = current_p_attropl->next;
+ }
+
+ }
+
+ return _p_attrl;
+ }
+
+ // Accesseur
+ char * Job_PBS::getScript()
+ {
+ return _script;
+ }
+
+ // Accesseur
+ char * Job_PBS::getDestination()
+ {
+ return _destination;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Job_PBS.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOB_PBS_H_
+#define _JOB_PBS_H_
+
+extern "C" {
+
+#include <pbs_error.h>
+#include <pbs_ifl.h>
+}
+#include "Batch_Job.hxx"
+
+namespace Batch {
+
+ class Job_PBS
+ {
+ public:
+ // Constructeur et destructeur
+ Job_PBS(const Job & job);
+ virtual ~Job_PBS();
+
+ // Accesseurs
+ struct attropl * getAttributesOP();
+ struct attrl * getAttributes();
+ char * getScript();
+ char * getDestination();
+
+ protected:
+ struct attropl * _p_attropl; // liste chainee d'attributs + operateur
+ struct attrl * _p_attrl; // liste chainee d'attributs
+ char * _script; // chemin d'acces au script du job
+ char * _destination; // queue dans laquelle le job est soumis
+
+ private:
+ // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur
+ void setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value);
+
+ // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur
+ struct attropl * findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource);
+
+ // Recherche le dernier element de la liste chainee d'attributs + operateur
+ struct attropl * lastAttributeOP(struct attropl * attr_list);
+
+ // Convertit un objet Parametre en liste chainee d'attributs + operateur
+ struct attropl * ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & param);
+
+ // Convertit un objet Environnement en liste chainee d'attributs + operateur
+ struct attropl * EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & env);
+
+ // Ajoute les variables d'environnement presentes dans tout job PBS
+ void addPBSEnvironnement(Environnement & E);
+
+
+ // Ajoute un element (name,resource,value) a la liste chainee d'attributs
+ void setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value);
+
+ // Recherche un element (name,resource,value) dans la liste chainee d'attributs
+ struct attrl * findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource);
+
+ // Recherche le dernier element de la liste chainee d'attributs
+ struct attrl * lastAttribute(struct attrl * attr_list);
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * ListIsFullException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Batch_ListIsFullException.hxx"
+using namespace std;
+
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * ListIsFullException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _LISTISFULLEXCEPTION_H_
+#define _LISTISFULLEXCEPTION_H_
+
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class ListIsFullException : public GenericException
+ {
+ public:
+ // Constructeur
+ ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {}
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * LongType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_LongType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string LongType::affiche() const
+ {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << _data;
+ return sst.str();
+ }
+
+ // Operateur d'affectation
+ LongType & LongType::operator =(long l)
+ {
+ _data = l;
+ return *this;
+ }
+
+ // Conversion en long
+ LongType::operator long() const
+ {
+ return this->_data;
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * LongType::clone() const
+ {
+ LongType * pL = new LongType(this->_data);
+ assert(pL != 0);
+ return pL;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * LongType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _LONGTYPE_H_
+#define _LONGTYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+
+namespace Batch {
+
+ class LongType : public GenericType
+ {
+ public:
+ // Constructeur
+ LongType(const long l=0L) : _data(l) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+
+ // Operateur d'affectation
+ virtual LongType & operator =(long);
+
+ // Conversion en long
+ virtual operator long() const;
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ long _data;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * MapKey.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Oct 14 14:00:30 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <string>
+#include "Batch_MapKey.hxx"
+using namespace std;
+
+namespace Batch {
+
+
+}
+
+
+// COMMENTS
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * MapKey.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Oct 14 14:00:29 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _MAPKEY_H_
+#define _MAPKEY_H_
+
+
+#include <string>
+
+namespace Batch {
+
+ // une classe privee pour les differents types
+ // ces types ne peuvent pas etre redefinis
+ class MapKey : public std::string
+ {
+ private:
+ friend class Parametre; // seule la classe Parametre peut creer des MapKey
+ MapKey() : std::string() {}
+ MapKey(const MapKey & mk, size_type pos, size_type npos) : std::string(mk, pos, npos) {}
+ MapKey(const char * s, size_type n) : std::string(s, n) {}
+ MapKey(const char * s) : std::string(s) {}
+ MapKey(size_type n, char c) : std::string(n, c) {}
+#ifdef __STL_MEMBER_TEMPLATES
+ template<class InputIterator>
+ MapKey(InputIterator __begin, InputIterator __end) : std::string(__begin, __end) {}
+#else
+ MapKey(const_iterator __begin, const_iterator __end) : std::string(__begin, __end) {}
+#endif
+
+ public:
+ MapKey(const MapKey & mk) : std::string(mk) {}
+
+ };
+
+}
+
+#endif
+
+// COMMENTS
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * NotYetImplementedException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Nov 25 11:35:07 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_NotYetImplementedException.hxx"
+
+namespace Batch {
+
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * NotYetImplementedException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Nov 25 11:35:07 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_
+#define _NOTYETIMPLEMENTEDEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+using namespace std;
+
+namespace Batch {
+
+ class NotYetImplementedException : public GenericException
+ {
+ public:
+ // Constructeur
+ NotYetImplementedException(string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Parametre.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <map>
+#include "Batch_Versatile.hxx"
+#include "Batch_InvalidKeyException.hxx"
+#include "Batch_Parametre.hxx"
+using namespace std;
+
+// Definition des membres constants statiques
+// Definition des noms globaux pour les clefs en tant que references
+// TODO : supprimer les declarations statiques des clefs de la map
+def_static_MapKey(ACCOUNT);
+def_static_MapKey(ARGUMENTS);
+def_static_MapKey(CHECKPOINT);
+def_static_MapKey(CKPTINTERVAL);
+def_static_MapKey(CREATIONTIME);
+def_static_MapKey(EGROUP);
+def_static_MapKey(ELIGIBLETIME);
+def_static_MapKey(ENDTIME);
+def_static_MapKey(EUSER);
+def_static_MapKey(EXECUTABLE);
+def_static_MapKey(EXECUTIONHOST);
+def_static_MapKey(EXITCODE);
+def_static_MapKey(HOLD);
+def_static_MapKey(ID);
+def_static_MapKey(INFILE);
+def_static_MapKey(MAIL);
+def_static_MapKey(MAXCPUTIME);
+def_static_MapKey(MAXDISKSIZE);
+def_static_MapKey(MAXRAMSIZE);
+def_static_MapKey(MAXWALLTIME);
+def_static_MapKey(MODIFICATIONTIME);
+def_static_MapKey(NAME);
+def_static_MapKey(NBPROC);
+def_static_MapKey(OUTFILE);
+def_static_MapKey(PID);
+def_static_MapKey(QUEUE);
+def_static_MapKey(QUEUEDTIME);
+def_static_MapKey(SERVER);
+def_static_MapKey(STARTTIME);
+def_static_MapKey(STATE);
+def_static_MapKey(TEXT);
+def_static_MapKey(TMPDIR);
+def_static_MapKey(USEDCPUTIME);
+def_static_MapKey(USEDDISKSIZE);
+def_static_MapKey(USEDRAMSIZE);
+def_static_MapKey(USEDWALLTIME);
+def_static_MapKey(USER);
+
+namespace Batch {
+
+ // Constructeur standard
+ // La map interne TypeMap possede les memes clefs que la map principale, mais les
+ // valeurs associees contiennent le type des clefs de la map principale ainsi que
+ // le nombre de valeurs autorisees dans l'objet Versatile (0=nombre quelconque,
+ // sinon valeur precisee)
+ Parametre::Parametre() : map< string, Versatile >()
+ {
+ TypeMap[ACCOUNT].type = STRING;
+ TypeMap[ACCOUNT].maxelem = 1;
+
+ TypeMap[ARGUMENTS].type = STRING;
+ TypeMap[ARGUMENTS].maxelem = 0;
+
+ TypeMap[CHECKPOINT].type = LONG;
+ TypeMap[CHECKPOINT].maxelem = 1;
+
+ TypeMap[CKPTINTERVAL].type = LONG;
+ TypeMap[CKPTINTERVAL].maxelem = 1;
+
+ TypeMap[CREATIONTIME].type = LONG;
+ TypeMap[CREATIONTIME].maxelem = 1;
+
+ TypeMap[EGROUP].type = STRING;
+ TypeMap[EGROUP].maxelem = 1;
+
+ TypeMap[ELIGIBLETIME].type = LONG;
+ TypeMap[ELIGIBLETIME].maxelem = 1;
+
+ TypeMap[ENDTIME].type = LONG;
+ TypeMap[ENDTIME].maxelem = 1;
+
+ TypeMap[EUSER].type = STRING;
+ TypeMap[EUSER].maxelem = 1;
+
+ TypeMap[EXECUTABLE].type = STRING;
+ TypeMap[EXECUTABLE].maxelem = 1;
+
+ TypeMap[EXECUTIONHOST].type = STRING;
+ TypeMap[EXECUTIONHOST].maxelem = 0;
+
+ TypeMap[EXITCODE].type = LONG;
+ TypeMap[EXITCODE].maxelem = 1;
+
+ TypeMap[HOLD].type = LONG;
+ TypeMap[HOLD].maxelem = 1;
+
+ TypeMap[ID].type = STRING;
+ TypeMap[ID].maxelem = 1;
+
+ TypeMap[INFILE].type = COUPLE;
+ TypeMap[INFILE].maxelem = 0;
+
+ TypeMap[MAIL].type = STRING;
+ TypeMap[MAIL].maxelem = 1;
+
+ TypeMap[MAXCPUTIME].type = LONG;
+ TypeMap[MAXCPUTIME].maxelem = 1;
+
+ TypeMap[MAXDISKSIZE].type = LONG;
+ TypeMap[MAXDISKSIZE].maxelem = 1;
+
+ TypeMap[MAXRAMSIZE].type = LONG;
+ TypeMap[MAXRAMSIZE].maxelem = 1;
+
+ TypeMap[MAXWALLTIME].type = LONG;
+ TypeMap[MAXWALLTIME].maxelem = 1;
+
+ TypeMap[MODIFICATIONTIME].type = LONG;
+ TypeMap[MODIFICATIONTIME].maxelem = 1;
+
+ TypeMap[NAME].type = STRING;
+ TypeMap[NAME].maxelem = 1;
+
+ TypeMap[NBPROC].type = LONG;
+ TypeMap[NBPROC].maxelem = 1;
+
+ TypeMap[OUTFILE].type = COUPLE;
+ TypeMap[OUTFILE].maxelem = 0;
+
+ TypeMap[PID].type = LONG;
+ TypeMap[PID].maxelem = 1;
+
+ TypeMap[QUEUE].type = STRING;
+ TypeMap[QUEUE].maxelem = 1;
+
+ TypeMap[QUEUEDTIME].type = LONG;
+ TypeMap[QUEUEDTIME].maxelem = 1;
+
+ TypeMap[SERVER].type = STRING;
+ TypeMap[SERVER].maxelem = 1;
+
+ TypeMap[STARTTIME].type = LONG;
+ TypeMap[STARTTIME].maxelem = 1;
+
+ TypeMap[STATE].type = STRING;
+ TypeMap[STATE].maxelem = 1;
+
+ TypeMap[TEXT].type = STRING;
+ TypeMap[TEXT].maxelem = 1;
+
+ TypeMap[TMPDIR].type = STRING;
+ TypeMap[TMPDIR].maxelem = 1;
+
+ TypeMap[USEDCPUTIME].type = LONG;
+ TypeMap[USEDCPUTIME].maxelem = 1;
+
+ TypeMap[USEDDISKSIZE].type = LONG;
+ TypeMap[USEDDISKSIZE].maxelem = 1;
+
+ TypeMap[USEDRAMSIZE].type = LONG;
+ TypeMap[USEDRAMSIZE].maxelem = 1;
+
+ TypeMap[USEDWALLTIME].type = LONG;
+ TypeMap[USEDWALLTIME].maxelem = 1;
+
+ TypeMap[USER].type = STRING;
+ TypeMap[USER].maxelem = 1;
+ }
+
+ // Operateur de recherche dans la map
+ // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de
+ // la valeur associée à la clef car il retourne une reference non constante
+ Versatile & Parametre::operator [] (const string & mk)
+ {
+ // On controle que la clef est valide
+ if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str());
+
+ // On recherche la valeur associee...
+ Versatile & V = map< string, Versatile >::operator [] (mk);
+
+ // ... et on l'initialise systematiquement
+ // ATTENTION : si un probleme de type survient (ie, on stocke une valeur d'un type
+ // different de celui inscrit dans TypeMap) une exception TypeMismatchException est
+ // levee
+ V.setName(mk);
+ V.setType(TypeMap[mk].type);
+ V.setMaxSize(TypeMap[mk].maxelem);
+
+ return V;
+ }
+
+ // Operateur de recherche dans la map
+ // Cet operateur agit sur les objets CONSTANTS
+ const Versatile & Parametre::operator [] (const string & mk) const
+ {
+ // On controle que la clef est valide
+ if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str());
+
+ // On recherche la valeur associee
+ Parametre::const_iterator it = find(mk);
+ const Versatile & V = (*it).second;
+
+ return V;
+ }
+
+ // Operateur d'affectation
+ Parametre & Parametre::operator =(const Parametre & PM)
+ {
+ // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie
+ if (this == &PM) return *this;
+
+ // On efface toute la map
+ erase(begin(), end());
+
+ // On recopie la map interne
+ // Meme si cela ne sert a rien pour le moment car les maps internes sont identiques,
+ // il n'est pas exclu que dans un avenir proche elles puissent etre differentes
+ (*this).TypeMap = PM.TypeMap;
+
+ // On recree la structure interne de la map avec les valeurs de celle passee en argument
+ Parametre::const_iterator it;
+ for(it=PM.begin(); it!=PM.end(); it++)
+ insert(make_pair( (*it).first ,
+ Versatile( (*it).second)
+ ) );
+
+ return *this;
+ }
+
+ // Constructeur par recopie
+ Parametre::Parametre(const Parametre & PM)
+ {
+ // inutile car l'objet est vierge : il vient d'etre cree
+ // On efface toute la map
+ // erase(begin(), end());
+
+ // On recopie la map interne
+ (*this).TypeMap = PM.TypeMap;
+
+ // On cree la structure interne de la map avec les valeurs de celle passee en argument
+ Parametre::const_iterator it;
+ for(it=PM.begin();
+ it!=PM.end();
+ it++)
+ insert(
+ make_pair(
+ (*it).first ,
+ Versatile( (*it).second)
+ ) );
+ }
+
+ // map< string, TypeParam > Parametre::getTypeMap() const
+ // {
+ // return TypeMap;
+ // }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Parametre.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _PARAMETRE_H_
+#define _PARAMETRE_H_
+
+#include <map>
+#include <string>
+#include "Batch_InvalidKeyException.hxx"
+#include "Batch_Versatile.hxx"
+
+
+// Ces macros permettent de simplifier l'ajout de nouvelles
+// clefs dans la map Parametre
+// TODO : remplacer ce mecanisme statique par la lecture
+// TODO : d'une descrption dans un fichier exterieur (genre XML)
+
+#define def_extern_MapKey(mk) extern const std::string & mk;
+#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \
+ const std::string & mk = Batch::Parametre::mk;
+
+namespace Batch {
+
+ class Parametre : public std::map< std::string, Versatile >
+ {
+ public:
+ // Constructeur standard
+ Parametre();
+
+ // Constructeur par recopie
+ Parametre(const Batch::Parametre & PM);
+
+ // Operateur de recherche dans la map
+ Versatile & operator [] (const std::string &);
+ const Versatile & operator [] (const std::string &) const;
+
+ // Operateur d'affectation
+ Parametre & operator =(const Batch::Parametre & PM);
+
+ // Declarations statique des clefs de la map
+ // TODO : supprimer les declarations statiques des clefs de la map
+ static const std::string ACCOUNT;
+ static const std::string ARGUMENTS;
+ static const std::string CHECKPOINT;
+ static const std::string CKPTINTERVAL;
+ static const std::string CREATIONTIME;
+ static const std::string EGROUP;
+ static const std::string ELIGIBLETIME;
+ static const std::string ENDTIME;
+ static const std::string EUSER;
+ static const std::string EXECUTABLE;
+ static const std::string EXECUTIONHOST;
+ static const std::string EXITCODE;
+ static const std::string HOLD;
+ static const std::string ID;
+ static const std::string INFILE;
+ static const std::string MAIL;
+ static const std::string MAXCPUTIME;
+ static const std::string MAXDISKSIZE;
+ static const std::string MAXRAMSIZE;
+ static const std::string MAXWALLTIME;
+ static const std::string MODIFICATIONTIME;
+ static const std::string NAME;
+ static const std::string NBPROC;
+ static const std::string OUTFILE;
+ static const std::string PID;
+ static const std::string QUEUE;
+ static const std::string QUEUEDTIME;
+ static const std::string SERVER;
+ static const std::string STARTTIME;
+ static const std::string STATE;
+ static const std::string TEXT;
+ static const std::string TMPDIR;
+ static const std::string USEDCPUTIME;
+ static const std::string USEDDISKSIZE;
+ static const std::string USEDRAMSIZE;
+ static const std::string USEDWALLTIME;
+ static const std::string USER;
+
+ protected:
+ std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
+
+ private:
+
+ };
+
+}
+
+def_extern_MapKey(ACCOUNT);
+def_extern_MapKey(ARGUMENTS);
+def_extern_MapKey(CHECKPOINT);
+def_extern_MapKey(CKPTINTERVAL);
+def_extern_MapKey(CREATIONTIME);
+def_extern_MapKey(EGROUP);
+def_extern_MapKey(ELIGIBLETIME);
+def_extern_MapKey(ENDTIME);
+def_extern_MapKey(EUSER);
+def_extern_MapKey(EXECUTABLE);
+def_extern_MapKey(EXECUTIONHOST);
+def_extern_MapKey(EXITCODE);
+def_extern_MapKey(HOLD);
+def_extern_MapKey(ID);
+def_extern_MapKey(INFILE);
+def_extern_MapKey(MAIL);
+def_extern_MapKey(MAXCPUTIME);
+def_extern_MapKey(MAXDISKSIZE);
+def_extern_MapKey(MAXRAMSIZE);
+def_extern_MapKey(MAXWALLTIME);
+def_extern_MapKey(MODIFICATIONTIME);
+def_extern_MapKey(NAME);
+def_extern_MapKey(NBPROC);
+def_extern_MapKey(OUTFILE);
+def_extern_MapKey(PID);
+def_extern_MapKey(QUEUE);
+def_extern_MapKey(QUEUEDTIME);
+def_extern_MapKey(SERVER);
+def_extern_MapKey(STARTTIME);
+def_extern_MapKey(STATE);
+def_extern_MapKey(TEXT);
+def_extern_MapKey(TMPDIR);
+def_extern_MapKey(USEDCPUTIME);
+def_extern_MapKey(USEDDISKSIZE);
+def_extern_MapKey(USEDRAMSIZE);
+def_extern_MapKey(USEDWALLTIME);
+def_extern_MapKey(USER);
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * PyVersatile.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Mon Oct 13 12:01:12 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <string>
+#include <Python.h>
+#include "Batch_TypeMismatchException.hxx"
+#include "Batch_ListIsFullException.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+#include "Batch_PyVersatile.hxx"
+
+namespace Batch {
+
+ // Constructeur a partir d'un objet Versatile
+ PyVersatile::PyVersatile(const Versatile & V) : Versatile(V)
+ {
+ // Nothing to do
+ }
+
+
+ // Constructeur a partir d'un PyObject
+ // Les objets autorises sont les strings et les ints,
+ // ainsi que les listes de strings
+ PyVersatile::PyVersatile(const PyObject * PyO) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException) : Versatile()
+ {
+ PyObject * _PyO = const_cast<PyObject *>(PyO);
+
+ if (PyList_Check(_PyO)) { // c'est une liste
+ _maxsize = PyList_Size(_PyO);
+ for(int i=0; i<_maxsize; i++) {
+ PyObject * val = PyList_GetItem(_PyO, i);
+ if (PyString_Check(val)) {
+ *this += PyString_AsString(val);
+
+ } else if (PyTuple_Check(val) &&
+ (PyTuple_Size(val) == 2) &&
+ PyString_Check( PyTuple_GetItem(val,0) ) &&
+ PyString_Check( PyTuple_GetItem(val,1) ) ) {
+ *this += Couple( PyString_AsString( PyTuple_GetItem(val,0) ),
+ PyString_AsString( PyTuple_GetItem(val,1) )
+ );
+
+ } else {
+ PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject");
+ }
+ }
+
+ } else if (PyString_Check(_PyO)) { // c'est une string
+ const char * s = PyString_AsString(_PyO);
+ Versatile V = string(s);
+ *this = V;
+
+ } else if (PyInt_Check(_PyO)) { // c'est un int
+ *this = PyInt_AsLong(_PyO);
+
+ } else { // erreur
+ PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject");
+ }
+ }
+
+
+
+ // Conversion de type vers un PyObject
+ PyVersatile::operator PyObject *() const
+ {
+ PyObject * obj;
+
+ if (_maxsize != 1) { // une liste
+ obj = PyList_New(0);
+ for(Versatile::const_iterator it=begin(); it!=end(); it++) {
+ char ch[2] = {0, 0};
+ string st;
+ Couple cp;
+// PyObject * tuple;
+ switch (_discriminator) {
+ // case BOOL:
+ // PyList_Append(obj, PyInt_FromLong(* static_cast<BoolType *>(*it)));
+ // break;
+
+ // case CHAR:
+ // *ch = * static_cast<CharType *>(*it);
+ // PyList_Append(obj, PyString_FromString(ch));
+ // break;
+
+ // case INT:
+ // PyList_Append(obj, PyInt_FromLong(* static_cast<IntType *>(*it)));
+ // break;
+
+ case LONG:
+ PyList_Append(obj, PyInt_FromLong(* static_cast<LongType *>(*it)));
+ break;
+
+ case STRING:
+ st = * static_cast<StringType *>(*it);
+ PyList_Append(obj, PyString_FromString(st.c_str()));
+ break;
+
+ case COUPLE:
+ cp = * static_cast<CoupleType *>(*it);
+// tuple = PyTuple_New(2);
+// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) );
+// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) );
+// PyList_Append(obj, tuple);
+ PyList_Append(obj, Py_BuildValue("(ss)", cp.getLocal().c_str(), cp.getRemote().c_str() ));
+ break;
+
+ case UNDEFINED:
+ PyList_Append(obj, Py_None);
+ break;
+ }
+
+ }
+
+ } else { // un scalaire
+ char ch[2] = {0, 0};
+ string st;
+ Couple cp;
+// PyObject * tuple;
+ switch (_discriminator) {
+ // case BOOL:
+ // obj = PyInt_FromLong(* static_cast<BoolType *>(front()));
+ // break;
+
+ // case CHAR:
+ // *ch = * static_cast<CharType *>(front());
+ // obj = PyString_FromString(ch);
+ // break;
+
+ // case INT:
+ // obj = PyInt_FromLong(* static_cast<IntType *>(front()));
+ // break;
+
+ case LONG:
+ obj = PyInt_FromLong(* static_cast<LongType *>(front()));
+ break;
+
+ case STRING:
+ st = * static_cast<StringType *>(front());
+ obj = PyString_FromString(st.c_str());
+ break;
+
+ case COUPLE:
+ cp = * static_cast<CoupleType *>(front());
+// tuple = PyTuple_New(2);
+// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) );
+// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) );
+// obj = PyList_New(0);
+// PyList_Append(obj, tuple);
+ obj = Py_BuildValue("[(ss)]", cp.getLocal().c_str(), cp.getRemote().c_str() );
+ break;
+
+ case UNDEFINED:
+ obj = Py_None;
+ break;
+ }
+ }
+
+ return obj;
+ }
+
+
+ // Operateur d'affectation a partir d'un objet Versatile
+ PyVersatile & PyVersatile::operator =(const Versatile & V)
+ {
+ Versatile * me = this;
+ *me = V;
+ return *this;
+ }
+
+}
+
+
+// COMMENTS
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * PyVersatile.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Mon Oct 13 12:01:12 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _PYVERSATILE_H_
+#define _PYVERSATILE_H_
+
+
+#include <Python.h>
+#include "Batch_Versatile.hxx"
+#include "Batch_TypeMismatchException.hxx"
+#include "Batch_ListIsFullException.hxx"
+#include "Batch_InvalidArgumentException.hxx"
+using namespace std;
+
+namespace Batch {
+
+ class PyVersatile : public Versatile
+ {
+ public:
+ // Constructeur a partir d'un objet Versatile
+ PyVersatile(const Versatile &);
+
+ // Constructeur a partir d'un PyObject
+ PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException);
+
+ // Conversion de type vers un PyObject
+ operator PyObject *() const;
+
+ // Operateur d'affectation a partir d'un objet Versatile
+ PyVersatile & operator =(const Versatile &);
+
+ protected:
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * RunTimeException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Nov 25 14:04:13 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Batch_RunTimeException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * RunTimeException.hxx :
+ *
+ * Auteur : %author% - EDF R&D
+ * Mail : mailto:ivan.dutka-malen@der.edf.fr
+ * Date : Tue Nov 25 14:04:13 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _RUNTIMEEXCEPTION_H_
+#define _RUNTIMEEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class RunTimeException : public GenericException
+ {
+ public:
+ // Constructeur
+ RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {}
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * StringType.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <assert.h>
+#include "Batch_StringType.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Conversion en chaine
+ string StringType::affiche() const
+ {
+ return _data;
+ }
+
+ // Operateur d'affectation
+ StringType & StringType::operator =(string s)
+ {
+ _data = s;
+ return *this;
+ }
+
+ // Conversion en chaine
+ StringType::operator string() const
+ {
+ return this->_data;
+ }
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ GenericType * StringType::clone() const
+ {
+ StringType * pS = new StringType(this->_data);
+ assert(pS != 0);
+ return pS;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * StringType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _STRINGTYPE_H_
+#define _STRINGTYPE_H_
+
+#include <string>
+#include "Batch_GenericType.hxx"
+
+namespace Batch {
+
+ class StringType : public GenericType
+ {
+ public:
+ // Constructeur
+ StringType(const std::string & s="") : _data(s) {}
+
+ // Conversion en chaine
+ virtual std::string affiche() const;
+ virtual operator std::string() const;
+
+ // Operateur d'affectation
+ virtual StringType & operator =(std::string);
+
+ // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+ // qu'il faudra detruire ensuite manuellement
+ virtual GenericType * clone() const;
+
+ protected:
+ std::string _data;
+
+ private:
+
+ };
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * TypeMismatchException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Batch_TypeMismatchException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * TypeMismatchException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _TYPEMISMATCHEXCEPTION_H_
+#define _TYPEMISMATCHEXCEPTION_H_
+
+
+#include "Batch_GenericException.hxx"
+
+namespace Batch {
+
+ class TypeMismatchException : public GenericException
+ {
+ public:
+ // Constructeur
+ TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {}
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Versatile.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <iostream>
+#include <list>
+#include <string>
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+#include "Batch_GenericType.hxx"
+#include "Batch_IntType.hxx"
+#include "Batch_BoolType.hxx"
+#include "Batch_CharType.hxx"
+#include "Batch_LongType.hxx"
+#include "Batch_StringType.hxx"
+#include "Batch_Versatile.hxx"
+#include "Batch_TypeMismatchException.hxx"
+#include "Batch_ListIsFullException.hxx"
+using namespace std;
+
+namespace Batch {
+
+ // Constructeur par recopie
+ Versatile::Versatile(const Versatile & V) : _discriminator(V._discriminator), _maxsize(V._maxsize), _name(V._name) // , _str_value(0)
+ {
+ Versatile::const_iterator it;
+
+ // On prend un a un les elements de l'objet passe en argument qu'on duplique
+ for(it=V.begin(); it!=V.end(); it++)
+ push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite
+ }
+
+ // Destructeur
+ Versatile::~Versatile()
+ {
+ eraseAll();
+ }
+
+ // Operateur d'affectation entre objets
+ Versatile & Versatile::operator = (const Versatile & Vrhs) throw(TypeMismatchException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(Vrhs._discriminator);
+ setMaxSize(Vrhs._maxsize);
+ _name = Vrhs._name;
+
+ // On efface les donnees precedentes
+ eraseAll();
+
+ // On copie les donnees de Vrhs
+ Versatile::const_iterator it;
+
+ for(it=Vrhs.begin(); it!=Vrhs.end(); it++)
+ push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite
+
+ return *this;
+ }
+
+ // Operateur d'affectation a partir d'un long
+ Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(LONG);
+
+ // On efface les donnees precedentes
+ eraseAll();
+
+ // On ajoute un element interne de type long a l'objet
+ LongType * pL = new LongType(l);
+ assert(pL != 0);
+ push_back(pL);
+ return *this;
+ }
+
+ // Operateur d'affectation a partir d'une string
+ Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(STRING);
+
+ // On efface les donnees precedentes
+ eraseAll();
+
+ // On ajoute un element interne de type string a l'objet
+ StringType * pS = new StringType(ch);
+ assert(pS != 0);
+ push_back(pS);
+
+ return *this;
+ }
+
+ // Operateur de concatenation a partir d'une string
+ Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(STRING);
+
+ // Si la taille maximale est atteinte, on leve une exception ListIsFullException
+ if (_maxsize == 0) push_back(new StringType(ch));
+ else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new StringType(ch));
+ else {
+ //MEDMEM::STRING msg;
+ ostringstream msg;
+ msg << "Taille maximum : " << _maxsize;
+ throw(ListIsFullException(msg.str()));
+ }
+ return *this;
+ }
+
+ // Operateur de concatenation a partir d'une string
+ Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException)
+ {
+ *this += ch;
+ return *this;
+ }
+
+ // Operateur d'affectation a partir d'un Couple
+ Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(COUPLE);
+
+ // On efface les donnees precedentes
+ eraseAll();
+
+ // On ajoute un element interne de type Couple a l'objet
+ CoupleType * pC = new CoupleType(cp);
+ assert(pC != 0);
+ push_back(pC);
+
+ return *this;
+ }
+
+ // Operateur de concatenation a partir d'un Couple
+ Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+ {
+ // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
+ setType(COUPLE);
+
+ // Si la taille maximale est atteinte, on leve une exception ListIsFullException
+ if (_maxsize == 0) push_back(new CoupleType(cp));
+ else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new CoupleType(cp));
+ else {
+ //MEDMEM::STRING msg;
+ ostringstream msg;
+ msg << "Taille maximum : " << _maxsize;
+ throw(ListIsFullException(msg.str()));
+ }
+ return *this;
+ }
+
+ // Operateur de concatenation a partir d'un Couple
+ Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+ {
+ *this += cp;
+ return *this;
+ }
+
+ ostream & operator << (ostream & os, const Versatile & V)
+ {
+ Versatile::const_iterator it;
+ char * sep = "";
+
+ for(it=V.begin(); it!=V.end(); it++, sep=" ") {
+ string s = (*it)->affiche();
+ os << sep << s;
+ }
+ return os;
+ }
+
+ // Positionnement du type de l'element interne
+ void Versatile::setType(DiscriminatorType t) throw(TypeMismatchException)
+ {
+ // Si le type est deja defini et ne correspond pas au type en argument
+ // une exception TypeMismatchException est levee
+ if ( (_discriminator == UNDEFINED) || (_discriminator == t) )
+ _discriminator = t;
+ else {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "Trying to change type of Versatile object \""
+ << _name << "\"";
+ throw(TypeMismatchException(sst.str()));
+ }
+ }
+
+ // Positionnement du nombre d'elements internes
+ void Versatile::setMaxSize(int i)
+ {
+ _maxsize = i;
+ if (i <= 0) return;
+ // Si la nouvelle taille est inferieure au nombre d'elements deja
+ // presents, les elements en surplus sont effaces (troncature)
+ if (size() > _maxsize)
+ {
+ int reste = size() - _maxsize;
+ Versatile::iterator it;
+ for(it=end(); (it!=begin()) && reste; it--, reste--)
+ {
+ delete back();
+ pop_back();
+ }
+ }
+ }
+
+
+ // Conversion de type vers un long
+ Versatile::operator long() const throw(TypeMismatchException)
+ {
+ // Si le type ne correspond pas ou si la liste contient plus d'un element,
+ // la conversion est impossible et une exception TypeMismatchException
+ // est levee
+ if ( (_maxsize != 1) || (_discriminator != LONG) || (size() == 0) ) {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "Cannot cast Versatile object \""
+ << _name << "\" to long";
+ throw(TypeMismatchException(sst.str()));
+ }
+ return *( static_cast<LongType *>(this->front()) );
+ }
+
+ // Conversion de type vers un Couple
+ Versatile::operator Couple() const throw(TypeMismatchException)
+ {
+ // Si le type ne correspond pas ou si la liste contient plus d'un element,
+ // la conversion est impossible et une exception TypeMismatchException
+ // est levee
+ if ( (_maxsize != 1) || (_discriminator != COUPLE) || (size() == 0) ) {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "Cannot cast Versatile object \""
+ << _name << "\" to Couple";
+ throw(TypeMismatchException(sst.str()));
+ }
+ return *( static_cast<CoupleType *>(this->front()) );
+ }
+
+ // Conversion de type vers une string
+ string Versatile::str() const throw(TypeMismatchException)
+ {
+ // Si le type ne correspond pas, la conversion est impossible et
+ // une exception TypeMismatchException est levee
+ if ( (_discriminator != STRING) || (size() == 0) ) {
+ //MEDMEM::STRING sst;
+ ostringstream sst;
+ sst << "Cannot cast Versatile object \""
+ << _name << "\" to string";
+ throw(TypeMismatchException(sst.str()));
+ }
+
+ // La chaine renvoyee est la concatenation des chaines internes
+ string s;
+ Versatile::const_iterator it;
+ const char * sep = "";
+ for(it=begin(); it!=end(); it++, s+=sep, sep=" ")
+ s += *( static_cast<StringType *>(*it));
+
+ return s;
+ }
+
+ // Conversion de type vers une string
+ Versatile::operator string () const throw(TypeMismatchException)
+ {
+ return str();
+ }
+
+ // Efface tous les elements internes de l'objet
+ void Versatile::eraseAll()
+ {
+ while(!empty())
+ {
+ delete back();
+ pop_back();
+ }
+ }
+
+
+ // Recuperation du type de l'element interne
+ DiscriminatorType Versatile::getType() const
+ {
+ return _discriminator;
+ }
+
+ // Recuperation du nom de l'objet
+ string Versatile::getName() const
+ {
+ return _name;
+ }
+
+ // Positionnement du nom de l'objet
+ void Versatile::setName(const string & name)
+ {
+ _name = name;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * Versatile.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _VERSATILE_H_
+#define _VERSATILE_H_
+
+#include <iostream>
+#include <list>
+#include <string>
+#include "Batch_GenericType.hxx"
+#include "Batch_IntType.hxx"
+#include "Batch_BoolType.hxx"
+#include "Batch_CharType.hxx"
+#include "Batch_LongType.hxx"
+#include "Batch_StringType.hxx"
+#include "Batch_CoupleType.hxx"
+#include "Batch_TypeMismatchException.hxx"
+#include "Batch_ListIsFullException.hxx"
+
+namespace Batch {
+
+ // Les types autorises
+ // enum DiscriminatorType { UNDEFINED, BOOL, CHAR, INT, LONG, STRING};
+ enum DiscriminatorType { UNDEFINED, LONG, STRING, COUPLE };
+
+ typedef struct {
+ DiscriminatorType type; // le type de l'element interne
+ int maxelem; // le nombre d'elements autorises
+ } TypeParam;
+
+ class Versatile : public std::list< GenericType * >
+ {
+ public:
+ // Constructeur standard et destructeur
+ Versatile() : _discriminator(UNDEFINED), _maxsize(1), _name("undefined") {}
+ virtual ~Versatile();
+
+ // Constructeur par recopie
+ Versatile(const Versatile & V);
+
+ // Constructeur depuis le type de "base"
+ Versatile(long l) : _discriminator(LONG), _maxsize(1), _name("long") { push_back(new LongType(l)); }
+ Versatile(const std::string & s) : _discriminator(STRING), _maxsize(1), _name("string") { push_back(new StringType(s)); }
+ Versatile(const Couple & c) : _discriminator(COUPLE), _maxsize(1), _name("couple") { push_back(new CoupleType(c)); }
+
+ // Operateur d'affectation et de concatenation a partir d'un type de "base"
+ Versatile & operator = (const long l) throw(TypeMismatchException);
+ Versatile & operator = (const std::string & ch) throw(TypeMismatchException);
+ Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException);
+ Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException);
+ Versatile & operator = (const Couple & cp) throw(TypeMismatchException);
+ Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException);
+ Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException);
+
+ // Operateur d'affectation entre objets
+ Versatile & operator = (const Versatile & V) throw(TypeMismatchException);
+
+ // Conversion de type vers un type de "base"
+ operator long() const throw(TypeMismatchException);
+ operator std::string() const throw(TypeMismatchException);
+ operator Couple() const throw(TypeMismatchException);
+ std::string str() const throw(TypeMismatchException);
+
+ // Operateur pour l'affichage sur un stream
+ friend std::ostream & operator << (std::ostream & os, const Versatile & );
+
+ // Positionnement et recuperation du type de l'element interne
+ void setType(DiscriminatorType) throw(TypeMismatchException);
+ DiscriminatorType getType() const;
+
+ // Positionnement et recuperation du nombre d'elements internes
+ void setMaxSize(int i);
+ int getMaxSize() const { return _maxsize; }
+
+ // Positionnement et recuperation du nom de l'objet
+ std::string getName() const;
+ void setName(const std::string & name);
+
+ protected:
+ // Efface tous les elements internes de l'objet
+ virtual void eraseAll();
+
+ DiscriminatorType _discriminator; // type de l'element interne
+ int _maxsize; // nombre max d'elements internes
+ std::string _name; // nom de l'objet (sert pour les exceptions)
+
+ private:
+
+ };
+
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * libBatch_Swig.i :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+/* ATTENTION:
+ ==========
+ Certaines classes ont des methodes surchargees et SWIG ne gere pas bien
+ ces surcharges, d'ou un probleme d'utilisation en Python de celles-ci.
+ En bref, ça ne marche pas et il faudra corriger le probleme...
+
+ TODO : corriger le probleme de surcharge des methodes en Python
+
+ IDM.
+*/
+
+
+/* Le nom du module Python tel qu'il est importe */
+%module libBatch_Swig
+
+/* Inclusion des conversions de type */
+%include libBatch_Swig_typemap.i
+
+/* Inclusion de la gestion des exceptions */
+%include libBatch_Swig_exception.i
+
+%{
+#include "Batch_Job.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_JobInfo.hxx"
+
+#include "Batch_BatchManager.hxx"
+#include "Batch_BatchManagerCatalog.hxx"
+#include "Batch_FactBatchManager.hxx"
+%}
+
+/* Les classes exportees en Python */
+%include Batch_Job.hxx
+%include Batch_JobId.hxx
+%include Batch_JobInfo.hxx
+
+%include Batch_BatchManager.hxx
+%include Batch_BatchManagerCatalog.hxx
+%include Batch_FactBatchManager.hxx
+
+
+
+/* Les methodes alterJob (surchargees et mal gerees en Python) sont
+ remplacees par des methodes setParametre et setEnvironnement.
+ cf. remarque ci-dessus.
+*/
+%ignore JobId::alterJob(const Parametre & param, const Environnement & env) const;
+%ignore JobId::alterJob(const Parametre & param) const;
+%ignore JobId::alterJob(const Environnement & env) const;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * _exception.i :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+%exception {
+ try {
+ $action
+ }
+ catch (Batch::GenericException & ex) {
+ std::string msg = ex.type + " : " + ex.message;
+ PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
+ return NULL;
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
+ return NULL;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*
+ * _typemap.i :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+%{
+#include <string>
+#include <list>
+#include <map>
+#include "Batch_Parametre.hxx"
+#include "Batch_PyVersatile.hxx"
+#include "Batch_JobId.hxx"
+#include "Batch_FactBatchManager.hxx"
+%}
+
+# // supprime toutes les definitions par defaut => sert au debug
+# %typemap(in) SWIGTYPE ;
+
+
+# // construction d'un dictionnaire Python a partir d'un objet BatchManagerCatalog C++
+%typemap(out) std::map<std::string, Batch::FactBatchManager *> *
+{
+ $result = PyDict_New();
+
+ // on itere sur toutes les clefs de la map
+ for(std::map<std::string, Batch::FactBatchManager *>::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) {
+ std::string key = (*it).first;
+ PyObject * obj = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0);
+ PyDict_SetItem($result, PyString_FromString(key.c_str()), obj);
+ }
+}
+
+
+# // construction d'un dictionnaire Python a partir d'un objet Parametre C++
+%typemap(out) Batch::Parametre
+{
+ $result = PyDict_New();
+
+ // on itere sur toutes les clefs de la map, et on passe par la classe PyVersatile
+ // qui convertit un Versatile en PyObject et vice versa
+ for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) {
+ std::string key = (*it).first;
+ Batch::PyVersatile PyV = (*it).second;
+ PyDict_SetItem($result, PyString_FromString(key.c_str()), PyV);
+ }
+}
+
+
+# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
+%typemap(in) Batch::Parametre & (Batch::Parametre PM)
+{
+ if (!PyDict_Check($input)) {
+ PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
+ return NULL;
+ }
+
+ try {
+ // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile
+ // qui convertit un Versatile en PyObject et vice versa
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value)) {
+ std::string mk = PyString_AsString(key);
+ Batch::PyVersatile PyV = value;
+ PyV.setName(mk);
+ PM[mk] = PyV;
+ }
+
+ $1 = &PM; // $1 est une reference donc on lui passe une adresse
+ }
+ catch (Batch::GenericException & ex) {
+ std::string msg = ex.type + " : " + ex.message;
+ PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
+ return NULL;
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
+ return NULL;
+ }
+}
+
+
+# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
+%typemap(in) Batch::Parametre (Batch::Parametre PM)
+{
+ if (!PyDict_Check($input)) {
+ PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
+ return NULL;
+ }
+
+ try {
+ // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile
+ // qui convertit un Versatile en PyObject et vice versa
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value)) {
+ std::string mk = PyString_AsString(key);
+ Batch::PyVersatile PyV = value;
+ PyV.setName(mk);
+ PM[mk] = PyV;
+ }
+
+ $1 = PM;
+ }
+ catch (Batch::GenericException & ex) {
+ std::string msg = ex.type + " : " + ex.message;
+ PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
+ return NULL;
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
+ return NULL;
+ }
+}
+
+
+# // construction d'un dictionnaire Python a partir d'un objet Environnement C++
+%typemap(out) Batch::Environnement
+{
+ $result = PyDict_New();
+
+ // on itere sur toutes les clefs de la map
+ for(Batch::Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) {
+ std::string key = (*it).first;
+ std::string val = (*it).second;
+ PyDict_SetItem($result,
+ PyString_FromString(key.c_str()),
+ PyString_FromString(val.c_str()));
+ }
+}
+
+
+# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
+%typemap(in) Batch::Environnement & (Batch::Environnement E)
+{
+ if (!PyDict_Check($input)) {
+ PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
+ return NULL;
+ }
+
+ // on itere sur toutes les clefs du dictionnaire
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value)) {
+ std::string mk = PyString_AsString(key);
+ std::string val = PyString_AsString(value);
+ E[mk] = val;
+ }
+
+ $1 = &E; // $1 est une reference donc on lui passe une adresse
+}
+
+
+
+# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
+%typemap(in) Batch::Environnement (Batch::Environnement E)
+{
+ if (!PyDict_Check($input)) {
+ PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
+ return NULL;
+ }
+
+ // on itere sur toutes les clefs du dictionnaire
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value)) {
+ std::string mk = PyString_AsString(key);
+ std::string val = PyString_AsString(value);
+ E[mk] = val;
+ }
+
+ $1 = E;
+}
+
+
+
+# // construction d'une string Python a partir d'une string STL
+%typemap(python,out) std::string
+{
+ $result = PyString_FromString($1.c_str());
+}
+
+
+
+# // construction d'une string STL a partir d'une string Python
+#%typemap(in) string & (string S)
+#{
+## if (!PyString_Check($input)) {
+# PyErr_SetString(PyExc_ValueError,"Expected a string");
+# return NULL;
+# }
+#
+# S = string(PyString_AsString($input));
+# $1 = &S; // $1 est une reference donc on lui passe une adresse
+#}
+
+
+
+# // construction d'une string STL a partir d'une string Python
+#%typemap(in) string (string S)
+#{
+## if (!PyString_Check($input)) {
+# PyErr_SetString(PyExc_ValueError,"Expected a string");
+# return NULL;
+# }
+#
+# S = string(PyString_AsString($input));
+# $1 = S;
+#}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "CASCatch_CatchSignals.hxx"
+
+#include "CASCatch_Failure.hxx"
+#include "CASCatch_ErrorHandler.hxx"
+#include <TCollection_AsciiString.hxx>
+
+#define MAX_HANDLER_NUMBER 6
+
+
+//================================================================================
+/*! Public -
+ * \brief creates a CASCatch_CatchSignals
+ */
+//================================================================================
+CASCatch_CatchSignals::CASCatch_CatchSignals()
+ :myIsActivated(Standard_False)
+{
+
+ Standard_Integer i = 0;
+ for(; i<=MAX_HANDLER_NUMBER; i++)
+ mySigStates[i] = NULL;
+}
+
+#ifndef WNT
+
+//================================ UNIX part ==================================================
+
+#include <OSD.hxx>
+#include <OSD_WhoAmI.hxx>
+#include <OSD_SIGHUP.hxx>
+#include <OSD_SIGINT.hxx>
+#include <OSD_SIGQUIT.hxx>
+#include <OSD_SIGILL.hxx>
+#include <OSD_SIGKILL.hxx>
+#include <OSD_SIGBUS.hxx>
+#include <OSD_SIGSEGV.hxx>
+#include <OSD_SIGSYS.hxx>
+#ifndef LIN
+#include <exception.h>
+#endif
+
+//==============================
+typedef void (ACT_SIGIO_HANDLER)(void) ;
+
+ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
+
+typedef void (* SIG_PFV) (int);
+
+#ifdef SUN
+# include <floatingpoint.h>
+#endif
+
+#ifdef SOLARIS
+# include <floatingpoint.h>
+# include <sys/machsig.h>
+# include <stdlib.h>
+# include <stdio.h>
+#endif
+
+#include <signal.h>
+#include <sys/signal.h>
+
+#ifdef LIN
+# include <stdlib.h>
+# include <stdio.h>
+#else
+# ifdef SA_SIGINFO
+# ifndef AIX
+# include <sys/siginfo.h>
+# endif
+# endif
+#endif
+
+
+#ifdef IRIX
+# include <sigfpe.h>
+# include <sys/siginfo.h>
+#endif
+
+
+//================================================================================
+/*! Private -
+ * \brief universal handler for signals
+ */
+//================================================================================
+static void Handler(const OSD_Signals theSig, const OSD_Signals)
+{
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, theSig);
+ sigprocmask(SIG_UNBLOCK, &set, NULL) ;
+
+ TCollection_AsciiString aMessage(theSig);
+ aMessage+=" signal detected";
+
+ CASCatch_Failure::Raise(aMessage.ToCString());
+}
+
+
+#ifdef SA_SIGINFO
+//================================================================================
+/*! Private -
+ * \brief handler for SIGSEGV signal
+ */
+//================================================================================
+static void SegvHandler(const OSD_Signals, const Standard_Address, const Standard_Address)
+{
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, SIGSEGV);
+ sigprocmask (SIG_UNBLOCK, &set, NULL);
+
+ CASCatch_Failure::Raise("SIGSEGV detected");
+}
+#endif
+
+
+//================================================================================
+/*! Public -
+ * \brief activates a signals handling
+ */
+//================================================================================
+void CASCatch_CatchSignals::Activate()
+{
+ if(myIsActivated) return;
+
+ struct sigaction act;
+
+ Standard_Integer i = 0;
+ for(; i<=MAX_HANDLER_NUMBER; i++)
+ mySigStates[i] = new struct sigaction(); //Initialize structures
+
+ int stat;
+ act.sa_handler = (SIG_PFV) &Handler ;
+ sigemptyset(&act.sa_mask) ;
+
+
+ stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]); // ...... hangup
+ stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]); // ...... floating point exception
+ stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]); // ...... interrupt
+ stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]); // ...... quit
+ stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]); // ...... bus error
+ stat = sigaction(SIGILL,&act,(struct sigaction*)mySigStates[5]); // ...... illegal instruction
+
+#ifdef SA_RESTART
+ act.sa_flags = SA_RESTART ;
+#else
+ act.sa_flags = 0 ;
+#endif
+ act.sa_handler = (SIG_PFV) &SegvHandler ;
+
+#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX
+ act.sa_flags = act.sa_flags | SA_SIGINFO ;
+# ifdef SOLARIS
+ act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ;
+# endif
+#endif
+
+ stat = sigaction( SIGSEGV , &act , (struct sigaction*)mySigStates[6]); // ...... segmentation violation
+
+ myIsActivated = Standard_True;
+}
+
+
+//================================================================================
+/*! Public -
+ * \brief deactivates a signals handling
+ */
+//================================================================================
+void CASCatch_CatchSignals::Deactivate()
+{
+ if(!myIsActivated) return;
+
+ struct sigaction oact;
+ int stat;
+
+ stat = sigaction(SIGHUP,(struct sigaction*)mySigStates[0],&oact); // ...... hangup
+ stat = sigaction(SIGFPE,(struct sigaction*)mySigStates[1],&oact); // ...... floating point exception
+ stat = sigaction(SIGINT,(struct sigaction*)mySigStates[2],&oact); // ...... interrupt
+ stat = sigaction(SIGQUIT,(struct sigaction*)mySigStates[3],&oact); // ...... quit
+ stat = sigaction(SIGBUS,(struct sigaction*)mySigStates[4],&oact); // ...... bus error
+ stat = sigaction(SIGILL,(struct sigaction*)mySigStates[5],&oact); // ...... illegal instruction
+ stat = sigaction(SIGSEGV,(struct sigaction*)mySigStates[6],&oact); // ...... segmentation violation
+
+
+ Standard_Integer i = 0;
+ for(; i<=MAX_HANDLER_NUMBER; i++)
+ delete (struct sigaction*)mySigStates[i];
+
+ myIsActivated = Standard_False;
+}
+
+
+
+#else
+//====================================== WNT part ====================================================
+#include <OSD_WNT_1.hxx>
+
+#include <process.h>
+#include <signal.h>
+#include <float.h>
+
+#define _OSD_FPX ( _EM_DENORMAL | _EM_INEXACT | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_OVERFLOW) //Mask these exceptions
+
+//================================================================================
+/*! Private -
+ * \brief handler for unexpected exceptions
+ */
+//================================================================================
+static Standard_Integer WntHandler(const Standard_Address theExceptionInfo)
+{
+ LPEXCEPTION_POINTERS lpXP = ( LPEXCEPTION_POINTERS )theExceptionInfo;
+ DWORD dwExceptionCode = lpXP -> ExceptionRecord -> ExceptionCode;
+
+ TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode);
+ aMessage+=" Exception code - unexpected exception";
+
+ CASCatch_Failure::Raise(aMessage.ToCString());
+
+ return EXCEPTION_EXECUTE_HANDLER;
+}
+
+void SIGWntHandler(int , int ) ;
+static void (*SIGWNTHANDLER)(int) = ( void (*)(int) ) ( &SIGWntHandler ) ;
+
+
+//================================================================================
+/*! Private -
+ * \brief handler for signals
+ */
+//================================================================================
+static void SIGWntHandler(const int signum , const int theCode)
+{
+
+ void (*OLDSIGWNTHANDLER)(int) ;
+ switch( signum ) {
+ case SIGFPE :
+ _fpreset() ;
+ _clearfp() ;
+ _controlfp ( _OSD_FPX, _MCW_EM );
+ OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
+
+ if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return;
+ CASCatch_Failure::Raise ("Floating point error");
+ break;
+ case SIGSEGV :
+ OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
+ CASCatch_Failure::Raise("Access violation");
+ break;
+ case SIGILL :
+ OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
+ CASCatch_Failure::Raise("Illegal instruction" );
+ break;
+ }
+}
+
+
+//================================================================================
+/*! Public -
+ * \brief activates a signals handling
+ */
+//================================================================================
+void CASCatch_CatchSignals::Activate()
+{
+ if(myIsActivated) return;
+
+ mySigStates[0] = SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )&WntHandler);
+
+ myFloatOpWord = _controlfp(0, 0);
+ _controlfp ( _OSD_FPX, _MCW_EM ); //Enable floating point exceptions
+
+ mySigStates[1] = signal( SIGSEGV , SIGWNTHANDLER );
+ mySigStates[2] = signal( SIGFPE , SIGWNTHANDLER );
+ mySigStates[3] = signal( SIGILL , SIGWNTHANDLER );
+
+ myIsActivated = Standard_True;
+}
+
+//================================================================================
+/*! Public -
+ * \brief deactivates a signals handling
+ */
+//================================================================================
+void CASCatch_CatchSignals::Deactivate()
+{
+ if(!myIsActivated) return;
+
+ SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )mySigStates[0]);
+
+ _controlfp ( myFloatOpWord, _MCW_EM );
+
+ signal( SIGSEGV , ( void (*)(int) )mySigStates[1]);
+ signal( SIGFPE , ( void (*)(int) )mySigStates[2]);
+ signal( SIGILL , ( void (*)(int) )mySigStates[3]);
+
+ Standard_Integer i = 0;
+ for(; i<=MAX_HANDLER_NUMBER; i++)
+ mySigStates[i] = NULL;
+
+ myIsActivated = Standard_False;
+}
+
+#endif
+
+//================================================================================
+/*! Private -
+ * \brief deactivates a signals handling
+ */
+//================================================================================
+void CASCatch_CatchSignals::Destroy()
+{
+ if(myIsActivated) Deactivate();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _CASCatch_CatchSignals_HeaderFile
+#define _CASCatch_CatchSignals_HeaderFile
+
+#include <Standard.hxx>
+
+/*!
+ * \class CASCatch_CatchSignals
+ * \brief This class controls an exception handling
+ *
+ */
+class CASCatch_CatchSignals {
+
+public:
+
+ // Methods PUBLIC
+ //
+Standard_EXPORT CASCatch_CatchSignals();
+Standard_EXPORT void Destroy() ;
+~CASCatch_CatchSignals() { Destroy(); }
+Standard_EXPORT void Activate() ;
+Standard_EXPORT void Deactivate() ;
+
+private:
+
+/*!\var mySigStates[7], private
+ * \brief stores signals' handler functions
+ */
+Standard_Address mySigStates[7];
+
+/*!\var myFloatOpWord
+ * \brief stores a float operation word, private
+ */
+Standard_Integer myFloatOpWord;
+
+/*!\var myIsActivated
+ * \brief stores a flag whether a catcher is activated, private]
+ */
+Standard_Boolean myIsActivated;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifdef NO_CXX_EXCEPTION
+
+#include "CASCatch_ErrorHandler.hxx"
+
+// During setjmp()/longjmp() K_SETJMP_CASCatch is non zero (try)
+// So if there is an abort request and if K_SETJMP_CASCatch is non zero, the abort
+// request will be ignored. If the abort request do a raise during a setjmp
+// or a longjmp, there will be a "terminating SEGV" impossible to handle.
+
+
+Standard_EXPORT int K_SETJMP_CASCatch = 0 ;
+
+static Handle(CASCatch_Failure) GlbError; //Last caught Error, Null if there is no error
+
+static CASCatch_ErrorHandler* Top = 0; //The top of the Errors Stack
+
+//=======================================================================
+//function : CASCatch_ErrorHandler
+//purpose : Constructor
+//=======================================================================
+CASCatch_ErrorHandler::CASCatch_ErrorHandler ()
+{
+ Previous = Top;
+ Top = this;
+ CaughtError.Nullify();
+ GlbError.Nullify();
+}
+
+//=======================================================================
+//function : ~CASCatch_ErrorHandler
+//purpose : Destructor : Delete the ErrorHandler and Abort if there is a 'Error'.
+//=======================================================================
+CASCatch_ErrorHandler::~CASCatch_ErrorHandler()
+{
+ Top = Top->Previous;
+ if( !GlbError.IsNull() ) Abort();
+}
+
+//=======================================================================
+//function : Abort: make a longjmp to the saved Context.
+//purpose : Abort if there is a non null 'Error'
+//=======================================================================
+void CASCatch_ErrorHandler::Abort ()
+{
+ //==== Check if can do the "longjmp" =======================================
+ if(Top == NULL || Top->Label == NULL) {
+ cout << "*** Abort *** an exception was raised, but no catch was found." << endl;
+ cout << "\t... The exception is:" << GlbError;
+ exit(1);
+ }
+
+#ifdef DO_ABORT
+ if ( K_SETJMP_CASCatch )
+ cout << "Recursive abort ===> Terminating SEGV ..." << endl ;
+ K_SETJMP_CASCatch = 1 ;
+#endif
+
+ longjmp(Top->Label, Standard_True);
+}
+
+//=======================================================================
+//function : Catches
+//purpose : If there is a 'Error', and it is in good type
+// returns True and clean 'Error', else returns False.
+//=======================================================================
+Standard_Boolean CASCatch_ErrorHandler::Catches
+ (const Handle(Standard_Type)& AType)
+{
+#ifdef DO_ABORT
+ K_SETJMP_CASCatch = 0 ;
+#endif
+ if(GlbError.IsNull())
+ return Standard_False;
+
+ if(GlbError->IsKind(AType)){
+ CaughtError = GlbError;
+ GlbError.Nullify();
+ return Standard_True;
+ } else {
+ return Standard_False;
+ }
+}
+
+//=======================================================================
+//function : LastCaughtError
+//purpose :
+//=======================================================================
+Handle(CASCatch_Failure) CASCatch_ErrorHandler::LastCaughtError()
+{
+ return Top->CaughtError;
+}
+
+//=======================================================================
+//function : Error
+//purpose :
+//=======================================================================
+void CASCatch_ErrorHandler::Error(const Handle(CASCatch_Failure)& aError)
+{
+ GlbError = aError;
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _CASCatch_ErrorHandler_HeaderFile
+#define _CASCatch_ErrorHandler_HeaderFile
+
+#include "CASCatch_Failure.hxx"
+
+#include <stdlib.h>
+#include <setjmp.h>
+
+
+extern int K_SETJMP_CASCatch ;
+
+/*!
+ * \class CASCatch_ErrorHandler
+ * \brief This class is an exception handler, private
+ *
+ */
+class CASCatch_ErrorHandler
+{
+ friend class CASCatch_Failure; // To execute the raise exception.
+
+ public:
+
+ Standard_EXPORT CASCatch_ErrorHandler();
+ Standard_EXPORT ~CASCatch_ErrorHandler();
+ Standard_EXPORT Standard_Boolean Catches (const Handle(Standard_Type)&);
+
+ private:
+ Standard_EXPORT static void Abort();
+ Standard_EXPORT static void Error(const Handle(CASCatch_Failure)&);
+ Standard_EXPORT static Handle(CASCatch_Failure) LastCaughtError();
+
+ //==== The fields ===========================================================
+ private:
+ CASCatch_ErrorHandler* Previous;
+ Handle(CASCatch_Failure) CaughtError;
+
+ public:
+ jmp_buf Label;
+
+};
+
+#undef CASCatch_TRY
+#define CASCatch_TRY try
+
+#undef CASCatch_CATCH
+#define CASCatch_CATCH catch
+
+
+#ifdef NO_CXX_EXCEPTION
+# undef CASCatch_TRY
+# undef CASCatch_CATCH
+
+# if defined(DO_ABORT)
+
+# define DoesNotAbort_CASCatch(aHandler) !(K_SETJMP_CASCatch = setjmp(aHandler.Label))
+
+# define CASCatch_TRY CASCatch_ErrorHandler _Function; \
+ K_SETJMP_CASCatch = 1 ; \
+ if(DoesNotAbort_CASCatch(_Function))
+
+# else //If DO_ABORT is not defined
+# define DoesNotAbort_CASCatch(aHandler) !setjmp(aHandler.Label)
+
+# define CASCatch_TRY CASCatch_ErrorHandler _Function; \
+ if(DoesNotAbort_CASCatch(_Function))
+# endif //DO_ABORT
+
+
+# define CASCatch_CATCH(Error) else if(_Function.Catches(STANDARD_TYPE(Error)))
+#endif //NO_CXX_EXCEPTION
+
+#endif //_CASCatch_ErrorHandler_HeaderFile
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "CASCatch_Failure.hxx"
+#include "CASCatch_ErrorHandler.hxx"
+#include <Standard_TypeMismatch.hxx>
+#include <Standard_Type.hxx>
+#include <string.h>
+
+IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
+IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient )
+
+
+#ifndef NO_CXX_EXCEPTION
+static Handle(CASCatch_Failure) RaisedError;
+#endif
+
+//================================================================================
+/*! Public -
+ * \brief creates a CASCatch_Failure
+ */
+//================================================================================
+CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";}
+
+
+//================================================================================
+/*! Public -
+ * \brief creates a CASCatch_Failure with a message
+ * \param an exception message
+ */
+//================================================================================
+CASCatch_Failure::CASCatch_Failure (const Standard_CString AString)
+{
+ if(AString) {
+ myMessage = new Standard_Character[strlen(AString) + 1];
+ strcpy(myMessage,AString);
+ }
+}
+
+//================================================================================
+/*! Public -
+ * \brief returns the last caught exception
+ */
+//================================================================================
+Handle(CASCatch_Failure) CASCatch_Failure::Caught()
+{
+#ifdef NO_CXX_EXCEPTION
+ return CASCatch_ErrorHandler::LastCaughtError();
+#else
+ return RaisedError ;
+#endif
+}
+
+//================================================================================
+/*! Public -
+ * \brief raises a CASCatch_Failure exception
+ * \param an exception message
+ */
+//================================================================================
+void CASCatch_Failure::Raise (const Standard_CString AString)
+{
+ Handle(CASCatch_Failure) E = new CASCatch_Failure() ;
+ E->Reraise (AString) ;
+}
+
+
+//================================================================================
+/*! Public -
+ * \brief re-raises a CASCatch_Failure exception
+ * \param an exception message
+ */
+//================================================================================
+void CASCatch_Failure::Reraise (const Standard_CString AString)
+{
+ if(AString){
+ myMessage = new Standard_Character[strlen(AString) + 1];
+ strcpy(myMessage,AString);
+ }
+
+#ifdef NO_CXX_EXCEPTION
+ CASCatch_ErrorHandler::Error(this) ;
+ CASCatch_ErrorHandler::Abort();
+#else
+ RaisedError = this ;
+ Throw() ;
+#endif
+}
+
+//================================================================================
+/*! Public -
+ * \brief returns an exception message
+ */
+//================================================================================
+Standard_CString CASCatch_Failure::GetError() const
+{
+ return myMessage;
+}
+
+//================================================================================
+/*! Public -
+ * \brief Is called when using standard C++ exceptions
+ */
+//================================================================================
+void CASCatch_Failure::Throw() const
+{
+#ifndef NO_CXX_EXCEPTION
+ throw CASCatch_Failure() ;
+#endif
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _CASCATCH_FAILURE_HeaderFile
+#define _CASCATCH_FAILURE_HeaderFile
+
+#include <Standard_Transient.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
+
+#include <Standard.hxx>
+
+/*!
+ * \class CASCatch_Failure
+ * \brief This class presents an exception to be thrown
+ *
+ */
+class CASCatch_Failure : public Standard_Transient
+{
+
+public:
+
+Standard_EXPORT CASCatch_Failure();
+Standard_EXPORT CASCatch_Failure(const Standard_CString aString);
+Standard_EXPORT void Reraise(const Standard_CString aMessage) ;
+Standard_EXPORT Standard_CString GetError() const;
+Standard_EXPORT static Handle_CASCatch_Failure Caught() ;
+Standard_EXPORT static void Raise(const Standard_CString aMessage = "") ;
+Standard_EXPORT virtual void Throw() const;public:
+
+public:
+
+DEFINE_STANDARD_RTTI( CASCatch_Failure )
+
+private:
+/*!\var myMessage
+ * \brief stores an exception message
+ */
+Standard_CString myMessage;
+
+};
+
+
+#endif
--- /dev/null
+# File : Makefile.in
+# Author : Sergey RUIN (OCN)
+# Module : SALOME
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= CASCatch_Failure.hxx \
+ CASCatch_CatchSignals.hxx \
+ CASCatch_ErrorHandler.hxx
+
+# Libraries targets
+LIB = libCASCatch.la
+
+LIB_SRC = CASCatch_Failure.cxx \
+ CASCatch_ErrorHandler.cxx \
+ CASCatch_CatchSignals.cxx
+
+CPPFLAGS += $(OCC_INCLUDES)
+CXXFLAGS += $(OCC_CXXFLAGS)
+LDFLAGS+= $(CAS_KERNEL) $(CAS_MATH)
+
+@CONCLUDE@
+
+
--- /dev/null
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS =
+
+EXPORT_HEADERS = \
+ ReceiverFactory.hxx \
+ SenderFactory.hxx \
+ SALOMEMultiComm.hxx \
+ MultiCommException.hxx \
+ SALOME_Comm_i.hxx
+
+# Libraries targets
+
+LIB = libSalomeCommunication.la
+LIB_SRC = SALOME_Comm_i.cxx SenderFactory.cxx MultiCommException.cxx SALOMEMultiComm.cxx ReceiverFactory.cxx
+LIB_SERVER_IDL = SALOME_Comm.idl SALOME_Exception.idl
+
+# Executables targets
+BIN =
+BIN_SRC =
+BIN_SERVER_IDL =
+
+CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDES)
+
+LDFLAGS+= -lOpUtil -lSALOMELocalTrace
+
+LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) $(MPI_LIBS)
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "MultiCommException.hxx"
+using namespace std;
+
+MultiCommException::MultiCommException(const char *message)
+{
+ _message=message;
+}
+
+const char *MultiCommException::what() const
+{
+ return _message.c_str();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _MULTICOMMEXCEPTION_HXX_
+#define _MULTICOMMEXCEPTION_HXX_
+
+#include <string>
+
+
+class MultiCommException {
+private:
+ std::string _message;
+public:
+ MultiCommException(const char *message);
+ const char *what() const;
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "Receiver.hxx"
+#include <string.h>
+using namespace std;
+
+/*!
+ return a deep copy of the array contained in the servant.
+ */
+void *Receiver::getLocalValue(long &size,SALOME_Sender_i* servant)
+{
+ const void *src=servant->getData(size);
+ long lgr=size*servant->getSizeOf();
+ void *ret=new char[lgr];
+ memcpy(ret,src,lgr);
+ return ret;
+ //return (void *)servant->getData(size);
+}
+
+void *Receiver::getValue(long &size,SALOME::Sender_ptr sender)
+{
+ SALOME_Sender_i* data=SALOME_Sender_i::find(sender);
+ if(data)
+ return getLocalValue(size,data);
+ else
+ return getDistValue(size);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _RECEIVER_HXX_
+#define _RECEIVER_HXX_
+
+#include "SALOME_Comm_i.hxx"
+
+/*! Abstract class factorizing common methods of all the receivers. All of the receivers have to inheritate from it.
+ */
+template<class T,class senderPtr, class senderSrv>
+class Receiver
+{
+public:
+ virtual T *getValue(long &size)=0;
+ virtual ~Receiver() {}
+protected:
+ virtual T *getValue(long &size,senderPtr sender);
+ static inline T *getLocalValue(long &size,senderSrv* servant);
+ virtual T *getDistValue(long &size)=0;
+};
+
+template<class T,class senderPtr, class senderSrv>
+T *Receiver<T,senderPtr,senderSrv>::getLocalValue(long &size,senderSrv* servant)
+{
+ const T *src=(const T *)servant->getData(size);
+ long lgr=size*servant->getSizeOf();
+ void *ret=new char[lgr];
+ memcpy(ret,src,lgr);
+ return (T *)ret;
+ //return (void *)servant->getData(size);
+}
+
+template<class T,class senderPtr, class senderSrv>
+T *Receiver<T,senderPtr,senderSrv>::getValue(long &size,senderPtr sender)
+{
+ senderSrv* data=senderSrv::find(sender);
+ if(data)
+ return getLocalValue(size,data);
+ else
+ return getDistValue(size);
+}
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifdef HAVE_MPI2
+#include "mpi.h"
+#endif
+#include "ReceiverFactory.hxx"
+#include "Receivers.hxx"
+using namespace std;
+
+#ifdef COMP_CORBA_DOUBLE
+#define CorbaDNoCopyReceiver CorbaNCNoCopyReceiver
+#define CorbaDWithCopyReceiver CorbaNCWithCopyReceiver
+#else
+#define CorbaDNoCopyReceiver CorbaWCNoCopyReceiver
+#define CorbaDWithCopyReceiver CorbaWCWithCopyReceiver
+#endif
+
+#ifdef COMP_CORBA_LONG
+#define CorbaINoCopyReceiver CorbaNCNoCopyReceiver
+#define CorbaIWithCopyReceiver CorbaNCWithCopyReceiver
+#else
+#define CorbaINoCopyReceiver CorbaWCNoCopyReceiver
+#define CorbaIWithCopyReceiver CorbaWCWithCopyReceiver
+#endif
+
+#ifdef HAVE_SOCKET
+#include <rpc/xdr.h>
+#endif
+
+/*!
+ This method performs the transfert of double array with the remote SenderDouble given. If it fails with this SenderDouble it tries with an another protocol (CORBA by default).
+ */
+double *ReceiverFactory::getValue(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException)
+{
+ double *ret;
+ try{
+ ret=getValueOneShot(sender,size);
+ }
+ catch(MultiCommException&)
+ {
+ SALOME::SenderDouble_ptr newSender=sender->buildOtherWithProtocol(SALOME::CORBA_);
+ MESSAGE("PROTOCOL CHANGED TO CORBA");
+ sender->release();
+ ret=getValueOneShot(newSender,size);
+ CORBA::release(newSender);
+ }
+ return ret;
+}
+
+/*!
+ This method performs the transfert of int array with the remote SenderInt given. If it fails with this SenderInt it tries with an another protocol (CORBA by default).
+ */
+int *ReceiverFactory::getValue(SALOME::SenderInt_ptr sender,long &size)throw(MultiCommException)
+{
+ int *ret;
+ try{
+ ret=getValueOneShot(sender,size);
+ }
+ catch(MultiCommException&)
+ {
+ SALOME::SenderInt_ptr newSender=sender->buildOtherWithProtocol(SALOME::CORBA_);
+ MESSAGE("PROTOCOL CHANGED TO CORBA");
+ sender->release();
+ ret=getValueOneShot(newSender,size);
+ CORBA::release(newSender);
+ }
+ return ret;
+}
+
+/*!
+ This method performs the transfert with the remote SenderDouble given. If it fails an exception is thrown.
+ */
+double *ReceiverFactory::getValueOneShot(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException)
+{
+ SALOME::CorbaDoubleNCSender_ptr cncD_ptr;
+ SALOME::CorbaDoubleCSender_ptr cwcD_ptr;
+#ifdef HAVE_MPI2
+ SALOME::MPISenderDouble_ptr mpi_ptr=SALOME::MPISenderDouble::_narrow(sender);
+#endif
+#ifdef HAVE_SOCKET
+ SALOME::SocketSenderDouble_ptr sock_ptr=SALOME::SocketSenderDouble::_narrow(sender);
+#endif
+ cncD_ptr=SALOME::CorbaDoubleNCSender::_narrow(sender);
+ cwcD_ptr=SALOME::CorbaDoubleCSender::_narrow(sender);
+ if(!CORBA::is_nil(cncD_ptr))
+ {
+ CORBA::release(sender);
+ CorbaDNoCopyReceiver<double,CORBA::Double,SALOME::vectorOfDouble_var,SALOME::CorbaDoubleNCSender_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(cncD_ptr);
+ return rec.getValue(size);
+ }
+ else if(!CORBA::is_nil(cwcD_ptr))
+ {
+ CORBA::release(sender);
+ CorbaDWithCopyReceiver<double,CORBA::Double,SALOME::vectorOfDouble_var,SALOME::CorbaDoubleCSender_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(cwcD_ptr);
+ return rec.getValue(size);
+ }
+#ifdef HAVE_MPI2
+ else if(!CORBA::is_nil(mpi_ptr))
+ {
+ CORBA::release(sender);
+ MPIReceiver<double,MPI_DOUBLE,SALOME::MPISenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(mpi_ptr);
+ return rec.getValue(size);
+ }
+#endif
+#ifdef HAVE_SOCKET
+ else if(!CORBA::is_nil(sock_ptr))
+ {
+ CORBA::release(sender);
+ SocketReceiver<double,xdr_double,SALOME::SocketSenderDouble_ptr,SALOME::SenderDouble_ptr,SALOME_SenderDouble_i> rec(sock_ptr);
+ return rec.getValue(size);
+ }
+#endif
+ else
+ {
+ throw MultiCommException("Unknown sender protocol");
+ return 0;
+ }
+}
+
+/*!
+ This method performs the transfert with the remote SenderInt given. If it fails an exception is thrown.
+ */
+int *ReceiverFactory::getValueOneShot(SALOME::SenderInt_ptr sender,long &size)throw(MultiCommException)
+{
+ SALOME::CorbaLongNCSender_ptr cncL_ptr;
+ SALOME::CorbaLongCSender_ptr cwcL_ptr;
+#ifdef HAVE_MPI2
+ SALOME::MPISenderInt_ptr mpi_ptr=SALOME::MPISenderInt::_narrow(sender);
+#endif
+#ifdef HAVE_SOCKET
+ SALOME::SocketSenderInt_ptr sock_ptr=SALOME::SocketSenderInt::_narrow(sender);
+#endif
+ cncL_ptr=SALOME::CorbaLongNCSender::_narrow(sender);
+ cwcL_ptr=SALOME::CorbaLongCSender::_narrow(sender);
+ if(!CORBA::is_nil(cncL_ptr))
+ {
+ CORBA::release(sender);
+ CorbaINoCopyReceiver<int,CORBA::Long,SALOME::vectorOfLong_var,SALOME::CorbaLongNCSender_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(cncL_ptr);
+ return rec.getValue(size);
+ }
+ else if(!CORBA::is_nil(cwcL_ptr))
+ {
+ CORBA::release(sender);
+ CorbaIWithCopyReceiver<int,CORBA::Long,SALOME::vectorOfLong_var,SALOME::CorbaLongCSender_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(cwcL_ptr);
+ return rec.getValue(size);
+ }
+#ifdef HAVE_MPI2
+ else if(!CORBA::is_nil(mpi_ptr))
+ {
+ CORBA::release(sender);
+ MPIReceiver<int,MPI_INT,SALOME::MPISenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(mpi_ptr);
+ return rec.getValue(size);
+ }
+#endif
+#ifdef HAVE_SOCKET
+ else if(!CORBA::is_nil(sock_ptr))
+ {
+ CORBA::release(sender);
+ SocketReceiver<int,xdr_int,SALOME::SocketSenderInt_ptr,SALOME::SenderInt_ptr,SALOME_SenderInt_i> rec(sock_ptr);
+ return rec.getValue(size);
+ }
+#endif
+ else
+ {
+ throw MultiCommException("Unknown sender protocol");
+ return 0;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _RECEIVERFACTORY_HXX_
+#define _RECEIVERFACTORY_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Comm)
+#include "MultiCommException.hxx"
+
+/*!
+ This class internally builds a receiver associated with the sender given. It also performs transfert completely and clean up the objects.
+ This is the only class used client side of an array.
+ */
+class ReceiverFactory
+{
+public:
+ static double *getValue(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException);
+ static int *getValue(SALOME::SenderInt_ptr sender,long &size)throw(MultiCommException);
+private:
+ static double *getValueOneShot(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException);
+ static int *getValueOneShot(SALOME::SenderInt_ptr sender,long &size)throw(MultiCommException);
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "poa.h"
+#include "utilities.h"
+using namespace std;
+
+#define TAILLE_SPLIT 100000
+#define TIMEOUT 20
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaNCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::CorbaNCNoCopyReceiver(CorbaSender mySender):_mySender(mySender){
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaNCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::~CorbaNCNoCopyReceiver(){
+ _mySender->release();
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaNCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getDistValue(long &size)
+{
+ TSeqCorba seq=_mySender->send();
+ size=seq->length();
+ return (T *)seq->get_buffer(1);
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaNCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaNCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::CorbaNCWithCopyReceiver(CorbaSender mySender):_mySender(mySender){
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaNCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::~CorbaNCWithCopyReceiver(){
+ _mySender->release();
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaNCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+ size=_mySender->getSize();
+ long n;
+ T *ret=new T[size];
+ T *iter=ret;
+ for(long i=0;i<size;i+=TAILLE_SPLIT)
+ {
+ if(size-i>TAILLE_SPLIT)
+ n=TAILLE_SPLIT;
+ else
+ n=size-i;
+ TSeqCorba seq=_mySender->sendPart(i,n);
+ T *seqd=(T *)seq->get_buffer(0);
+ for(long j=0;j<n;j++)
+ *iter++=*seqd++;
+ }
+ return ret;
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaNCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaWCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::CorbaWCNoCopyReceiver(CorbaSender mySender):_mySender(mySender){
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaWCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::~CorbaWCNoCopyReceiver(){
+ _mySender->release();
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaWCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+ size=_mySender->getSize();
+ long n;
+ T *ret=new T[size];
+ T *iter=ret;
+ for(long i=0;i<size;i+=TAILLE_SPLIT)
+ {
+ if(size-i>TAILLE_SPLIT)
+ n=TAILLE_SPLIT;
+ else
+ n=size-i;
+ TSeqCorba seq=_mySender->sendPart(i,n);
+ TCorba *seqd=seq->get_buffer(0);
+ for(long j=0;j<n;j++)
+ *iter++=*seqd++;
+ }
+ return ret;
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaWCNoCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaWCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::CorbaWCWithCopyReceiver(CorbaSender mySender):_mySender(mySender){
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+CorbaWCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::~CorbaWCWithCopyReceiver(){
+ _mySender->release();
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaWCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+ size=_mySender->getSize();
+ long n;
+ T *ret=new T[size];
+ T *iter=ret;
+ for(long i=0;i<size;i+=TAILLE_SPLIT)
+ {
+ if(size-i>TAILLE_SPLIT)
+ n=TAILLE_SPLIT;
+ else
+ n=size-i;
+ TSeqCorba seq=_mySender->sendPart(i,n);
+ TCorba *seqd=seq->get_buffer(0);
+ for(long j=0;j<n;j++)
+ *iter++=*seqd++;
+ }
+ return ret;
+}
+
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+T *CorbaWCWithCopyReceiver<T,TCorba,TSeqCorba,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+#ifdef HAVE_MPI2
+
+template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::MPIReceiver(CorbaSender mySender):_mySender(mySender){
+}
+
+template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::~MPIReceiver(){
+ _mySender->release();
+}
+
+template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getDistValue(long &size){
+ int i=0;
+ int myproc;
+ int sproc;
+ MPI_Status status;
+ MPI_Comm com;
+ char port_name_clt [MPI_MAX_PORT_NAME];
+ float telps, tuser, tsys, tcpu;
+ T *_v;
+ long _n;
+
+
+ CORBA::Any a;
+ MPI_Comm_rank(MPI_COMM_WORLD, &myproc);
+ SALOME::MPISender::param_var p =_mySender->getParam();
+ _mySender->send();
+ sproc = p->myproc;
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
+ while ( i != TIMEOUT && MPI_Lookup_name((char*)p->service,MPI_INFO_NULL,port_name_clt) != MPI_SUCCESS) {
+ i++;
+ }
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
+ if ( i == TIMEOUT ) {
+ MPI_Finalize();
+ exit(-1);
+ }
+ else{
+ // Connect to service, get the inter-communicator server
+ // Attention MPI_Comm_connect est un appel collectif :
+ // - Si lancement mpirun -c n -----> uniquement MPI_COMM_SELF fonctionne
+ // - Si lancement client_server&client_server ----> MPI_COMM_WORLD fonctionne
+
+ // TIMEOUT is inefficient since MPI_Comm_Connect doesn't return if we asked for
+ // a service that has been unpublished !
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
+ i = 0;
+ while ( i != TIMEOUT && MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &com)!=MPI_SUCCESS ) {
+ i++;
+ }
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
+ if ( i == TIMEOUT ) {
+ MPI_Finalize();
+ exit(-1);
+ }
+ }
+ MPI_Recv( &_n, 1, MPI_LONG, sproc,p->tag1,com,&status);
+ _v = new T[_n];
+ MPI_Recv( _v, _n, T2, sproc,p->tag2,com,&status);
+ _mySender->close(p);
+ MPI_Comm_disconnect( &com );
+ size=_n;
+ return _v;
+}
+
+template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+T *MPIReceiver<T,T2,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+#endif
+
+#ifdef HAVE_SOCKET
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <rpc/xdr.h>
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::SocketReceiver(CorbaSender mySender) : _mySender(mySender)
+{
+ _clientSockfd = -1;
+ _senderDestruc=true;
+}
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::~SocketReceiver()
+{
+ if(_senderDestruc)
+ {
+ _mySender->release();
+ }
+}
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+T *SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::getValue(long &size)
+{
+ return Receiver<T,servForT,ptrForT>::getValue(size,_mySender);
+}
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+T* SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::getDistValue(long &size)
+{
+ int n=0, m;
+ T *v;
+ XDR xp; /* pointeur sur le decodeur XDR */
+
+ try{
+ initCom();
+
+ SALOME::SocketSender::param_var p = _mySender->getParam();
+
+ size = p->lend - p->lstart + 1;
+ v = new T[size];
+
+ connectCom(p->internet_address, p->myport);
+
+ _mySender->send();
+
+ xdrmem_create(&xp,(char*)v,size*sizeof(T),XDR_DECODE );
+ while( n < size*sizeof(T) ){
+ m = read(_clientSockfd, (char*)v+n, size*sizeof(T)-n);
+ if( m < 0 ){
+ closeCom();
+ delete [] v;
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::COMM;
+ es.text = "error read Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ n += m;
+ }
+ xdr_vector( &xp, (char*)v, size, sizeof(T), (xdrproc_t)myFunc);
+ xdr_destroy( &xp );
+
+ _mySender->endOfCom();
+ closeCom();
+ }
+ catch(SALOME::SALOME_Exception &ex){
+ if( ex.details.type == SALOME::COMM )
+ {
+ _senderDestruc=false;
+ cout << ex.details.text << endl;
+ throw MultiCommException("Unknown sender protocol");
+ }
+ else
+ throw ex;
+ }
+
+ return v;
+}
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+void SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::initCom()
+{
+ try{
+ _mySender->initCom();
+
+ /* Ouverture de la socket */
+ _clientSockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if (_clientSockfd < 0) {
+ closeCom();
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::COMM;
+ es.text = "error Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ }
+ catch(SALOME::SALOME_Exception &ex){
+ if( ex.details.type == SALOME::COMM )
+ {
+ _senderDestruc=false;
+ cout << ex.details.text << endl;
+ throw MultiCommException("Unknown sender protocol");
+ }
+ else
+ throw ex;
+ }
+
+}
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+void SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::connectCom(const char *dest_address, int port)
+{
+ struct sockaddr_in serv_addr;
+ struct hostent * server;
+ SALOME::ExceptionStruct es;
+
+ try{
+ /* reception of the host structure on the remote process */
+ server = gethostbyname(dest_address);
+ if( server == NULL ) {
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error unknown host Socket exception";
+ _senderDestruc=false;
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ /* Initialisation of the socket structure */
+ bzero((char*)&serv_addr,sizeof(serv_addr));
+ serv_addr.sin_family = AF_INET;
+ serv_addr.sin_addr.s_addr = INADDR_ANY;
+ bcopy((char *)server->h_addr,
+ (char *)&serv_addr.sin_addr.s_addr,
+ server->h_length);
+ serv_addr.sin_port = htons(port);
+
+ if( connect(_clientSockfd, (struct sockaddr *) & serv_addr, sizeof(struct sockaddr)) < 0 ){
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error connect Socket exception";
+ _senderDestruc=false;
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ _mySender->acceptCom();
+
+ }
+ catch(SALOME::SALOME_Exception &ex){
+ if( ex.details.type == SALOME::COMM )
+ {
+ _senderDestruc=false;
+ cout << ex.details.text << endl;
+ throw MultiCommException("Unknown sender protocol");
+ }
+ else
+ throw ex;
+ }
+
+}
+
+
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+void SocketReceiver<T,myFunc,CorbaSender,servForT,ptrForT>::closeCom()
+{
+ _mySender->closeCom();
+ if( _clientSockfd >= 0 ){
+ close(_clientSockfd);
+ _clientSockfd = -1;
+ }
+
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _RECEIVERS_HXX_
+#define _RECEIVERS_HXX_
+
+#ifdef HAVE_MPI2
+#include "mpi.h"
+#endif
+#include "SALOME_Comm_i.hxx"
+#include "Receiver.hxx"
+
+/*!
+ Receiver used for transfert with CORBA when no copy is required remotely and locally.
+ */
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+class CorbaNCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+public:
+ CorbaNCNoCopyReceiver(CorbaSender mySender);
+ ~CorbaNCNoCopyReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+};
+
+/*!
+ Receiver used for transfert with CORBA when copy is not required remotely but required locally.
+ */
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+class CorbaNCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+public:
+ CorbaNCWithCopyReceiver(CorbaSender mySender);
+ ~CorbaNCWithCopyReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+};
+
+/*!
+ Receiver used for transfert with CORBA when copy is required remotely but not required locally.
+ */
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+class CorbaWCNoCopyReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+public:
+ CorbaWCNoCopyReceiver(CorbaSender mySender);
+ ~CorbaWCNoCopyReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+};
+
+/*!
+ Receiver used for transfert with CORBA when copy is required both remotely and locally.
+ */
+template<class T,class TCorba,class TSeqCorba,class CorbaSender,class servForT,class ptrForT>
+class CorbaWCWithCopyReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+public:
+ CorbaWCWithCopyReceiver(CorbaSender mySender);
+ ~CorbaWCWithCopyReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+};
+
+#ifdef HAVE_MPI2
+/*!
+ Receiver for MPI transfert.
+ */
+template<class T,MPI_Datatype T2,class CorbaSender,class servForT,class ptrForT>
+class MPIReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+public:
+ MPIReceiver(CorbaSender mySender);
+ ~MPIReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+};
+#endif
+
+#ifdef HAVE_SOCKET
+
+class XDR;
+
+/*!
+ Receiver for transfert with sockets.
+ */
+template<class T,int (*myFunc)(XDR*,T*),class CorbaSender,class servForT,class ptrForT>
+class SocketReceiver : public Receiver<T,servForT,ptrForT>
+{
+private:
+ CorbaSender _mySender;
+ int _clientSockfd;
+ bool _senderDestruc;
+public:
+ SocketReceiver(CorbaSender mySender);
+ ~SocketReceiver();
+ T *getValue(long &size);
+private:
+ T *getDistValue(long &size);
+ void initCom();
+ void connectCom(const char *, int);
+ void closeCom();
+};
+#endif
+
+#include "Receivers.cxx"
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOMEMultiComm.hxx"
+#ifndef WNT
+using namespace std;
+#endif
+
+SALOMEMultiComm::SALOMEMultiComm():_type(SALOME::CORBA_)
+{
+}
+
+SALOMEMultiComm::SALOMEMultiComm(SALOME::TypeOfCommunication type):_type(type)
+{
+}
+
+void SALOMEMultiComm::setProtocol(SALOME::TypeOfCommunication type)
+{
+ _type=type;
+}
+
+SALOME::TypeOfCommunication SALOMEMultiComm::getProtocol() const
+{
+ return _type;
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _SALOMEMULTICOMM_HXX_
+#define _SALOMEMULTICOMM_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Comm)
+
+/*!
+ Class is designed to ease the use of multi communication.\n
+ Simply inherite from it your servant class you want to emit data with senders.
+ */
+class SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass {
+protected:
+ SALOME::TypeOfCommunication _type;
+public:
+ SALOMEMultiComm();
+ SALOMEMultiComm(SALOME::TypeOfCommunication type);
+ virtual void setProtocol(SALOME::TypeOfCommunication type);
+ SALOME::TypeOfCommunication getProtocol() const;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_Comm_i.hxx"
+#ifndef WNT
+#include <rpc/xdr.h>
+#endif
+#include "poa.h"
+#include "omnithread.h"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "utilities.h"
+
+#include "SenderFactory.hxx"
+using namespace std;
+
+#ifndef WNT
+CORBA::ORB_var &getGlobalORB(){
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ CORBA::ORB_var &orb = init(0,0);
+ return orb;
+}
+#endif
+
+/*! Return the C++ data associated to the array to transmit.
+ Used when sender and receiver are collocalized.
+ */
+const void *SALOME_Sender_i::getData(long &size) const{
+ size=_lgrTabToSend;
+ return _tabToSend;
+}
+
+/*! Return the sizeof() of each component of the generic array
+ */
+int SALOME_Sender_i::getSizeOf() const {
+ return _sizeOf;
+}
+
+/*! Unique constructor */
+SALOME_Sender_i::SALOME_Sender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):_tabToSend(tabToSend),_lgrTabToSend(lgrTabToSend),_sizeOf(sizeOf),_ownTabToSend(ownTabToSend){
+}
+
+/*! To force ownerShip status */
+void SALOME_Sender_i::setOwnerShip(bool own)
+{
+ _ownTabToSend=own;
+}
+
+/*! Method for the remote destroy of the current servant. This method is used by the receiver to destroy the sender when the transfert is complete.
+ */
+void SALOME_Sender_i::release()
+{
+ PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
+ _default_POA()->deactivate_object(oid);
+ _remove_ref();
+}
+
+SALOME_SenderDouble_i::SALOME_SenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
+{
+}
+
+/*! Destructor.
+ */
+SALOME_SenderDouble_i::~SALOME_SenderDouble_i()
+{
+ if(_ownTabToSend)
+ delete [] (double *)_tabToSend;
+}
+
+/*! Return a new sender of the same array but with an another protocol and delegates to the returned sender the ownership of array.
+ */
+SALOME::SenderDouble_ptr SALOME_SenderDouble_i::buildOtherWithProtocol(SALOME::TypeOfCommunication type)
+{
+ return SenderFactory::buildSender(type,this);
+}
+
+/*! Method to establish if the CORBA object refered by pCorba is collocalised.\n
+ If it is, the pointer to the servant that incarnates the CORBA object is returned.
+*/
+SALOME_SenderDouble_i *SALOME_SenderDouble_i::find(SALOME::SenderDouble_ptr pCorba){
+ PortableServer::ServantBase *ret;
+ try {
+ ret=PortableServer::POA::_the_root_poa()->reference_to_servant(pCorba);
+ }
+ catch(...){
+ return 0;
+ }
+ ret->_remove_ref();
+ return dynamic_cast<SALOME_SenderDouble_i *>(ret);
+}
+
+SALOME_SenderInt_i::SALOME_SenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
+{
+}
+
+/*! Destructor.
+ */
+SALOME_SenderInt_i::~SALOME_SenderInt_i()
+{
+ if(_ownTabToSend)
+ delete [] (int *)_tabToSend;
+}
+
+/*! Return a new sender of the same array but with an another protocol.
+ */
+SALOME::SenderInt_ptr SALOME_SenderInt_i::buildOtherWithProtocol(SALOME::TypeOfCommunication type)
+{
+ return SenderFactory::buildSender(type,this);
+}
+
+/*! Method to establish if the CORBA object refered by pCorba is collocalised.\n
+ If it is, the pointer to the servant that incarnates the CORBA object is returned.
+*/
+SALOME_SenderInt_i *SALOME_SenderInt_i::find(SALOME::SenderInt_ptr pCorba){
+ PortableServer::ServantBase *ret;
+ try {
+ ret=PortableServer::POA::_the_root_poa()->reference_to_servant(pCorba);
+ }
+ catch(...){
+ return 0;
+ }
+ ret->_remove_ref();
+ return dynamic_cast<SALOME_SenderInt_i *>(ret);
+}
+
+SALOME_CorbaDoubleNCSender_i::SALOME_CorbaDoubleNCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend){
+}
+
+SALOME_CorbaDoubleNCSender_i::~SALOME_CorbaDoubleNCSender_i(){
+}
+
+CORBA::ULong SALOME_CorbaDoubleNCSender_i::getSize(){
+ CORBA::ULong ret=_lgrTabToSend;
+ return ret;
+}
+
+SALOME::vectorOfDouble* SALOME_CorbaDoubleNCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
+ SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble(length,length,(CORBA::Double *)((double *)_tabToSend+(long)offset),0);
+ return c1._retn();
+}
+
+SALOME::vectorOfDouble* SALOME_CorbaDoubleNCSender_i::send(){
+ SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble(_lgrTabToSend,_lgrTabToSend,(CORBA::Double *)_tabToSend,0);
+ return c1._retn();
+}
+
+SALOME_CorbaDoubleCSender_i::SALOME_CorbaDoubleCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend){
+}
+
+SALOME_CorbaDoubleCSender_i::~SALOME_CorbaDoubleCSender_i(){
+}
+
+CORBA::ULong SALOME_CorbaDoubleCSender_i::getSize(){
+ CORBA::ULong ret=_lgrTabToSend;
+ return ret;
+}
+
+SALOME::vectorOfDouble* SALOME_CorbaDoubleCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
+ SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble;
+ c1->length(length);
+ for (long i=0; i<length; i++)
+ c1[i] = ((double *)_tabToSend)[i+offset];
+ return c1._retn();
+}
+
+////////////////////////
+
+SALOME_CorbaLongNCSender_i::SALOME_CorbaLongNCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend){
+}
+
+SALOME_CorbaLongNCSender_i::~SALOME_CorbaLongNCSender_i(){
+}
+
+CORBA::ULong SALOME_CorbaLongNCSender_i::getSize(){
+ CORBA::ULong ret=_lgrTabToSend;
+ return ret;
+}
+
+SALOME::vectorOfLong* SALOME_CorbaLongNCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
+ SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong(length,length,(CORBA::Long *)((long *)_tabToSend+(long)offset),0);
+ return c1._retn();
+}
+
+SALOME::vectorOfLong* SALOME_CorbaLongNCSender_i::send(){
+ SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong(_lgrTabToSend,_lgrTabToSend,(CORBA::Long *)_tabToSend,0);
+ return c1._retn();
+}
+
+SALOME_CorbaLongCSender_i::SALOME_CorbaLongCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend){
+}
+
+SALOME_CorbaLongCSender_i::~SALOME_CorbaLongCSender_i(){
+}
+
+CORBA::ULong SALOME_CorbaLongCSender_i::getSize(){
+ CORBA::ULong ret=_lgrTabToSend;
+ return ret;
+}
+
+SALOME::vectorOfLong* SALOME_CorbaLongCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
+ SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong;
+ c1->length(length);
+ for (long i=0; i<length; i++)
+ c1[i] = ((long *)_tabToSend)[i+offset];
+ return c1._retn();
+}
+
+#ifdef HAVE_MPI2
+
+unsigned long SALOME_MPISender_i::_tag1=0;
+
+unsigned long SALOME_MPISender_i::_tag2=1;
+
+SALOME_MPISender_i::SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeOf,ownTabToSend){
+ _portName=new char[MPI_MAX_PORT_NAME];
+}
+
+SALOME_MPISender_i::~SALOME_MPISender_i(){
+ delete [] _portName;
+}
+
+SALOME::MPISender::param* SALOME_MPISender_i::getParam()
+{
+ char stag[12];
+ int myproc,i=0;
+
+ SALOME::MPISender::param_var p = new SALOME::MPISender::param;
+ MPI_Comm_rank(MPI_COMM_WORLD,&_cproc);
+ p->myproc = _cproc;
+ p->tag1 = _tag1;
+ _tag1Inst=_tag1;
+ p->tag2 =_tag2;
+ _tag2Inst=_tag2;
+ std::string service("toto_");
+ sprintf(stag,"%d_",_tag1);
+ service += stag;
+ sprintf(stag,"%d_",p->tag2);
+ service += stag;
+ p->service = CORBA::string_dup(service.c_str());
+ MPI_Open_port(MPI_INFO_NULL, _portName);
+ MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_RETURN);
+ while ( i != TIMEOUT && MPI_Publish_name((char*)service.c_str(),MPI_INFO_NULL,_portName) != MPI_SUCCESS) {
+ i++;
+ }
+ MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_ARE_FATAL);
+ if ( i == TIMEOUT ) {
+ MPI_Close_port(_portName);
+ MPI_Finalize();
+ exit(-1);
+ }
+ _tag1 += 2;
+ _tag2 += 2;
+ return p._retn();
+}
+
+void SALOME_MPISender_i::send()
+{
+ _type=getTypeOfDataTransmitted();
+ _argsForThr=new (void *)[8];
+ _argsForThr[0]=_portName;
+ _argsForThr[1]=&_lgrTabToSend;
+ _argsForThr[2]=(void *)_tabToSend;
+ _argsForThr[3]=&_cproc;
+ _argsForThr[4]=&_tag1Inst;
+ _argsForThr[5]=&_tag2Inst;
+ _argsForThr[6]=&_com;
+ _argsForThr[7]=&_type;
+
+ _newThr=new omni_thread(SALOME_MPISender_i::myThread,_argsForThr);
+ _newThr->start();
+}
+
+void* SALOME_MPISender_i::myThread(void *args)
+{
+ void **argsTab=(void **)args;
+ long *lgrTabToSend=(long *)argsTab[1];
+ int *cproc=(int *)argsTab[3];
+ int *tag1=(int *)argsTab[4];
+ int *tag2=(int *)argsTab[5];
+ MPI_Comm *com=(MPI_Comm *)argsTab[6];
+ SALOME::TypeOfDataTransmitted *type=(SALOME::TypeOfDataTransmitted *)argsTab[7];
+
+ MPI_Comm_accept((char *)argsTab[0],MPI_INFO_NULL,0,MPI_COMM_SELF,com);
+ MPI_Send(lgrTabToSend,1,MPI_LONG,*cproc,*tag1,*com);
+ switch(*type)
+ {
+ case SALOME::DOUBLE_:
+ MPI_Send(argsTab[2],*lgrTabToSend,MPI_DOUBLE,*cproc,*tag2,*com);
+ break;
+ case SALOME::INT_:
+ MPI_Send(argsTab[2],*lgrTabToSend,MPI_INT,*cproc,*tag2,*com);
+ }
+ omni_thread::exit();
+ return args;
+}
+
+void SALOME_MPISender_i::close(const SALOME::MPISender::param& p)
+{
+ std::string service(p.service);
+ const char *st=p.service;
+ void *r;
+ _newThr->join(&r);
+ MPI_Comm_free(&_com);
+ MPI_Unpublish_name((char *)service.c_str(),MPI_INFO_NULL,_portName);
+ MPI_Close_port(_portName);
+ delete [] _argsForThr;
+}
+
+SALOME_MPISenderDouble_i::SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend)
+ :SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_MPISender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
+ ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
+{
+}
+
+SALOME_MPISenderInt_i::SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend)
+ :SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_MPISender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
+ ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
+{
+}
+
+#endif
+
+#ifdef HAVE_SOCKET
+
+//CCRT porting
+#define _POSIX_PII_SOCKET
+#define _LIBC_POLLUTION_H_
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+
+SALOME_SocketSender_i::SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeOf,ownTabToSend){
+ _IPAddress = inetAddress();
+ _serverSockfd = -1;
+ _clientSockfd = -1;
+}
+
+SALOME_SocketSender_i::~SALOME_SocketSender_i(){
+}
+
+std::string SALOME_SocketSender_i::inetAddress()
+{
+ char s[256];
+ char t[INET_ADDRSTRLEN+1];
+ struct hostent *host;
+ struct in_addr saddr;
+
+ gethostname(s, 255);
+
+ *t = '\0';
+
+ saddr.s_addr = inet_addr(s);
+ if (saddr.s_addr != -1)
+ inet_ntop(AF_INET, &saddr, t, INET_ADDRSTRLEN);
+ else {
+ host = gethostbyname(s);
+ if (host != NULL)
+ inet_ntop(AF_INET, (struct in_addr *) *host->h_addr_list,
+ t, INET_ADDRSTRLEN);
+ }
+ return std::string(t);
+}
+
+SALOME::SocketSender::param * SALOME_SocketSender_i::getParam()
+{
+
+ SALOME::SocketSender::param_var p = new SALOME::SocketSender::param;
+
+ p->lstart = 0;
+ p->lend = _lgrTabToSend - 1;
+ p->myport = _port;
+ p->internet_address = CORBA::string_dup(_IPAddress.c_str());
+
+ return p._retn();
+}
+
+void SALOME_SocketSender_i::send()
+{
+ _type=getTypeOfDataTransmitted();
+ _argsForThr=new void *[6];
+ _argsForThr[0]=&_serverSockfd;
+ _argsForThr[1]=&_clientSockfd;
+ _argsForThr[2]=&_lgrTabToSend;
+ _argsForThr[3]=(void *)_tabToSend;
+ _argsForThr[4]=&_errorFlag;
+ _argsForThr[5]=&_type;
+
+ _newThr=new omni_thread(SALOME_SocketSender_i::myThread,_argsForThr);
+ _newThr->start();
+}
+
+void* SALOME_SocketSender_i::myThread(void *args)
+{
+ int n=0, m;
+ void **argsTab=(void **)args;
+ int *serverSockfd=(int *)argsTab[0];
+ int *clientSockfd=(int *)argsTab[1];
+ long *lgrTabToSend=(long *)argsTab[2];
+ void *tabToSend=argsTab[3];
+ bool *errorFlag=(bool*)argsTab[4];
+ SALOME::TypeOfDataTransmitted *type=(SALOME::TypeOfDataTransmitted *)argsTab[5];
+
+ XDR xp; /* pointeur sur le decodeur XDR */
+
+ switch(*type)
+ {
+ case SALOME::DOUBLE_:
+ xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(double),XDR_ENCODE );
+ xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(double), (xdrproc_t)xdr_double );
+
+ *errorFlag = false;
+ while( n < *lgrTabToSend*sizeof(double) ){
+ m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(double)-n);
+ if( m < 0 ){
+ if( *clientSockfd >= 0 ){
+ ::close(*clientSockfd);
+ *clientSockfd = -1;
+ }
+ if( *serverSockfd >= 0 ){
+ ::close(*serverSockfd);
+ *serverSockfd = -1;
+ }
+ *errorFlag = true;
+ }
+ n += m;
+ }
+ xdr_destroy( &xp );
+
+ xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(double),XDR_DECODE );
+ xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(double), (xdrproc_t)xdr_double );
+ xdr_destroy( &xp );
+ break;
+ case SALOME::INT_:
+ xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(int),XDR_ENCODE );
+ xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(int), (xdrproc_t)xdr_int );
+
+ *errorFlag = false;
+ while( n < *lgrTabToSend*sizeof(int) ){
+ m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(int)-n);
+ if( m < 0 ){
+ if( *clientSockfd >= 0 ){
+ ::close(*clientSockfd);
+ *clientSockfd = -1;
+ }
+ if( *serverSockfd >= 0 ){
+ ::close(*serverSockfd);
+ *serverSockfd = -1;
+ }
+ *errorFlag = true;
+ }
+ n += m;
+ }
+ xdr_destroy( &xp );
+
+ xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(int),XDR_DECODE );
+ xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(int), (xdrproc_t)xdr_int );
+ xdr_destroy( &xp );
+ }
+ return args;
+}
+
+void SALOME_SocketSender_i::initCom() throw(SALOME::SALOME_Exception)
+{
+ struct sockaddr_in serv_addr;
+ socklen_t n;
+ SALOME::ExceptionStruct es;
+
+ /* Ouverture de la socket */
+ _serverSockfd = socket(AF_INET , SOCK_STREAM , 0);
+ if(_serverSockfd < 0) {
+ es.type = SALOME::COMM;
+ es.text = "error Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ /* Socket structure initialisation*/
+ bzero((char*)&serv_addr,sizeof(serv_addr));
+ serv_addr.sin_family = AF_INET;
+ serv_addr.sin_port = 0; /* asking for a free port */
+ serv_addr.sin_addr.s_addr = INADDR_ANY;
+
+ /* Association of socket with a port */
+ if( ::bind(_serverSockfd, (struct sockaddr *) & serv_addr,
+ sizeof(struct sockaddr)) < 0 ) {
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error bind Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ /* Listening to the allocated port */
+ if( listen(_serverSockfd, 10) < 0 ) {
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error listen Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ /* Retrieving port number*/
+ if( getsockname(_serverSockfd, (struct sockaddr *) & serv_addr, &n) < 0 ){
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error getName Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ _port = htons(serv_addr.sin_port);
+ SCRUTE(_port);
+}
+
+void SALOME_SocketSender_i::acceptCom() throw(SALOME::SALOME_Exception)
+{
+ socklen_t sin_size;
+ struct sockaddr_in client_addr;
+ SALOME::ExceptionStruct es;
+
+ sin_size = sizeof(struct sockaddr_in);
+
+ _clientSockfd = accept(_serverSockfd, (struct sockaddr *)&client_addr, &sin_size);
+ if( _clientSockfd < 0 ){
+ closeCom();
+ es.type = SALOME::COMM;
+ es.text = "error accept Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+}
+
+void SALOME_SocketSender_i::closeCom()
+{
+ if( _clientSockfd >= 0 ){
+ ::close(_clientSockfd);
+ _clientSockfd = -1;
+ }
+ if( _serverSockfd >= 0 ){
+ ::close(_serverSockfd);
+ _serverSockfd = -1;
+ }
+
+}
+
+void SALOME_SocketSender_i::endOfCom()
+{
+ void *r;
+ _newThr->join(&r);
+ if(_errorFlag)
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::COMM;
+ es.text = "error write Socket exception";
+ throw SALOME::SALOME_Exception(es);
+ }
+ delete [] _argsForThr;
+}
+
+SALOME_SocketSenderDouble_i::SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend)
+ :SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_SocketSender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
+ ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
+{
+}
+
+SALOME_SocketSenderInt_i::SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend)
+ :SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_SocketSender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
+ ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
+{
+}
+
+//CCRT porting
+#undef _LIBC_POLLUTION_H_
+#undef _POSIX_PII_SOCKET
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _SALOME_COMM_I_HXX_
+#define _SALOME_COMM_I_HXX_
+
+#ifdef HAVE_MPI2
+#include "mpi.h"
+#endif
+#include <string>
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Comm)
+
+#define TIMEOUT 20
+
+
+/*!
+ Generic servant class for senders that factorizes all the common methods and attributes necessary to senders.
+ All servant classes for senders have to inheritate from it.
+ */
+class SALOME_Sender_i : public virtual POA_SALOME::Sender,
+ public PortableServer::RefCountServantBase {
+protected:
+ /*! Pointer to the generic array to transmit*/
+ const void *_tabToSend;
+ /*! Length of the generic array to transmit*/
+ long _lgrTabToSend;
+ /*! it represents the sizeof() of each component of the generic array:\n
+ Practically in terms of bytes the size to be transmitted is _lgrTabToSend*_sizeOf
+ */
+ int _sizeOf;
+ /*! Indicates if _tabToSend has to be deallocated */
+ bool _ownTabToSend;
+
+ SALOME_Sender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
+public:
+ const void *getData(long &size) const;
+ int getSizeOf() const;
+ void setOwnerShip(bool own);
+ bool getOwnerShip() const { return _ownTabToSend; }
+ void release();
+ virtual ~SALOME_Sender_i() {}
+};
+
+class SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble,
+ public virtual SALOME_Sender_i
+{
+public:
+ SALOME_SenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted() { return SALOME::DOUBLE_; }
+ SALOME::SenderDouble_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
+ virtual ~SALOME_SenderDouble_i();
+ static SALOME_SenderDouble_i *find(SALOME::SenderDouble_ptr pCorba);
+};
+
+class SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt,
+ public virtual SALOME_Sender_i
+{
+public:
+ SALOME_SenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME::TypeOfDataTransmitted getTypeOfDataTransmitted() { return SALOME::INT_; }
+ SALOME::SenderInt_ptr buildOtherWithProtocol(SALOME::TypeOfCommunication type);
+ virtual ~SALOME_SenderInt_i();
+ static SALOME_SenderInt_i *find(SALOME::SenderInt_ptr pCorba);
+};
+
+/*! Servant class for CORBA sender for double* when no copy of array _tabToSend is required, that is to say double and CORBA::Double are binary equal.
+ */
+class SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender,
+ public SALOME_SenderDouble_i
+{
+public:
+ SALOME_CorbaDoubleNCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ ~SALOME_CorbaDoubleNCSender_i();
+ CORBA::ULong getSize();
+ SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
+ SALOME::vectorOfDouble* send();
+};
+
+/*! Servant class for CORBA sender for double* when copy of array _tabToSend is required, that is to say double and CORBA::Double are NOT binary equal.
+ */
+class SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender,
+ public SALOME_SenderDouble_i
+{
+public:
+ SALOME_CorbaDoubleCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ ~SALOME_CorbaDoubleCSender_i();
+ CORBA::ULong getSize();
+ SALOME::vectorOfDouble* sendPart(CORBA::ULong offset, CORBA::ULong length);
+};
+
+/*! Servant class for CORBA sender for int* when no copy of array _tabToSend is required, that is to say int and CORBA::Long are binary equal.
+ */
+class SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender,
+ public SALOME_SenderInt_i
+{
+public:
+ SALOME_CorbaLongNCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ ~SALOME_CorbaLongNCSender_i();
+ CORBA::ULong getSize();
+ SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
+ SALOME::vectorOfLong* send();
+};
+
+/*! Servant class for CORBA sender for int* when copy of array _tabToSend is required, that is to say int and CORBA::Long are NOT binary equal.
+ */
+class SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender,
+ public SALOME_SenderInt_i
+{
+public:
+ SALOME_CorbaLongCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ ~SALOME_CorbaLongCSender_i();
+ CORBA::ULong getSize();
+ SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
+#ifndef WNT
+ SALOME::CorbaLongCSender_ptr _this();
+#endif
+};
+
+#ifdef HAVE_MPI2
+
+/*! Servant class of sender using MPI2.
+ */
+class SALOME_MPISender_i : public virtual POA_SALOME::MPISender,
+ public virtual SALOME_Sender_i
+{
+private:
+ static unsigned long _tag1;
+ static unsigned long _tag2;
+ /*! Name of the port opened*/
+ char *_portName;
+ int _cproc;
+ /*! Tag 1 that identifies the transfert*/
+ int _tag1Inst;
+ /*! Tag 2 that identifies the transfert*/
+ int _tag2Inst;
+ /*! MPI communicator*/
+ MPI_Comm _com;
+ /*! Array of pointer for asynchronous invocation with omnithread*/
+ void **_argsForThr;
+ /*! Pointer to thread created on asynchronous invocation*/
+ omni_thread *_newThr;
+ /*! Type the component of the array*/
+ SALOME::TypeOfDataTransmitted _type;
+public:
+ SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
+ ~SALOME_MPISender_i();
+ SALOME::MPISender::param* getParam();
+ void send();
+ void close(const SALOME::MPISender::param& p);
+private:
+ static void* myThread(void *args);
+};
+
+class SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble,
+ public SALOME_SenderDouble_i,
+ public SALOME_MPISender_i
+{
+public:
+ SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+};
+
+class SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt,
+ public SALOME_SenderInt_i,
+ public SALOME_MPISender_i
+{
+public:
+ SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+};
+
+#endif
+
+#ifdef HAVE_SOCKET
+
+/*! Servant class of sender using Sockets.
+ */
+class SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender,
+ public virtual SALOME_Sender_i
+{
+private:
+ int _serverSockfd;
+ int _clientSockfd;
+ int _port;
+ std::string _IPAddress;
+ void **_argsForThr;
+ omni_thread *_newThr;
+ bool _errorFlag;
+ /*! Type the component of the array*/
+ SALOME::TypeOfDataTransmitted _type;
+public:
+ SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
+ ~SALOME_SocketSender_i();
+ SALOME::SocketSender::param* getParam();
+ void send();
+ void initCom() throw(SALOME::SALOME_Exception);
+ void acceptCom() throw(SALOME::SALOME_Exception);
+ void endOfCom();
+ void closeCom();
+private:
+ static void* myThread(void *args);
+ std::string inetAddress();
+};
+
+class SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble,
+ public SALOME_SenderDouble_i,
+ public SALOME_SocketSender_i
+{
+public:
+ SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+};
+
+class SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt,
+ public SALOME_SenderInt_i,
+ public SALOME_SocketSender_i
+{
+public:
+ SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+};
+
+#endif
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_Comm_i.hxx"
+#include "SenderFactory.hxx"
+#include "utilities.h"
+#include "SALOMEMultiComm.hxx"
+using namespace std;
+
+#ifdef COMP_CORBA_DOUBLE
+#define SALOME_CorbaDoubleSender SALOME_CorbaDoubleNCSender_i
+#else
+#define SALOME_CorbaDoubleSender SALOME_CorbaDoubleCSender_i
+#endif
+
+#ifdef COMP_CORBA_LONG
+#define SALOME_CorbaLongSender SALOME_CorbaLongNCSender_i
+#else
+#define SALOME_CorbaLongSender SALOME_CorbaLongCSender_i
+#endif
+
+SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab)throw(MultiCommException){
+ switch(multiCommunicator.getProtocol())
+ {
+ case SALOME::CORBA_:
+ {
+ SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
+ return retc->_this();
+ }
+#ifdef HAVE_MPI2
+ case SALOME::MPI_:
+ {
+ SALOME_MPISenderDouble_i* retm=new SALOME_MPISenderDouble_i(tab,lgr,ownTab);
+ return retm->_this();
+ }
+#endif
+#ifdef HAVE_SOCKET
+ case SALOME::SOCKET_:
+ {
+ SALOME_SocketSenderDouble_i* rets=new SALOME_SocketSenderDouble_i(tab,lgr,ownTab);
+ return rets->_this();
+ }
+#endif
+ default:
+ {
+ multiCommunicator.setProtocol(SALOME::CORBA_);
+ MESSAGE("PROTOCOL CHANGED TO CORBA");
+ SALOME_CorbaDoubleSender * retc=new SALOME_CorbaDoubleSender(tab,lgr,ownTab);
+ return retc->_this();
+ }
+// throw MultiCommException("Communication protocol not implemented");
+ }
+}
+
+SALOME::SenderInt_ptr SenderFactory::buildSender(SALOMEMultiComm &multiCommunicator,const int *tab,long lgr,bool ownTab)throw(MultiCommException){
+ switch(multiCommunicator.getProtocol())
+ {
+ case SALOME::CORBA_:
+ {
+ SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
+ return retc->_this();
+ }
+#ifdef HAVE_MPI2
+ case SALOME::MPI_:
+ {
+ SALOME_MPISenderInt_i* retm=new SALOME_MPISenderInt_i(tab,lgr,ownTab);
+ return retm->_this();
+ }
+#endif
+#ifdef HAVE_SOCKET
+ case SALOME::SOCKET_:
+ {
+ SALOME_SocketSenderInt_i* rets=new SALOME_SocketSenderInt_i(tab,lgr,ownTab);
+ return rets->_this();
+ }
+#endif
+ default:
+ {
+ multiCommunicator.setProtocol(SALOME::CORBA_);
+ SALOME_CorbaLongSender * retc=new SALOME_CorbaLongSender(tab,lgr,ownTab);
+ return retc->_this();
+ }
+// throw MultiCommException("Communication protocol not implemented");
+ }
+ }
+
+SALOME::SenderDouble_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderDouble_i *src)
+{
+ SALOMEMultiComm mc(NewType);
+ long n;
+ const double *data=(const double *)src->getData(n);
+ bool own=src->getOwnerShip();
+ src->setOwnerShip(false);
+ return buildSender(mc,data,n,own);
+}
+
+SALOME::SenderInt_ptr SenderFactory::buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderInt_i *src)
+{
+ SALOMEMultiComm mc(NewType);
+ long n;
+ const int *data=(const int *)src->getData(n);
+ bool own=src->getOwnerShip();
+ src->setOwnerShip(false);
+ return buildSender(mc,data,n,own);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _SENDERFACTORY_HXX_
+#define _SENDERFACTORY_HXX_
+
+#include "MultiCommException.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Comm)
+
+class SALOMEMultiComm;
+
+class SALOME_SenderDouble_i;
+class SALOME_SenderInt_i;
+
+/*!
+ This class implements the factory pattern of GoF by making a sender by giving an array and a communicator.It completely hides the type of sender from the user.
+ */
+class SenderFactory
+{
+public:
+ static SALOME::SenderDouble_ptr buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab=false) throw(MultiCommException);
+ static SALOME::SenderInt_ptr buildSender(SALOMEMultiComm &multiCommunicator,const int *tab,long lgr,bool ownTab=false) throw(MultiCommException);
+ static SALOME::SenderDouble_ptr buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderDouble_i *src);
+ static SALOME::SenderInt_ptr buildSender(SALOME::TypeOfCommunication NewType,SALOME_SenderInt_i *src);
+};
+
+template<class T>
+struct mapCppSender {
+ typedef T SenderVarType;
+};
+
+template<>
+struct mapCppSender<int>
+{
+ typedef SALOME::SenderInt_var SenderVarType;
+};
+
+template<>
+struct mapCppSender<double>
+{
+ typedef SALOME::SenderDouble_var SenderVarType;
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+%{
+ #include "ReceiverFactory.hxx"
+ #include "SALOME_Comm_i.hxx"
+%}
+
+%typemap(python,in) SALOME::SenderDouble_ptr
+{
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("import CORBA", Py_single_input, pdict, pdict);
+
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+
+ PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
+
+ if (iorSupport == Py_None)
+ return NULL;
+ char * s = PyString_AsString(PyObject_Str(iorSupport));
+
+ // Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::Object_var O = ORB->string_to_object(s);
+ SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O);
+ $1 = t;
+}
+
+%typemap(python,in) SALOME::SenderInt_ptr
+{
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("import CORBA", Py_single_input, pdict, pdict);
+
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+
+ PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
+
+ if (iorSupport == Py_None)
+ return NULL;
+ char * s = PyString_AsString(PyObject_Str(iorSupport));
+
+ // Ask omniORB to convert IOR string to SALOME::SenderInt_ptr
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::Object_var O = ORB->string_to_object(s);
+ SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O);
+ $1 = t;
+}
+
+PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble);
+
+%{
+PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble)
+{
+ PyObject *py_list;
+ long size;
+ double *ret=ReceiverFactory::getValue(senderDouble,size);
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i, Py_BuildValue("d", (double) ret[i]));
+ if(err)
+ {
+ char * message = "Error in SUPPORT::getTypes";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ PyObject * result = Py_BuildValue("O", py_list);
+ delete [] ret;
+ Py_DECREF(py_list);
+ return result;
+}
+%}
+
+
+PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt);
+
+%{
+PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt)
+{
+ PyObject *py_list;
+ long size;
+ int *ret=ReceiverFactory::getValue(senderInt,size);
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i, Py_BuildValue("i", (int) ret[i]));
+ if(err)
+ {
+ char * message = "Error in SUPPORT::getTypes";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ PyObject * result = Py_BuildValue("O", py_list);
+ delete [] ret;
+ Py_DECREF(py_list);
+ return result;
+}
+%}
--- /dev/null
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= libSALOME_Comm.i
+
+# Libraries targets
+
+LIB = libSALOME_Commcmodule.la
+LIB_SERVER_IDL = SALOME_Exception.idl
+
+SWIG_DEF = libSALOME_Comm.i
+EXPORT_PYSCRIPTS = libSALOME_Comm.py
+
+CPPFLAGS+=$(PYTHON_INCLUDES) $(MPI_INCLUDES) -I$(top_srcdir)/src/Communication/src
+LIBS+= $(PYTHON_LIBS)
+LDFLAGS+= -lSalomeCommunication
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+%module libSALOME_Comm
+
+%{
+ #include "ReceiverFactory.hxx"
+ #undef SEEK_SET
+ #undef SEEK_CUR
+ #undef SEEK_END
+ #include "SALOME_Comm_i.hxx"
+%}
+
+%typemap(python,in) SALOME::SenderDouble_ptr
+{
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("import CORBA", Py_single_input, pdict, pdict);
+
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+
+ PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
+
+ if (iorSupport == Py_None)
+ return NULL;
+ char * s = PyString_AsString(PyObject_Str(iorSupport));
+
+ // Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::Object_var O = ORB->string_to_object(s);
+ SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O);
+ $1 = t;
+}
+
+%typemap(python,in) SALOME::SenderInt_ptr
+{
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("import CORBA", Py_single_input, pdict, pdict);
+
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+
+ PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
+
+ if (iorSupport == Py_None)
+ return NULL;
+ char * s = PyString_AsString(PyObject_Str(iorSupport));
+
+ // Ask omniORB to convert IOR string to SALOME::SenderInt_ptr
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::Object_var O = ORB->string_to_object(s);
+ SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O);
+ $1 = t;
+}
+
+PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble);
+
+%{
+PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble)
+{
+ PyObject *py_list;
+ long size;
+ double *ret=ReceiverFactory::getValue(senderDouble,size);
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i, Py_BuildValue("d", (double) ret[i]));
+ if(err)
+ {
+ char * message = "Error in SUPPORT::getTypes";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ PyObject * result = Py_BuildValue("O", py_list);
+ delete [] ret;
+ Py_DECREF(py_list);
+ return result;
+}
+%}
+
+
+PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt);
+
+%{
+PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt)
+{
+ PyObject *py_list;
+ long size;
+ int *ret=ReceiverFactory::getValue(senderInt,size);
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i, Py_BuildValue("i", (int) ret[i]));
+ if(err)
+ {
+ char * message = "Error in SUPPORT::getTypes";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ PyObject * result = Py_BuildValue("O", py_list);
+ delete [] ret;
+ Py_DECREF(py_list);
+ return result;
+}
+%}
--- /dev/null
+// SALOME Container : implementation of container and engine for Kernel
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Component_i.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+
+//#define private protected // for pd_refCount trace
+#include "SALOME_Component_i.hxx"
+#include "SALOME_Container_i.hxx"
+#include "RegistryConnexion.hxx"
+#include "OpUtil.hxx"
+#include <stdio.h>
+#ifndef WNT
+#include <dlfcn.h>
+#endif
+#include <cstdlib>
+#include "utilities.h"
+
+#ifndef WNT
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#else
+#include <sys/timeb.h>
+int SIGUSR11 = 1000;
+#endif
+
+
+using namespace std;
+
+extern bool _Sleeping ;
+static Engines_Component_i * theEngines_Component ;
+
+bool Engines_Component_i::_isMultiStudy = true;
+bool Engines_Component_i::_isMultiInstance = false;
+
+//=============================================================================
+/*!
+ * Default constructor, not for use
+ */
+//=============================================================================
+
+Engines_Component_i::Engines_Component_i()
+{
+ //ASSERT(0);
+ INFOS("Default Constructor...");
+}
+
+//=============================================================================
+/*!
+ * Standard Constructor for generic Component, used in derived class
+ * Connection to Registry and Notification
+ * \param orb Object Request broker given by Container
+ * \parap poa Portable Object Adapter from Container (normally root_poa)
+ * \param contId container CORBA id inside the server
+ * \param instanceName unique instance name for this object (see Container_i)
+ * \param interfaceName component class name
+ * \param notif use of notification
+ */
+//=============================================================================
+
+Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) :
+ _instanceName(instanceName),
+ _interfaceName(interfaceName),
+ _myConnexionToRegistry(0),
+ _ThreadId(0) ,
+ _ThreadCpuUsed(0) ,
+ _Executed(false) ,
+ _graphName("") ,
+ _nodeName(""),
+ _studyId(-1)
+{
+ MESSAGE("Component constructor with instanceName "<< _instanceName);
+ //SCRUTE(pd_refCount);
+ _orb = CORBA::ORB::_duplicate(orb);
+ _poa = PortableServer::POA::_duplicate(poa);
+ _contId = contId ;
+ CORBA::Object_var o = _poa->id_to_reference(*contId); // container ior...
+ const CORBA::String_var ior = _orb->object_to_string(o);
+ _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession",
+ _instanceName.c_str());
+
+ _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
+ //SCRUTE(pd_refCount);
+}
+
+//=============================================================================
+/*!
+ * Standard constructor for parallel component
+ * Connection Notification (no connection to Registry !)
+ * \param orb Object Request broker given by Container
+ * \parap poa Portable Object Adapter from Container (normally root_poa)
+ * \param contId container CORBA id inside the server
+ * \param instanceName unique instance name for this object (see Container_i)
+ * \param interfaceName component class name
+ * \param flag not used...
+ * \param notif use of notification
+ */
+//=============================================================================
+
+Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ int flag,
+ bool notif ) :
+ _instanceName(instanceName),
+ _interfaceName(interfaceName),
+ _myConnexionToRegistry(0),
+ _ThreadId(0) ,
+ _ThreadCpuUsed(0) ,
+ _Executed(false) ,
+ _graphName("") ,
+ _nodeName(""),
+ _studyId(-1)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _poa = PortableServer::POA::_duplicate(poa);
+ _contId = contId ;
+
+ _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
+}
+
+//=============================================================================
+/*!
+ * Destructor: call Container for decrement of instances count.
+ * When instances count falls to 0, the container tries to remove the
+ * component library (dlclose)
+ */
+//=============================================================================
+
+Engines_Component_i::~Engines_Component_i()
+{
+ MESSAGE("Component destructor");
+ Engines_Container_i::decInstanceCnt(_interfaceName);
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return name of the instance, unique in this Container
+ */
+//=============================================================================
+
+char* Engines_Component_i::instanceName()
+{
+ return CORBA::string_dup(_instanceName.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return name of the component class
+ */
+//=============================================================================
+
+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
+ */
+//=============================================================================
+
+void Engines_Component_i::ping()
+{
+ MESSAGE("Engines_Component_i::ping() pid "<< getpid() << " threadid "
+ << pthread_self());
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Deactivate this instance. CORBA object is deactivated (do not
+ * respond any more to CORBA calls), the connection to Regsitry is removed
+ * (Registry informed of deactivation), internal server reference counter on
+ * the derived servant class is decremented, to allow destruction of the class
+ * (delete) by POA, when there are no more references.
+ * -- TO BE USED BY CONTAINER ONLY (Container housekeeping) --
+ */
+//=============================================================================
+
+void Engines_Component_i::destroy()
+{
+ MESSAGE("Engines_Component_i::destroy()");
+ //SCRUTE(pd_refCount);
+
+ delete _notifSupplier;
+ _notifSupplier = 0;
+
+ delete _myConnexionToRegistry;
+ _myConnexionToRegistry = 0 ;
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ //SCRUTE(pd_refCount);
+ _thisObj->_remove_ref();
+ //SCRUTE(pd_refCount);
+ MESSAGE("Engines_Component_i::destroyed") ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return CORBA reference of the Container
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr Engines_Component_i::GetContainerRef()
+{
+ // MESSAGE("Engines_Component_i::GetContainerRef");
+ CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ;
+ return Engines::Container::_narrow(o);
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ * Gives a sequence of (key=string,value=any) to the component.
+ * Base class component stores the sequence in a map.
+ * The map is cleared before.
+ * This map is for use by derived classes.
+ * \param dico sequence of (key=string,value=any)
+ */
+//=============================================================================
+
+void Engines_Component_i::setProperties(const Engines::FieldsDict& dico)
+{
+ _fieldsDict.clear();
+ for (CORBA::ULong i=0; i<dico.length(); i++)
+ {
+ std::string cle(dico[i].key);
+ _fieldsDict[cle] = dico[i].value;
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ * returns a previously stored map (key=string,value=any) as a sequence.
+ * (see setProperties)
+ */
+//=============================================================================
+
+Engines::FieldsDict* Engines_Component_i::getProperties()
+{
+ Engines::FieldsDict_var copie = new Engines::FieldsDict;
+ copie->length(_fieldsDict.size());
+ map<std::string,CORBA::Any>::iterator it;
+ CORBA::ULong i = 0;
+ for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++, i++)
+ {
+ std::string cle((*it).first);
+ copie[i].key = CORBA::string_dup(cle.c_str());
+ copie[i].value = _fieldsDict[cle];
+ }
+ return copie._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used by Supervision to give names to this instance
+ */
+//=============================================================================
+
+void Engines_Component_i::Names( const char * graphName ,
+ const char * nodeName )
+{
+ _graphName = graphName ;
+ _nodeName = nodeName ;
+ // MESSAGE("Engines_Component_i::Names( '" << _graphName << "' , '"
+ // << _nodeName << "' )");
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Component_i::Kill_impl()
+{
+// MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self()
+// << " pid " << getpid() << " instanceName "
+// << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+// << dec << " _ThreadId " << _ThreadId << " this " << hex << this
+// << dec ) ;
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+ {
+ RetVal = Killer( _ThreadId , 0 ) ;
+ _ThreadId = (pthread_t ) -1 ;
+ }
+
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+ {
+ RetVal = Killer( *_ThreadId , 0 ) ;
+ _ThreadId = (pthread_t* ) 0 ;
+ }
+
+#endif
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Component_i::Stop_impl()
+{
+ MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+ {
+ RetVal = Killer( _ThreadId , 0 ) ;
+ _ThreadId = (pthread_t ) -1 ;
+ }
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+ {
+ RetVal = Killer( *_ThreadId , 0 ) ;
+ _ThreadId = (pthread_t* ) 0 ;
+ }
+#endif
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Component_i::Suspend_impl()
+{
+ MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ return false ;
+ }
+ else
+ {
+#ifndef WNT
+ RetVal = Killer( _ThreadId ,SIGINT ) ;
+#else
+ RetVal = Killer( *_ThreadId ,SIGINT ) ;
+#endif
+ //if ( RetVal ) _Sleeping = true;
+
+ }
+ }
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Component_i::Resume_impl()
+{
+ MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ RetVal = true ;
+ }
+ else
+ {
+ RetVal = false ;
+ }
+ }
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ */
+//=============================================================================
+
+CORBA::Long Engines_Component_i::CpuUsed_impl()
+{
+ long cpu = 0 ;
+ if ( _ThreadId || _Executed )
+ {
+ if ( _ThreadId > 0 )
+ {
+#ifndef WNT
+ if ( pthread_self() != _ThreadId )
+#else
+ if ( pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ }
+ else
+ {
+ // Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
+#ifndef WNT
+ Killer( _ThreadId ,SIGUSR1 ) ;
+#else
+ Killer( *_ThreadId ,SIGUSR11 ) ;
+#endif
+ }
+ cpu = _ThreadCpuUsed ;
+ }
+ else
+ {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu << endl ;
+ }
+ }
+ else
+ {
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu<< endl ;
+ }
+ }
+ else
+ {
+ // cout<< pthread_self()<<"Engines_Component_i::CpuUsed_impl _ThreadId "
+ // <<_ThreadId <<" "<<_serviceName<<" _StartUsed "<<_StartUsed<<endl;
+ }
+ return cpu ;
+}
+
+
+//=============================================================================
+/*!
+ * C++ method: return Container Servant
+ */
+//=============================================================================
+
+Engines_Container_i *Engines_Component_i::GetContainerPtr()
+{
+ return dynamic_cast<Engines_Container_i*>(_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
+ * constructor, when instance is activated.
+ */
+//=============================================================================
+
+PortableServer::ObjectId * Engines_Component_i::getId()
+{
+// MESSAGE("PortableServer::ObjectId * Engines_Component_i::getId()");
+ return _id ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: used by derived classes for supervision
+ */
+//=============================================================================
+
+void Engines_Component_i::beginService(const char *serviceName)
+{
+ MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
+ << endl << "Component instance : " << _instanceName << endl << endl);
+#ifndef WNT
+ _ThreadId = pthread_self() ;
+#else
+ _ThreadId = new pthread_t;
+ _ThreadId->p = pthread_self().p ;
+ _ThreadId->x = pthread_self().x ;
+#endif
+ _StartUsed = 0 ;
+ _StartUsed = CpuUsed_impl() ;
+ _ThreadCpuUsed = 0 ;
+ _Executed = true ;
+ _serviceName = serviceName ;
+ if ( pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS , NULL ) )
+ {
+ perror("pthread_setcanceltype ") ;
+ exit(0) ;
+ }
+ if ( pthread_setcancelstate( PTHREAD_CANCEL_ENABLE , NULL ) )
+ {
+ perror("pthread_setcancelstate ") ;
+ exit(0) ;
+ }
+// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName
+// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed
+// << " _graphName " << _graphName << " _nodeName " << _nodeName );
+
+ // --- for supervisor : all strings given with setProperties
+ // are set in environment
+ bool overwrite = true;
+ map<std::string,CORBA::Any>::iterator it;
+ for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++)
+ {
+ std::string cle((*it).first);
+ if ((*it).second.type()->kind() == CORBA::tk_string)
+ {
+ const char* value;
+ (*it).second >>= value;
+ // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
+#if defined __GNUC__
+ int ret = setenv(cle.c_str(), value, overwrite);
+#else
+ //CCRT porting : setenv not defined in stdlib.h
+ std::string s(cle);
+ s+='=';
+ s+=value;
+ // char* cast because 1st arg of linux putenv function
+ // is not a const char* !
+ int ret=putenv((char *)s.c_str());
+ //End of CCRT porting
+#endif
+ MESSAGE("--- setenv: "<<cle<<" = "<< value);
+ }
+ }
+}
+
+//=============================================================================
+/*!
+ * C++ method: used by derived classes for supervision
+ */
+//=============================================================================
+
+void Engines_Component_i::endService(const char *serviceName)
+{
+ _ThreadCpuUsed = CpuUsed_impl() ;
+ MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
+ << endl << " Component instance : " << _instanceName << " StartUsed "
+ << _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
+ _ThreadId = 0 ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: -- CHECK IF USED --
+ */
+//=============================================================================
+
+char* Engines_Component_i::graphName()
+{
+ return CORBA::string_dup( _graphName.c_str() ) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: -- CHECK IF USED --
+ */
+//=============================================================================
+
+char* Engines_Component_i::nodeName()
+{
+ return CORBA::string_dup( _nodeName.c_str() ) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: used in Supervision (see kill_impl)
+ */
+//=============================================================================
+
+bool Engines_Component_i::Killer( pthread_t ThreadId , int signum )
+{
+#ifndef WNT
+ if ( ThreadId )
+#else
+ if ( ThreadId.p )
+#endif
+ {
+ if ( signum == 0 )
+ {
+ if ( pthread_cancel( ThreadId ) )
+ {
+ perror("Killer pthread_cancel error") ;
+ return false ;
+ }
+ else
+ {
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_canceled") ;
+ }
+ }
+ else
+ {
+ if ( pthread_kill( ThreadId , signum ) == -1 )
+ {
+ perror("Killer pthread_kill error") ;
+ return false ;
+ }
+ else
+ {
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_killed(" << signum << ")") ;
+ }
+ }
+ }
+ return true ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+void SetCpuUsed()
+{
+ theEngines_Component->SetCurCpu() ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+void Engines_Component_i::SetCurCpu()
+{
+ _ThreadCpuUsed = CpuUsed() ;
+ // MESSAGE(pthread_self() <<
+ // " Engines_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+long Engines_Component_i::CpuUsed()
+{
+ long cpu = 0 ;
+#ifndef WNT
+ struct rusage usage ;
+ if ( _ThreadId || _Executed )
+ {
+ if ( getrusage( RUSAGE_SELF , &usage ) == -1 )
+ {
+ perror("Engines_Component_i::CpuUsed") ;
+ return 0 ;
+ }
+ cpu = usage.ru_utime.tv_sec - _StartUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed " << " "
+ // << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed
+ // << " = " << cpu << endl ;
+ }
+ else
+ {
+ // cout << pthread_self() << "Engines_Component_i::CpuUsed _ThreadId "
+ // << _ThreadId << " " << _serviceName<< " _StartUsed "
+ // << _StartUsed << endl ;
+ }
+#else
+ // NOT implementet yet
+#endif
+
+
+ return cpu ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: Send message to event channel
+ */
+//=============================================================================
+
+void Engines_Component_i::sendMessage(const char *event_type,
+ const char *message)
+{
+ _notifSupplier->Send(graphName(), nodeName(), event_type, message);
+}
+
+//=============================================================================
+/*!
+ * C++ method: return standard library name built on component name
+ */
+//=============================================================================
+
+string Engines_Component_i::GetDynLibraryName(const char *componentName)
+{
+ string ret="lib";
+ ret+=componentName;
+ ret+="Engine.so";
+ return ret;
+}
+
+//=============================================================================
+/*!
+ * C++ method: DumpPython default implementation
+ */
+//=============================================================================
+
+Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
+{
+ char* aScript = "def RebuildData(theStudy): pass";
+ char* aBuffer = new char[strlen(aScript)+1];
+ strcpy(aBuffer, aScript);
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+ int aBufferSize = strlen(aBuffer)+1;
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+ isValidScript = true;
+ return aStreamFile._retn();
+}
--- /dev/null
+// SALOME Container : implementation of container and engine for Kernel
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Container_i.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+
+//#define private public
+#include <SALOMEconfig.h>
+#ifndef WNT
+#include CORBA_SERVER_HEADER(SALOME_Component)
+#else
+#include <SALOME_Component.hh>
+#endif
+#include <pthread.h> // must be before Python.h !
+#include <Python.h>
+#include "SALOME_Container_i.hxx"
+#include "SALOME_Component_i.hxx"
+#include "SALOME_NamingService.hxx"
+#include "OpUtil.hxx"
+#include <string.h>
+#include <stdio.h>
+#ifndef WNT
+#include <dlfcn.h>
+#include <unistd.h>
+#else
+#include "../../adm/win32/SALOME_WNT.hxx"
+#include <signal.h>
+#include <process.h>
+int SIGUSR1 = 1000;
+#endif
+#include "Container_init_python.hxx"
+
+#include "utilities.h"
+using namespace std;
+
+bool _Sleeping = false ;
+
+// // Needed by multi-threaded Python --- Supervision
+int _ArgC ;
+char ** _ArgV ;
+
+
+// Containers with name FactoryServer are started via rsh in LifeCycleCORBA
+// Other Containers are started via start_impl of FactoryServer
+
+extern "C" {void ActSigIntHandler() ; }
+#ifndef WNT
+extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
+#else
+ extern "C" {void SigIntHandler( int ) ; }
+#endif
+
+
+map<std::string, int> Engines_Container_i::_cntInstances_map;
+map<std::string, void *> Engines_Container_i::_library_map;
+map<std::string, void *> Engines_Container_i::_toRemove_map;
+omni_mutex Engines_Container_i::_numInstanceMutex ;
+
+//=============================================================================
+/*!
+ * Default constructor, not for use
+ */
+//=============================================================================
+
+Engines_Container_i::Engines_Container_i () :
+ _numInstance(0)
+{
+}
+
+//=============================================================================
+/*!
+ * Construtor to use
+ */
+//=============================================================================
+
+Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ char *containerName ,
+ int argc , char* argv[],
+ bool activAndRegist,
+ bool isServantAloneInProcess
+ ) :
+ _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
+{
+ _pid = (long)getpid();
+
+ if(activAndRegist)
+ ActSigIntHandler() ;
+
+ _argc = argc ;
+ _argv = argv ;
+
+ string hostname = GetHostname();
+ MESSAGE(hostname << " " << getpid() << " Engines_Container_i starting argc "
+ << _argc << " Thread " << pthread_self() ) ;
+
+ int i = 0 ;
+ while ( _argv[ i ] )
+ {
+ MESSAGE(" argv" << i << " " << _argv[ i ]) ;
+ i++ ;
+ }
+
+ if ( argc < 2 )
+ {
+ INFOS("SALOME_Container usage : SALOME_Container ServerName");
+ ASSERT(0) ;
+ }
+ SCRUTE(argv[1]);
+ _isSupervContainer = false;
+ if (strcmp(argv[1],"SuperVisionContainer") == 0) _isSupervContainer = true;
+
+ if (_isSupervContainer)
+ {
+ _ArgC = argc ;
+ _ArgV = argv ;
+ }
+
+ _orb = CORBA::ORB::_duplicate(orb) ;
+ _poa = PortableServer::POA::_duplicate(poa) ;
+
+ // Pour les containers paralleles: il ne faut pas enregistrer et activer
+ // le container generique, mais le container specialise
+
+ if(activAndRegist)
+ {
+ _id = _poa->activate_object(this);
+ _NS = new SALOME_NamingService();
+ _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
+ CORBA::Object_var obj=_poa->id_to_reference(*_id);
+ Engines::Container_var pCont
+ = Engines::Container::_narrow(obj);
+
+ _containerName = _NS->BuildContainerNameForNS(containerName,
+ hostname.c_str());
+ SCRUTE(_containerName);
+ _NS->Register(pCont, _containerName.c_str());
+ MESSAGE("Engines_Container_i::Engines_Container_i : Container name "
+ << _containerName);
+
+ // Python:
+ // import SALOME_Container
+ // pycont = SALOME_Container.SALOME_Container_i(containerIORStr)
+
+ CORBA::String_var sior = _orb->object_to_string(pCont);
+ string myCommand="pyCont = SALOME_Container.SALOME_Container_i('";
+ myCommand += _containerName + "','";
+ myCommand += sior;
+ myCommand += "')\n";
+ SCRUTE(myCommand);
+
+ if (!_isSupervContainer)
+ {
+ Py_ACQUIRE_NEW_THREAD;
+#ifdef WNT
+ // mpv: this is temporary solution: there is a unregular crash if not
+ Sleep(2000);
+ PyRun_SimpleString("import sys\n");
+ // first element is the path to Registry.dll, but it's wrong
+ PyRun_SimpleString("sys.path = sys.path[1:]\n");
+#endif
+ PyRun_SimpleString("import SALOME_Container\n");
+ PyRun_SimpleString((char*)myCommand.c_str());
+ Py_RELEASE_NEW_THREAD;
+ }
+ }
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+Engines_Container_i::~Engines_Container_i()
+{
+ MESSAGE("Container_i::~Container_i()");
+ delete _id;
+}
+
+//=============================================================================
+/*!
+ * CORBA attribute: Container name (see constructor)
+ */
+//=============================================================================
+
+char* Engines_Container_i::name()
+{
+ return CORBA::string_dup(_containerName.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Get the hostName of the Container (without domain extensions)
+ */
+//=============================================================================
+
+char* Engines_Container_i::getHostName()
+{
+ string s = GetHostname();
+ // MESSAGE("Engines_Container_i::getHostName " << s);
+ return CORBA::string_dup(s.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Get the PID (process identification) of the Container
+ */
+//=============================================================================
+
+CORBA::Long Engines_Container_i::getPID()
+{
+ return (CORBA::Long)getpid();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: check if servant is still alive
+ */
+//=============================================================================
+
+void Engines_Container_i::ping()
+{
+ MESSAGE("Engines_Container_i::ping() pid "<< getpid());
+}
+
+//=============================================================================
+/*!
+ * CORBA method, oneway: Server shutdown.
+ * - Container name removed from naming service,
+ * - servant deactivation,
+ * - orb shutdown if no other servants in the process
+ */
+//=============================================================================
+
+void Engines_Container_i::Shutdown()
+{
+ MESSAGE("Engines_Container_i::Shutdown()");
+ _NS->Destroy_FullDirectory(_containerName.c_str());
+ //_remove_ref();
+ //_poa->deactivate_object(*_id);
+ if(_isServantAloneInProcess)
+ {
+ MESSAGE("Effective Shutdown of container Begins...");
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ bp1->deleteInstance(bp1);
+ _orb->shutdown(0);
+ }
+}
+
+
+//=============================================================================
+/*!
+ * CORBA method: load a new component class (Python or C++ implementation)
+ * \param componentName like COMPONENT
+ * try to make a Python import of COMPONENT,
+ * then a lib open of libCOMPONENTEngine.so
+ * \return true if dlopen successfull or already done, false otherwise
+ */
+//=============================================================================
+
+bool
+Engines_Container_i::load_component_Library(const char* componentName)
+{
+
+ string aCompName = componentName;
+
+ // --- try dlopen C++ component
+
+#ifndef WNT
+ string impl_name = string ("lib") + aCompName + string("Engine.so");
+#else
+ string impl_name = aCompName + string("Engine.dll");
+#endif
+ SCRUTE(impl_name);
+
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see decInstanceCnt, finalize_removal))
+ if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name);
+ if (_library_map[impl_name])
+ {
+ MESSAGE("Library " << impl_name << " already loaded");
+ _numInstanceMutex.unlock();
+ return true;
+ }
+
+ void* handle;
+#ifndef WNT
+ handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+#else
+ handle = dlopen( impl_name.c_str() , 0 ) ;
+#endif
+ if ( handle )
+ {
+ _library_map[impl_name] = handle;
+ _numInstanceMutex.unlock();
+ return true;
+ }
+ else
+ {
+ INFOS("Can't load shared library : " << impl_name);
+ INFOS("error dlopen: " << dlerror());
+ }
+ _numInstanceMutex.unlock();
+
+ // --- try import Python component
+
+ INFOS("try import Python component "<<componentName);
+ if (_isSupervContainer)
+ {
+ INFOS("Supervision Container does not support Python Component Engines");
+ return false;
+ }
+ if (_library_map[aCompName])
+ {
+ return true; // Python Component, already imported
+ }
+ else
+ {
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ "import_component",
+ "s",componentName);
+ int ret= PyInt_AsLong(result);
+ SCRUTE(ret);
+ Py_RELEASE_NEW_THREAD;
+
+ if (ret) // import possible: Python component
+ {
+ _library_map[aCompName] = (void *)pyCont; // any non O value OK
+ MESSAGE("import Python: "<<aCompName<<" OK");
+ return true;
+ }
+ }
+ return false;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Creates a new servant instance of a component.
+ * 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::Component_ptr
+Engines_Container_i::create_component_instance(const char*genericRegisterName,
+ CORBA::Long studyId)
+{
+ if (studyId < 0)
+ {
+ INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
+ return Engines::Component::_nil() ;
+ }
+
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+
+ string aCompName = genericRegisterName;
+ if (_library_map[aCompName]) // Python component
+ {
+ if (_isSupervContainer)
+ {
+ INFOS("Supervision Container does not support Python Component Engines");
+ return Engines::Component::_nil();
+ }
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aCompName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ "create_component_instance",
+ "ssl",
+ aCompName.c_str(),
+ instanceName.c_str(),
+ studyId);
+ string iors = PyString_AsString(result);
+ SCRUTE(iors);
+ Py_RELEASE_NEW_THREAD;
+
+ CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+ iobject = Engines::Component::_narrow( obj ) ;
+ return iobject._retn();
+ }
+
+ //--- try C++
+
+#ifndef WNT
+ string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
+#else
+ string impl_name = genericRegisterName +string("Engine.dll");
+#endif
+ void* handle = _library_map[impl_name];
+ if ( !handle )
+ {
+ INFOS("shared library " << impl_name <<"must be loaded before instance");
+ return Engines::Component::_nil() ;
+ }
+ else
+ {
+ iobject = createInstance(genericRegisterName,
+ handle,
+ studyId);
+ return iobject._retn();
+ }
+}
+
+//=============================================================================
+/*!
+ * 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
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Container_i::find_component_instance( const char* registeredName,
+ CORBA::Long studyId)
+{
+ Engines::Component_var anEngine = Engines::Component::_nil();
+ map<string,Engines::Component_var>::iterator itm =_listInstances_map.begin();
+ while (itm != _listInstances_map.end())
+ {
+ string instance = (*itm).first;
+ SCRUTE(instance);
+ if (instance.find(registeredName) == 0)
+ {
+ anEngine = (*itm).second;
+ if (studyId == anEngine->getStudyId())
+ {
+ return anEngine._retn();
+ }
+ }
+ itm++;
+ }
+ return anEngine._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: find or create an instance of the component (servant),
+ * load a new component class (dynamic library) if required,
+ * ---- FOR COMPATIBILITY WITH 2.2 ----
+ * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+ * The servant registers itself to naming service and Registry.
+ * \param genericRegisterName Name of the component to register
+ * in Registry & Name Service
+ * \param componentName Name of the constructed library of the component
+ * \return a loaded component
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Container_i::load_impl( const char* genericRegisterName,
+ const char* componentName )
+{
+ string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ if (load_component_Library(genericRegisterName))
+ iobject = find_or_create_instance(genericRegisterName, impl_name);
+ return iobject._retn();
+}
+
+
+//=============================================================================
+/*!
+ * CORBA method: Stops the component servant, and deletes all related objects
+ * \param component_i Component to be removed
+ */
+//=============================================================================
+
+void Engines_Container_i::remove_impl(Engines::Component_ptr component_i)
+{
+ ASSERT(! CORBA::is_nil(component_i));
+ string instanceName = component_i->instanceName() ;
+ MESSAGE("unload component " << instanceName);
+ _listInstances_map.erase(instanceName);
+ component_i->destroy() ;
+ _NS->Destroy_Name(instanceName.c_str());
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Discharges unused libraries from the container.
+ */
+//=============================================================================
+
+void Engines_Container_i::finalize_removal()
+{
+ MESSAGE("finalize unload : dlclose");
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see decInstanceCnt, load_component_Library)
+ map<string, void *>::iterator ith;
+ for (ith = _toRemove_map.begin(); ith != _toRemove_map.end(); ith++)
+ {
+ void *handle = (*ith).second;
+ string impl_name= (*ith).first;
+ if (handle)
+ {
+ SCRUTE(handle);
+ SCRUTE(impl_name);
+// dlclose(handle); // SALOME unstable after ...
+// _library_map.erase(impl_name);
+ }
+ }
+ _toRemove_map.clear();
+ _numInstanceMutex.unlock();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Kill the container process with exit(0).
+ * To remove : never returns !
+ */
+//=============================================================================
+
+bool Engines_Container_i::Kill_impl()
+{
+ MESSAGE("Engines_Container_i::Kill() pid "<< getpid() << " containerName "
+ << _containerName.c_str() << " machineName "
+ << GetHostname().c_str());
+ INFOS("===============================================================");
+ INFOS("= REMOVE calls to Kill_impl in C++ container =");
+ INFOS("===============================================================");
+ //exit( 0 ) ;
+ ASSERT(0);
+ return false;
+}
+
+//=============================================================================
+/*!
+ * C++ method: Finds an already existing servant instance of a component, or
+ * create an instance.
+ * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+ * \param genericRegisterName Name of the component instance to register
+ * in Registry & Name Service,
+ * (without _inst_n suffix, like "COMPONENT")
+ * \param componentLibraryName like "libCOMPONENTEngine.so"
+ * \return a loaded component
+ *
+ * example with names:
+ * aGenRegisterName = COMPONENT (= first argument)
+ * impl_name = libCOMPONENTEngine.so (= second argument)
+ * _containerName = /Containers/cli76ce/FactoryServer
+ * factoryName = COMPONENTEngine_factory
+ * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+ *
+ * instanceName = COMPONENT_inst_1
+ * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Container_i::find_or_create_instance(string genericRegisterName,
+ string componentLibraryName)
+{
+ string aGenRegisterName = genericRegisterName;
+ string impl_name = componentLibraryName;
+ void* handle = _library_map[impl_name];
+ if ( !handle )
+ {
+ INFOS("shared library " << impl_name <<"must be loaded before instance");
+ return Engines::Component::_nil() ;
+ }
+ else
+ {
+ // --- find a registered instance in naming service, or create
+
+ string component_registerBase =
+ _containerName + "/" + aGenRegisterName;
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ try
+ {
+ CORBA::Object_var obj =
+ _NS->ResolveFirst( component_registerBase.c_str());
+ if ( CORBA::is_nil( obj ) )
+ {
+ iobject = createInstance(genericRegisterName,
+ handle,
+ 0); // force multiStudy instance here !
+ }
+ else
+ {
+ iobject = Engines::Component::_narrow( obj ) ;
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>
+ (_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::Component::_nil();
+ INFOS("load_impl & find_component_instance methods "
+ << "NOT SUITABLE for mono study components");
+ }
+ }
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::load_impl catched" ) ;
+ }
+ return iobject._retn();
+ }
+}
+
+//=============================================================================
+/*!
+ * C++ method: create a servant instance of a component.
+ * \param genericRegisterName Name of the component instance to register
+ * 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:
+ * aGenRegisterName = COMPONENT (= first argument)
+ * _containerName = /Containers/cli76ce/FactoryServer
+ * factoryName = COMPONENTEngine_factory
+ * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+ * instanceName = COMPONENT_inst_1
+ * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Container_i::createInstance(string genericRegisterName,
+ void *handle,
+ int studyId)
+{
+ // --- find the factory
+
+ string aGenRegisterName = genericRegisterName;
+ string factory_name = aGenRegisterName + string("Engine_factory");
+ SCRUTE(factory_name) ;
+
+ typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
+ (CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) ;
+
+ FACTORY_FUNCTION Component_factory
+ = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ( (error = dlerror() ) != NULL)
+ {
+ INFOS("Can't resolve symbol: " + factory_name);
+ SCRUTE(error);
+ return Engines::Component::_nil() ;
+ }
+
+ // --- create instance
+
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+
+ try
+ {
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
+ aGenRegisterName.c_str() ) ;
+
+ // --- get reference & servant from id
+
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow( obj ) ;
+
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>(_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(aGenRegisterName);
+ SCRUTE(_cntInstances_map[aGenRegisterName]);
+ //SCRUTE(servant->pd_refCount);
+ bool ret_studyId = servant->setStudyId(studyId);
+ ASSERT(ret_studyId);
+
+ // --- register the engine under the name
+ // containerName(.dir)/instanceName(.object)
+
+ _NS->Register( iobject , component_registerName.c_str() ) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::createInstance exception catched" ) ;
+ }
+ return iobject._retn();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void Engines_Container_i::decInstanceCnt(string genericRegisterName)
+{
+ string aGenRegisterName =genericRegisterName;
+ MESSAGE("Engines_Container_i::decInstanceCnt " << aGenRegisterName);
+ ASSERT(_cntInstances_map[aGenRegisterName] > 0);
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see finalize_removal, load_component_Library)
+ _cntInstances_map[aGenRegisterName] -= 1;
+ SCRUTE(_cntInstances_map[aGenRegisterName]);
+ if (_cntInstances_map[aGenRegisterName] == 0)
+ {
+ string impl_name =
+ Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
+ SCRUTE(impl_name);
+ void* handle = _library_map[impl_name];
+ ASSERT(handle);
+ _toRemove_map[impl_name] = handle;
+ }
+ _numInstanceMutex.unlock();
+}
+
+//=============================================================================
+/*!
+ * Retrieves only with container naming convention if it is a python container
+ */
+//=============================================================================
+
+bool Engines_Container_i::isPythonContainer(const char* ContainerName)
+{
+ bool ret=false;
+ int len=strlen(ContainerName);
+ if(len>=2)
+ if(strcmp(ContainerName+len-2,"Py")==0)
+ ret=true;
+ return ret;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void ActSigIntHandler()
+{
+#ifndef WNT
+ struct sigaction SigIntAct ;
+ SigIntAct.sa_sigaction = &SigIntHandler ;
+ SigIntAct.sa_flags = SA_SIGINFO ;
+#endif
+
+// DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals
+// (SIGINT | SIGUSR1) :
+// it must be only one signal ===> one call for SIGINT
+// and an other one for SIGUSR1
+
+#ifndef WNT
+ if ( sigaction( SIGINT , &SigIntAct, NULL ) )
+ {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
+ if ( sigaction( SIGUSR1 , &SigIntAct, NULL ) )
+ {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
+
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==INFOS is commented
+ // INFOS(pthread_self() << "SigIntHandler activated") ;
+
+#else
+ signal( SIGINT, SigIntHandler );
+ signal( SIGUSR1, SigIntHandler );
+#endif
+
+}
+
+void SetCpuUsed() ;
+
+#ifndef WNT
+void SigIntHandler(int what ,
+ siginfo_t * siginfo ,
+ void * toto )
+{
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==MESSAGE is commented
+ // MESSAGE(pthread_self() << "SigIntHandler what " << what << endl
+ // << " si_signo " << siginfo->si_signo << endl
+ // << " si_code " << siginfo->si_code << endl
+ // << " si_pid " << siginfo->si_pid) ;
+
+ if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ // MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else
+ {
+ ActSigIntHandler() ;
+ if ( siginfo->si_signo == SIGUSR1 )
+ {
+ SetCpuUsed() ;
+ }
+ else
+ {
+ _Sleeping = true ;
+ // MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping )
+ {
+ sleep( 1 ) ;
+ count += 1 ;
+ }
+ // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
+ return ;
+ }
+}
+#else // Case WNT
+void SigIntHandler( int what )
+{
+ MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
+ if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else
+ {
+ ActSigIntHandler() ;
+ if ( what == SIGUSR1 )
+ {
+ SetCpuUsed() ;
+ }
+ else
+ {
+ _Sleeping = true ;
+ MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping )
+ {
+ Sleep( 1000 ) ;
+ count += 1 ;
+ }
+ MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
+ return ;
+ }
+}
+#endif
+
--- /dev/null
+# SALOME Container : implementation of container and engine for Kernel
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS = SALOME_ComponentPy.py \
+ SALOME_ContainerPy.py \
+ SALOME_Container.py
+
+EXPORT_HEADERS = \
+ SALOME_Component_i.hxx \
+ SALOME_Container_i.hxx \
+ SALOME_ContainerManager.hxx \
+ Container_init_python.hxx
+
+# Libraries targets
+
+LIB = libSalomeContainer.la
+LIB_SRC = Component_i.cxx \
+ Container_i.cxx \
+ SALOME_ContainerManager.cxx \
+ Container_init_python.cxx
+
+LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Exception.idl
+LIB_CLIENT_IDL =
+
+# Executables targets
+BIN = SALOME_Container SALOME_ContainerManagerServer
+BIN_SRC = SALOME_Container_SignalsHandler.cxx
+BIN_SERVER_IDL = SALOME_Component.idl SALOME_ContainerManager.idl
+
+CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDES) $(OCC_INCLUDES) $(QT_MT_INCLUDES)
+CXXFLAGS+=$(OCC_CXXFLAGS)
+
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSalomeResourcesManager
+
+LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS) $(MPI_LIBS)
+
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMEBasics
+LIBSFORBIN= $(LIBS)
+@CONCLUDE@
--- /dev/null
+// SALOME Container : implementation of container and engine for Kernel
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_Container.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+
+#ifdef HAVE_MPI2
+#include <mpi.h>
+#endif
+
+#include <iostream>
+#include <string>
+#include <stdio.h>
+
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+#include "SALOME_Container_i.hxx"
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "OpUtil.hxx"
+
+#ifdef CHECKTIME
+#include <Utils_Timer.hxx>
+#endif
+
+#include "Container_init_python.hxx"
+
+using namespace std;
+
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+
+int main(int argc, char* argv[])
+{
+#ifdef HAVE_MPI2
+ MPI_Init(&argc,&argv);
+#endif
+
+ // Initialise the ORB.
+ //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
+ //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var orb = init(0 , 0 ) ;
+
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ INFOS_COMPILATION;
+ BEGIN_OF(argv[0]);
+
+ ASSERT(argc > 1);
+ SCRUTE(argv[1]);
+ bool isSupervContainer = false;
+ if (strcmp(argv[1],"SuperVisionContainer") == 0) isSupervContainer = true;
+
+ if (!isSupervContainer)
+ {
+ int _argc = 1;
+ char* _argv[] = {""};
+ KERNEL_PYTHON::init_python(argc,argv);
+ }
+ else
+ {
+ Py_Initialize() ;
+ PySys_SetArgv( argc , argv ) ;
+ }
+
+ char *containerName = "";
+ if(argc > 1)
+ {
+ containerName = argv[1] ;
+ }
+
+ try
+ {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+ // add new container to the kill list
+#ifndef WNT
+ char aCommand[40];
+ sprintf(aCommand, "addToKillList.py %d SALOME_Container", getpid());
+ system(aCommand);
+#endif
+
+ Engines_Container_i * myContainer
+ = new Engines_Container_i(orb, root_poa, containerName , argc , argv );
+
+ pman->activate();
+
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
+#endif
+
+ HandleServerSideSignals(orb);
+
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+#ifdef HAVE_MPI2
+ MPI_Finalize();
+#endif
+
+ //END_OF(argv[0]);
+ //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ //bp1->deleteInstance(bp1);
+ return 0 ;
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_NamingService.hxx"
+#include "OpUtil.hxx"
+#include <sys/types.h>
+#ifndef WNT
+#include <unistd.h>
+#endif
+#include <vector>
+#include "Utils_CorbaException.hxx"
+
+#define TIME_OUT_TO_LAUNCH_CONT 21
+
+using namespace std;
+
+const char *SALOME_ContainerManager::_ContainerManagerNameInNS =
+ "/ContainerManager";
+
+//=============================================================================
+/*!
+ * Constructor
+ * \param orb
+ * Define a CORBA single thread policy for the server, which avoid to deal
+ * with non thread-safe usage like Change_Directory in SALOME naming service
+ */
+//=============================================================================
+
+SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
+{
+ MESSAGE("constructor");
+ _NS = new SALOME_NamingService(orb);
+ _ResManager = new SALOME_ResourcesManager(orb);
+ _id=0;
+ PortableServer::POA_var root_poa = PortableServer::POA::_the_root_poa();
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+ PortableServer::POA_var my_poa;
+
+ CORBA::PolicyList policies;
+ policies.length(1);
+ PortableServer::ThreadPolicy_var threadPol =
+ root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
+ policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+
+ my_poa =
+ root_poa->create_POA("SThreadPOA",pman,policies);
+ threadPol->destroy();
+ PortableServer::ObjectId_var id = my_poa->activate_object(this);
+ CORBA::Object_var obj = my_poa->id_to_reference(id);
+ Engines::ContainerManager_var refContMan =
+ Engines::ContainerManager::_narrow(obj);
+
+ _NS->Register(refContMan,_ContainerManagerNameInNS);
+ MESSAGE("constructor end");
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+
+SALOME_ContainerManager::~SALOME_ContainerManager()
+{
+ MESSAGE("destructor");
+ delete _NS;
+ delete _ResManager;
+}
+
+//=============================================================================
+/*! CORBA method:
+ * shutdown all the containers, then the ContainerManager servant
+ */
+//=============================================================================
+
+void SALOME_ContainerManager::Shutdown()
+{
+ MESSAGE("Shutdown");
+ ShutdownContainers();
+ PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
+ _default_POA()->deactivate_object(oid);
+ _remove_ref();
+
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Loop on all the containers listed in naming service, ask shutdown on each
+ */
+//=============================================================================
+
+void SALOME_ContainerManager::ShutdownContainers()
+{
+ MESSAGE("ShutdownContainers");
+ _NS->Change_Directory("/Containers");
+ vector<string> vec = _NS->list_directory_recurs();
+ for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++)
+ {
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ {
+ MESSAGE("ShutdownContainers: " << (*iter));
+ cont->Shutdown();
+ }
+ else MESSAGE("ShutdownContainers: no container ref for " << (*iter));
+ }
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Find a suitable Container in a list of machines, or start one
+ * \param params Machine Parameters required for the container
+ * \param possibleComputers list of machines usable for find or start
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::
+FindOrStartContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputers)
+{
+ long id;
+ string containerNameInNS;
+ char idc[3*sizeof(long)];
+
+ Engines::Container_ptr ret = FindContainer(params,possibleComputers);
+ if(!CORBA::is_nil(ret))
+ return ret;
+ MESSAGE("Container doesn't exist try to launch it ...");
+ MESSAGE("SALOME_ContainerManager::FindOrStartContainer " <<
+ possibleComputers.length());
+ //vector<string> vector;
+ string theMachine=_ResManager->FindBest(possibleComputers);
+ MESSAGE("try to launch it on " << theMachine);
+
+ // Get Id for container: a parallel container registers in Naming Service
+ // on the machine where is process 0. ContainerManager does'nt know the name
+ // of this machine before the launch of the parallel container. So to get
+ // the IOR of the parallel container in Naming Service, ContainerManager
+ // gives a unique Id. The parallel container registers his name under
+ // /ContainerManager/Id directory in NamingService
+
+ id = GetIdForContainer();
+
+ string command;
+ if(theMachine=="")
+ {
+ MESSAGE("SALOME_ContainerManager::FindOrStartContainer : " <<
+ "no possible computer");
+ return Engines::Container::_nil();
+ }
+ else if(theMachine==GetHostname())
+ {
+ command=_ResManager->BuildCommandToLaunchLocalContainer(params,id);
+ }
+ else
+ command =
+ _ResManager->BuildCommandToLaunchRemoteContainer(theMachine,params,id);
+
+ _ResManager->RmTmpFile();
+ int status=system(command.c_str());
+ if (status == -1)
+ {
+ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
+ "(system command status -1)");
+ return Engines::Container::_nil();
+ }
+ else if (status == 217)
+ {
+ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
+ "(system command status 217)");
+ return Engines::Container::_nil();
+ }
+ else
+ {
+ int count=TIME_OUT_TO_LAUNCH_CONT;
+ while ( CORBA::is_nil(ret) && count )
+ {
+#ifndef WNT
+ sleep( 1 ) ;
+#else
+ Sleep(1000);
+#endif
+ count-- ;
+ if ( count != 10 )
+ MESSAGE( count << ". Waiting for FactoryServer on " << theMachine);
+ if(params.isMPI)
+ {
+ containerNameInNS = "/ContainerManager/id";
+ sprintf(idc,"%ld",id);
+ containerNameInNS += idc;
+ }
+ else
+ containerNameInNS =
+ _NS->BuildContainerNameForNS(params,theMachine.c_str());
+ SCRUTE(containerNameInNS);
+ CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
+ ret=Engines::Container::_narrow(obj);
+ }
+ if ( CORBA::is_nil(ret) )
+ {
+ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed");
+ }
+ return ret;
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+Engines::MachineList *
+SALOME_ContainerManager::
+GetFittingResources(const Engines::MachineParameters& params,
+ const char *componentName)
+{
+ MESSAGE("SALOME_ContainerManager::GetFittingResources");
+ Engines::MachineList *ret=new Engines::MachineList;
+ vector<string> vec;
+ try
+ {
+ vec = _ResManager->GetFittingResources(params,componentName);
+ }
+ catch(const SALOME_Exception &ex)
+ {
+ INFOS("Caught exception.");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
+ //return ret;
+ }
+
+ // MESSAGE("Machine list length "<<vec.size());
+ ret->length(vec.size());
+ for(unsigned int i=0;i<vec.size();i++)
+ {
+ (*ret)[i]=(vec[i]).c_str();
+ }
+ return ret;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+char*
+SALOME_ContainerManager::
+FindBest(const Engines::MachineList& possibleComputers)
+{
+ string theMachine=_ResManager->FindBest(possibleComputers);
+ return CORBA::string_dup(theMachine.c_str());
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::
+FindContainer(const Engines::MachineParameters& params,
+ const char *theMachine)
+{
+ string containerNameInNS(_NS->BuildContainerNameForNS(params,theMachine));
+ CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
+ if( !CORBA::is_nil(obj) )
+ return Engines::Container::_narrow(obj);
+ else
+ return Engines::Container::_nil();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::
+FindContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputers)
+{
+ MESSAGE("FindContainer "<<possibleComputers.length());
+ for(unsigned int i=0;i<possibleComputers.length();i++)
+ {
+ MESSAGE("FindContainer possible " << possibleComputers[i]);
+ Engines::Container_ptr cont = FindContainer(params,possibleComputers[i]);
+ if( !CORBA::is_nil(cont) )
+ return cont;
+ }
+ MESSAGE("FindContainer: not found");
+ return Engines::Container::_nil();
+}
+
+//=============================================================================
+/*!
+ * Get Id for container: a parallel container registers in Naming Service
+ * on the machine where is process 0. ContainerManager does'nt know the name
+ * of this machine before the launch of the parallel container. So to get
+ * the IOR of the parallel container in Naming Service, ContainerManager
+ * gives a unique Id. The parallel container registers his name under
+ * /ContainerManager/Id directory in NamingService
+ */
+//=============================================================================
+
+
+long SALOME_ContainerManager::GetIdForContainer(void)
+{
+ _id++;
+ return _id;
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef __SALOME_CONTAINERMANAGER_HXX__
+#define __SALOME_CONTAINERMANAGER_HXX__
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include "SALOME_ResourcesManager.hxx"
+#include "SALOME_LoadRateManager.hxx"
+
+#include <string>
+
+class SALOME_NamingService;
+
+#if defined CONTAINER_EXPORTS
+#if defined WIN32
+#define CONTAINER_EXPORT __declspec( dllexport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#else
+#if defined WNT
+#define CONTAINER_EXPORT __declspec( dllimport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#endif
+
+class CONTAINER_EXPORT SALOME_ContainerManager:
+ public POA_Engines::ContainerManager,
+ public PortableServer::RefCountServantBase
+{
+
+public:
+ SALOME_ContainerManager(CORBA::ORB_ptr orb);
+ ~SALOME_ContainerManager();
+
+ Engines::Container_ptr
+ FindOrStartContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputer);
+
+ Engines::MachineList *
+ GetFittingResources(const Engines::MachineParameters& params,
+ const char *componentName);
+
+ char* FindBest(const Engines::MachineList& possibleComputers);
+
+ void Shutdown();
+ void ShutdownContainers();
+
+ static const char *_ContainerManagerNameInNS;
+
+protected:
+ Engines::Container_ptr
+ FindContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputers);
+
+ Engines::Container_ptr
+ FindContainer(const Engines::MachineParameters& params,
+ const char *theMachine);
+
+ long GetIdForContainer(void);
+ long _id;
+
+ SALOME_ResourcesManager *_ResManager;
+ SALOME_NamingService *_NS;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_ContainerManager.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "utilities.h"
+
+int main(int argc, char* argv[])
+{
+ PortableServer::POA_var root_poa;
+ PortableServer::POAManager_var pman;
+ CORBA::Object_var obj;
+
+ CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ INFOS_COMPILATION;
+ BEGIN_OF(argv[0]);
+ try{
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ root_poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(root_poa))
+ pman = root_poa->the_POAManager();
+ }
+ catch(CORBA::COMM_FAILURE&){
+ MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ try{
+ SALOME_ContainerManager *cmServ=new SALOME_ContainerManager(orb);
+ pman->activate();
+ orb->run();
+ }catch(CORBA::SystemException&){
+ MESSAGE("Caught CORBA::SystemException.");
+ }catch(PortableServer::POA::WrongPolicy&){
+ MESSAGE("Caught CORBA::WrongPolicyException.");
+ }catch(PortableServer::POA::ServantAlreadyActive&){
+ MESSAGE("Caught CORBA::ServantAlreadyActiveException");
+ }catch(CORBA::Exception&){
+ MESSAGE("Caught CORBA::Exception.");
+ }catch(std::exception& exc){
+ MESSAGE("Caught std::exception - "<<exc.what());
+ }catch(...){
+ MESSAGE("Caught unknown exception.");
+ }
+ END_OF(argv[0]);
+ // delete myThreadTrace;
+}
+
--- /dev/null
+#! /usr/bin/env python
+#
+# SALOME Container : implementation of container and engine for Kernel
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : SALOME_ContainerPy.py
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+import os
+import sys
+import string
+import omnipatch # PAL10310
+from omniORB import CORBA, PortableServer
+import SALOMEDS
+import Engines, Engines__POA
+from SALOME_NamingServicePy import *
+from SALOME_ComponentPy import *
+
+from SALOME_utilities import *
+from Utils_Identity import getShortHostName
+
+#=============================================================================
+
+#define an implementation of the container interface
+
+class SALOME_ContainerPy_i (Engines__POA.Container):
+ _orb = None
+ _poa = None
+ _numInstance = 0
+ _listInstances_map = {}
+
+ #-------------------------------------------------------------------------
+
+ def __init__(self, orb, poa, containerName):
+ MESSAGE( "SALOME_ContainerPy_i::__init__" )
+ self._orb = orb
+ self._poa = poa
+ myMachine=getShortHostName()
+ Container_path = "/Containers/" + myMachine + "/" + containerName
+ #self._containerName = containerName
+ self._containerName = Container_path
+ print "container name ",self._containerName
+
+ naming_service = SALOME_NamingServicePy_i(self._orb)
+ self._naming_service = naming_service
+ MESSAGE( str(Container_path) )
+ naming_service.Register(self._this(), Container_path)
+
+ #-------------------------------------------------------------------------
+
+ def start_impl(self, ContainerName):
+ MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) )
+ myMachine=getShortHostName()
+ theContainer = "/Containers/" + myMachine + "/" + ContainerName
+ try:
+ obj = self._naming_service.Resolve(theContainer)
+ except :
+ obj = None
+ MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object not found in Naming Service" )
+ if obj is None:
+ container = None
+ else:
+ container = obj._narrow(Engines.Container)
+ if container is None:
+ MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(containerName) + ".object exists but is not a Container" )
+ else :
+ MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without new launch" )
+ return container
+ #shstr = os.getenv( "PWD" ) + "/"
+ #shstr += "runSession ./SALOME_ContainerPy.py "
+ shstr = os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/SALOME_ContainerPy.py ";
+ #shstr = "runSession SALOME_ContainerPy.py "
+ shstr += ContainerName
+
+ # mpv: fix for SAL4731 - allways create new file to write log of server
+ num = 1
+ fileName = ""
+ while 1:
+ fileName = "/tmp/"+ContainerName+"_%i.log"%num
+ if not os.path.exists(fileName):
+ break
+ num += 1
+ pass
+
+ shstr += " > "
+ shstr += fileName
+ shstr += " 2>&1 &"
+
+ #shstr += " > /tmp/"
+ #shstr += ContainerName
+ #shstr += ".log 2>&1 &"
+
+ MESSAGE( "SALOME_ContainerPy_i::start_impl " + "os.system(" + str(shstr) + ")" )
+ os.system( shstr )
+ count = 21
+ while container is None :
+ time.sleep(1)
+ count = count - 1
+ MESSAGE( str(count) + ". Waiting for " + str(theContainer) )
+ try :
+ obj = self._naming_service.Resolve(theContainer)
+ except :
+ obj = None
+ if obj is None:
+ container = None
+ else:
+ container = obj._narrow(Engines.Container)
+ if container is None:
+ MESSAGE( str(containerName) + ".object exists but is not a Container" )
+ return container
+ if count == 0 :
+ return container
+
+ #-------------------------------------------------------------------------
+
+ def instance(self, nameToRegister, componentName):
+ MESSAGE( "SALOME_ContainerPy_i::instance " + str(nameToRegister) + ' ' + str(componentName) )
+ self._numInstance = self._numInstance +1
+ instanceName = nameToRegister + "_inst_" + `self._numInstance`
+
+ component=__import__(componentName)
+ factory=getattr(component,componentName)
+ comp_i=factory(self._orb, self._poa, self._this(), self._containerName,
+ instanceName, nameToRegister)
+
+ MESSAGE( "SALOME_ContainerPy_i::instance : component created")
+ comp_o = comp_i._this()
+ return comp_o
+
+ #-------------------------------------------------------------------------
+
+ def load_impl(self, nameToRegister, componentName):
+ MESSAGE( "SALOME_ContainerPy_i::load_impl " + str(nameToRegister) + ' ' + str(componentName) )
+ self._numInstance = self._numInstance +1
+ instanceName = nameToRegister + "_inst_" + `self._numInstance`
+ interfaceName = nameToRegister
+ the_command = "import " + nameToRegister + "\n"
+ the_command = the_command + "comp_i = " + nameToRegister + "." + nameToRegister
+ the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
+ MESSAGE( "SALOME_ContainerPy_i::load_impl :" + str (the_command) )
+ exec the_command
+ comp_o = comp_i._this()
+ return comp_o
+
+ #-------------------------------------------------------------------------
+
+ def import_component(self, componentName):
+ MESSAGE( "SALOME_Container_i::import_component" )
+ ret=0
+ try:
+ print "try import ",componentName
+ __import__(componentName)
+ print "import ",componentName," successful"
+ ret=1
+ except:
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
+ return ret
+
+ #-------------------------------------------------------------------------
+
+ def load_component_Library(self, componentName):
+ MESSAGE( "SALOME_ContainerPy_i::load_component_Library " + str(componentName) )
+ ret = 0
+ instanceName = componentName + "_inst_" + `self._numInstance`
+ interfaceName = componentName
+ #the_command = "import " + componentName + "\n"
+ #the_command = the_command + "comp_i = " + componentName + "." + componentName
+ #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
+ #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) )
+ #exec the_command
+ #comp_o = comp_i._this()
+ #if comp_o is not None:
+ # ret = 1
+ #else:
+ # --- try to import Python component
+ # retImpl = self.import_component(componentName)
+ # if retImpl == 1:
+ #import is possible
+ # ret = 1
+ # else:
+ #import isn't possible
+ # ret = 0
+ #return ret
+ return self.import_component(componentName)
+
+ #-------------------------------------------------------------------------
+
+ def create_component_instance(self, componentName, studyId):
+ MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) + ' ' + str(studyId) )
+ if studyId < 0:
+ MESSAGE( "Study ID is lower than 0!" )
+ return None
+ else:
+ self._numInstance = self._numInstance +1
+ instanceName = componentName + "_inst_" + `self._numInstance`
+ comp_iors=""
+ try:
+ component=__import__(componentName)
+ factory=getattr(component,componentName)
+ comp_i=factory(self._orb,
+ self._poa,
+ self._this(),
+ self._containerName,
+ instanceName,
+ componentName)
+
+ MESSAGE( "SALOME_Container_i::create_component_instance : OK")
+ comp_o = comp_i._this()
+ self._listInstances_map[instanceName] = comp_i
+ except:
+ import traceback
+ traceback.print_exc()
+ MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")
+ return comp_o
+
+ #-------------------------------------------------------------------------
+
+ def find_component_instance(self, registeredName, studyId):
+ anEngine = None
+ keysList = self._listInstances_map.keys()
+ i = 0
+ while i < len(keysList):
+ instance = keysList[i]
+ if find(instance,registeredName) == 0:
+ anEngine = self._listInstances_map[instance]
+ if studyId == anEngine.getStudyId():
+ return anEngine._this()
+ i = i + 1
+ return anEngine._this()
+
+
+ #-------------------------------------------------------------------------
+
+ def remove_impl(self, component):
+ MESSAGE( "SALOME_ContainerPy_i::remove_impl" )
+ instanceName = component._get_instanceName()
+ MESSAGE( "unload component " + str(instanceName) )
+ self._listInstances_map.remove(instanceName)
+ component.destroy()
+ self._naming_service.Destroy_Name(str(instanceName))
+
+ #-------------------------------------------------------------------------
+
+ def finalize_removal(self):
+ MESSAGE( "SALOME_ContainerPy_i::finalize_removal" )
+ return None
+
+ #-------------------------------------------------------------------------
+
+ def ping(self):
+ MESSAGE( "SALOME_ContainerPy_i::ping() pid " + str(os.getpid()) )
+ return None
+
+ #-------------------------------------------------------------------------
+
+ def getPID(self):
+ return os.getpid()
+
+ #-------------------------------------------------------------------------
+
+ def _get_name(self):
+ MESSAGE( "SALOME_ContainerPy_i::_get_name" )
+ return self._containerName
+
+ #-------------------------------------------------------------------------
+
+ def getHostName(self):
+ MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" )
+ self._machineName = "localhost"
+ return self._machineName
+
+ #-------------------------------------------------------------------------
+
+ def _get_machineName(self):
+ MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" )
+ self._machineName = "localhost"
+ return self._machineName
+
+ #-------------------------------------------------------------------------
+
+ def Shutdown(self):
+ self._orb.shutdown(0)
+ pass
+
+#=============================================================================
+
+#initialise the ORB and find the root POA
+orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+poa = orb.resolve_initial_references("RootPOA")
+
+#create an instance of SALOME_ContainerPy_i and a Container reference
+#containerName = "FactoryServerPy"
+MESSAGE( str(sys.argv) )
+containerName = sys.argv[1]
+cpy_i = SALOME_ContainerPy_i(orb, poa, containerName)
+cpy_o = cpy_i._this()
+
+#activate the POA
+poaManager = poa._get_the_POAManager()
+poaManager.activate()
+
+#Block for ever
+orb.run()
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Tool.cxx
+// Created : Mon Oct 21 16:24:34 2002
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : SALOMEDS
+// Copyright : Open CASCADE
+
+#include "HDFOI.hxx"
+
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_Directory.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+#ifdef WNT
+#include <io.h>
+#include <time.h>
+#endif
+
+using namespace std;
+
+bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp);
+bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp);
+bool CreateGroupFromASCII(HDFcontainerObject *father, FILE *fp);
+
+void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident);
+void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident);
+void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident);
+
+char* GetTmpDir();
+char* makeName(char* name);
+char* restoreName(char* name);
+void write_float64(FILE* fp, hdf_float64* value);
+void read_float64(FILE* fp, hdf_float64* value);
+
+#define MAX_STRING_SIZE 65535
+#define MAX_ID_SIZE 20
+#define NB_FLOAT_IN_ROW 3
+#define NB_INTEGER_IN_ROW 9
+
+#define ASCIIHDF_ID "ASCIIHDF"
+#define ATTRIBUTE_ID "ATTRIBUTE"
+#define DATASET_ID "DATASET"
+#define GROUP_ID "GROUP"
+
+#define ASCIIHDF_ID_END "ASCIIHDF_END"
+#define ATTRIBUTE_ID_END "ATTRIBUTE_END"
+#define DATASET_ID_END "DATASET_END"
+#define GROUP_ID_END "GROUP_END"
+
+
+//============================================================================
+// function : isASCII
+// purpose : Returns True if the file is a converted to ASCII HDF file
+//============================================================================
+bool HDFascii::isASCII(const char* thePath) {
+ int fd;
+ if(!(fd = open(thePath, O_RDONLY))) return false;
+ char* aBuffer = new char[9];
+ aBuffer[8] = (char)0;
+ read(fd, aBuffer, 8);
+ close(fd);
+
+ if(strcmp(aBuffer, ASCIIHDF_ID) == 0) return true;
+
+ return false;
+}
+
+//############################## HDF => ASCII ################################
+
+//============================================================================
+// function : ConvertFromHDFToASCII
+// purpose : Converts a file pointed by thePath to ASCII format
+// If isReplace is true the newly created file will replace the existent one.
+// If isReplace is false theExtension will be added to a created file name
+// Returns the file name of ASCII file
+//============================================================================
+char* HDFascii::ConvertFromHDFToASCII(const char* thePath,
+ bool isReplace,
+ const char* theExtension)
+{
+ TCollection_AsciiString aPath((char*)thePath);
+ if(!isReplace) {
+ if(theExtension == NULL) aPath += ".asc";
+ else aPath += (char*)theExtension;
+ }
+
+ TCollection_AsciiString aFileName(aPath);
+ if(isReplace) aFileName=aPath+".ascii_tmp";
+
+ HDFfile *hdf_file = new HDFfile((char*)thePath);
+ hdf_file->OpenOnDisk(HDF_RDONLY);
+
+ char name[HDF_NAME_MAX_LEN+1];
+ int nbsons = hdf_file->nInternalObjects(), nbAttr = hdf_file->nAttributes();
+
+ FILE* fp = fopen(aFileName.ToCString(), "w");
+ fprintf(fp, "%s\n", ASCIIHDF_ID);
+ fprintf(fp, "%i\n", nbsons+nbAttr);
+
+ for(unsigned j=0; j<nbAttr; j++) {
+ char* attr_name = hdf_file->GetAttributeName(j);
+ HDFattribute *hdf_attribute = new HDFattribute(attr_name, hdf_file);
+ delete attr_name;
+ SaveAttributeInASCIIfile(hdf_attribute, fp, 0);
+ hdf_attribute = 0;
+ }
+
+ for (Standard_Integer i=0; i<nbsons; i++) {
+ hdf_file->InternalObjectIndentify(i,name);
+ if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
+
+ hdf_object_type type = hdf_file->InternalObjectType(name);
+
+ if(type == HDF_DATASET) {
+ HDFdataset* hdf_dataset = new HDFdataset(name, hdf_file);
+ SaveDatasetInASCIIfile(hdf_dataset, fp, 0);
+ hdf_dataset = 0;
+ } else if(type == HDF_GROUP) {
+ HDFgroup *hdf_group = new HDFgroup(name, hdf_file);
+ SaveGroupInASCIIfile(hdf_group, fp, 0);
+ hdf_group = 0;
+ }
+ }
+
+ fprintf(fp, "%s", ASCIIHDF_ID_END);
+
+ fclose(fp);
+
+ hdf_file->CloseOnDisk();
+ delete hdf_file;
+
+ if(isReplace) {
+ OSD_Path anOSDPath(aFileName);
+ OSD_File anOSDFile(anOSDPath);
+ if(anOSDFile.Exists())
+ anOSDFile.Move(aPath);
+ else
+ return NULL;
+ }
+
+ int length = strlen(aPath.ToCString());
+ char *new_str = new char[ 1+length ];
+ strcpy(new_str , aPath.ToCString()) ;
+
+ return new_str;
+}
+
+
+//============================================================================
+// function : SaveGroupInASCIIfile
+// purpose :
+//============================================================================
+void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident)
+{
+ hdf_group->OpenOnDisk();
+
+ TCollection_AsciiString anIdent(ident, '\t');
+ int nbsons = hdf_group->nInternalObjects(), nbAttr = hdf_group->nAttributes();
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID);*/
+ fprintf(fp, "%s\n", GROUP_ID);
+
+ char* name = makeName(hdf_group->GetName());
+
+ /*fprintf(fp, "%s%s %i\n", anIdent.ToCString(), name, nbsons+nbAttr);*/
+ fprintf(fp, "%s %i\n", name, nbsons+nbAttr);
+ delete name;
+
+ for(unsigned j=0; j<nbAttr; j++) {
+ name = hdf_group->GetAttributeName(j);
+ HDFattribute *hdf_attribute = new HDFattribute(name, hdf_group);
+ delete name;
+ SaveAttributeInASCIIfile(hdf_attribute, fp, ident+1);
+ hdf_attribute = 0;
+ }
+
+ char objName[HDF_NAME_MAX_LEN+1];
+
+ for (int i=0; i<nbsons; i++) {
+ hdf_group->InternalObjectIndentify(i, objName);
+
+ if (strncmp(objName, "INTERNAL_COMPLEX",16) == 0) continue;
+
+ hdf_object_type type = hdf_group->InternalObjectType(objName);
+
+ if (type == HDF_DATASET) {
+ HDFdataset* hdf_dataset = new HDFdataset(objName, hdf_group);
+ SaveDatasetInASCIIfile(hdf_dataset, fp, ident+1);
+ hdf_dataset = 0;
+ } else if (type == HDF_GROUP) {
+ HDFgroup *hdf_subgroup = new HDFgroup(objName, hdf_group);
+ SaveGroupInASCIIfile(hdf_subgroup, fp, ident+1);
+ hdf_subgroup = 0;
+ }
+ }
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID_END);*/
+ fprintf(fp, "%s\n", GROUP_ID_END);
+
+ hdf_group->CloseOnDisk();
+}
+
+//============================================================================
+// function : SaveDatasetInASCIIfile
+// purpose :
+//============================================================================
+void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident)
+{
+ hdf_dataset->OpenOnDisk();
+
+ long size = hdf_dataset->GetSize();
+ long ndim = hdf_dataset->nDim(); //Get number of dimesions
+ hdf_size *dim = new hdf_size[ndim];
+ hdf_type type = hdf_dataset->GetType();
+ hdf_byte_order order = hdf_dataset->GetOrder();
+ int nbAttr = hdf_dataset->nAttributes();
+
+ TCollection_AsciiString anIdent(ident, '\t');
+ TCollection_AsciiString anIdentChild(ident+1, '\t');
+
+ char* name = makeName(hdf_dataset->GetName());
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID);*/
+ fprintf(fp, "%s\n", DATASET_ID);
+ /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, nbAttr);*/
+ fprintf(fp, "%s %i %i\n", name, type, nbAttr);
+ delete name;
+
+ hdf_dataset->GetDim(dim);
+ /*fprintf(fp, "%s %i\n", anIdentChild.ToCString(), ndim);*/
+ fprintf(fp, " %i\n", ndim);
+
+ for(int i = 0;i < ndim;i++) {
+ /*fprintf(fp, "%s%i", anIdentChild.ToCString(), dim[i]);*/
+ fprintf(fp, " %i", dim[i]);
+ }
+
+ /*fprintf(fp, "%s\n", anIdentChild.ToCString());*/
+ fprintf(fp, "\n");
+ delete dim;
+
+ /*fprintf(fp, "%s%li:", anIdentChild.ToCString(), size);*/
+// fprintf(fp, "%li:", size);
+ fprintf(fp, "%li %i:", size, order);
+
+ if (type == HDF_STRING) {
+ char* val = new char[size];
+ hdf_dataset->ReadFromDisk(val);
+ fwrite(val, 1, size, fp);
+ delete val;
+ } else if (type == HDF_FLOAT64) {
+ hdf_float64* val = new hdf_float64[size];
+ hdf_dataset->ReadFromDisk(val);
+ fprintf(fp, "\n");
+ for (int i = 0, j = 0; i < size; i++) {
+ write_float64(fp, &val[i]);
+ if(++j == NB_FLOAT_IN_ROW) {
+ fprintf(fp, "\n");
+ j = 0;
+ }
+ else fprintf(fp," ");
+ }
+ delete val;
+ } else if(type == HDF_INT64) {
+ hdf_int64* val = new hdf_int64[size];
+ hdf_dataset->ReadFromDisk(val);
+ fprintf(fp, "\n");
+ for (int i = 0, j = 0; i < size; i++) {
+ fprintf(fp, " %li", val[i]);
+ if(++j == NB_INTEGER_IN_ROW) {
+ fprintf(fp, "\n");
+ j = 0;
+ }
+ }
+ delete val;
+ } else if(type == HDF_INT32) {
+ hdf_int32* val = new hdf_int32[size];
+ hdf_dataset->ReadFromDisk(val);
+ fprintf(fp, "\n");
+ for (int i = 0, j = 0; i < size; i++) {
+ fprintf(fp, " %i", val[i]);
+ if(++j == NB_INTEGER_IN_ROW) {
+ fprintf(fp, "\n");
+ j = 0;
+ }
+ }
+ delete val;
+ }
+
+ fprintf(fp, "\n");
+
+#ifndef WNT
+ for(unsigned j=0; j<nbAttr; j++) {
+#else
+ for(j=0; j<nbAttr; j++) {
+#endif
+ name = hdf_dataset->GetAttributeName(j);
+ HDFattribute *hdf_attribute = new HDFattribute(name, hdf_dataset);
+ delete name;
+ SaveAttributeInASCIIfile(hdf_attribute, fp, ident+1);
+ hdf_attribute = 0;
+ }
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID_END); */
+ fprintf(fp, "%s\n", DATASET_ID_END);
+
+ hdf_dataset->CloseOnDisk();
+}
+
+
+//============================================================================
+// function : SaveAttributeInASCIIfile
+// purpose :
+//============================================================================
+void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident)
+{
+ hdf_attribute->OpenOnDisk();
+
+ hdf_type type = hdf_attribute->GetType();
+
+ TCollection_AsciiString anIdent(ident, '\t');
+ TCollection_AsciiString anIdentChild(ident+1, '\t');
+
+ char* name = makeName(hdf_attribute->GetName());
+ int size = hdf_attribute->GetSize();
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID);*/
+ fprintf(fp, "%s\n", ATTRIBUTE_ID);
+ /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, size);*/
+ fprintf(fp, "%s %i %i\n", name, type, size);
+
+ delete name;
+
+ if (type == HDF_STRING) {
+ char* val = new char[size+1];
+ hdf_attribute->ReadFromDisk(val);
+ /*fprintf(fp, "%s:", anIdentChild.ToCString());*/
+ fprintf(fp, ":");
+ fwrite(val, 1, size, fp);
+ fprintf(fp, "\n");
+ delete val;
+ } else if (type == HDF_FLOAT64) {
+ hdf_float64 val;
+ hdf_attribute->ReadFromDisk(&val);
+ /*fprintf(fp, "%s", anIdentChild.ToCString());*/
+ write_float64(fp, &val);
+ fprintf(fp, "\n");
+ } else if(type == HDF_INT64) {
+ hdf_int64 val;
+ hdf_attribute->ReadFromDisk(&val);
+ /*fprintf(fp, "%s%li \n", anIdentChild.ToCString(), val);*/
+ fprintf(fp, "%li \n", val);
+ } else if(type == HDF_INT32) {
+ hdf_int32 val;
+ hdf_attribute->ReadFromDisk(&val);
+ /*fprintf(fp, "%s%i \n", anIdentChild.ToCString(), val);*/
+ fprintf(fp, "%i \n", val);
+ }
+
+ /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID_END);*/
+ fprintf(fp, "%s\n", ATTRIBUTE_ID_END);
+
+ hdf_attribute->CloseOnDisk();
+}
+
+//############################## ASCII => HDF ################################
+
+//============================================================================
+// function : ConvertFromASCIIToHDF
+// purpose : Converts a file pointed by thePath to HDF format
+// Returns a name of directory where a created HDF file is placed
+// The created file is named "hdf_from_ascii.hdf"
+//============================================================================
+char* HDFascii::ConvertFromASCIIToHDF(const char* thePath)
+{
+ // Get a temporary directory to store a file
+ TCollection_AsciiString aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf");
+ // Build a full file name of temporary file
+ TCollection_AsciiString aFullName = aTmpDir + aFileName;
+
+ HDFfile *hdf_file = new HDFfile(aFullName.ToCString());
+ hdf_file->CreateOnDisk();
+
+ FILE *fp = fopen(thePath, "r");
+ if(!fp) return NULL;
+
+ char type[9];
+ int nbsons, i;
+ fscanf(fp, "%s", type);
+ fscanf(fp, "%i",&nbsons);
+
+ if(strcmp(type, ASCIIHDF_ID) != 0) return NULL;
+
+ for(i = 0; i < nbsons; i++) {
+ char id_of_begin[MAX_ID_SIZE];
+ fscanf(fp, "%s\n", id_of_begin);
+
+ if(strcmp(id_of_begin, GROUP_ID) == 0) {
+ if(!CreateGroupFromASCII(hdf_file, fp)) {
+ cout << "ConvertFromASCIIToHDF : Can not create group number " << i << endl;
+ return NULL;
+ }
+ }
+ else if(strcmp(id_of_begin, DATASET_ID) == 0) {
+ if(!CreateDatasetFromASCII(hdf_file, fp)) {
+ cout << "ConvertFromASCIIToHDF :Can not create dataset number " << i << endl;
+ return NULL;
+ }
+ }
+ else if(strcmp(id_of_begin, ATTRIBUTE_ID) == 0) {
+ if(!CreateAttributeFromASCII(hdf_file, fp)) {
+ cout << "ConvertFromASCIIToHDF :Can not create attribute number " << i << endl;
+ return NULL;
+ }
+ }
+ else
+ cout << "ConvertFromASCIIToHDF : Unrecognized type " << id_of_begin << endl;
+ }
+
+ char id_of_end[MAX_ID_SIZE];
+ fscanf(fp, "%s", id_of_end);
+ if(strcmp(id_of_end, ASCIIHDF_ID_END) != 0) {
+ cout << "ConvertFromASCIIToHDF : Can not find the end ASCII token " << endl;
+ return false;
+ }
+
+ hdf_file->CloseOnDisk();
+ delete hdf_file;
+
+ int length = strlen(aTmpDir.ToCString());
+ char *new_str = new char[ 1+length ];
+ strcpy(new_str , aTmpDir.ToCString()) ;
+
+ return new_str;
+}
+
+
+//============================================================================
+// function : CreateGroupFromASCII
+// purpose : Creates a HDF group from a set attributes situated under theLabel
+//============================================================================
+bool CreateGroupFromASCII(HDFcontainerObject *father, FILE *fp)
+{
+ char name[HDF_NAME_MAX_LEN+1];
+ int nbsons, i;
+ fscanf(fp, "%s %i\n", name, &nbsons);
+
+ char* new_name = restoreName(name);
+
+ HDFgroup* hdf_group = new HDFgroup(new_name, father);
+
+ delete new_name;
+
+ hdf_group->CreateOnDisk();
+
+ for(i = 0; i < nbsons; i++) {
+ char id_of_begin[MAX_ID_SIZE];
+ fscanf(fp, "%s\n", id_of_begin);
+
+ if(strcmp(id_of_begin, GROUP_ID) == 0) {
+ if(!CreateGroupFromASCII(hdf_group, fp)) {
+ cout << "Can not create subgroup " << i << " for group " << name << endl;
+ return false;
+ }
+ }
+ else if(strcmp(id_of_begin, DATASET_ID) == 0) {
+ if(!CreateDatasetFromASCII(hdf_group, fp)) {
+ cout << "Can not create dataset " << i << " for group " << name << endl;
+ return false;
+ }
+ }
+ else if(strcmp(id_of_begin, ATTRIBUTE_ID) == 0) {
+ if(!CreateAttributeFromASCII(hdf_group, fp)) {
+ cout << "Can not create attribute " << i << " for group " << name << endl;
+ return false;
+ }
+ }
+ else
+ cout << "CreateGroupFromASCII : Unrecognized type " << id_of_begin << endl;
+ }
+
+ hdf_group->CloseOnDisk();
+ hdf_group = 0; //will be deleted by father destructor
+
+ char id_of_end[MAX_ID_SIZE];
+ fscanf(fp, "%s\n", id_of_end);
+ if(strcmp(id_of_end, GROUP_ID_END) != 0) {
+ cout << "CreateGroupFromASCII : Invalid end token : " << id_of_end << endl;
+ return false;
+ }
+
+ return true;
+}
+
+
+//============================================================================
+// function : CreateDatasetFromASCII
+// purpose : Creates a HDF dataset from a set attributes situated under theLabel
+//============================================================================
+bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp)
+{
+ char name[HDF_NAME_MAX_LEN+1];
+ hdf_type type;
+ hdf_byte_order order;
+ int nbDim, nbAttr;
+ long i, size;
+
+ fscanf(fp, "%s %i %i\n", name, &type, &nbAttr);
+ char* new_name = restoreName(name);
+
+ fscanf(fp, "%i\n", &nbDim);
+
+ hdf_size* sizeArray = new hdf_size[nbDim];
+ int dim = 0;
+ for(i = 0; i<nbDim; i++) {
+ fscanf(fp, "%i\n", &dim);
+ sizeArray[i] = dim;
+ }
+
+ // order (2-d member) was not written in earlier versions
+ char tmp;
+ int nbRead = fscanf(fp, "%li %i%c", &size, &order, &tmp);
+ if ( nbRead < 2 ) { // fscanf stops before ":"
+ fscanf(fp, "%c", &tmp);
+ order = H5T_ORDER_NONE;
+ }
+ if ( type != HDF_FLOAT64 ) // use order only for FLOAT64
+ order = H5T_ORDER_NONE;
+
+ HDFdataset* hdf_dataset = new HDFdataset(new_name, father,type, sizeArray, nbDim, order);
+ delete new_name;
+ delete sizeArray;
+
+ hdf_dataset->CreateOnDisk();
+
+ if (type == HDF_STRING) {
+ char *val = new char[size+1];
+ fread(val, 1, size, fp);
+ hdf_dataset->WriteOnDisk(val);
+ delete val;
+ } else if (type == HDF_FLOAT64) {
+ hdf_float64* val = new hdf_float64[size];
+ for(i=0; i<size; i++) {
+ read_float64(fp, &(val[i]));
+ }
+ hdf_dataset->WriteOnDisk(val);
+ delete val;
+ } else if(type == HDF_INT64) {
+ hdf_int64* val = new hdf_int64[size];
+ for(i=0; i<size; i++) {
+ fscanf(fp, " %li", &(val[i]));
+ }
+ hdf_dataset->WriteOnDisk(val);
+ delete val;
+ } else if(type == HDF_INT32) {
+ hdf_int32* val = new hdf_int32[size];
+ for(i=0; i<size; i++) {
+ fscanf(fp, " %i", &(val[i]));
+ }
+ hdf_dataset->WriteOnDisk(val);
+ delete val;
+ }
+
+ char token[MAX_ID_SIZE];
+
+ for(i = 0; i < nbAttr; i++) {
+ fscanf(fp, "%s\n", token);
+
+ if(strcmp(token, ATTRIBUTE_ID) == 0) {
+ if(!CreateAttributeFromASCII(hdf_dataset, fp)) {
+ cout << "Can not create attribute " << i << " for dataset " << name << endl;
+ return false;
+ }
+ }
+ else {
+ cout << "CreateGroupFromASCII : Unrecognized type " << token << endl;
+ return false;
+ }
+ }
+
+ fscanf(fp, "%s\n", token);
+ if(strcmp(token, DATASET_ID_END) != 0) {
+ cout << "CreateDatasetFromASCII : Invalid end token : " << token << endl;
+ return false;
+ }
+
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0; //will be deleted by father destructor
+
+ return true;
+}
+
+
+//============================================================================
+// function : CreateAttributeFromASCII
+// purpose : Creates a HDF attribute from a set attributes situated under theLabel
+//============================================================================
+bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp)
+{
+ char name[HDF_NAME_MAX_LEN+1];
+
+ hdf_type type;
+ int size;
+ fscanf(fp, "%s %i %i\n", name, &type, &size);
+ char* new_name = restoreName(name);
+ HDFattribute* hdf_attribute = new HDFattribute(new_name, father, type, size);
+
+ hdf_attribute->CreateOnDisk();
+
+ delete new_name;
+
+ if (type == HDF_STRING) {
+ char tmp;
+ fscanf(fp, "%c", &tmp);
+ char *val = new char[size+1];
+ val[size] = (char)0;
+ fread(val, 1, size, fp);
+ hdf_attribute->WriteOnDisk(val);
+ delete val;
+ } else if (type == HDF_FLOAT64) {
+ hdf_float64 val;
+ read_float64(fp, &val);
+ hdf_attribute->WriteOnDisk(&val);
+ } else if(type == HDF_INT64) {
+ hdf_int64 val;
+ fscanf(fp, "%li", &val);
+ hdf_attribute->WriteOnDisk(&val);
+ } else if(type == HDF_INT32) {
+ hdf_int32 val;
+ fscanf(fp, "%i", &val);
+ hdf_attribute->WriteOnDisk(&val);
+ }
+
+ hdf_attribute->CloseOnDisk();
+ hdf_attribute = 0; //will be deleted by father destructor
+
+
+ char id_of_end[MAX_ID_SIZE];
+ fscanf(fp, "%s\n", id_of_end);
+ if(strcmp(id_of_end, ATTRIBUTE_ID_END) != 0) {
+ cout << "CreateAttributeFromASCII : Invalid end token : " << id_of_end << endl;
+ return false;
+ }
+
+ return true;
+}
+
+
+//============================================================================
+// function : GetTempDir
+// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
+//============================================================================
+char* GetTmpDir()
+{
+ //Find a temporary directory to store a file
+
+ TCollection_AsciiString aTmpDir;
+
+#ifdef WNT
+ char *aTmp;
+ aTmp = getenv("TMP");
+ if(aTmp != NULL)
+ aTmpDir = TCollection_AsciiString(aTmp);
+ else
+ aTmpDir = TCollection_AsciiString("C:\\");
+#else
+ aTmpDir = TCollection_AsciiString("/tmp/");
+#endif
+
+ srand((unsigned int)time(NULL));
+
+ int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
+ TCollection_AsciiString aSubDir(aRND);
+ if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+
+ aTmpDir += aSubDir; //Get RND sub directory
+
+#ifdef WIN32
+ if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+#else
+ if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+#endif
+
+ OSD_Path aPath(aTmpDir);
+ OSD_Directory aDir(aPath);
+
+ for(aRND = 0; aDir.Exists(); aRND++) {
+ aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
+ aPath = OSD_Path(aTmpDir);
+ aDir = OSD_Directory(aPath);
+ }
+
+ OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
+ aDir.Build(aProtection);
+
+ int length = strlen(aTmpDir.ToCString());
+ char *new_str = new char[ 1+length ];
+ strcpy(new_str , aTmpDir.ToCString());
+
+ return new_str;
+}
+
+char* makeName(char* name)
+{
+ TCollection_AsciiString aName(name), aNewName;
+ Standard_Integer i, length = aName.Length();
+ char replace = (char)19;
+
+ for(i=1; i<=length; i++) {
+ if(aName.Value(i) == ' ') aNewName+=replace;
+ else aNewName += aName.Value(i);
+ }
+
+ length = strlen(aNewName.ToCString());
+ char *new_str = new char[ 1+length ];
+ strcpy(new_str , aNewName.ToCString()) ;
+ return new_str;
+}
+
+char* restoreName(char* name)
+{
+ TCollection_AsciiString aName(name), aNewName;
+ Standard_Integer i, length = aName.Length();
+ char replace = (char)19;
+
+ for(i=1; i<=length; i++) {
+ if(aName.Value(i) == replace) aNewName+=' ';
+ else aNewName += aName.Value(i);
+ }
+
+ length = strlen(aNewName.ToCString());
+ char *new_str = new char[ 1+length ];
+ strcpy(new_str , aNewName.ToCString()) ;
+ return new_str;
+}
+
+void write_float64(FILE* fp, hdf_float64* value)
+{
+ unsigned char* array = (unsigned char*)value;
+ for(int i = 0; i < sizeof(hdf_float64); i++) {
+ unsigned tmp = (unsigned short)array[i];
+ fprintf(fp, " %2x", tmp);
+ }
+}
+
+void read_float64(FILE* fp, hdf_float64* value)
+{
+ unsigned char* array = (unsigned char*)value;
+ for(int i = 0; i < sizeof(hdf_float64); i++) {
+ unsigned tmp;
+ fscanf(fp, " %x", &tmp);
+ array[i] = (unsigned char)tmp;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : HDFascii.hxx
+// Created : Mon Jun 10 16:24:50 2003
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : HDFPersist
+// Copyright : Open CASCADE
+
+
+#ifndef __HDFascii_H__
+#define __HDFascii_H__
+
+#include <Standard_Macro.hxx>
+
+
+class Standard_EXPORT HDFascii
+{
+public:
+
+ static char* ConvertFromHDFToASCII(const char* thePath,
+ bool isReplaced = true,
+ const char* theExtension = NULL);
+
+ static char* ConvertFromASCIIToHDF(const char* thePath);
+
+ static bool isASCII(const char* thePath);
+};
+#endif
--- /dev/null
+// SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : HDFdataset.cc
+// Module : SALOME
+
+extern "C"
+{
+#include "hdfi.h"
+#include <string.h>
+}
+#include "HDFdataset.hxx"
+#include "HDFcontainerObject.hxx"
+#include "HDFexception.hxx"
+
+#include <iostream>
+using namespace std;
+
+herr_t dataset_attr(hid_t loc_id, const char *attr_name, void *operator_data)
+{
+ *(char**)operator_data = new char[strlen(attr_name)+1];
+ strcpy(*(char**)operator_data, attr_name);
+ return 1;
+}
+
+HDFdataset::HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
+ hdf_size dim[], int dimsize, hdf_byte_order order)
+ : HDFinternalObject(name)
+{
+ int i;
+
+ _father = father;
+ _fid = _father->GetId();
+ _father->AddSon(this);
+ _type = type;
+ _ndim = dimsize;
+ _dim = new hdf_size[dimsize];
+ _byte_order = order;
+ _size = 1;
+ _attribute = NULL;
+ for (i=0;i<dimsize;i++)
+ {
+ _dim[i] = dim[i];
+ _size = _size * _dim[i];
+ }
+}
+
+
+HDFdataset::HDFdataset(char *name,HDFcontainerObject *father)
+ : HDFinternalObject(name)
+{
+ _father = father;
+ _fid = _father->GetId();
+ _father->AddSon(this);
+ _type = HDF_NONE;
+ _ndim = -1;
+ _dim = 0;
+ _byte_order = H5T_ORDER_ERROR;
+ _size = -1;
+ _attribute = NULL;
+}
+
+HDFdataset::~HDFdataset()
+{
+ delete [] _dim;
+}
+
+void HDFdataset::CreateOnDisk()
+{
+ if ((_id = HDFdatasetCreate(_fid,_name,_type,_dim,_ndim,_byte_order)) < 0)
+ throw HDFexception("Can't create dataset");
+}
+
+void HDFdataset::OpenOnDisk()
+{
+ if ((_id = HDFdatasetOpen(_fid,_name)) < 0)
+ throw HDFexception("Can't open dataset");
+}
+
+void HDFdataset::CloseOnDisk()
+{
+ hdf_err ret;
+
+ if ((ret = HDFdatasetClose(_id)) < 0)
+ throw HDFexception("Can't close dataset");
+ _id = -1;
+}
+
+void HDFdataset::WriteOnDisk(void *values)
+{
+ hdf_err ret;
+
+ if ((ret = HDFdatasetWrite(_id,values)) < 0)
+ throw HDFexception("Can't write dataset");
+
+}
+
+void HDFdataset::ReadFromDisk(void *values)
+{
+ hdf_err ret;
+
+ if ((ret = HDFdatasetRead(_id,values)) < 0)
+ throw HDFexception("Can't read dataset");
+}
+
+HDFcontainerObject *HDFdataset::GetFather()
+{
+ return _father;
+}
+
+hdf_type HDFdataset::GetType()
+{
+ if (_type == HDF_NONE)
+ if ((_type = HDFdatasetGetType(_id)) == HDF_NONE)
+ throw HDFexception("Can't determine the type of data in the dataset");
+
+ return _type;
+}
+
+int HDFdataset::nDim()
+{
+ if (_ndim == -1)
+ if ((_ndim = HDFdatasetGetnDim(_id)) < 0)
+ throw HDFexception("Can't determine the dataset dimensions number");
+
+ return _ndim;
+}
+
+void HDFdataset::GetDim(hdf_size dim[])
+{
+ int i;
+ int ndim;
+ hdf_err ret;
+
+ if (_dim == 0)
+ {
+ if (_ndim == -1)
+ ndim = HDFdatasetGetnDim(_id);
+ else
+ ndim = _ndim;
+ _dim = new hdf_size[ndim];
+ if ((ret == HDFdatasetGetDim(_id,_dim)) < 0)
+ throw HDFexception("Can't determine the size dimensions of the dataset ");
+ }
+
+ for (i=0;i<_ndim;i++)
+ dim[i] = _dim[i];
+}
+
+int HDFdataset::GetSize()
+{
+ int size_type;
+
+ if (_size == -1)
+ {
+ if ((_size = HDFdatasetGetSize(_id)) < 0)
+ throw HDFexception("Can't determine the size of the dataset");
+
+ if (_type == HDF_NONE)
+ if ((_type = HDFdatasetGetType(_id)) == HDF_NONE)
+ throw HDFexception("Can't determine the size of the dataset");
+
+ switch (_type)
+ {
+ case HDF_INT32 :
+ size_type = 4;
+ break;
+
+ case HDF_INT64 :
+ case HDF_FLOAT64 :
+ size_type = 8;
+ break;
+
+ default :
+ size_type = 1;
+ }
+ _size = _size / size_type;
+ }
+
+ return _size;
+}
+
+hdf_byte_order HDFdataset::GetOrder()
+{
+ if (_byte_order < 0 )
+ if ((_byte_order = HDFdatasetGetOrder( _id )) < 0)
+ throw HDFexception("Can't determine the byte order of the dataset");
+ return _byte_order;
+}
+
+hdf_object_type HDFdataset::GetObjectType()
+{
+ return HDF_DATASET;
+}
+
+
+int HDFdataset::nAttributes()
+{
+ int nbAttrs = H5Aget_num_attrs(_id);
+ if(nbAttrs <= 0) nbAttrs = 0;
+ return nbAttrs;
+}
+
+
+char* HDFdataset::GetAttributeName(unsigned idx)
+{
+ int nbAttrs = nAttributes();
+ if(nbAttrs == 0) return NULL;
+ H5Aiterate(_id, &idx, dataset_attr, &_attribute);
+ return _attribute;
+}
+
--- /dev/null
+// SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : HDFdataset.hxx
+// Module : SALOME
+
+#ifndef HDFDATASET_HXX
+#define HDFDATASET_HXX
+
+extern "C"
+{
+#include "HDFtypes.h"
+}
+#include "HDFinternalObject.hxx"
+#include "HDFcontainerObject.hxx"
+#include <Standard_Macro.hxx>
+
+class Standard_EXPORT HDFdataset : public HDFinternalObject
+{
+private :
+ HDFcontainerObject *_father;
+ hdf_idt _fid;
+ hdf_type _type;
+ hdf_size *_dim;
+ hdf_byte_order _byte_order;
+ int _size;
+ int _ndim;
+ char* _attribute;
+
+public:
+ HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
+ hdf_size dim[],int dimsize, hdf_byte_order order = H5T_ORDER_NONE);
+
+ HDFdataset(char *name,HDFcontainerObject *father);
+ virtual ~HDFdataset();
+
+ void CreateOnDisk();
+ void OpenOnDisk();
+ void CloseOnDisk();
+
+ void WriteOnDisk(void *values);
+ void ReadFromDisk(void *values);
+
+ HDFcontainerObject *GetFather();
+ hdf_type GetType();
+ int nDim();
+ void GetDim(hdf_size dim[]);
+ int GetSize();
+ hdf_object_type GetObjectType();
+ hdf_byte_order GetOrder();
+
+ int nAttributes();
+ char* GetAttributeName(unsigned idx);
+};
+
+#endif
--- /dev/null
+/*----------------------------------------------------------------------------
+SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+
+ Copyright (C) 2003 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.
+
+ 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+
+ File : HDFdatasetCreate.c
+Module : SALOME
+----------------------------------------------------------------------------*/
+
+#include "hdfi.h"
+
+/*
+ * - Name : HDFdatasetCreate
+ * - Description : creates a HDF dataset
+ * - Parameters :
+ * - pid (IN) : father ID
+ * - name (IN) : dataset name
+ * - type (IN) : dataset type (HDF_STRING,HDF_INT32,HDF_INT64,HDF_FLOAT64)
+ * - dimd (IN) : dataset size
+ * - order(IN) : byte order (H5T_ORDER_NONE, H5T_ORDER_LE, H5T_ORDER_BE)
+ * - Result :
+ * - if success : returns dataset ID
+ * - if failure : -1
+ */
+
+hdf_idt HDFdatasetCreate(hdf_idt pid,char *name,hdf_type type,
+ hdf_size *dimd, int ndim, hdf_byte_order order)
+{
+ hdf_idt dataset, dataspace = 0;
+ hdf_err ret;
+ hdf_idt type_hdf, new_type_hdf = -1;
+
+ switch(type)
+ {
+ case HDF_FLOAT64 :
+#ifdef PCLINUX
+ type_hdf = H5T_IEEE_F64BE;
+#else
+ type_hdf = H5T_IEEE_F64LE;
+#endif
+ break;
+
+ case HDF_INT32 :
+#ifdef PCLINUX
+ type_hdf = H5T_STD_I32BE;
+#else
+ type_hdf = H5T_NATIVE_INT;
+#endif
+ break;
+
+ case HDF_INT64 :
+ type_hdf = H5T_NATIVE_LONG;
+ break;
+
+ case HDF_STRING :
+ if((new_type_hdf = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if((ret = H5Tset_size(new_type_hdf,1)) < 0)
+ return -1;
+ break;
+
+ default :
+ return -1;
+ }
+
+ /* set order */
+ if ( order != H5T_ORDER_ERROR &&
+ order != H5T_ORDER_NONE &&
+ type != HDF_STRING )
+ {
+ if (( new_type_hdf = H5Tcopy( type_hdf )) < 0 )
+ return -1;
+ if (( ret = H5Tset_order (new_type_hdf, order )) < 0 )
+ return -1;
+ }
+
+ if ((dataset = H5Dopen(pid,name)) < 0)
+ {
+ if ((dataspace = H5Screate_simple(ndim, dimd, NULL)) < 0)
+ return -1;
+ if ((dataset = H5Dcreate(pid,name,
+ new_type_hdf < 0 ? type_hdf : new_type_hdf,
+ dataspace, H5P_DEFAULT)) < 0)
+ return -1;
+ }
+ else
+ return -1;
+
+ if ( ! (new_type_hdf < 0) && (ret = H5Tclose(new_type_hdf)) < 0)
+ return -1;
+ if ((ret = H5Sclose(dataspace)) < 0)
+ return -1;
+
+ return dataset;
+}
--- /dev/null
+/*----------------------------------------------------------------------------
+SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+
+ Copyright (C) 2003 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.
+
+ 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+
+ File : HDFdatasetGetOrder.c
+Module : SALOME
+----------------------------------------------------------------------------*/
+
+#include "hdfi.h"
+#include <hdf5.h>
+
+hdf_byte_order
+HDFdatasetGetOrder(hdf_idt dataset_id)
+{
+ hdf_idt type_id;
+ hdf_byte_order order;
+
+ if ((type_id = H5Dget_type(dataset_id)) < 0)
+ return -1;
+
+ order = H5Tget_order(type_id);
+
+ H5Tclose(type_id);
+
+ return order;
+}
--- /dev/null
+/*----------------------------------------------------------------------------------
+ SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+
+ Copyright (C) 2003 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.
+
+ 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+
+ File : HDFtypes.h
+ Module : SALOME
+----------------------------------------------------------------------------------*/
+
+#ifndef HDFTYPES_H
+#define HDFTYPES_H
+
+#include <hdf5.h>
+
+/* max length of a HDF object */
+#define HDF_NAME_MAX_LEN 100
+
+/* HDF 5 types */
+typedef size_t hdf_size_type;
+typedef H5T_class_t hdf_class_type;
+typedef hsize_t hdf_size;
+typedef hid_t hdf_idt;
+typedef herr_t hdf_err;
+typedef hbool_t hdf_bool;
+typedef H5T_order_t hdf_byte_order;
+
+typedef int hdf_int32;
+typedef long hdf_int64;
+typedef double hdf_float64;
+
+/* Access Mode */
+typedef enum {HDF_RDONLY,HDF_RDWR} hdf_access_mode;
+
+/* Values types for HDF datasets and attributes */
+typedef enum {HDF_NONE,HDF_STRING, HDF_INT32, HDF_INT64, HDF_FLOAT64} hdf_type;
+/* - HDF_STRING : C string
+ - HDF_INT32 : 32 bits integer
+ - HDF_INT64 : 64 bits integer
+ - HDF_FLOAT64 : IEEE 64 bits float
+*/
+
+/* HDF object types */
+typedef enum {HDF_OBJECT,HDF_FILE,HDF_GROUP,HDF_DATASET,
+ HDF_ATTRIBUTE} hdf_object_type;
+
+#endif /* HDFTYPES_H */
--- /dev/null
+# SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS = \
+ HDFattribute.hxx \
+ HDFcontainerObject.hxx \
+ HDFdataset.hxx \
+ HDFexplorer.hxx \
+ HDFexception.hxx \
+ HDFfile.hxx \
+ HDFgroup.hxx \
+ HDFinternalObject.hxx \
+ HDFobject.hxx \
+ HDFOI.hxx \
+ HDFtypes.h \
+ HDFconvert.hxx \
+ hdfi.h \
+ HDFascii.hxx
+
+# Libraries targets
+
+LIB = libSalomeHDFPersist.la
+LIB_SRC = \
+ HDFfileCreate.c \
+ HDFfileClose.c \
+ HDFfileOpen.c \
+ HDFfileMount.c \
+ HDFfileUmount.c \
+ HDFgroupCreate.c \
+ HDFgroupOpen.c \
+ HDFgroupClose.c \
+ HDFdatasetOpen.c \
+ HDFdatasetClose.c \
+ HDFdatasetCreate.c \
+ HDFdatasetWrite.c \
+ HDFdatasetRead.c \
+ HDFdatasetGetDim.c \
+ HDFdatasetGetSize.c \
+ HDFdatasetGetType.c \
+ HDFdatasetGetnDim.c \
+ HDFdatasetGetOrder.c \
+ HDFattrOpen.c \
+ HDFattrClose.c \
+ HDFattrWrite.c \
+ HDFattrCreate.c \
+ HDFattrRead.c \
+ HDFattrGetType.c \
+ HDFattrGetSize.c \
+ HDFerrorModeLock.c \
+ HDFnObjects.c \
+ HDFobjectIdentify.c \
+ HDFobjectType.c \
+ HDFobject.cc \
+ HDFinternalObject.cc \
+ HDFattribute.cc \
+ HDFcontainerObject.cc \
+ HDFdataset.cc \
+ HDFfile.cc \
+ HDFgroup.cc \
+ HDFexplorer.cc \
+ HDFconvert.cc \
+ HDFascii.cc
+
+#BIN = test9 test8
+
+CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) -DPCLINUX
+LDFLAGS+= $(CAS_KERNEL) $(HDF5_LIBS)
+
+@CONCLUDE@
--- /dev/null
+/*----------------------------------------------------------------------
+ SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+
+ Copyright (C) 2003 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.
+
+ 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+ File : hdfi.h
+ Module : SALOME
+ ----------------------------------------------------------------------*/
+
+#ifndef HDFI_H
+#define HDFI_H
+
+#include "HDFtypes.h"
+
+/* HDF C INTERFACE */
+
+/* File Interface */
+extern
+hdf_idt HDFfileCreate(char *name);
+
+extern
+hdf_err HDFfileClose(hdf_idt fid);
+
+extern
+hdf_idt HDFfileOpen(char *name,hdf_access_mode access_mode);
+
+extern
+hdf_err HDFfileMount(hdf_idt id,const char *name,hdf_idt fid);
+
+extern
+hdf_err HDFfileUmount(hdf_idt id,const char *name);
+
+/* Group Interface */
+extern
+hdf_idt HDFgroupCreate(hdf_idt pid, char *name);
+
+extern
+hdf_idt HDFgroupOpen(hdf_idt pid, char *name);
+
+extern
+hdf_err HDFgroupClose(hdf_idt id);
+
+/* DataSet Interface */
+extern
+hdf_idt HDFdatasetOpen(hdf_idt pid,char *name);
+
+extern
+hdf_err HDFdatasetClose(hdf_idt id);
+
+extern
+hdf_idt HDFdatasetCreate(hdf_idt pid,char *name,hdf_type type,
+ hdf_size *dimd, int ndim, hdf_byte_order order);
+
+extern
+hdf_err HDFdatasetWrite(hdf_idt id, void *val);
+
+extern
+hdf_err HDFdatasetRead(hdf_idt id, void *val);
+
+extern
+hdf_type HDFdatasetGetType(hdf_idt id);
+
+extern
+int HDFdatasetGetnDim(hdf_idt id);
+
+extern
+hdf_err HDFdatasetGetDim(hdf_idt id,hdf_size dim[]);
+
+extern
+int HDFdatasetGetSize(hdf_idt id);
+
+extern
+hdf_byte_order HDFdatasetGetOrder(hdf_idt id);
+
+/* Attribute interface */
+extern
+hdf_idt HDFattrOpen(hdf_idt pid,char *name);
+
+extern
+hdf_err HDFattrClose(hdf_idt id);
+
+extern
+hdf_idt HDFattrCreate(hdf_idt pid,char *name,hdf_type type, size_t size);
+
+extern
+hdf_err HDFattrWrite(hdf_idt id,void *val);
+
+extern
+hdf_err HDFattrRead(hdf_idt id,void *val);
+
+extern
+hdf_type HDFattrGetType(hdf_idt id);
+
+extern
+hdf_type HDFattrGetSize(hdf_idt id);
+
+/* HDF Tools */
+extern
+void HDFerrorModeLock();
+
+extern
+hdf_err
+HDFnObjects(hdf_idt fid,char *path,int *n);
+
+extern
+hdf_err HDFobjectIdentify(hdf_idt fid,char *path,int i,char *name);
+
+extern
+hdf_err HDFobjectType(hdf_idt id, char *name, hdf_object_type *type);
+
+#endif /* HDFI_H */
--- /dev/null
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Sergey RUIN, OCC
+# Module : SALOME
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py salome_shared_modules.py batchmode_salome.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py salome_ComponentGUI.py omnipatch.py
+
+EXPORT_SHAREDPYSCRIPTS=kernel_shared_modules.py
+
+@CONCLUDE@
--- /dev/null
+"""
+
+"""
+import import_hook
+
+import glob,os,sys,string,imp
+
+from import_hook import register_name
+from import_hook import register_pattern
+
+register_name("qt")
+register_name("libSALOME_LifeCycleCORBA")
+register_pattern(lambda(x):x.endswith("_idl"))
+register_pattern(lambda(x):x.endswith("_Swig"))
+
+register_name("CORBA")
+from omniORB import CORBA
+
+register_name("omniORB")
+import omniORB
+
+register_name("CosNaming")
+import CosNaming
+
+register_name("omnipatch")
+import omnipatch
+
+import Engines
+import SALOME
+import SALOMEDS
+import SALOME_ModuleCatalog
+
+def init_shared_modules():
+ """
+ This function initializes shared modules that need to be
+ """
+ # EDF-CCAR:
+ # Problem with omniORB : omniORB creates a C Python module named _omnipy
+ # this module has sub-modules : omni_func, ...
+ # _omnipy is quite a package but import with Python sub-interpreters does not seem to work
+ # To make it work we need to add those sub-modules in sys.modules
+ import sys
+ import _omnipy
+ sys.modules["_omnipy.omni_func"]=_omnipy.omni_func
+ sys.modules["_omnipy.poa_func"]=_omnipy.poa_func
+ sys.modules["_omnipy.poamanager_func"]=_omnipy.poamanager_func
+ sys.modules["_omnipy.orb_func"]=_omnipy.orb_func
+
--- /dev/null
+"""
+ This patch of omniORB is made to make it work with multiple interpreters
+ and to correct the problem of incomplete import of CORBA packages
+ in some situations common in SALOME
+
+ This patch add or modify functions in omniORB module.
+
+ In multiple interpreters context, omniORB module is meant to be shared among
+ all interpreters
+"""
+import sys,string,imp
+import omniORB
+# Map of partially-opened modules
+_partialModules = {}
+# Map of modules to share
+shared_imported={}
+
+# Function to return a Python module for the required IDL module name
+def openModule(mname, fname=None):
+ # Salome modification start
+ # Be sure to use the right module dictionnary
+ import sys
+ # Salome modification end
+
+ if mname == "CORBA":
+ mod = sys.modules["omniORB.CORBA"]
+
+ elif sys.modules.has_key(mname):
+ mod = sys.modules[mname]
+
+ if _partialModules.has_key(mname):
+ pmod = _partialModules[mname]
+ mod.__dict__.update(pmod.__dict__)
+ del _partialModules[mname]
+
+ elif _partialModules.has_key(mname):
+ mod = _partialModules[mname]
+
+ else:
+ mod = newModule(mname)
+
+ # Salome modification start
+ shared_imported[mname]=mod
+ # Salome modification end
+
+ if not hasattr(mod, "__doc__") or mod.__doc__ is None:
+ mod.__doc__ = "omniORB IDL module " + mname + "\n\n" + \
+ "Generated from:\n\n"
+
+ if fname is not None:
+ mod.__doc__ = mod.__doc__ + " " + fname + "\n"
+
+ return mod
+
+# Function to create a new module, and any parent modules which do not
+# already exist
+def newModule(mname):
+ # Salome modification start
+ # Be sure to use the right module dictionnary
+ import sys
+ # Salome modification end
+
+ mlist = string.split(mname, ".")
+ current = ""
+ mod = None
+
+ for name in mlist:
+ current = current + name
+
+ if sys.modules.has_key(current):
+ mod = sys.modules[current]
+
+ elif _partialModules.has_key(current):
+ mod = _partialModules[current]
+
+ else:
+ newmod = imp.new_module(current)
+ if mod: setattr(mod, name, newmod)
+ _partialModules[current] = mod = newmod
+
+ current = current + "."
+
+ return mod
+
+# Function to update a module with the partial module store in the
+# partial module map
+def updateModule(mname):
+ if _partialModules.has_key(mname):
+ pmod = _partialModules[mname]
+ mod = sys.modules[mname]
+ mod.__dict__.update(pmod.__dict__)
+ del _partialModules[mname]
+
+omniORB.updateModule=updateModule
+omniORB.newModule=newModule
+omniORB.openModule=openModule
+
--- /dev/null
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : salome.py
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+import omnipatch
+from salome_kernel import *
+from salome_study import *
+from salome_iapp import *
+
+salome_initial=1
+def salome_init(theStudyId=0):
+ """
+ Performs only once SALOME general purpose intialisation for scripts.
+ optional argument : theStudyId
+ When in embedded interpreter inside IAPP, theStudyId is not used
+ When used without GUI (external interpreter)
+ 0 : create a new study (default).
+ n (>0) : try connection to study with Id = n, or create a new one
+ if study not found.
+ If study creation, its Id may be different from theStudyId !
+ Provides:
+ orb reference to CORBA
+ lcc a LifeCycleCorba instance
+ naming_service a naming service instance
+ cm reference to the container manager
+ sg access to SALOME GUI (when linked with IAPP GUI)
+ myStudyManager the study manager
+ myStudyId active study identifier
+ myStudy active study itself (CORBA reference)
+ myStudyName active study name
+ """
+ global salome_initial
+ global orb, lcc, naming_service, cm
+ global sg
+ global myStudyManager, myStudyId, myStudy, myStudyName
+
+ if salome_initial:
+ salome_initial=0
+ sg = salome_iapp_init()
+ orb, lcc, naming_service, cm = salome_kernel_init()
+ myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
+
--- /dev/null
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : salome_shared_modules.py
+# Module : SALOME
+
+from SALOME_utilities import *
+
+"""
+This module with help of import_hook and *_shared_modules
+filters imports when using the embedded Python interpretor.
+
+Some imports can't be done more than once.
+This is related to the multi study feature that is implemented
+by using the Python multi interpreter feature.
+Some modules register objects or classes by calling modules
+implemented in C. These operations can't be done multiple times.
+So it's very important to control these imports.
+
+Examples:
+ - PyQt : import qt calls a C module to register classes
+ - OmniORB : import *_idl calls a C module to register CORBA interfaces
+
+Usage:
+ - First : the module salome_shared_modules is imported by main Python interpretor.
+ It will keep a dictionnary and a list that are shared among all
+ the subinterpretors and imports import_hook module that replaces
+ the standard import mechanism par one that prevents more than one import
+ for some modules identified by name (call register_name) or by a
+ validator (call register_pattern).
+
+ Calls to register_name and register_pattern are done in modules named *_shared_modules
+ that could be found in the path SALOMEPATH
+
+"""
+import glob,os,sys
+
+import import_hook
+# shared_imported, patterns, register_name, register_pattern
+# will be shared by all Python sub interpretors
+from omnipatch import shared_imported
+import_hook.shared_imported=shared_imported
+from import_hook import patterns
+from import_hook import register_name
+from import_hook import register_pattern
+
+register_name("salome_shared_modules")
+
+# Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set.
+salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR"))
+
+list_modules=[]
+
+# Import all *_shared_modules in the path and store them in list_modules
+path=salome_path.split(":")
+for rep in path:
+ # Import all *_shared_modules in rep
+ for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")):
+ try:
+ name=os.path.splitext(os.path.basename(f))[0]
+ register_name(name)
+ m=__import__(name)
+ list_modules.append(m)
+ except:
+ pass
+
+#
+# If shared modules have been imported before installing import mechanism
+# we add them to shared_imported
+#
+for name,module in sys.modules.items():
+ if import_hook.is_shared(name) and shared_imported.get(name) is None:
+ #print "Module shared added to shared_imported: ",name
+ shared_imported[name]=module
+
--- /dev/null
+# SALOME SALOME_SWIG : binding of C++ implementation and Python
+#
+# Copyright (C) 2003 CEA/DEN, EDF R&D
+#
+#
+#
+# File : salome_test.py
+# Module : SALOME
+
+print "Test the application loading GEOM, SMESH, VISU, MED, components and doing some"
+print "operation within the components."
+
+import salome
+from salome import sg
+import SALOMEDS
+import os
+
+import SALOME_ModuleCatalog
+
+print "======================================================================"
+print " Get Catalog "
+print "======================================================================"
+obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
+catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
+
+print "======================================================================"
+print " Create Study "
+print "======================================================================"
+
+comp = catalog.GetComponent("GEOM")
+if comp is None:
+ raise RuntimeError,"Component GEOM not found in Module Catalog."
+
+import geompy
+
+print "================================="
+print " create AttributeReal "
+print "================================="
+A = geompy.myBuilder.FindOrCreateAttribute(geompy.father, "AttributeReal")
+if A == None :
+ raise RuntimeError, "Can't create AttributeReal attribute"
+A = A._narrow(SALOMEDS.AttributeReal)
+A.SetValue(0.0001)
+if A.Value() != 0.0001:
+ raise RuntimeError, "Error : wrong value of AttributeReal"
+
+print
+print " =========== Test Geometry =========================="
+print
+
+print "==================================="
+print " define a box"
+print "==================================="
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box,"box")
+
+print
+print "============= Test SMESH ============================="
+print
+
+import StdMeshers
+
+comp = catalog.GetComponent("SMESH")
+if comp is None:
+ raise RuntimeError,"Component SMESH not found in Module Catalog."
+
+comp = catalog.GetComponent("MED")
+if comp is None:
+ raise RuntimeError,"Component MED not found in Module Catalog."
+
+import SMESH
+
+geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
+myBuilder = salome.myStudy.NewBuilder()
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId);
+
+ShapeTypeCompSolid = 1
+ShapeTypeSolid = 2
+ShapeTypeShell = 3
+ShapeTypeFace = 4
+ShapeTypeWire = 5
+ShapeTypeEdge = 6
+ShapeTypeVertex = 7
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box,"box")
+
+# ---- add first face of box in study
+
+subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
+face=subShapeList[0]
+name = geompy.SubShapeName(face, box)
+print name
+idface=geompy.addToStudyInFather(box,face,name)
+
+# ---- add shell from box in study
+
+subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+print name
+idshell=geompy.addToStudyInFather(box,shell,name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
+edge=edgeList[0];
+name = geompy.SubShapeName(edge, face)
+print name
+idedge=geompy.addToStudyInFather(face,edge,name)
+
+
+# ---- SMESH
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+print "-------------------------- LocalLength"
+hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" )
+hypLen1.SetLength(100)
+print hypLen1.GetName()
+print hypLen1.GetId()
+print hypLen1.GetLength()
+
+smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100")
+
+print "-------------------------- NumberOfSegments"
+hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
+hypNbSeg1.SetNumberOfSegments(7)
+print hypNbSeg1.GetName()
+print hypNbSeg1.GetId()
+print hypNbSeg1.GetNumberOfSegments()
+
+smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7")
+
+print "-------------------------- MaxElementArea"
+hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
+hypArea1.SetMaxElementArea(2500)
+print hypArea1.GetName()
+print hypArea1.GetId()
+print hypArea1.GetMaxElementArea()
+
+smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500")
+
+print "-------------------------- MaxElementArea"
+hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
+hypArea2.SetMaxElementArea(500)
+print hypArea2.GetName()
+print hypArea2.GetId()
+print hypArea2.GetMaxElementArea()
+
+smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500")
+
+print "-------------------------- Regular_1D"
+algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" )
+listHyp=algoReg.GetCompatibleHypothesis()
+for hyp in listHyp:
+ print hyp
+print algoReg.GetName()
+print algoReg.GetId()
+
+smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" )
+
+print "-------------------------- MEFISTO_2D"
+algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" )
+listHyp=algoMef.GetCompatibleHypothesis()
+for hyp in listHyp:
+ print hyp
+print algoMef.GetName()
+print algoMef.GetId()
+
+smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D" )
+
+# ---- add hypothesis to box
+
+print "-------------------------- add hypothesis to box"
+box=salome.IDToObject(idbox)
+mesh = smesh.CreateMesh(box)
+
+smeshgui.SetName( salome.ObjectToID(mesh), "MeshBox" );
+
+ret=mesh.AddHypothesis(box,algoReg)
+print ret
+ret=mesh.AddHypothesis(box,algoMef)
+print ret
+
+
+ret=mesh.AddHypothesis(box,hypNbSeg1)
+print ret
+ret=mesh.AddHypothesis(box,hypArea1)
+print ret
+
+
+# ---- add hypothesis to edge
+
+print "-------------------------- add hypothesis to edge"
+edge=salome.IDToObject(idedge)
+submesh=mesh.GetSubMesh(edge, "SubMeshEdge")
+
+ret=mesh.AddHypothesis(edge,algoReg)
+print ret
+ret=mesh.AddHypothesis(edge,hypLen1)
+print ret
+
+print "-------------------------- add hypothesis to face"
+face=salome.IDToObject(idface)
+submesh = mesh.GetSubMesh(face, "SubMeshFace")
+
+ret=mesh.AddHypothesis(face,hypArea2)
+print ret
+
+smesh.Compute(mesh, box)
+sg.updateObjBrowser(1);
+
+print
+print "============= Test Supervisor ============================="
+print
+
+comp = catalog.GetComponent("SUPERV")
+if comp is None:
+ raise RuntimeError,"Component SUPERV not found in Module Catalog."
+
+from SuperV import *
+import SALOMEDS
+myStudy = salome.myStudy
+myBuilder = myStudy.NewBuilder()
+
+SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV")
+father = myStudy.FindComponent("SUPERV")
+if father is None:
+ father = myBuilder.NewComponent("SUPERV")
+ A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
+ FName = A1._narrow(SALOMEDS.AttributeName)
+ FName.SetValue( salome.sg.getComponentUserName("SUPERV") )
+ A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap");
+ aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
+ aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" );
+ myBuilder.DefineComponentInstance(father,SuperVision)
+
+def addStudy(ior):
+ dataflow = SuperVision.getStreamGraph(ior)
+ name=dataflow.Name()
+ itr = myStudy.NewChildIterator(father)
+ while itr.More():
+ item=itr.Value()
+ res,A=item.FindAttribute("AttributeName")
+ if res:
+ aName = A._narrow(SALOMEDS.AttributeName)
+ if aName.Value() == name :
+ print myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
+ A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
+ print "A = ", A
+ if A is not None :
+ #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
+ anIOR = A._narrow(SALOMEDS.AttributeIOR);
+ print "anIOR.SetValue(dataflow.getIOR())"
+ anIOR.SetValue(dataflow.getIOR())
+ return
+ itr.Next()
+ obj = myBuilder.NewObject(father)
+ A=myBuilder.FindOrCreateAttribute(obj, "AttributeName")
+ aName=A._narrow(SALOMEDS.AttributeName)
+ aName.SetValue(name)
+ A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR")
+ anIOR = A._narrow(SALOMEDS.AttributeIOR)
+ anIOR.SetValue(dataflow.getIOR())
+
+import os
+dir= os.getenv("DATA_DIR")
+if dir == None:
+ raise RuntimeError, "DATA_DIR is not defined"
+xmlfile = dir + "/Superv/Graphs/GraphGeomEssaiGates.xml"
+print "Load dataflow from the file : "
+print xmlfile
+print
+
+myGraph = StreamGraph ( xmlfile )
+
+# This DataFlow is "valid" : no loop, correct links between Nodes etc...
+print "myGraph.IsValid() = ", myGraph.IsValid()
+
+# Get Nodes
+myGraph.PrintNodes()
+
+# This DataFlow is "executable" : all pending Ports are defined with Datas
+print myGraph.IsExecutable()
+
+# Starts only execution of that DataFlow and gets control immediatly
+print myGraph.Run()
+
+# That DataFlow is running ==> 0 (false)
+print myGraph.IsDone()
+
+# Events of execution :
+aStatus,aNode,anEvent,aState = myGraph.Event()
+while aStatus :
+ print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
+ aStatus,aNode,anEvent,aState = myGraph.Event()
+print "myGraph.IsDone() = ",myGraph.IsDone()
+
+# Wait for Completion (but it is already done after event loop ...)
+print "Done : ",myGraph.DoneW()
+
+print " "
+#print "Type : print myGraph.IsDone()"
+#print " If execution is finished ==> 1 (true)"
+res=myGraph.IsDone()
+if res != 1:
+ raise RuntimeError, "myGraph.Run() is not done"
+
+print " "
+print "Type : myGraph.PrintPorts()"
+print " to see input and output values of the graph"
+myGraph.PrintPorts()
+
+# Export will create newsupervisionexample.xml and the corresponding .py file
+tmpdir=os.getenv("TmpDir")
+if tmpdir is None:
+ tmpdir="/tmp"
+file = tmpdir + "/newsupervisionexample"
+print "--------------\n"+file+"\n--------------\n"
+myGraph.Export(file)
+
+ior = salome.orb.object_to_string(myGraph.G)
+addStudy(ior)
+
+GraphName = myGraph.Name()
+print "Befor save ",
+#nodes = myGraph.Nodes()
+nodes = myGraph.G.Nodes().FNodes
+length_bs = len(nodes)
+print "ListOfNodes length = ", length_bs
+names=[]
+for node in nodes:
+ names.append(node.Name())
+print names
+
+# Graph creation
+GraphInLines = StreamGraph( 'GraphInLines' )
+GraphInLines.SetName( 'GraphInLines' )
+GraphInLines.SetAuthor( '' )
+GraphInLines.SetComment( '' )
+GraphInLines.Coords( 0 , 0 )
+
+# Creation of InLine Nodes
+PyAdd = []
+PyAdd.append( 'def Add(a,b) : ' )
+PyAdd.append( ' return a+b ' )
+PyAdd.append( '' )
+Add = GraphInLines.INode( 'Add' , PyAdd )
+Add.InPort( 'a' , 'long' )
+Add.InPort( 'b' , 'long' )
+Add.OutPort( 'f' , 'long' )
+Add.SetName( 'Add' )
+Add.SetAuthor( '' )
+Add.SetComment( 'Python function' )
+Add.Coords( 351 , 77 )
+PySub = []
+PySub.append( 'def Sub(a,b) : ' )
+PySub.append( ' return a-b ' )
+PySub.append( '' )
+Sub = GraphInLines.INode( 'Sub' , PySub )
+Sub.InPort( 'a' , 'long' )
+Sub.InPort( 'b' , 'long' )
+Sub.OutPort( 'f' , 'long' )
+Sub.SetName( 'Sub' )
+Sub.SetAuthor( '' )
+Sub.SetComment( 'Python function' )
+Sub.Coords( 86 , 333 )
+PyMul = []
+PyMul.append( 'def Mul(a,b) : ' )
+PyMul.append( ' return a*b ' )
+Mul = GraphInLines.INode( 'Mul' , PyMul )
+Mul.InPort( 'a' , 'long' )
+Mul.InPort( 'b' , 'long' )
+Mul.OutPort( 'Result' , 'long' )
+Mul.SetName( 'Mul' )
+Mul.SetAuthor( '' )
+Mul.SetComment( 'Python function' )
+Mul.Coords( 616 , 247 )
+
+# Creation of intermediate Output variables and of Control Links
+Addf = Add.Port( 'f' )
+Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
+Mula.AddCoord( 1 , 570 , 356 )
+Mula.AddCoord( 2 , 570 , 186 )
+Subf = Sub.Port( 'f' )
+Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
+Mulb.AddCoord( 1 , 282 , 376 )
+Mulb.AddCoord( 2 , 282 , 442 )
+Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
+Addb.AddCoord( 1 , 283 , 209 )
+Addb.AddCoord( 2 , 283 , 374 )
+Addb.AddCoord( 3 , 283 , 442 )
+
+# Creation of Input datas
+Adda = Add.Input( 'a' , 1)
+Suba = Sub.Input( 'a' , 3)
+Subb = Sub.Input( 'b' , 4)
+
+# Creation of Output variables
+MulResult = Mul.Port( 'Result' )
+
+GraphInLines.Run()
+
+GraphInLines.DoneW()
+
+GraphInLines.PrintPorts()
+
+sg.updateObjBrowser(1);
+
+print
+print "============= Test VISU and MED ============================="
+print
+
+comp = catalog.GetComponent("VISU")
+if comp is None:
+ raise RuntimeError,"Component VISU not found in Module Catalog."
+
+import sys
+import SALOMEDS
+import SALOME
+import SALOME_MED
+import VISU
+
+import visu_gui
+
+medFileName = "pointe.med"
+medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+print "Load ", medFile
+
+studyCurrent = salome.myStudyName
+
+med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
+
+try:
+ if os.access(medFile, os.R_OK) :
+ if not os.access(medFile, os.W_OK) :
+ import random
+ medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName
+ print " -- Copy " + medFile + " to " + medFileNew
+ os.system("cp "+ medFile + " " + medFileNew)
+ medFile = medFileNew
+ os.system("chmod 755 " + medFile)
+
+ if os.access(medFile, os.W_OK) :
+ med_comp.readStructFileWithFieldType(medFile,studyCurrent)
+ med_obj = visu_gui.visu.getMedObjectFromStudy()
+ print "med_obj - ", med_obj
+
+ myField1 = visu_gui.visu.getFieldObjectFromStudy(2,1)
+ aMeshName = "maa1"
+ anEntity = VISU.NODE
+ aTimeStampId = -1
+
+ myResult1 = myVisu.ImportMedField(myField1)
+ aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
+
+ aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField1.getName(), aTimeStampId)
+
+ myResult2 = myVisu.ImportFile(medFile);
+ aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity);
+
+ aTimeStampId = 3
+ aScalarMap2= myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField1.getName(), aTimeStampId)
+
+ sg.updateObjBrowser(0)
+ else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
+ else : print "We have no permission to read medFile, it will not be opened";
+
+except:
+ if sys.exc_type == SALOME.SALOME_Exception :
+ print "There is no permission to read " + medFile
+ else :
+ print sys.exc_type
+ print sys.exc_value
+ print sys.exc_traceback
+
+sg.updateObjBrowser(1);
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include <Launchers.hxx>
+#include "utilities.h"
+
+using namespace std;
+
+static int Launchers_IsLoaded = 0;
+static PyObject * Launchers_module = 0;
+static char * Launchers_name="Launchers";
+
+PyThreadState *mainThreadState=0;
+
+PyThreadState * getMainThreadState(){
+ PyInterpreterState *interp;
+ PyThreadState *p;
+ interp=PyInterpreterState_Head();
+ for (interp = PyInterpreterState_Head(); interp != NULL; ){
+ if(interp->next == NULL)break;
+ interp=interp->next;
+ }
+ for (p = interp->tstate_head; p != NULL; ){
+ if(p->next == NULL)break;
+ p=p->next;
+ }
+ return p;
+}
+PyThreadState *acquireMainThread(){
+ PyEval_AcquireLock();
+ return PyThreadState_Swap(mainThreadState);
+}
+void releaseMainThread(PyThreadState *tstate){
+ PyThreadState_Swap(tstate);
+ PyEval_ReleaseLock();
+}
+
+void Launchers_assertInitialized() {
+ MESSAGE("===========================================================");
+ MESSAGE("Launchers_assertInitialized");
+ MESSAGE("===========================================================");
+ PyThreadState *_save;
+ if( !Py_IsInitialized() ) {
+ MESSAGE("===========================================================");
+ MESSAGE("Py_Initialize()");
+ MESSAGE("===========================================================");
+ Py_Initialize();
+ PyEval_InitThreads();
+ PyEval_SaveThread();
+ }
+ if( !Launchers_IsLoaded ) {
+ mainThreadState=getMainThreadState();
+ _save=acquireMainThread();
+ Launchers_module=PyImport_ImportModule(Launchers_name);
+ if(!Launchers_module){
+ PyErr_Print();
+ return;
+ }
+ Py_INCREF(Launchers_module);
+ Launchers_IsLoaded = 1;
+ releaseMainThread(_save);
+ }
+}
+
+PyObject * getLauncher(char* arg0) {
+ PyObject *v;
+ PyThreadState *_save;
+ Launchers_assertInitialized();
+ _save=acquireMainThread();
+ v=PyObject_CallMethod(Launchers_module,"getLauncher","s",arg0);
+ if(!v){
+ PyErr_Print();
+ return NULL;
+ }
+ releaseMainThread(_save);
+ Py_INCREF(v);
+ return v;
+}
+
+void Launcher_Slaunch(PyObject *self, char* arg1, char* arg2) {
+ PyObject *v;
+ PyThreadState *_save;
+ Launchers_assertInitialized();
+ _save=acquireMainThread();
+ v=PyObject_CallMethod(self,"Slaunch","ss",arg1,arg2);
+ if(!v){
+ PyErr_Print();
+ }
+ releaseMainThread(_save);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include <pthread.h> // must be before Python.h !
+#include <Python.h>
+#define elDEBUG 0
+
+PyObject * getLauncher(char* );
+void Launcher_Slaunch(PyObject * objId, char*, char* );
+
--- /dev/null
+// SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_LifeCycleCORBA.cxx
+// Author : Paul RASCLE, EDF
+// Module : SALOME
+// $Header$
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <iomanip>
+
+#include "OpUtil.hxx"
+#include "utilities.h"
+#include "Launchers.hxx"
+
+#include <ServiceUnreachable.hxx>
+
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOMETraceCollector.hxx"
+#ifndef WNT
+#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#else
+#include "SALOME_ModuleCatalog.hh"
+#endif
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_Component_i.hxx"
+#include "SALOME_NamingService.hxx"
+using namespace std;
+
+IncompatibleComponent::IncompatibleComponent( void ):
+ SALOME_Exception( "IncompatibleComponent" )
+{
+}
+
+IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex):
+ SALOME_Exception( ex )
+{
+}
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+
+SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
+{
+ // be sure to have an instance of traceCollector, when used via SWIG
+ // in a Python module
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ if (!ns)
+ {
+ _NS = new SALOME_NamingService(orb);
+ }
+ else _NS = ns;
+ //add try catch
+ _NS->Change_Directory("/"); // mpv 250105: current directory may be not root
+ // (in SALOMEDS for an example)
+ // not enough: set a current directory in naming service is not thread safe
+ // if naming service instance is shared among several threads...
+ // ==> allways use absolute path and dot rely on current directory!
+
+ CORBA::Object_var obj =
+ _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
+ _ContManager=Engines::ContainerManager::_narrow(obj);
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
+{
+}
+
+//=============================================================================
+/*! Public -
+ * Find and aready existing and registered component instance.
+ * \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 not found
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId)
+{
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+
+ Engines::MachineList_var listOfMachines =
+ _ContManager->GetFittingResources(params, componentName);
+
+ Engines::Component_var compo = _FindComponent(params,
+ componentName,
+ studyId,
+ listOfMachines);
+
+ return compo._retn();
+}
+
+//=============================================================================
+/*! Public -
+ * Load a component instance on a container defined by machine parameters
+ * \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
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId)
+{
+ // --- Check if Component Name is known in ModuleCatalog
+
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+
+ Engines::MachineList_var listOfMachines =
+ _ContManager->GetFittingResources(params, componentName);
+
+ Engines::Component_var compo = _LoadComponent(params,
+ componentName,
+ studyId,
+ listOfMachines);
+
+ return compo._retn();
+}
+
+//=============================================================================
+/*! Public -
+ * Find and aready existing and registered component instance or load a new
+ * component instance on a container defined by machine parameters.
+ * \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
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::
+FindOrLoad_Component(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId)
+{
+ // --- Check if Component Name is known in ModuleCatalog
+
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+
+ Engines::MachineList_var listOfMachines =
+ _ContManager->GetFittingResources(params,componentName);
+
+ Engines::Component_var compo = _FindComponent(params,
+ componentName,
+ studyId,
+ listOfMachines);
+
+ if(CORBA::is_nil(compo))
+ compo = _LoadComponent(params,
+ componentName,
+ studyId,
+ listOfMachines);
+
+ return compo._retn();
+}
+
+//=============================================================================
+/*! Public -
+ * Find and aready existing and registered component instance or load a new
+ * component instance on a container defined by name
+ * \param containerName the name of container, under one of the forms
+ * - 1 aContainer (local container)
+ * - 2 machine/aContainer (container on hostname = machine)
+ * \param componentName the name of component class
+ * \return a CORBA reference of the component instance, or _nil if problem
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName,
+ const char *componentName)
+{
+ // --- Check if Component Name is known in ModuleCatalog
+
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+
+ // --- Check if containerName contains machine name (if yes: rg>0)
+
+ char *stContainer=strdup(containerName);
+ string st2Container(stContainer);
+ int rg=st2Container.find("/");
+
+ Engines::MachineParameters_var params=new Engines::MachineParameters;
+ preSet(params);
+ if (rg<0)
+ {
+ // containerName doesn't contain "/" => Local container
+ params->container_name=CORBA::string_dup(stContainer);
+ params->hostname=CORBA::string_dup(GetHostname().c_str());
+ }
+ else
+ {
+ stContainer[rg]='\0';
+ params->container_name=CORBA::string_dup(stContainer+rg+1);
+ params->hostname=CORBA::string_dup(stContainer);
+ }
+ params->isMPI = false;
+ SCRUTE(params->container_name);
+// SCRUTE(params->hostname);
+// SCRUTE(params->OS);
+// SCRUTE(params->mem_mb);
+// SCRUTE(params->cpu_clock);
+// SCRUTE(params->nb_proc_per_node);
+// SCRUTE(params->nb_node);
+// SCRUTE(params->isMPI);
+ free(stContainer);
+ return FindOrLoad_Component(params,componentName);
+
+}
+
+//=============================================================================
+/*! Public -
+ * Check if the component class is known in module catalog
+ * \param componentName the name of component class
+ * \return true if found, false otherwise
+ */
+//=============================================================================
+
+bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
+{
+
+ try
+ {
+ CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
+ SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
+ ASSERT(! CORBA::is_nil(Catalog));
+ SALOME_ModuleCatalog::Acomponent_ptr compoInfo =
+ Catalog->GetComponent(componentName);
+ if (CORBA::is_nil (compoInfo))
+ {
+ INFOS("Catalog Error : Component not found in the catalog");
+ return false;
+ }
+ else return true;
+ }
+ catch (ServiceUnreachable&)
+ {
+ INFOS("Caught exception: Naming Service Unreachable");
+ }
+ catch (...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return false;
+}
+
+//=============================================================================
+/*! Public -
+ * Not so complex... useful ?
+ */
+//=============================================================================
+
+bool
+SALOME_LifeCycleCORBA::isMpiContainer(const Engines::MachineParameters& params)
+ throw(IncompatibleComponent)
+{
+ if( params.isMPI )
+ return true;
+ else
+ return false;
+}
+
+
+//=============================================================================
+/*! Public -
+ * Pre initialisation of a given Engines::MachineParameters with default
+ * values.
+ * - container_name = "" : not relevant
+ * - hostname = "" : not relevant
+ * - OS = "" : not relevant
+ * - mem_mb = 0 : not relevant
+ * - cpu_clock = 0 : not relevant
+ * - nb_proc_per_node = 0 : not relevant
+ * - nb_node = 0 : not relevant
+ * - isMPI = false : standard components
+ */
+//=============================================================================
+
+void SALOME_LifeCycleCORBA::preSet( Engines::MachineParameters& params)
+{
+ params.container_name = "";
+ params.hostname = "";
+ params.OS = "";
+ params.mem_mb = 0;
+ params.cpu_clock = 0;
+ params.nb_proc_per_node = 0;
+ params.nb_node = 0;
+ params.isMPI = false;
+}
+
+//=============================================================================
+/*! Public -
+ * \return a number of processors not 0, only for MPI containers
+ */
+//=============================================================================
+
+int SALOME_LifeCycleCORBA::NbProc(const Engines::MachineParameters& params)
+{
+ if( !isMpiContainer(params) )
+ return 0;
+ else if( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+ return 1;
+ else if( params.nb_node == 0 )
+ return params.nb_proc_per_node;
+ else if( params.nb_proc_per_node == 0 )
+ return params.nb_node;
+ else
+ return params.nb_node * params.nb_proc_per_node;
+}
+
+//=============================================================================
+/*! Protected -
+ * Find and aready existing and registered component instance.
+ * \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
+ * - build a list of machines on which an instance of the component is running,
+ * - find the best machine among the list
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::
+_FindComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId,
+ const Engines::MachineList& listOfMachines)
+{
+ // --- build the list of machines on which the component is already running
+
+ const char *containerName = params.container_name;
+ int nbproc = NbProc(params);
+// MESSAGE("_FindComponent, required " << containerName <<
+// " " << componentName << " " << nbproc);
+
+ Engines::MachineList_var machinesOK = new Engines::MachineList;
+
+ unsigned int lghtOfmachinesOK = 0;
+ machinesOK->length(listOfMachines.length());
+
+ for(unsigned int i=0; i<listOfMachines.length(); i++)
+ {
+ const char *currentMachine=listOfMachines[i];
+// MESSAGE("_FindComponent, look at " << currentMachine);
+ CORBA::Object_var obj = _NS->ResolveComponent(currentMachine,
+ containerName,
+ componentName,
+ nbproc);
+ if (!CORBA::is_nil(obj))
+ machinesOK[lghtOfmachinesOK++] = CORBA::string_dup(currentMachine);
+ }
+
+ // --- find the best machine among the list
+
+ if(lghtOfmachinesOK != 0)
+ {
+ machinesOK->length(lghtOfmachinesOK);
+ CORBA::String_var bestMachine = _ContManager->FindBest(machinesOK);
+ CORBA::Object_var obj = _NS->ResolveComponent(bestMachine,
+ containerName,
+ componentName,
+ nbproc);
+ return Engines::Component::_narrow(obj);
+ }
+ else
+ return Engines::Component::_nil();
+}
+
+//=============================================================================
+/*! Protected -
+ * Load a component instance.
+ * \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 problem
+ * - Finds a container in the list of machine or start one.
+ * - Try to load the component library in the container,
+ * - then create an instance of the component.
+ */
+//=============================================================================
+
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::
+_LoadComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId,
+ const Engines::MachineList& listOfMachines)
+{
+ const char *containerName = params.container_name;
+ int nbproc = NbProc(params);
+
+ MESSAGE("_LoadComponent, required " << containerName <<
+ " " << componentName << " " << nbproc);
+
+ Engines::Container_var cont =
+ _ContManager->FindOrStartContainer(params,
+ listOfMachines);
+ if (CORBA::is_nil(cont)) return Engines::Component::_nil();
+
+ bool isLoadable = cont->load_component_Library(componentName);
+ if (!isLoadable) return Engines::Component::_nil();
+
+ Engines::Component_var myInstance =
+ cont->create_component_instance(componentName, studyId);
+ return myInstance._retn();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include "LifeCycleCORBATest.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+
+using namespace std;
+
+// --- uncomment to have some traces on standard error
+// (useful only when adding new tests...)
+//#define _DEVDEBUG_
+
+#ifdef _DEVDEBUG_
+#define MYDEVTRACE {std::cerr << __FILE__ << " [" << __LINE__ << "] : ";}
+#define DEVTRACE(msg) {MYDEVTRACE; std::cerr<<msg<<std::endl<<std::flush;}
+#else
+#define MYDEVTRACE
+#define DEVTRACE(msg)
+#endif
+
+#define TRACEFILE "/tmp/traceUnitTest.log"
+
+// ============================================================================
+/*!
+ * Set Trace mecanism
+ * - delete preexisting trace classes if any
+ * - set trace on file
+ * Get or initialize the orb
+ * Create a SALOME_NamingService instance
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::setUp()
+{
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+
+ // --- trace on file
+ char *theFileName = TRACEFILE;
+
+ string s = "file:";
+ s += theFileName;
+ //s="local";
+ //s="with_logger";
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ ofstream traceFile;
+ // traceFile.open(theFileName, ios::out | ios::trunc);
+ traceFile.open(theFileName, ios::out | ios::app);
+ CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+ traceFile.close();
+
+ bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+
+ // --- Get or initialize the orb
+
+ int _argc = 1;
+ char* _argv[] = {""};
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(_argc , _argv ) ;
+
+ // --- Create a SALOME_NamingService instance
+
+ _NS.init_orb(_orb) ;
+}
+
+// ============================================================================
+/*!
+ * - delete trace classes
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::tearDown()
+{
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component.
+ * - get a local container (no hostname given),
+ * load an engine, check that the CORBA object is not null.
+ * - check narrow
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container,
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "myContainer";
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component.
+ * - Call 2 times FindOrLoad_Component with the same parameters
+ * - check if we get the same engine
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_SameInstance()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container,
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "myContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
+
+ Engines::Component_var mycompo2 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+
+ Engines::TestComponent_var m2;
+ m2 = Engines::TestComponent::_narrow(mycompo2);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m2));
+
+ // --- check equality of instance names
+
+ string name1 = m1->instanceName();
+ string name2 = m2->instanceName();
+ CPPUNIT_ASSERT_EQUAL(name1, name2);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with Python Component on C++ Container
+ * load an engine, check that the CORBA object is not null.
+ * - check narrow
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_PythonInCppContainer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container,
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "myContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with Python Component on C++ Container
+ * - Call 2 times FindOrLoad_Component with the same parameters
+ * - check if we get the same engine
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_PythonSameInstance()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container (with a name based on local hostname),
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "myContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
+
+ Engines::Component_var mycompo2 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+
+ Engines::TestComponent_var m2;
+ m2 = Engines::TestComponent::_narrow(mycompo2);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m2));
+
+ // --- check equality of instance names
+
+ string name1 = m1->instanceName();
+ string name2 = m2->instanceName();
+ CPPUNIT_ASSERT_EQUAL(name1, name2);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with a component name not in catalog.
+ * See list of catalog given to module catalog server.
+ * Here, we work with KERNEL_SRC/resources/KERNELCatalog.xml that contains
+ * only KERNEL, SalomeTestComponent and SALOME_TestComponentPy
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_UnknownInCatalog()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container (with a name based on local hostname),
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "myContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"MyNewComponent");
+ CPPUNIT_ASSERT(CORBA::is_nil(mycompo1));
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with hostname given
+ * - get a local container : getHostName()/componentName,
+ * load an engine, check that the CORBA object is not null.
+ * - check narrow
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainerHostname()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container (with a name based on local hostname),
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = GetHostname();
+ containerName += "/theContainer";
+ DEVTRACE("containerName = " << containerName);
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with and without local hostname given.
+ * We must get the same container, the same instance of component
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_SameContainer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- get a local container (with a name based on local hostname),
+ // load an engine, check that the CORBA object is not null
+
+ string containerName = "aContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
+
+ containerName = GetHostname();
+ containerName += "/aContainer";
+ DEVTRACE("containerName = " << containerName);
+ Engines::Component_var mycompo2 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+
+ Engines::TestComponent_var m2;
+ m2 = Engines::TestComponent::_narrow(mycompo2);
+ CPPUNIT_ASSERT(!CORBA::is_nil(m2));
+
+ // --- check equality of instance names
+
+ string name1 = m1->instanceName();
+ string name2 = m2->instanceName();
+ CPPUNIT_ASSERT_EQUAL(name1, name2);
+
+ // --- check containers are the same servant (same container name+hostname)
+
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ Engines::Container_var c2 = m2->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string cname1 = c1->name();
+ string cname2 = c2->name();
+ CPPUNIT_ASSERT_EQUAL(cname1, cname2);
+ string hostname1 = c1->getHostName();
+ string hostname2 = c2->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, hostname2);
+ CORBA::Long pidc1 = c1->getPID();
+ CORBA::Long pidc2 = c2->getPID();
+ CPPUNIT_ASSERT_EQUAL(pidc1, pidc2);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component: check behaviour when ask for an unknown computer
+ * We must catch a Salome Exception with "unknown host" message
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_UnknownMachine()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ // --- try to get a distant container on an unknown machine (not existing)
+ // check that the CORBA object is null
+
+ string containerName = "aFarAwayComputer";
+ containerName += "/theContainer";
+// CPPUNIT_ASSERT_THROW(Engines::Component_var mycompo =
+// _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");,SALOME::SALOME_Exception);
+ try
+ {
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ }
+ catch(const SALOME::SALOME_Exception &ex)
+ {
+ CPPUNIT_ASSERT(true);
+// string expectedMessage = "BAD PARAM";
+// std::ostream os;
+// os << ex;
+// string actualMessage = os.str();
+// DEVTRACE("actual Exception Message = " << actualMessage);
+// CPPUNIT_ASSERT(actualMessage.find(expectedMessage) != string::npos);
+ }
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component, empty params must give an instance
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_ParamsEmpty()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params);
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component params = local container
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_ParamsLocalContainer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params);
+ string hostname=GetHostname();
+ params.hostname=hostname.c_str();
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo);
+
+ // --- check that container is on local computer
+
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string hostname1 = c1->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+}
+
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component params = containerName
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_ParamsContainerName()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params);
+ string containerName = "myContainer";
+ params.container_name = containerName.c_str();
+ Engines::Component_var mycompo =
+ _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo);
+
+ // --- check that container has good name
+
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string hostname1 = c1->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ string cname1 = c1->name();
+ CPPUNIT_ASSERT(cname1.find(containerName) != string::npos);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component on remote computer
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_RemoteComputer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ string remoteHost = GetRemoteHost();
+
+ string containerName = remoteHost;
+ containerName += "/aContainer";
+ DEVTRACE("containerName = " << containerName);
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
+ CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
+ "computers from ResourcesCatalog",
+ !CORBA::is_nil(mycompo1));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+
+ // --- check that container is on good computer
+
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string hostname1 = c1->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with params on remote computer
+ * params empty except hostname
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ string remoteHost = GetRemoteHost();
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params);
+ params.hostname = remoteHost.c_str();
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
+ "computers from ResourcesCatalog",
+ !CORBA::is_nil(mycompo1));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+
+ // --- check that container is on good computer
+
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string hostname1 = c1->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
+}
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component with params on remote computer
+ * params empty except hostname and container_name
+ */
+// ============================================================================
+
+void
+LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer2()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ string remoteHost = GetRemoteHost();
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params);
+ params.hostname = remoteHost.c_str();
+ params.container_name = "anotherContainer";
+
+ Engines::Component_var mycompo1 =
+ _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
+ "computers from ResourcesCatalog",
+ !CORBA::is_nil(mycompo1));
+
+ // --- check narrow
+
+ Engines::TestComponent_var m1;
+ m1 = Engines::TestComponent::_narrow(mycompo1);
+
+ // --- check that container is on good computer
+
+ CPPUNIT_ASSERT(!CORBA::is_nil(m1));
+ Engines::Container_var c1 = m1->GetContainerRef();
+ CPPUNIT_ASSERT(!CORBA::is_nil(c1));
+ string hostname1 = c1->getHostName();
+ CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
+}
+
+
+
+// ============================================================================
+/*!
+ * Check FindOrLoad_Component params = containerName
+ */
+// ============================================================================
+
+// void
+// LifeCycleCORBATest::testFindOrLoad_Component_()
+// {
+// }
+
+
+
+
+
+
+
+
+// ============================================================================
+/*!
+ * Get a remote HostName in the Resource Catalog
+ */
+// ============================================================================
+
+string LifeCycleCORBATest::GetRemoteHost()
+{
+ SALOME_LifeCycleCORBA _LCC(&_NS);
+
+ CORBA::Object_var obj = _NS.Resolve("/ContainerManager");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ Engines::ContainerManager_var containerManager =
+ Engines::ContainerManager::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(containerManager));
+
+ Engines::MachineParameters params;
+ _LCC.preSet(params); // empty params to get all the machines
+
+ Engines::MachineList_var hostList =
+ containerManager->GetFittingResources(params,"SalomeTestComponent");
+ CPPUNIT_ASSERT(hostList->length() > 1);
+
+ string localHost = GetHostname();
+ string remoteHost;
+ for (unsigned int i=0; i < hostList->length(); i++)
+ {
+ const char* aMachine = hostList[i];
+ string machine(aMachine);
+ if (machine != localHost)
+ {
+ remoteHost = machine;
+ break;
+ }
+ }
+ CPPUNIT_ASSERT(remoteHost != "");
+ return remoteHost;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _LIFECYCLECORBATEST_HXX_
+#define _LIFECYCLECORBATEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
+#include "SALOME_NamingService.hxx"
+
+class LifeCycleCORBATest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( LifeCycleCORBATest );
+ CPPUNIT_TEST( testFindOrLoad_Component_LaunchContainer );
+ CPPUNIT_TEST( testFindOrLoad_Component_SameInstance );
+ CPPUNIT_TEST( testFindOrLoad_Component_PythonInCppContainer );
+ CPPUNIT_TEST( testFindOrLoad_Component_PythonSameInstance );
+ CPPUNIT_TEST( testFindOrLoad_Component_UnknownInCatalog );
+ CPPUNIT_TEST( testFindOrLoad_Component_LaunchContainerHostname );
+ CPPUNIT_TEST( testFindOrLoad_Component_SameContainer );
+ CPPUNIT_TEST( testFindOrLoad_Component_UnknownMachine );
+ CPPUNIT_TEST( testFindOrLoad_Component_ParamsEmpty );
+ CPPUNIT_TEST( testFindOrLoad_Component_ParamsLocalContainer );
+ CPPUNIT_TEST( testFindOrLoad_Component_ParamsContainerName );
+ CPPUNIT_TEST( testFindOrLoad_Component_RemoteComputer );
+ CPPUNIT_TEST( testFindOrLoad_Component_ParamsRemoteComputer );
+ CPPUNIT_TEST( testFindOrLoad_Component_ParamsRemoteComputer2 );
+// CPPUNIT_TEST( testFindOrLoad_Component_ );
+// CPPUNIT_TEST( testFindOrLoad_Component_ );
+// CPPUNIT_TEST( );
+// CPPUNIT_TEST( );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+
+ void setUp();
+ void tearDown();
+
+ void testFindOrLoad_Component_LaunchContainer();
+ void testFindOrLoad_Component_SameInstance();
+ void testFindOrLoad_Component_PythonInCppContainer();
+ void testFindOrLoad_Component_PythonSameInstance();
+ void testFindOrLoad_Component_UnknownInCatalog();
+ void testFindOrLoad_Component_LaunchContainerHostname();
+ void testFindOrLoad_Component_SameContainer();
+ void testFindOrLoad_Component_UnknownMachine();
+ void testFindOrLoad_Component_ParamsEmpty();
+ void testFindOrLoad_Component_ParamsLocalContainer();
+ void testFindOrLoad_Component_ParamsContainerName();
+ void testFindOrLoad_Component_RemoteComputer();
+ void testFindOrLoad_Component_ParamsRemoteComputer();
+ void testFindOrLoad_Component_ParamsRemoteComputer2();
+// void testFindOrLoad_Component_();
+// void testFindOrLoad_Component_();
+
+protected:
+ std::string GetRemoteHost();
+ CORBA::ORB_var _orb;
+ SALOME_NamingService _NS;
+};
+
+#endif
--- /dev/null
+# SALOMELocalTrace : log on local machine
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE (EDF)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= LifeCycleCORBATest.hxx
+
+EXPORT_PYSCRIPTS = TestLifeCycleCORBA.py
+
+# Libraries targets
+
+LIB = libLifeCycleCORBATest.la
+LIB_SRC = LifeCycleCORBATest.cxx
+LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
+ SALOME_Exception.idl nstest.idl
+
+# Executables targets
+
+BIN = TestLifeCycleCORBA
+BIN_SRC =
+
+CXXFLAGS += @CPPUNIT_INCLUDES@
+CPPFLAGS += @CPPUNIT_INCLUDES@
+
+LIBS= @LIBS@ @CPPUNIT_LIBS@
+
+LDFLAGS+=
+
+LDFLAGSFORBIN+= \
+ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \
+ -lSALOMETraceCollectorTest \
+ -lUtilsTest -lOpUtil \
+ -lNamingServiceTest -lSalomeNS \
+ -lSalomeContainer -lSalomeResourcesManager \
+ -lRegistry -lSalomeNotification \
+ -lLifeCycleCORBATest -lSalomeLifeCycleCORBA
+
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMETraceCollectorTest.hxx"
+#include "UtilsTest.hxx"
+#include "NamingServiceTest.hxx"
+#include "LifeCycleCORBATest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( UtilsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( NamingServiceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( LifeCycleCORBATest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+
+%module libSALOME_LifeCycleCORBA
+
+%{
+#include "utilities.h"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+ using namespace std;
+%}
+
+%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr
+{
+ //MESSAGE("typemap out on CORBA object ptr");
+ //SCRUTE($1);
+
+ // --- Get the Python orb
+
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("from omniORB import CORBA", Py_single_input, pdict, pdict);
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // --- Get the C++ orb
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ string s = ORB->object_to_string($1);
+ //SCRUTE(s);
+ PyObject * tmp = PyString_FromString(s.c_str());
+ //SCRUTE(tmp);
+ $result = PyObject_CallMethod(orb, "string_to_object", "O", tmp);
+ //SCRUTE($result);
+}
+
+
+%typemap(typecheck) const Engines::MachineParameters &
+{
+ $1 = ($input != 0);
+}
+
+%typemap(python,in) const Engines::MachineParameters &
+{
+ printf("typemap in on Engines::MachineParameters\n");
+ //MESSAGE("typemap in on Engines::MachineParameters");
+ //ASSERT (PyDict_Check($input))
+ if (PyDict_Check($input) == 1)
+ {
+ Engines::MachineParameters *param = new Engines::MachineParameters ;
+ param->container_name = CORBA::string_dup("");
+ param->hostname = CORBA::string_dup("");
+ param->OS = CORBA::string_dup("");
+ param->mem_mb = 0;
+ param->cpu_clock = 0;
+ param->nb_proc_per_node = 0;
+ param->nb_node = 0;
+ param->isMPI = false;
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value))
+ {
+ char* keystr = PyString_AsString(key);
+ printf("key: %s\n", keystr);
+ if (strcmp(keystr,"container_name")==0)
+ {
+ param->container_name = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"hostname")==0)
+ {
+ param->hostname = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"OS")==0)
+ {
+ param->OS = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"mem_mb")==0)
+ {
+ param->mem_mb = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"cpu_clock")==0)
+ {
+ param->cpu_clock = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"nb_proc_per_node")==0)
+ {
+ param->nb_proc_per_node = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"nb_node")==0)
+ {
+ param->nb_node = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"isMPI")==0)
+ {
+ param->isMPI = PyLong_AsLong(value);
+ }
+ }
+ $1 = param;
+ }
+ else
+ {
+ printf("pas un dico\n");
+ return NULL;
+ }
+}
+
+%typemap(python,freearg) const Engines::MachineParameters &
+{
+ MESSAGE("delete $1");
+ delete $1;
+}
+
+%include "SALOME_LifeCycleCORBA.hxx"
--- /dev/null
+// SALOME MPIContainer : implemenation of container based on MPI libraries
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : MPIContainer_i.cxx
+// Module : SALOME
+
+#include <iostream.h>
+#include <dlfcn.h>
+#include <stdio.h>
+#include "SALOME_Component_i.hxx"
+#include "MPIContainer_i.hxx"
+#include "SALOME_NamingService.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
+#include "utilities.h"
+#include <pthread.h> // must be before Python.h !
+#include <Python.h>
+#include "Container_init_python.hxx"
+using namespace std;
+
+// L'appel au registry SALOME ne se fait que pour le process 0
+Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ char * containerName,
+ int argc, char *argv[])
+ : Engines_Container_i(orb,poa,containerName,argc,argv,false), MPIObject_i(nbproc,numproc)
+{
+ long id=0;
+ string IdContainerinNS;
+ char idc[3*sizeof(long)];
+
+ MESSAGE("[" << numproc << "] activate object");
+ _id = _poa->activate_object(this);
+
+ if(argc>1)
+ {
+ for(int i=0;i<argc;i++)
+ {
+ if(strcmp(argv[i],"-id")==NULL)
+ {
+ id = atoi(argv[i+1]);
+ continue;
+ }
+ }
+ }
+ SCRUTE(id);
+
+ if(numproc==0){
+
+ _NS = new SALOME_NamingService();
+ _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
+
+ CORBA::Object_var obj=_poa->id_to_reference(*_id);
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
+
+ string hostname = GetHostname();
+ _containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
+ SCRUTE(_containerName);
+ _NS->Register(pCont, _containerName.c_str());
+
+ // A parallel container registers in Naming Service
+ // on the machine where is process 0. ContainerManager does'nt know the name
+ // of this machine before the launch of the parallel container. So to get
+ // the IOR of the parallel container in Naming Service, ContainerManager
+ // gives a unique Id. The parallel container registers his name under
+ // /ContainerManager/Id directory in NamingService
+
+ IdContainerinNS = "/ContainerManager/id";
+ sprintf(idc,"%ld",id);
+ IdContainerinNS += idc;
+ SCRUTE(IdContainerinNS);
+ _NS->Register(pCont, IdContainerinNS.c_str());
+
+ }
+
+ // Root recupere les ior des container des autre process
+ Engines::MPIObject_var pobj = POA_Engines::MPIContainer::_this();
+ BCastIOR(_orb,pobj,true);
+}
+
+Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc)
+ : Engines_Container_i(), MPIObject_i(nbproc,numproc)
+{
+}
+
+Engines_MPIContainer_i::~Engines_MPIContainer_i(void)
+{
+ MESSAGE("[" << _numproc << "] Engines_MPIContainer_i::~Engines_MPIContainer_i()");
+}
+
+// Load component
+void Engines_MPIContainer_i::Shutdown()
+{
+ int ip;
+ MESSAGE("[" << _numproc << "] shutdown of MPI Corba Server");
+ if( _numproc == 0 ){
+ _NS->Destroy_FullDirectory(_containerName.c_str());
+ for(ip= 1;ip<_nbproc;ip++)
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Shutdown();
+ }
+ _orb->shutdown(0);
+
+}
+
+// Load a component library
+bool Engines_MPIContainer_i::load_component_Library(const char* componentName)
+{
+ if( _numproc == 0 ){
+ // Invocation du chargement du composant dans les autres process
+ for(int ip= 1;ip<_nbproc;ip++)
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asload_component_Library(componentName);
+ }
+
+ return Lload_component_Library(componentName);
+}
+
+void Engines_MPIContainer_i::Asload_component_Library(const char* componentName)
+{
+ Lload_component_Library(componentName);
+}
+
+bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName)
+{
+ string aCompName = componentName;
+
+ // --- try dlopen C++ component
+
+ string impl_name = string ("lib") + aCompName + string("Engine.so");
+ SCRUTE(impl_name);
+
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see decInstanceCnt, finalize_removal))
+ if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name);
+ if (_library_map[impl_name])
+ {
+ MESSAGE("[" << _numproc << "] Library " << impl_name << " already loaded");
+ _numInstanceMutex.unlock();
+ return true;
+ }
+
+ void* handle;
+ handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+ if ( handle )
+ {
+ _library_map[impl_name] = handle;
+ _numInstanceMutex.unlock();
+ return true;
+ }
+ else
+ {
+ INFOS("[" << _numproc << "] Can't load shared library : " << impl_name);
+ INFOS("[" << _numproc << "] error dlopen: " << dlerror());
+ }
+ _numInstanceMutex.unlock();
+
+ // --- try import Python component
+
+ INFOS("[" << _numproc << "] try import Python component "<<componentName);
+ if (_isSupervContainer)
+ {
+ INFOS("[" << _numproc << "] Supervision Container does not support Python Component Engines");
+ return false;
+ }
+ if (_library_map[aCompName])
+ {
+ return true; // Python Component, already imported
+ }
+ else
+ {
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ "import_component",
+ "s",componentName);
+ int ret= PyInt_AsLong(result);
+ SCRUTE(ret);
+ Py_RELEASE_NEW_THREAD;
+
+ if (ret) // import possible: Python component
+ {
+ _library_map[aCompName] = (void *)pyCont; // any non O value OK
+ MESSAGE("[" << _numproc << "] import Python: "<<aCompName<<" OK");
+ return true;
+ }
+ }
+ return false;
+}
+
+// Create an instance of component
+Engines::Component_ptr
+Engines_MPIContainer_i::create_component_instance( const char* componentName,
+ CORBA::Long studyId)
+{
+ if( _numproc == 0 ){
+ // Invocation du chargement du composant dans les autres process
+ for(int ip= 1;ip<_nbproc;ip++)
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Ascreate_component_instance(componentName,studyId);
+ }
+
+ return Lcreate_component_instance(componentName,studyId);
+}
+
+void Engines_MPIContainer_i::Ascreate_component_instance( const char* componentName,
+ CORBA::Long studyId)
+{
+ Lcreate_component_instance(componentName,studyId);
+}
+
+Engines::Component_ptr
+Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterName, CORBA::Long studyId)
+{
+ if (studyId < 0) {
+ INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
+ return Engines::Component::_nil() ;
+ }
+
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ Engines::MPIObject_var pobj;
+
+ string aCompName = genericRegisterName;
+ if (_library_map[aCompName]) { // Python component
+ if (_isSupervContainer) {
+ INFOS("Supervision Container does not support Python Component Engines");
+ return Engines::Component::_nil();
+ }
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aCompName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ "create_component_instance",
+ "ssl",
+ aCompName.c_str(),
+ instanceName.c_str(),
+ studyId);
+ string iors = PyString_AsString(result);
+ SCRUTE(iors);
+ Py_RELEASE_NEW_THREAD;
+
+ CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+ iobject = Engines::Component::_narrow( obj ) ;
+ pobj = Engines::MPIObject::_narrow(obj) ;
+ if( _numproc == 0 )
+ _NS->Register(iobject, component_registerName.c_str()) ;
+ // Root recupere les ior des composants des autre process
+ BCastIOR(_orb,pobj,false);
+
+ return iobject._retn();
+ }
+
+ //--- try C++
+
+ string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
+ void* handle = _library_map[impl_name];
+ if ( !handle ) {
+ INFOS("shared library " << impl_name <<"must be loaded before instance");
+ return Engines::Component::_nil() ;
+ }
+ else {
+ iobject = createMPIInstance(genericRegisterName,
+ handle,
+ studyId);
+ return iobject._retn();
+ }
+}
+
+Engines::Component_ptr
+Engines_MPIContainer_i::createMPIInstance(string genericRegisterName,
+ void *handle,
+ int studyId)
+{
+ Engines::Component_var iobject;
+ Engines::MPIObject_var pobj;
+ // --- find the factory
+
+ string aGenRegisterName = genericRegisterName;
+ string factory_name = aGenRegisterName + string("Engine_factory");
+ SCRUTE(factory_name) ;
+
+ typedef PortableServer::ObjectId * (*MPIFACTORY_FUNCTION)
+ (int,int,
+ CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) ;
+
+ MPIFACTORY_FUNCTION MPIComponent_factory
+ = (MPIFACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ( (error = dlerror() ) != NULL) {
+ // Try to load a sequential component
+ MESSAGE("[" << _numproc << "] Try to load a sequential component");
+ _numInstanceMutex.unlock() ;
+ iobject = Engines_Container_i::createInstance(genericRegisterName,handle,studyId);
+ if( CORBA::is_nil(iobject) ) return Engines::Component::_duplicate(iobject);
+ }
+
+ // --- create instance
+
+ iobject = Engines::Component::_nil() ;
+
+ try
+ {
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (MPIComponent_factory) ( _nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(),
+ aGenRegisterName.c_str() ) ;
+
+ // --- get reference & servant from id
+
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow( obj ) ;
+ pobj = Engines::MPIObject::_narrow(obj) ;
+
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>(_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(aGenRegisterName);
+ SCRUTE(_cntInstances_map[aGenRegisterName]);
+ //SCRUTE(servant->pd_refCount);
+ bool ret_studyId = servant->setStudyId(studyId);
+ ASSERT(ret_studyId);
+
+ // --- register the engine under the name
+ // containerName(.dir)/instanceName(.object)
+
+ if( _numproc == 0 ){
+ _NS->Register( iobject , component_registerName.c_str() ) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
+ // Root recupere les ior des composants des autre process
+ BCastIOR(_orb,pobj,false);
+
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::createInstance exception catched" ) ;
+ }
+ return iobject._retn();
+}
+
+// Load component
+Engines::Component_ptr Engines_MPIContainer_i::load_impl(const char* nameToRegister,
+ const char* componentName)
+{
+ if( _numproc == 0 ){
+ // Invocation du chargement du composant dans les autres process
+ for(int ip= 1;ip<_nbproc;ip++)
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asload_impl(nameToRegister,
+ componentName);
+ }
+
+ return Lload_impl(nameToRegister,componentName);
+
+}
+
+// Load component
+void Engines_MPIContainer_i::Asload_impl(const char* nameToRegister,
+ const char* componentName)
+{
+ Lload_impl(nameToRegister,componentName);
+}
+
+Engines::Component_ptr Engines_MPIContainer_i::Lload_impl(
+ const char* nameToRegister,
+ const char* componentName)
+{
+ Engines::Component_var iobject;
+ Engines::MPIObject_var pobj;
+ char cproc[4];
+
+ sprintf(cproc,"_%d",_numproc);
+
+ BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lload_impl");
+
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ char _aNumI[12];
+ sprintf(_aNumI,"%d",_numInstance) ;
+
+ string _impl_name = componentName;
+ string _nameToRegister = nameToRegister;
+ string instanceName = _nameToRegister + "_inst_" + _aNumI + cproc;
+ MESSAGE("[" << _numproc << "] instanceName=" << instanceName);
+
+ string absolute_impl_name(_impl_name);
+ MESSAGE("[" << _numproc << "] absolute_impl_name=" << absolute_impl_name);
+ void * handle = dlopen(absolute_impl_name.c_str(), RTLD_LAZY);
+ if(!handle){
+ INFOS("[" << _numproc << "] Can't load shared library : " << absolute_impl_name);
+ INFOS("[" << _numproc << "] error dlopen: " << dlerror());
+ return Engines::Component::_nil() ;
+ }
+
+ string factory_name = _nameToRegister + string("Engine_factory");
+ MESSAGE("[" << _numproc << "] factory_name=" << factory_name) ;
+
+ PortableServer::ObjectId * (*MPIComponent_factory) (int,int,
+ CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) =
+ (PortableServer::ObjectId * (*) (int,int,
+ CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *))
+ dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ((error = dlerror()) != NULL){
+ // Try to load a sequential component
+ MESSAGE("[" << _numproc << "] Try to load a sequential component");
+ _numInstanceMutex.unlock() ;
+ iobject = Engines_Container_i::load_impl(nameToRegister,componentName);
+ if( CORBA::is_nil(iobject) ) return Engines::Component::_duplicate(iobject);
+ }
+ else{
+ // Instanciation du composant parallele
+ MESSAGE("[" << _numproc << "] Try to load a parallel component");
+ PortableServer::ObjectId * id = (MPIComponent_factory)
+ (_nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(), _nameToRegister.c_str());
+ // get reference from id
+ CORBA::Object_var o = _poa->id_to_reference(*id);
+ pobj = Engines::MPIObject::_narrow(o) ;
+ iobject = Engines::Component::_narrow(o) ;
+ }
+
+ if( _numproc == 0 ){
+ // utiliser + tard le registry ici :
+ // register the engine under the name containerName.dir/nameToRegister.object
+ string component_registerName = _containerName + "/" + _nameToRegister;
+ _NS->Register(iobject, component_registerName.c_str()) ;
+ }
+
+ _numInstanceMutex.unlock() ;
+
+ // Root recupere les ior des composants des autre process
+ BCastIOR(_orb,pobj,false);
+
+ END_OF("[" <<_numproc << "] MPIContainer_i::Lload_impl");
+ return Engines::Component::_duplicate(iobject);
+
+}
+
+void Engines_MPIContainer_i::remove_impl(Engines::Component_ptr component_i)
+{
+ int ip;
+ Engines::Component_ptr cptr;
+ Engines::MPIObject_ptr pcptr;
+ Engines::MPIObject_ptr spcptr;
+
+ ASSERT(! CORBA::is_nil(component_i));
+
+ if( _numproc == 0 ){
+ // Invocation de la destruction du composant dans les autres process
+ pcptr = (Engines::MPIObject_ptr)component_i;
+ for(ip= 1;ip<_nbproc;ip++){
+ spcptr = Engines::MPIObject::_narrow((*(pcptr->tior()))[ip]);
+ cptr = (Engines::Component_ptr)spcptr;
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asremove_impl(cptr);
+ }
+ }
+
+ Lremove_impl(component_i);
+}
+
+void Engines_MPIContainer_i::Asremove_impl(Engines::Component_ptr component_i)
+{
+ Lremove_impl(component_i);
+}
+
+void Engines_MPIContainer_i::Lremove_impl(Engines::Component_ptr component_i)
+{
+ BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl");
+
+ ASSERT(! CORBA::is_nil(component_i));
+
+ string instanceName = component_i->instanceName() ;
+ MESSAGE("[" << _numproc << "] unload component " << instanceName);
+ component_i->destroy() ;
+ MESSAGE("[" << _numproc << "] test key handle_map");
+ _numInstanceMutex.lock() ; // lock on the remove on handle_map
+ _numInstanceMutex.unlock() ;
+ MESSAGE("[" << _numproc << "] list handle_map");
+
+ END_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl");
+
+}
+
+void Engines_MPIContainer_i::finalize_removal()
+{
+ int ip;
+
+ if( _numproc == 0 ){
+ // Invocation de la destruction du composant dans les autres process
+ for(ip= 1;ip<_nbproc;ip++)
+ (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asfinalize_removal();
+ }
+
+ Lfinalize_removal();
+}
+
+void Engines_MPIContainer_i::Asfinalize_removal()
+{
+ Lfinalize_removal();
+}
+
+void Engines_MPIContainer_i::Lfinalize_removal()
+{
+ BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal");
+
+// map<string, void *>::iterator im ;
+// // lock on the explore remove_map & dlclose
+// _numInstanceMutex.lock() ;
+// for (im = remove_map.begin() ; im != remove_map.end() ; im ++)
+// {
+// void * handle = (*im).second ;
+// MESSAGE("[" << _numproc << "] dlclose " << (*im).first);
+// dlclose(handle) ;
+// }
+// MESSAGE("[" << _numproc << "] remove_map.clear()");
+// remove_map.clear() ;
+// _numInstanceMutex.unlock() ;
+
+ END_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal");
+}
--- /dev/null
+// SALOME MPIContainer : implemenation of container based on MPI libraries
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : MPIObject_i.cxx
+// Module : SALOME
+
+#include <mpi.h>
+#include "MPIObject_i.hxx"
+#include "utilities.h"
+using namespace std;
+
+MPIObject_i::MPIObject_i()
+{
+ MPI_Comm_size( MPI_COMM_WORLD, &_nbproc );
+ MPI_Comm_rank( MPI_COMM_WORLD, &_numproc );
+ _tior=NULL;
+}
+
+MPIObject_i::MPIObject_i(int nbproc, int numproc)
+{
+ _nbproc = nbproc;
+ _numproc = numproc;
+ _tior=NULL;
+}
+
+MPIObject_i::~MPIObject_i()
+{
+ if(_tior) delete _tior;
+}
+
+Engines::IORTab* MPIObject_i::tior()
+{
+ Engines::IORTab_var tior = new Engines::IORTab;
+ tior->length(_tior->length());
+ for(unsigned int ip=0;ip<tior->length();ip++)
+ tior[ip] = (*_tior)[ip];
+ return tior._retn();
+};
+
+void MPIObject_i::tior(const Engines::IORTab& ior)
+{
+ _tior = new Engines::IORTab;
+ _tior->length(ior.length());
+ for(unsigned int ip=0;ip<ior.length();ip++)
+ (*_tior)[ip] = ior[ip];
+}
+
+void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj,
+ bool amiCont)
+{
+ int err, ip, n;
+ char *ior;
+ MPI_Status status; /* status de reception de message MPI */
+
+ if( _numproc == 0 ){
+
+ //Allocation du tableau des IOR
+ Engines::IORTab_var iort = new Engines::IORTab;
+ iort->length(_nbproc);
+
+ iort[0] = pobj;
+
+ // Process 0 recupere les ior de l'object sur les autres process
+ for(ip=1;ip<_nbproc;ip++){
+ err = MPI_Recv(&n,1,MPI_INT,ip,ip,MPI_COMM_WORLD,&status);
+ if(err){
+ MESSAGE("[" << _numproc << "] MPI_RECV error");
+ exit(1);
+ }
+ // Allocation de la chaine de longueur n
+ ior = new char[n];
+ err = MPI_Recv(ior,n,MPI_CHAR,ip,2*ip,MPI_COMM_WORLD,&status);
+ if(err){
+ MESSAGE("[" << _numproc << "] MPI_RECV error");
+ exit(1);
+ }
+ iort[ip] = orb->string_to_object(ior);
+ delete [] ior;
+ }
+ // On donne le tableau des ior a l'objet Corba du process 0
+ if( amiCont )
+ tior(*(iort._retn()));
+ else
+ pobj->tior(*(iort._retn()));
+
+ }
+ else{
+ // Conversion IOR vers string
+ ior = orb->object_to_string(pobj);
+ n = strlen(ior) + 1;
+ // On envoie l'IOR au process 0
+ err = MPI_Send(&n,1,MPI_INT,0,_numproc,MPI_COMM_WORLD);
+ if(err){
+ MESSAGE("[" << _numproc << "] MPI_SEND error");
+ exit(1);
+ }
+ err = MPI_Send(ior,n,MPI_CHAR,0,2*_numproc,MPI_COMM_WORLD);
+ if(err){
+ MESSAGE("[" << _numproc << "] MPI_SEND error");
+ exit(1);
+ }
+ CORBA::string_free(ior);
+ }
+
+}
+
--- /dev/null
+# SALOME MPIContainer : implemenation of container based on MPI libraries
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS =
+
+EXPORT_HEADERS = \
+ MPIObject_i.hxx \
+ MPIContainer_i.hxx
+
+# Libraries targets
+
+LIB = libSalomeMPIContainer.la
+LIB_SRC = MPIObject_i.cxx MPIContainer_i.cxx
+LIB_CLIENT_IDL = SALOME_Component.idl
+LIB_SERVER_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl
+
+# Executables targets
+BIN = SALOME_MPIContainer
+BIN_SRC =
+BIN_SERVER_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_Exception.idl
+
+CPPFLAGS+= $(PYTHON_INCLUDES)
+LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSalomeResourcesManager
+
+ifeq (@WITHMPI@,yes)
+ LIBS += $(PYTHON_LIBS) $(MPI_LIBS)
+ CXXFLAGS+=${MPI_INCLUDES}
+ CXX_DEPEND_FLAG+=${MPI_INCLUDES}
+ LDFLAGSFORBIN= $(LDFLAGS) -lSALOMEBasics
+ LIBSFORBIN= $(LIBS)
+endif
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include <mpi.h>
+#include <iostream>
+#include "MPIContainer_i.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "utilities.h"
+#include "SALOMETraceCollector.hxx"
+using namespace std;
+
+int main(int argc, char* argv[])
+{
+ int nbproc, numproc;
+ Engines_MPIContainer_i * myContainer=NULL;
+
+ MPI_Init(&argc,&argv);
+ MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
+ MPI_Comm_rank(MPI_COMM_WORLD,&numproc);
+
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+ // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+
+ BEGIN_OF("[" << numproc << "] " << argv[0])
+ try {
+
+ // Obtain a reference to the root POA.
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+
+ // obtain the root poa manager
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+ // define policy objects
+ PortableServer::ImplicitActivationPolicy_var implicitActivation =
+ root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
+
+ // default = NO_IMPLICIT_ACTIVATION
+ PortableServer::ThreadPolicy_var threadPolicy =
+ root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
+ // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
+
+ // create policy list
+ CORBA::PolicyList policyList;
+ policyList.length(2);
+ policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
+ policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
+
+ // create the child POA
+ PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
+ PortableServer::POA_var factory_poa =
+ root_poa->create_POA("factory_poa", pman, policyList) ;
+ //with nil_mgr instead of pman, a new POA manager is created with the new POA
+
+ // destroy policy objects
+ implicitActivation->destroy() ;
+ threadPolicy->destroy() ;
+
+ char *containerName = "";
+ if (argc >1)
+ {
+ containerName = argv[1] ;
+ }
+
+ MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
+ myContainer = new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
+
+ pman->activate();
+
+ orb->run();
+
+ }
+ catch(CORBA::SystemException&){
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::WrongPolicy&){
+ INFOS("Caught CORBA::WrongPolicyException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&){
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&){
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(...){
+ INFOS("Caught unknown exception.");
+ }
+
+ if(myContainer)
+ delete myContainer;
+
+ END_OF("[" << numproc << "] " << argv[0]);
+ // delete myThreadTrace;
+
+ MPI_Finalize();
+
+}
+
--- /dev/null
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Patrick GOLDBRONN (CEA)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+
+@COMMENCE@
+
+SUBDIRS = \
+ Basics \
+ SALOMELocalTrace \
+ CASCatch \
+ HDFPersist \
+ Logger \
+ SALOMETraceCollector \
+ Utils \
+ NamingService \
+ GenericObj \
+ Registry \
+ ModuleCatalog \
+ DataTypeCatalog \
+ RessourcesCatalog \
+ ResourcesManager \
+ Notification \
+ NOTIFICATION_SWIG \
+ Container \
+ TestContainer \
+ LifeCycleCORBA \
+ LifeCycleCORBA_SWIG \
+ SALOMEDSClient \
+ TOOLSDS \
+ SALOMEDSImpl \
+ SALOMEDS \
+ KERNEL_PY \
+ ModuleGenerator \
+ Communication \
+ Communication_SWIG
+
+ifeq (@mpi_ok@,yes)
+ SUBDIRS+= MPIContainer TestMPIContainer
+endif
+
+ifeq (@WITH_BATCH@,yes)
+ SUBDIRS += Batch Batch_SWIG
+endif
+
+ifeq (@cppunit_ok@,yes)
+ SUBDIRS+= \
+ Basics/Test \
+ SALOMELocalTrace/Test \
+ Logger/Test \
+ SALOMETraceCollector/Test \
+ Utils/Test \
+ NamingService/Test \
+ LifeCycleCORBA/Test \
+ UnitTests
+endif
+
+@MODULE@
+
--- /dev/null
+// SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ModuleCatalog_impl.cxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+//
+#include "SALOME_ModuleCatalog_impl.hxx"
+#include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
+#include <fstream>
+#include <map>
+
+#include <qstringlist.h>
+#include <qfileinfo.h>
+using namespace std;
+
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 1;
+#endif
+
+static const char* SEPARATOR = ":";
+
+//----------------------------------------------------------------------
+// Function : SALOME_ModuleCatalogImpl
+// Purpose : Constructor
+//----------------------------------------------------------------------
+SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb)
+{
+ if(MYDEBUG) MESSAGE("Catalog creation");
+
+ // Conversion rules for component types
+ ComponentTypeConvert[GEOM]
+ = SALOME_ModuleCatalog::GEOM;
+ ComponentTypeConvert[MESH]
+ = SALOME_ModuleCatalog::MESH;
+ ComponentTypeConvert[Med]
+ = SALOME_ModuleCatalog::Med;
+ ComponentTypeConvert[SOLVER]
+ = SALOME_ModuleCatalog::SOLVER;
+ ComponentTypeConvert[DATA]
+ = SALOME_ModuleCatalog::DATA;
+ ComponentTypeConvert[VISU]
+ = SALOME_ModuleCatalog::VISU;
+ ComponentTypeConvert[SUPERV]
+ = SALOME_ModuleCatalog::SUPERV;
+ ComponentTypeConvert[OTHER]
+ = SALOME_ModuleCatalog::OTHER;
+
+ // Conversion rules for datastream parameters type and dependency
+ DataStreamTypeConvert["UNKNOWN"]
+ = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+ DataStreamTypeConvert["INTEGER"]
+ = SALOME_ModuleCatalog::DATASTREAM_INTEGER;
+ DataStreamTypeConvert["FLOAT"]
+ = SALOME_ModuleCatalog::DATASTREAM_FLOAT;
+ DataStreamTypeConvert["DOUBLE"]
+ = SALOME_ModuleCatalog::DATASTREAM_DOUBLE;
+ DataStreamTypeConvert["STRING"]
+ = SALOME_ModuleCatalog::DATASTREAM_STRING;
+ DataStreamTypeConvert["BOOLEAN"]
+ = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN;
+
+ DataStreamDepConvert["UNDEFINED"]
+ = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
+ DataStreamDepConvert["T"]
+ = SALOME_ModuleCatalog::DATASTREAM_TEMPORAL;
+ DataStreamDepConvert["I"]
+ = SALOME_ModuleCatalog::DATASTREAM_ITERATIVE;
+
+ // Empty used variables
+ _general_module_list.resize(0);
+ _general_path_list.resize(0);
+
+ _personal_module_list.resize(0);
+ _personal_path_list.resize(0);
+
+ // Parse the arguments given at server run
+ if (!_parseArguments(argc, argv,&_general_path,&_personal_path))
+ if(MYDEBUG) MESSAGE( "Error while argument parsing" );
+
+ // Test existency of files
+ if (_general_path == NULL){
+ if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" );
+ }else{
+ // Affect the _general_module_list and _general_path_list members
+ // with the common catalog
+
+ QStringList dirList
+ = QStringList::split( SEPARATOR, _general_path,
+ false ); // skip empty entries
+
+ for ( int i = 0; i < dirList.count(); i++ ) {
+ QFileInfo fileInfo( dirList[ i ] );
+ if ( fileInfo.isFile() && fileInfo.exists() ) {
+ _parse_xml_file(fileInfo.filePath(),
+ _general_module_list,
+ _general_path_list);
+ }
+ }
+
+ // Verification of _general_path_list content
+ if(!_verify_path_prefix(_general_path_list)){
+ if(MYDEBUG) MESSAGE( "Error while parsing the general path list, "
+ "differents paths are associated to the same computer,"
+ "the first one will be choosen");
+ }else{
+ if(MYDEBUG) MESSAGE("General path list OK");
+ }
+
+ if(_personal_path != NULL){
+ // Initialize the _personal_module_list and
+ // _personal_path_list members with the personal catalog files
+ _parse_xml_file(_personal_path,
+ _personal_module_list,
+ _personal_path_list);
+
+ // Verification of _general_path_list content
+ if(!_verify_path_prefix(_personal_path_list)){
+ if(MYDEBUG) MESSAGE("Error while parsing the personal path list, "
+ "differents paths are associated to the same computer, "
+ "the first one will be choosen" );
+ }else {
+ if(MYDEBUG) MESSAGE("Personal path list OK");
+ }
+ }else
+ if(MYDEBUG) MESSAGE("No personal catalog indicated or error while "
+ "opening the personal catalog");
+ }
+}
+
+//----------------------------------------------------------------------
+// Function : ~SALOME_ModuleCatalogImpl
+// Purpose : Destructor
+//----------------------------------------------------------------------
+SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
+{
+ if(MYDEBUG) MESSAGE("Catalog Destruction");
+}
+
+
+//----------------------------------------------------------------------
+// Function : GetComputerList
+// Purpose : get a computer list
+//----------------------------------------------------------------------
+SALOME_ModuleCatalog::ListOfComputers*
+SALOME_ModuleCatalogImpl::GetComputerList()
+{
+ SALOME_ModuleCatalog::ListOfComputers_var _list_computers =
+ new SALOME_ModuleCatalog::ListOfComputers;
+ return _list_computers._retn();
+}
+
+//----------------------------------------------------------------------
+// Function : GetPathPrefix
+// Purpose : get the PathPrefix of a computer
+//----------------------------------------------------------------------
+char *
+SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
+ if(MYDEBUG) MESSAGE("Begin of GetPathPrefix");
+ // Variables initialisation
+ char* _path = NULL;
+ bool _find = false ;
+
+ // Parse all the path prefixes
+ // looking for the wanted computer
+ for (unsigned int ind = 0 ; ind < _personal_path_list.size() ; ind++)
+ {
+ for (unsigned int ind1 = 0 ; ind1 < _personal_path_list[ind].listOfComputer.size() ; ind1++)
+ {
+ if (strcmp(machinename, _personal_path_list[ind].listOfComputer[ind1].c_str()) == 0)
+ {
+ _find = true ;
+ // Wanted computer
+ // affect the path to be returned
+ const char* _temp = _personal_path_list[ind].path.c_str() ;
+ _path = new char[strlen(_temp)+1];
+ strcpy(_path,_temp);
+ }
+ }
+ }
+
+ if (!_find)
+ {
+ for (unsigned int ind = 0 ; ind < _general_path_list.size() ; ind++)
+ {
+ for (unsigned int ind1 = 0 ; ind1 < _general_path_list[ind].listOfComputer.size() ; ind1++)
+ {
+ if (strcmp(machinename, _general_path_list[ind].listOfComputer[ind1].c_str()) == 0)
+ {
+ _find = true ;
+ // Wanted computer
+ // affect the path to be returned
+ const char* _temp = _general_path_list[ind].path.c_str() ;
+ _path = new char[strlen(_temp)+1];
+ strcpy(_path,_temp);
+ }
+ }
+ }
+ }
+
+ return _path;
+}
+
+//----------------------------------------------------------------------
+// Function : GetComponentList
+// Purpose : get a component list
+// If a component is defined in the personal catalog and
+// in the general catalog (same name), the component defined
+// in the personal catalog is used
+//----------------------------------------------------------------------
+SALOME_ModuleCatalog::ListOfComponents*
+SALOME_ModuleCatalogImpl::GetComponentList()
+{
+ if(MYDEBUG) MESSAGE("Begin of GetComponentList");
+ SALOME_ModuleCatalog::ListOfComponents_var _list_components =
+ new SALOME_ModuleCatalog::ListOfComponents;
+
+ _list_components->length(_personal_module_list.size());
+
+ // All the components defined in the personal catalog are taken
+ for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+ _list_components[ind]=(_personal_module_list[ind].name).c_str();
+ if(MYDEBUG) SCRUTE(_list_components[ind]) ;
+ }
+
+ int indice = _personal_module_list.size() ;
+ bool _find = false;
+
+ // The components in the general catalog are taken only if they're
+ // not defined in the personal catalog
+#ifndef WNT
+ for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+#else
+ for(ind=0; ind < _general_module_list.size();ind++){
+#endif
+ _find = false;
+ for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+ // searching if the component is already defined in
+ // the personal catalog
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+ _find = true;
+ }
+ if(!_find){
+ if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name
+ << " has to be to added in the list");
+ _list_components->length(indice+1);
+ // The component is not already defined => has to be taken
+ _list_components[indice]=(_general_module_list[ind].name).c_str();
+ if(MYDEBUG) SCRUTE(_list_components[indice]) ;
+
+ indice++;
+ }else{
+ if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name
+ << " was already defined in the personal catalog") ;
+ }
+ }
+
+ if(MYDEBUG) MESSAGE ( "End of GetComponentList" );
+ return _list_components._retn();
+}
+
+
+//----------------------------------------------------------------------
+// Function : GetComponentIconeList
+// Purpose : get a component list of component name and component icone
+// If a component is defined in the personal catalog and
+// in the general catalog (same name), the component defined
+// in the personal catalog is used
+//----------------------------------------------------------------------
+SALOME_ModuleCatalog::ListOfIAPP_Affich*
+SALOME_ModuleCatalogImpl::GetComponentIconeList()
+{
+ if(MYDEBUG) MESSAGE("Begin of GetComponentIconeList");
+
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone =
+ new SALOME_ModuleCatalog::ListOfIAPP_Affich;
+
+ _list_components_icone->length(_personal_module_list.size());
+
+ // All the components defined in the personal catalog are taken
+ for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+ _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
+ _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
+ _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
+ _list_components_icone[ind].moduleversion=(_personal_module_list[ind].version).c_str();
+ _list_components_icone[ind].modulecomment=(_personal_module_list[ind].comment).c_str();
+ //if(MYDEBUG) SCRUTE(_list_components_icone[ind].modulename);
+ //if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
+ }
+
+ int indice = _personal_module_list.size() ;
+ bool _find = false;
+
+ // The components in the general catalog are taken only if they're
+ // not defined in the personal catalog
+#ifndef WNT
+ for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+#else
+ for(ind=0; ind < _general_module_list.size();ind++){
+#endif
+ _find = false;
+ for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+ // searching if the component is aleready defined in
+ // the personal catalog
+ if((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+ _find = true;
+ }
+ if(!_find){
+ // if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ _list_components_icone->length(indice+1);
+ // The component is not already defined => has to be taken
+ _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();
+ _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();
+ _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str();
+ _list_components_icone[indice].moduleversion=_general_module_list[ind].version.c_str();
+ _list_components_icone[indice].modulecomment=_general_module_list[ind].comment.c_str();
+ //if(MYDEBUG) SCRUTE(_list_components_icone[indice].modulename) ;
+ //if(MYDEBUG) SCRUTE(_list_components_icone[indice].moduleicone);
+
+ indice++;
+ }
+ // else
+ //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
+ }
+
+ return _list_components_icone._retn() ;
+}
+
+//----------------------------------------------------------------------
+// Function : GetTypedComponentList
+// Purpose : get a component list of a wanted type
+// If a component is defined in the personal catalog and
+// in the general catalog (same name), the component defined
+// in the personal catalog is used
+//----------------------------------------------------------------------
+SALOME_ModuleCatalog::ListOfComponents*
+SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type)
+{
+ if(MYDEBUG) MESSAGE("Begin of GetTypedComponentList");
+ SALOME_ModuleCatalog::ListOfComponents_var _list_typed_component =
+ new SALOME_ModuleCatalog::ListOfComponents;
+ int _j = 0;
+
+ _list_typed_component->length(0);
+ // Transform SALOME_ModuleCatalog::ComponentType in ParserComponentType
+ ParserComponentType _temp_component_type;
+ switch(component_type){
+ case SALOME_ModuleCatalog::GEOM:
+ _temp_component_type = GEOM ;
+ break;
+ case SALOME_ModuleCatalog::MESH:
+ _temp_component_type = MESH;
+ break;
+ case SALOME_ModuleCatalog::Med:
+ _temp_component_type = Med;
+ break;
+ case SALOME_ModuleCatalog::SOLVER:
+ _temp_component_type = SOLVER;
+ break;
+ case SALOME_ModuleCatalog::DATA:
+ _temp_component_type = DATA;
+ break;
+ case SALOME_ModuleCatalog::VISU:
+ _temp_component_type = VISU;
+ break;
+ case SALOME_ModuleCatalog::SUPERV:
+ _temp_component_type = SUPERV;
+ break;
+ case SALOME_ModuleCatalog::OTHER:
+ _temp_component_type = OTHER;
+ break;
+ }
+
+ // All the components in the personal catalog are taken
+ for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
+ {
+ if (_personal_module_list[ind].type == _temp_component_type)
+ {
+ _list_typed_component->length(_j + 1);
+ _list_typed_component[_j] = (_moduleList[ind].name).c_str();
+ //if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
+ _j++;
+ }
+ }
+
+ int indice = _list_typed_component->length() ;
+ bool _find = false;
+
+ // The components in the general catalog are taken only if they're
+ // not defined in the personal catalog
+#ifndef WNT
+ for (unsigned int ind=0; ind < _general_module_list.size();ind++)
+#else
+ for (ind=0; ind < _general_module_list.size();ind++)
+#endif
+ {
+ _find = false;
+
+ if(_general_module_list[ind].type == _temp_component_type)
+ {
+ for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
+ {
+ // searching if the component is aleready defined in
+ // the personal catalog
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+ _find = true;
+ }
+ if (!_find)
+ {
+ //if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+ _list_typed_component->length(indice+1);
+ // The component is not already defined => has to be taken
+ _list_typed_component[indice]=(_general_module_list[ind].name).c_str();
+ //if(MYDEBUG) SCRUTE(_list_typed_component[indice]) ;
+
+ indice++;
+ }
+ //else
+ //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
+ }
+ }
+
+
+ return _list_typed_component._retn();
+}
+
+//----------------------------------------------------------------------
+// Function : GetComponent
+// Purpose : get a component
+// If a component is defined in the personal catalog and
+// in the general catalog (same name), the component defined
+// in the personal catalog is used
+//----------------------------------------------------------------------
+SALOME_ModuleCatalog::Acomponent_ptr
+SALOME_ModuleCatalogImpl::GetComponent(const char* name)
+{
+ // Looking for component named "componentname" in the personal catalog
+ // If found, get name, interfaces and constraint
+ // If not found, looking for component named "componentname" in
+ // the general catalog
+ // If found, get name, interfaces and constraint
+ // If not found, NULL pointer is returned
+
+ std::string s(name);
+ ParserComponent *C_parser = NULL;
+ ParserPathPrefixes *pp = NULL;
+
+ SALOME_ModuleCatalog::Acomponent_ptr compo
+ = SALOME_ModuleCatalog::Acomponent::_nil();
+ C_parser = findComponent(s);
+ if (C_parser) {
+
+ // DebugParserComponent(*C_parser);
+
+ SALOME_ModuleCatalog::Component C_corba;
+ duplicate(C_corba, *C_parser);
+
+
+ SALOME_ModuleCatalog_AcomponentImpl * aComponentImpl =
+ new SALOME_ModuleCatalog_AcomponentImpl(C_corba);
+
+ compo = aComponentImpl->_this();
+ }
+ else {
+ // Not found in the personal catalog and in the general catalog
+ // return NULL object
+ if(MYDEBUG) MESSAGE("Component with name " << name
+ << " not found in catalog");
+ }
+
+ return compo;
+}
+
+SALOME_ModuleCatalog::Component *
+SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
+{
+ std::string s(name);
+
+ ParserComponent * C_parser = findComponent(s);
+
+ if (C_parser) {
+
+ SALOME_ModuleCatalog::Component * C_corba
+ = new SALOME_ModuleCatalog::Component;
+ duplicate(*C_corba, *C_parser);
+ return C_corba;
+ }
+
+ return NULL;
+}
+
+ParserComponent *
+SALOME_ModuleCatalogImpl::findComponent(const string & name)
+{
+ ParserComponent * C_parser = NULL;
+
+ if (!C_parser)
+ for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
+ {
+ if (name.compare(_personal_module_list[ind].name) == 0)
+ {
+ if(MYDEBUG) MESSAGE("Component named " << name
+ << " found in the personal catalog");
+ C_parser = &(_personal_module_list[ind]);
+ break;
+ }
+ }
+
+ if (!C_parser)
+ for (unsigned int ind=0; ind < _general_module_list.size();ind++)
+ {
+ if (name.compare(_general_module_list[ind].name) == 0)
+ {
+ // if(MYDEBUG) MESSAGE("Component named " << name
+ // << " found in the general catalog");
+ C_parser = &(_general_module_list[ind]);
+ break;
+ }
+ }
+
+ return C_parser;
+}
+
+//----------------------------------------------------------------------
+// Function : _parse_xml_file
+// Purpose : parse one module catalog
+//----------------------------------------------------------------------
+void
+SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
+ ParserComponents& modulelist,
+ ParserPathPrefixes& pathList)
+{
+ if(MYDEBUG) BEGIN_OF("_parse_xml_file");
+ if(MYDEBUG) SCRUTE(file);
+
+ SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
+ QFile xmlFile(file);
+
+ QXmlInputSource source(xmlFile);
+
+ QXmlSimpleReader reader;
+ reader.setContentHandler( handler );
+ reader.setErrorHandler( handler );
+ reader.parse( source );
+ xmlFile.close();
+
+ unsigned int i, j;
+
+ for ( i = 0; i < _moduleList.size(); i++) {
+ for (j=0; j<modulelist.size(); j++) {
+ if (modulelist[j].name == _moduleList[i].name)
+ break;
+ }
+ if (j < modulelist.size())
+ modulelist[j] = _moduleList[i];
+ else
+ modulelist.push_back(_moduleList[i]);
+ }
+
+ for ( i=0; i < _pathList.size(); i++)
+ pathList.push_back(_pathList[i]) ;
+
+ for (j=0; j<modulelist.size(); j++)
+ modulelist[j].prefixes = pathList;
+}
+
+void
+SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file)
+{
+ _parse_xml_file(file, _personal_module_list, _personal_path_list);
+}
+
+
+//
+// Duplicate functions create a Corba structure (component,
+// interface, service, parameter) from the corresponding C++
+// parser structure
+//
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a component from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::Component & C_corba,
+ const ParserComponent & C_parser)
+{
+ C_corba.name = CORBA::string_dup(C_parser.name.c_str());
+ C_corba.username = CORBA::string_dup(C_parser.username.c_str());
+ C_corba.multistudy = C_parser.multistudy;
+ C_corba.icon = CORBA::string_dup(C_parser.icon.c_str());
+ C_corba.type = ComponentTypeConvert[C_parser.type];
+ C_corba.implementationType = C_parser.implementationType;
+
+ unsigned int _length = C_parser.interfaces.size();
+ C_corba.interfaces.length(_length);
+
+ for (unsigned int ind = 0; ind < _length; ind++)
+ duplicate(C_corba.interfaces[ind], C_parser.interfaces[ind]);
+}
+
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create an interface from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
+ const ParserInterface & I_parser)
+{
+ //duplicate interface name
+ I_corba.interfacename = CORBA::string_dup(I_parser.name.c_str());
+
+ // duplicate service list
+ unsigned int _length = I_parser.services.size();
+ // if(MYDEBUG) SCRUTE(_length);
+ // I_corba.interfaceservicelist
+ // = new SALOME_ModuleCatalog::ListOfInterfaceService;
+ I_corba.interfaceservicelist.length(_length);
+
+ for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
+ duplicate(I_corba.interfaceservicelist[ind1],
+ I_parser.services[ind1]);
+}
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::Service & S_corba,
+ const ParserService & S_parser)
+{
+ // duplicate service name
+ S_corba.ServiceName = CORBA::string_dup(S_parser.name.c_str());
+
+ // duplicate service by default
+ S_corba.Servicebydefault = S_parser.byDefault;
+
+ S_corba.TypeOfNode = S_parser.typeOfNode;
+
+ unsigned int _length;
+
+ // duplicate in Parameters
+ _length = S_parser.inParameters.size();
+ S_corba.ServiceinParameter.length(_length);
+
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_corba.ServiceinParameter[ind2],
+ S_parser.inParameters[ind2]);
+
+ // duplicate out Parameters
+ _length = S_parser.outParameters.size();
+ S_corba.ServiceoutParameter.length(_length);
+
+#ifndef WNT
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
+ duplicate(S_corba.ServiceoutParameter[ind2],
+ S_parser.outParameters[ind2]);
+
+ // duplicate in DataStreamParameters
+ _length = S_parser.inDataStreamParameters.size();
+ S_corba.ServiceinDataStreamParameter.length(_length);
+
+#ifndef WNT
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
+ duplicate(S_corba.ServiceinDataStreamParameter[ind2],
+ S_parser.inDataStreamParameters[ind2]);
+
+ // duplicate out DataStreamParameters
+ _length = S_parser.outDataStreamParameters.size();
+ // if(MYDEBUG) SCRUTE(_length);
+ S_corba.ServiceoutDataStreamParameter.length(_length);
+
+#ifndef WNT
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
+ duplicate(S_corba.ServiceoutDataStreamParameter[ind2],
+ S_parser.outDataStreamParameters[ind2]);
+}
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service parameter from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::ServicesParameter & P_corba,
+ const ParserParameter & P_parser)
+{
+ // duplicate parameter name
+ P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
+
+ // duplicate parameter type
+ P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str());
+}
+
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service datastream parameter from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
+ const ParserDataStreamParameter & P_parser)
+{
+ std::map < std::string,
+ SALOME_ModuleCatalog::DataStreamType >::const_iterator it_type;
+
+ std::map < std::string,
+ SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep;
+
+ // duplicate parameter name
+ P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
+
+ // doesn't work ???
+ // it_type = DataStreamTypeConvert.find(P_parser.type);
+ // P_corba.Parametertype
+ // = (it_type == DataStreamTypeConvert.end())
+ // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+
+ if(MYDEBUG) SCRUTE(P_parser.type);
+ P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+ for (it_type = DataStreamTypeConvert.begin();
+ it_type != DataStreamTypeConvert.end();
+ it_type++)
+ if (P_parser.type.compare(it_type->first) == 0) {
+ P_corba.Parametertype = it_type->second;
+ break;
+ }
+ if(MYDEBUG) SCRUTE(P_corba.Parametertype);
+
+ // duplicate parameter type
+
+ // doesn't work ???
+ // it_type = DataStreamTypeConvert.find(P_parser.type);
+ // P_corba.Parametertype
+ // = (it_type == DataStreamTypeConvert.end())
+ // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+
+ if(MYDEBUG) SCRUTE(P_parser.dependency);
+ P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
+ for (it_dep = DataStreamDepConvert.begin();
+ it_dep != DataStreamDepConvert.end();
+ it_dep++)
+ if (P_parser.dependency.compare(it_dep->first) == 0) {
+ P_corba.Parameterdependency = it_dep->second;
+ break;
+ }
+
+ if(MYDEBUG) SCRUTE(P_corba.Parameterdependency);
+}
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create the path prefix structures from the catalog parsing
+//----------------------------------------------------------------------
+void
+SALOME_ModuleCatalogImpl::duplicate(ParserPathPrefixes &L_out,
+ const ParserPathPrefixes &L_in)
+{
+ L_out = L_in;
+}
+
+
+//----------------------------------------------------------------------
+// Function : _verify_path_prefix
+// Purpose : verify the path prefix structures from the catalog parsing
+// Verify that there only one path prefix associated to a
+// particular computer
+//----------------------------------------------------------------------
+bool
+SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList)
+{
+ bool _return_value = true;
+ vector<string> _machine_list;
+
+ // Fill a list of all computers indicated in the path list
+ for (unsigned int ind = 0; ind < pathList.size(); ind++)
+ {
+ for (unsigned int ind1 = 0 ; ind1 < pathList[ind].listOfComputer.size(); ind1++)
+ {
+ _machine_list.push_back(pathList[ind].listOfComputer[ind1]);
+ }
+ }
+
+ // Parse if a computer name is twice in the list of computers
+#ifndef WNT
+ for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
+#else
+ for (ind = 0; ind < _machine_list.size(); ind++)
+#endif
+ {
+ for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
+ {
+ if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
+ {
+ if(MYDEBUG) MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list");
+ _return_value = false;
+ }
+ }
+ }
+ return _return_value;
+}
+
+
+//----------------------------------------------------------------------
+// Function : _parseArguments
+// Purpose : parse arguments to get general and personal catalog files
+//----------------------------------------------------------------------
+bool
+SALOME_ModuleCatalogImpl::_parseArguments(int argc, char **argv,
+ char **_general,
+ char** _personal)
+{
+ bool _return_value = true;
+ *_general = NULL;
+ *_personal = NULL ;
+ for (int ind = 0; ind < argc ; ind++)
+ {
+
+ if (strcmp(argv[ind],"-help") == 0)
+ {
+ INFOS( "Usage: " << argv[0]
+ << " -common 'path to general catalog' "
+ " -personal 'path to personal catalog' "
+ " -ORBInitRef NameService=corbaname::localhost");
+ _return_value = false ;
+ }
+
+ if (strcmp(argv[ind],"-common") == 0)
+ {
+ if (ind + 1 < argc)
+ {
+ // General catalog file
+ *_general = argv[ind + 1] ;
+ }
+ }
+ else if (strcmp(argv[ind],"-personal") == 0)
+ {
+ if (ind + 1 < argc)
+ {
+ // Personal catalog file
+ *_personal = argv[ind + 1] ;
+ }
+ }
+ }
+ return _return_value;
+}
+
+
--- /dev/null
+// SALOME NamingService : wrapping NamingService services
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_NamingService.cxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#include "SALOME_NamingService.hxx"
+#include "ServiceUnreachable.hxx"
+
+#include "utilities.h"
+
+#include <iostream>
+#include <cstring>
+#include <string>
+
+using namespace std;
+
+// ============================================================================
+/*! \brief Default Constructor without ORB reference.
+ *
+ * After Default Constructor, one needs to initialize ORB.
+ * \sa init_orb(CORBA::ORB_ptr orb), SALOME_NamingService(CORBA::ORB_ptr orb)
+ */
+// ============================================================================
+
+SALOME_NamingService::SALOME_NamingService()
+{
+ MESSAGE("SALOME_NamingService default constructor");
+ _orb = CORBA::ORB::_nil();
+ _root_context = CosNaming::NamingContext::_nil();
+}
+
+// ============================================================================
+/*! \brief Standard Constructor, with ORB reference.
+ *
+ * Initializes the naming service root context
+ * \param orb CORBA::ORB_ptr arguments
+ */
+// ============================================================================
+
+SALOME_NamingService::SALOME_NamingService(CORBA::ORB_ptr orb)
+{
+ MESSAGE("SALOME_NamingService creation");
+ _orb = orb ;
+ _initialize_root_context();
+}
+
+// ============================================================================
+/*! \brief Standard destructor.
+ *
+ * The standard destructor does nothing special.
+ */
+// ============================================================================
+
+SALOME_NamingService::~SALOME_NamingService()
+{
+ // Problem MESSAGE with singleton: late destruction,
+ // after trace system destruction ?
+ //MESSAGE("SALOME_NamingService destruction");
+}
+
+// ============================================================================
+/*! \brief initializes ORB reference and naming service root context.
+ *
+ * Initializes ORB reference and naming service root context.
+ * For use after default constructor.
+ * \param orb CORBA::ORB_ptr arguments
+ */
+// ============================================================================
+
+void SALOME_NamingService::init_orb(CORBA::ORB_ptr orb)
+{
+ MESSAGE("SALOME_NamingService initialisation");
+
+ Utils_Locker lock (&_myMutex);
+ _orb = orb;
+
+ _initialize_root_context();
+}
+
+// ============================================================================
+/*! \brief Registers a CORBA object reference under a path.
+ *
+ * Registers a CORBA object reference under a path. If the path ends with '/',
+ * only a directory is created.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param ObjRef CORBA object reference to associate to the path. To create
+ * only a directory, give nil pointer.
+ * \param Path A relative or absolute pathname to store the object reference.
+ * If the pathname begins with a '/', pathname is taken
+ * as an absolute pathname. Else, pathname is taken as a relative
+ * path, to current context. Prefer absolute pathname, relative
+ * pathname are not safe, when SALOME_NamingService object is
+ * shared or use in multithreaded context.
+ * If the path ends with '/', only a directory is created.
+ * \sa Change_Directory(const char* Path),
+ * Create_Directory(const char* Path)
+ * CORBA::Object_ptr Resolve(const char* Path)
+ */
+// ============================================================================
+
+void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef,
+ const char* Path)
+ throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Register: " << Path);
+
+ Utils_Locker lock (&_myMutex);
+
+ // --- _current_context is replaced to the _root_context
+ // if the Path begins whith '/'
+
+ if (Path[0] == '/')
+ {
+ _current_context = _root_context;
+ }
+
+ // --- the resolution of the directory path has to be done
+ // to place the current_context to the correct node
+
+ CosNaming::Name context_name;
+ vector<string> splitPath;
+ int dimension_resultat = _createContextNameDir(Path,
+ context_name,
+ splitPath,
+ true);
+
+ CORBA::Boolean not_exist = false;
+
+ if (dimension_resultat > 0)
+ {
+ // A directory is treated (not only an object name)
+ // test if the directory where ObjRef should be recorded already exists
+ // If not, create the new context
+
+ try
+ {
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ }
+
+ catch (CosNaming::NamingContext::NotFound &)
+ {
+ // --- failed to resolve, therefore assume cold start
+ not_exist = true;
+ }
+
+ catch (CosNaming::NamingContext::InvalidName &)
+ {
+ INFOS("Register() : CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed &)
+ {
+ INFOS("Register() : CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Register() : CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+
+ if (not_exist)
+ {
+ try
+ {
+ context_name.length(1);
+ for (int i = 0 ; i < dimension_resultat ;i++)
+ {
+ context_name[0].id =
+ CORBA::string_dup(splitPath[i].c_str());
+ context_name[0].kind = CORBA::string_dup("dir");
+ // SCRUTE(_context_name[0].id);
+ // --- check if the path is created
+ try
+ {
+ // --- if the context is already created, nothing to do
+ CORBA::Object_var obj =
+ _current_context->resolve(context_name);
+ _current_context =
+ CosNaming::NamingContext::_narrow(obj);
+ }
+
+ catch (CosNaming::NamingContext::NotFound &)
+ {
+ // --- the context must be created
+ CosNaming::NamingContext_var temp_context =
+ _current_context->bind_new_context(context_name);
+ _current_context = temp_context;
+ }
+ }
+ }
+
+ catch (CosNaming::NamingContext::AlreadyBound&)
+ {
+ INFOS("Register() : CosNaming::NamingContext::AlreadyBound");
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
+
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context");
+
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS("Register(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS("Register(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Register():CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+ }
+ }
+
+ // --- The current directory is now the directory where the object should
+ // be recorded
+
+ int sizePath = splitPath.size();
+ if (sizePath > dimension_resultat)
+ {
+ ASSERT(sizePath == dimension_resultat+1);
+ context_name.length(1);
+
+ try
+ {
+ // --- the last element is an object and not a directory
+
+ context_name[0].id =
+ CORBA::string_dup(splitPath[dimension_resultat].c_str());
+ context_name[0].kind = CORBA::string_dup("object");
+ //SCRUTE(context_name[0].id);
+
+ _current_context->bind(context_name, ObjRef);
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
+
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context");
+
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS("Register(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS("Register(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CosNaming::NamingContext::AlreadyBound&)
+ {
+ INFOS("Register(): CosNaming::NamingContext::AlreadyBound, "
+ << "object will be rebind");
+ _current_context->rebind(context_name, ObjRef);
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("!!!Register(): CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+ }
+}
+
+// ============================================================================
+/*! \brief get the CORBA object reference associated to a name.
+ *
+ * get the CORBA object reference associated to a complete name with a path.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown
+ * \param Path pathname. If the pathname begins with a '/', pathname is taken
+ * as an absolute pathname. Else, pathname is taken as a relative
+ * path, to current context. Prefer absolute pathname, relative
+ * pathname are not safe, when SALOME_NamingService object is
+ * shared or use in multithreaded context.
+ * \return the object reference if it exists under the pathname,
+ * or nil reference in other cases.
+ * \sa Register(CORBA::Object_ptr ObjRef, const char* Path),
+ * Change_Directory(const char* Path)
+ */
+// ============================================================================
+
+CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path)
+ throw(ServiceUnreachable)
+{
+// MESSAGE("BEGIN OF Resolve: " << Path);
+
+ Utils_Locker lock (&_myMutex);
+
+ // --- _current_context is replaced to the _root_context
+ // if the Path begins whith '/'
+
+ if (Path[0] == '/')
+ {
+ _current_context = _root_context;
+ }
+
+ // --- the resolution of the directory path has to be done
+ // to place the current_context to the correct node
+
+ CosNaming::Name context_name;
+ vector<string> splitPath;
+ int dimension_resultat = _createContextNameDir(Path,
+ context_name,
+ splitPath,
+ false);
+
+ ASSERT(!CORBA::is_nil(_current_context));
+
+ CORBA::Object_ptr obj = CORBA::Object::_nil();
+
+ try
+ {
+ obj = _current_context->resolve(context_name);
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS("Resolve() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
+
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Resolve() : "
+ << (char *) n[0].id << " (" << (char *) n[0].kind
+ << ") is not a context");
+
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS("Resolve() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS("Resolve(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS("Resolve(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Resolve():CORBA::SystemException : unable to contact"
+ << "the naming service");
+ throw ServiceUnreachable();
+ }
+
+ return obj;
+}
+
+// ============================================================================
+/*! \brief get the CORBA object reference associated to an uncomplete name.
+ *
+ * get the CORBA object reference associated to an uncomplete name with a
+ * path. Look for the first occurence of name*.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown
+ * \param Path pathname under the form "/path/name" (Absolute reference !)
+ * search the fist reference like "/path(.dir)/name*(.kind)"
+ * \return the object reference if found, or nil reference.
+ * \sa Resolve(const char* Path)
+ */
+// ============================================================================
+
+CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path)
+ throw(ServiceUnreachable)
+{
+// MESSAGE("ResolveFirst");
+
+ Utils_Locker lock (&_myMutex);
+// SCRUTE(Path);
+
+ string thePath = Path;
+ string basePath = "";
+ string name = thePath;
+
+ string::size_type idx = thePath.rfind('/');
+
+ if (idx != string::npos) // at least one '/' found
+ {
+ basePath = thePath.substr(0, idx);
+ name = thePath.substr(idx + 1);
+// SCRUTE(basePath);
+ }
+
+// SCRUTE(name);
+ CORBA::Object_ptr obj = CORBA::Object::_nil();
+
+ bool isOk = false;
+ if (basePath.empty())
+ isOk =true;
+ else
+ isOk = Change_Directory(basePath.c_str());
+
+ if (isOk)
+ {
+ vector<string> listElem = list_directory();
+ vector<string>::iterator its = listElem.begin();
+
+ while (its != listElem.end())
+ {
+ MESSAGE(*its);
+
+ if ((*its).find(name) == 0)
+ {
+ return Resolve((*its).c_str());
+ }
+
+ its++;
+ }
+ }
+
+ return obj;
+}
+
+// ============================================================================
+/*! \brief find a component instance from hostname, containername,
+ * componentName and number of processors.
+ *
+ * find a component instance from hostname, containername, componentName and
+ * number of processors.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param hostname name of the machine on which the component is searched.
+ * \param containername name of the container in which the component is
+ instanciated.
+ * \param componentname name of the component we are looking for an existing
+ instance.
+ * \param nbproc in case of multi processor machine, container name is
+ * suffixed with _nbproc.
+ * \return the object reference
+ */
+// ============================================================================
+
+CORBA::Object_ptr
+SALOME_NamingService::ResolveComponent(const char* hostname,
+ const char* containerName,
+ const char* componentName,
+ const int nbproc)
+ throw(ServiceUnreachable)
+{
+// MESSAGE("ResolveComponent");
+
+ Utils_Locker lock (&_myMutex);
+
+ string name = "/Containers/";
+
+ name += hostname;
+
+ if ( strlen(containerName) != 0 )
+ {
+ name += "/";
+
+ if ( nbproc >= 1 )
+ {
+ char *newContainerName = new char[strlen(containerName) + 8];
+ sprintf(newContainerName, "%s_%d", containerName, nbproc);
+ name += newContainerName;
+ delete [] newContainerName;
+ }
+
+ else
+ name += containerName;
+
+ name += "/";
+
+ name += componentName;
+
+ return ResolveFirst(name.c_str());
+ }
+
+ else
+ {
+ SCRUTE(name);
+ if (Change_Directory(name.c_str()))
+ {
+ vector<string> contList = list_subdirs();
+
+ for (unsigned int ind = 0; ind < contList.size(); ind++)
+ {
+ name = contList[ind].c_str();
+
+ if ( nbproc >= 1 )
+ {
+ char *str_nbproc = new char[8];
+ sprintf(str_nbproc, "_%d", nbproc);
+ if( strstr(name.c_str(),str_nbproc) == NULL)
+ continue; // check only containers with _%d in name
+ delete [] str_nbproc;
+ }
+
+ name += "/";
+ name += componentName;
+ SCRUTE(name);
+ CORBA::Object_ptr obj = ResolveFirst(name.c_str());
+
+ if ( !CORBA::is_nil(obj) )
+ return obj;
+ }
+ }
+
+ return CORBA::Object::_nil();
+ }
+}
+
+// ============================================================================
+/*! \brief provide a default container name if empty.
+ *
+ * the given container name is returned unchanged, unless it is empty.
+ * \param containerName
+ * \return container name, where empty input is replaced by "FactoryServer",
+ * without the path.
+ * \sa BuildContainerNameForNS(const char *containerName, const char *hostname)
+ */
+// ============================================================================
+
+string SALOME_NamingService::ContainerName(const char *containerName)
+{
+ string ret;
+
+ if (strlen(containerName) == 0)
+ ret = "FactoryServer";
+ else
+ ret = containerName;
+
+ return ret;
+}
+
+// ============================================================================
+/*! \brief build a container name, given a MachineParameters struct.
+ *
+ * Build a container name with a MachineParameters struct. In case of multi
+ * processor machine, container name is suffixed with _nbproc. nproc equals
+ * (number of nodes)*(number of processor per nodes).
+ * \param params struct from which we get container name (may be
+ * empty), number of nodes and number of processor
+ * per node.
+ * \return a container name without the path.
+ * \sa BuildContainerNameForNS(const Engines::MachineParameters& params,
+ * const char *hostname)
+ */
+// ============================================================================
+
+string
+SALOME_NamingService::ContainerName(const Engines::MachineParameters& params)
+{
+ int nbproc;
+
+ if ( !params.isMPI )
+ nbproc = 0;
+ else if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+ nbproc = 1;
+ else if ( params.nb_node == 0 )
+ nbproc = params.nb_proc_per_node;
+ else if ( params.nb_proc_per_node == 0 )
+ nbproc = params.nb_node;
+ else
+ nbproc = params.nb_node * params.nb_proc_per_node;
+
+ string ret = ContainerName(params.container_name);
+
+ if ( nbproc >= 1 )
+ {
+ char *suffix = new char[8];
+ sprintf(suffix, "_%d", nbproc);
+ ret += suffix;
+ }
+
+ return ret;
+}
+
+// ============================================================================
+/*! \brief build a string representing a container in Naming Service.
+ *
+ * Build a string representing the absolute pathname of a container in
+ * SALOME_NamingService. This form gives a suffixed containerName in case of
+ * multi processor machine.
+ * \param params struct from which we get container name (may be
+ * empty), number of nodes and number of processor
+ * per node.
+ * /param hostname name of the host of the container, without domain names.
+ * /return the path under the form /Containers/hostname/containerName
+ * /sa ContainerName(const Engines::MachineParameters& params)
+ */
+// ============================================================================
+
+string SALOME_NamingService::BuildContainerNameForNS(const char *containerName,
+ const char *hostname)
+{
+ string ret = "/Containers/";
+ ret += hostname;
+ ret += "/";
+ ret += ContainerName(containerName);
+
+ return ret;
+}
+
+// ============================================================================
+/*! \brief build a string representing a container in Naming Service.
+ *
+ * Build a string representing the absolute pathname of a container in
+ * SALOME_NamingService.
+ * /param params used as it is, or replaced by FactoryServer if empty.
+ * /param hostname name of the host of the container, without domain names.
+ * /return the path under the form /Containers/hostname/containerName
+ * /sa ContainerName(const char *containerName)
+ */
+// ============================================================================
+
+string
+SALOME_NamingService::
+BuildContainerNameForNS(const Engines::MachineParameters& params,
+ const char *hostname)
+{
+ string ret = "/Containers/";
+ ret += hostname;
+ ret += "/";
+ ret += ContainerName(params);
+
+ return ret;
+}
+
+// ============================================================================
+/*! \brief search a name in current directory.
+ *
+ * Search a name in the current directory. after call, the current directory
+ * is changed to the directory containing the last occurence of name found.
+ * If no occurence found (see return value), current directory remains
+ * unchanged.
+ *
+ * \param name the name to search.
+ * \return number of occurences found.
+ * \sa Change_Directory(const char* Path)
+ */
+// ============================================================================
+
+int SALOME_NamingService::Find(const char* name)
+throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Find " << name);
+
+ Utils_Locker lock (&_myMutex);
+
+ CORBA::Long occurence_number = 0 ;
+
+ try
+ {
+ _Find(name, occurence_number);
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("!!!Find() : CORBA::SystemException : unable to contact"
+ << " the naming service");
+ throw ServiceUnreachable();
+ }
+
+ return occurence_number;
+}
+
+// ============================================================================
+/*! \brief Creates a directory (context_name)
+ *
+ * Creates a directory (context_name) relative to the current directory
+ * (current context) or relative to the root directory (root context), if
+ * the path given begins with a '/'.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param Path A relative or absolute pathname to store the object reference.
+ * If the pathname begins with a '/', pathname is taken
+ * as an absolute pathname. Else, pathname is taken as a relative
+ * path, to current context. Prefer absolute pathname, relative
+ * pathname are not safe, when SALOME_NamingService object is
+ * shared or use in multithreaded context.
+ * \return true if successfull
+ * (creation not strictly garanteed if true, because Register may
+ * catch some specific unlikely exception without throw anything
+ * --- to be corrected ---)
+ * \sa RegisterCORBA::Object_ptr ObjRef, const char* Path)
+ */
+// ============================================================================
+
+bool SALOME_NamingService::Create_Directory(const char* Path)
+throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Create_Directory");
+
+ Utils_Locker lock (&_myMutex);
+
+ string path(Path);
+
+ // --- if path empty, nothing to create, no context change
+
+ if (path.empty())
+ return false;
+
+ // --- if path ='/', nothing to create, only change to root_context
+
+ if (path == "/")
+ {
+ MESSAGE("Create Directory '/', just change to root_context");
+ _current_context = _root_context;
+ return true;
+ }
+
+ // --- path must end with '/'
+
+ if (path[path.length()-1] != '/') path += '/';
+
+ Register(CORBA::Object::_nil(), path.c_str());
+ return true;
+}
+
+// ============================================================================
+/*! \brief change current directory to the given path
+ *
+ * change the current directory to the given path in parameter.
+ * Warning: avoid use when the SALOME_NamingService instance is shared by
+ * several threads (current context may be modified by another thread).
+ * If the path is empty, nothing done return OK.
+ * If Path ="/", the current directory changes to the root directory.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param Path the new current directory
+ * \return true if the change succeeded
+ */
+// ============================================================================
+
+bool SALOME_NamingService::Change_Directory(const char* Path)
+throw(ServiceUnreachable)
+{
+// MESSAGE("BEGIN OF Change_Directory " << Path);
+ Utils_Locker lock (&_myMutex);
+
+ string path(Path);
+
+ // --- if path empty, nothing to do
+
+ if (path.empty())
+ return true;
+
+ // --- if path ='/', nothing to resolve, only change to root_context
+
+ if (path == "/")
+ {
+// MESSAGE("Change_Directory is called to go to the root_context");
+ _current_context = _root_context;
+ return true;
+ }
+
+ CosNaming::NamingContext_var current_context = _current_context;
+ bool changeOK = false;
+
+ // --- replace _current_context with _root_context if Path begins whith '/'
+
+ if (path[0] == '/')
+ current_context = _root_context;
+
+ // --- need to resolve directory path
+
+ ASSERT(!CORBA::is_nil(current_context));
+
+ if (path[path.length()-1] != '/') path += '/';
+// SCRUTE(path);
+ CosNaming::Name context_name;
+ vector<string> splitPath;
+ int dimension_resultat = _createContextNameDir(path.c_str(),
+ context_name,
+ splitPath,
+ true);
+
+ // --- Context creation
+
+ try
+ {
+ CORBA::Object_var obj = current_context->resolve(context_name);
+ current_context = CosNaming::NamingContext::_narrow(obj);
+ ASSERT(!CORBA::is_nil(current_context));
+ _current_context = current_context;
+ changeOK = true;
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS( "Change_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Change_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context" );
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS( "Change_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object" );
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS("Change_Directory(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS("Change_Directory(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Change_Directory():CORBA::SystemException : unable to contact"
+ << "the naming service");
+ throw ServiceUnreachable();
+ }
+
+ return changeOK;
+}
+
+// ============================================================================
+/*! \brief get the current directory path
+ *
+ * Get the current directory path.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \return the path of the current_context
+ * \sa _current_directory
+ */
+// ============================================================================
+
+char* SALOME_NamingService::Current_Directory()
+throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Current_Directory");
+
+ Utils_Locker lock (&_myMutex);
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ vector<string> splitPath;
+ splitPath.resize(0);
+ int lengthPath = 0;
+ bool notFound = true ;
+
+ // --- start search from root context
+
+ _current_context = _root_context ;
+
+ try
+ {
+ _current_directory(splitPath, lengthPath, ref_context, notFound );
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Current_Directory(): CORBA::SystemException: unable to contact"
+ << " the naming service" )
+ throw ServiceUnreachable();
+ }
+
+ string path;
+ lengthPath = splitPath.size();
+ for (int k = 0 ; k < lengthPath ;k++)
+ {
+ path += "/";
+ path += splitPath[k];
+ }
+
+ SCRUTE(path)
+ _current_context = ref_context ;
+
+ return strdup(path.c_str());
+}
+
+// ============================================================================
+/*! \brief list recursively all objects in the current context
+ *
+ * List and print via trace all directories and objects in the current
+ * context. Trace must be activated: compile option _DEBUG_
+ * If the NamingService is out, the exception ServiceUnreachable is thrown
+ */
+// ============================================================================
+
+void SALOME_NamingService::list()
+throw(ServiceUnreachable)
+{
+ MESSAGE("Begin of list");
+
+ Utils_Locker lock (&_myMutex)
+
+ ;
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding ;
+
+ unsigned long nb = 0 ; // --- only for the BindingIterator use,
+ // to access the bindings
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ _current_context->list(nb, binding_list, binding_iterator) ;
+
+ if (! CORBA::is_nil(binding_iterator))
+ {
+ while (binding_iterator->next_one(binding))
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::ncontext)
+ {
+ MESSAGE( "Context : " << bindingName[0].id );
+
+ try
+ {
+ Change_Directory(bindingName[0].id);
+ }
+
+ catch (ServiceUnreachable&)
+ {
+ INFOS( "list(): ServiceUnreachable" )
+ throw ServiceUnreachable();
+ }
+
+ list();
+ _current_context = ref_context ;
+ }
+
+ else if (binding->binding_type == CosNaming::nobject)
+ {
+ MESSAGE( "Object : " << bindingName[0].id );
+ }
+ }
+
+ binding_iterator->destroy();
+ }
+}
+
+// ============================================================================
+/*! \brief list all the objects in the current directory.
+ *
+ * get a list of all the objects in the current directory, without recursion
+ * on the subdirectories. Only the objects are listed, not the directories.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \return list of strings with objects found.
+ * \sa vector<string> list_directory_recurs()
+ */
+// ============================================================================
+
+vector<string> SALOME_NamingService::list_directory()
+throw(ServiceUnreachable)
+{
+// MESSAGE("list_directory");
+ vector<string> dirList ;
+ dirList.resize(0);
+
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding ;
+
+ unsigned long nb = 0 ; // --- only for the BindingIterator use,
+ // to access the bindings
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ _current_context->list(nb, binding_list, binding_iterator);
+
+ if (binding_iterator->_is_nil())
+ return dirList;
+
+ while (binding_iterator->next_one(binding))
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::nobject)
+ {
+ dirList.push_back(CORBA::string_dup(bindingName[0].id));
+ }
+ }
+
+// for (unsigned int ind = 0; ind < dirList.size(); ind++)
+// MESSAGE("list_directory : Object : " << dirList[ind]);
+
+ binding_iterator->destroy();
+
+ return dirList;
+}
+
+
+// ============================================================================
+/*! \brief list all the subdirectories in the current directory.
+ *
+ * get a list of all the subdirectories in the current directory,
+ * without recursion on the subdirectories.
+ * Only the subdirectories are listed, not the objects.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \return list of strings with directories found.
+ * \sa vector<string> list_directory()
+ */
+// ============================================================================
+
+vector<string> SALOME_NamingService::list_subdirs()
+throw(ServiceUnreachable)
+{
+ MESSAGE("list_subdirs");
+ vector<string> dirList ;
+ dirList.resize(0);
+
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding ;
+
+ unsigned long nb = 0 ; // --- only for the BindingIterator use,
+ // to access the bindings
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ _current_context->list(nb, binding_list, binding_iterator) ;
+
+ if (binding_iterator->_is_nil())
+ return dirList;
+
+ while (binding_iterator->next_one(binding))
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::ncontext)
+ {
+ dirList.push_back(CORBA::string_dup(bindingName[0].id));
+ }
+ }
+
+ for (unsigned int ind = 0; ind < dirList.size(); ind++)
+ MESSAGE("list_directory : Object : " << dirList[ind]);
+
+ binding_iterator->destroy();
+
+ return dirList;
+}
+
+// ============================================================================
+/*! \brief list all the objects in the current directory and subdirectories.
+ *
+ * get a list of all the objects in the current directory, with recursion
+ * on the subdirectories. Only the objects are listed, not the directories.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \return list of strings with objects found.
+ * \sa vector<string> list_directory()
+ */
+// ============================================================================
+
+vector<string> SALOME_NamingService::list_directory_recurs()
+throw(ServiceUnreachable)
+{
+ MESSAGE("list_directory_recurs");
+
+ Utils_Locker lock (&_myMutex);
+
+ vector<string> dirList ;
+
+ string currentDir = Current_Directory();
+
+ _list_directory_recurs(dirList, "", currentDir);
+
+ return dirList;
+}
+
+// ============================================================================
+/*! \brief destroy an entry in naming service.
+ *
+ * Destroy an association Path - Object Reference.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown
+ * \param Path object path
+ */
+// ============================================================================
+
+void SALOME_NamingService::Destroy_Name(const char* Path)
+throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Destroy_Name " << Path);
+
+ Utils_Locker lock (&_myMutex);
+
+ string path(Path);
+
+ // --- if path empty, nothing to do
+
+ if (path.empty())
+ return;
+
+ // --- if path = '/' not applicable, nothing to do
+
+ if (path == "/")
+ return;
+
+ // --- if path begins with '/', set current directory to root context
+
+ if (path[0] == '/')
+ _current_context = _root_context;
+
+ // --- context of the directory containing the object
+
+ CosNaming::Name context_name;
+ vector<string> splitPath;
+ int dimension_resultat = _createContextNameDir(path.c_str(),
+ context_name,
+ splitPath,
+ true);
+
+ bool exist = false;
+
+ if (dimension_resultat > 0)
+ {
+ // --- path contains a directory, not only an object name
+ // switch to the new directory (or return if directory not found)
+
+ try
+ {
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ exist = true;
+ }
+
+ catch (CosNaming::NamingContext::NotFound &ex)
+ {
+ // --- failed to resolve
+ exist = false;
+
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS( "Destroy_Name(): " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found" );
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS( "Destroy_Name() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context" );
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS( "Destroy_Name() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object" );
+ }
+
+ catch (CosNaming::NamingContext::InvalidName &)
+ {
+ INFOS("Destroy_Name: CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed &)
+ {
+ INFOS("Destroy_Name: CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Destroy_Name : CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+
+ if (! exist) return;
+ }
+
+ ASSERT(!CORBA::is_nil(_current_context));
+
+ // --- The current directory is now the directory where the object should
+ // be destroyed
+
+ int sizePath = splitPath.size();
+ if (sizePath > dimension_resultat)
+ {
+ ASSERT(sizePath == dimension_resultat+1);
+ context_name.length(1);
+
+ try
+ {
+ // --- the last element is an object and not a directory
+
+ context_name[0].id =
+ CORBA::string_dup(splitPath[dimension_resultat].c_str());
+ context_name[0].kind = CORBA::string_dup("object");
+ SCRUTE(context_name[0].id);
+
+ _current_context->unbind(context_name);
+ MESSAGE("The object " << context_name[0].id << " has been deleted");
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS( "Destroy_Name() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found" );
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS( "Destroy_Name() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context" );
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS( "Destroy_Name() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object" );
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS( "Destroy_Name(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS( "Destroy_Name(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS( "Destroy_Name(): CORBA::SystemException: unable to contact"
+ << " the naming service");
+ throw ServiceUnreachable();
+ }
+ }
+}
+
+// ============================================================================
+/*! \brief Destroy an empty directory
+ *
+ * Destroy an empty directory in Naming Service.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param Path directory path
+ */
+// ============================================================================
+
+void SALOME_NamingService::Destroy_Directory(const char* Path)
+throw(ServiceUnreachable)
+{
+ MESSAGE("BEGIN OF Destroy_Directory " << Path);
+
+ Utils_Locker lock (&_myMutex);
+
+ string path(Path);
+
+ // --- if path empty, nothing to do
+
+ if (path.empty())
+ return;
+
+ // --- if path begins with '/', set current directory to root context
+
+ if (path[0] == '/')
+ _current_context = _root_context;
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ // --- path must ends with '/' for a directory
+
+ if (path[path.size() -1] != '/')
+ path += '/';
+
+ // --- context of the directory
+
+ CosNaming::Name context_name;
+ vector<string> splitPath;
+ int dimension_resultat = _createContextNameDir(path.c_str(),
+ context_name,
+ splitPath,
+ true);
+ bool exist = false;
+
+ if (dimension_resultat > 0)
+ {
+ // --- path contains a directory, not only an object name
+ // switch to the new directory (or return if directory not found)
+
+ try
+ {
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ exist = true;
+ }
+
+ catch (CosNaming::NamingContext::NotFound &ex)
+ {
+ // --- failed to resolve
+ exist = false;
+
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS( "Destroy_Directory(): " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found" );
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS( "Destroy_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context" );
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS( "Destroy_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object" );
+ }
+
+ catch (CosNaming::NamingContext::InvalidName &)
+ {
+ INFOS("Destroy_Directory: CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed &)
+ {
+ INFOS("Destroy_Directory: CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Destroy_Directory : CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+
+ if (! exist) return;
+ }
+
+ ASSERT(!CORBA::is_nil(_current_context));
+
+ // --- Context Destruction
+
+ bool isContextDestroyed = false;
+ try
+ {
+ _current_context->destroy();
+ MESSAGE( "The context " << path << " has been deleted" );
+ isContextDestroyed = true;
+ }
+
+ catch (CosNaming::NamingContext::NotEmpty&)
+ {
+ INFOS( "Destroy_Directory(): CosNaming::NamingContext::NoEmpty "
+ << path << " is not empty" );
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS( "Destroy_Directory():CORBA::SystemException : "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+
+ // --- go to the reference directory
+
+ _current_context = ref_context ;
+
+ ASSERT(!CORBA::is_nil(_current_context));
+
+ if (isContextDestroyed)
+ {
+ try
+ {
+ _current_context->unbind(context_name);
+ MESSAGE( "The bind to the context "
+ << context_name[0].id
+ << " has been deleted" );
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex)
+ {
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS( "Destroy_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found" );
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS( "Destroy_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context" );
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS( "Destroy_Directory() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object" );
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&)
+ {
+ INFOS("Destroy_Directory: CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&)
+ {
+ INFOS("Destroy_Directory: CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("Destroy_Directory:CORBA::SystemException : unable to contact"
+ << " the naming service");
+ throw ServiceUnreachable();
+ }
+ }
+}
+
+// ============================================================================
+/*! \brief Destroy a directory with its contents.
+ *
+ * Destroy the objects associations in a directory, and the directory itself,
+ * if there is no subdirectories.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param Path the directory path.
+ */
+// ============================================================================
+
+void SALOME_NamingService::Destroy_FullDirectory(const char* Path)
+throw(ServiceUnreachable)
+{
+ MESSAGE("begin of Destroy_FullDirectory " << Path);
+ if( Change_Directory(Path) )
+ {
+ vector<string> contList = list_directory();
+
+ for (unsigned int ind = 0; ind < contList.size(); ind++)
+ Destroy_Name(contList[ind].c_str());
+
+ Destroy_Directory(Path);
+ }
+}
+
+// ============================================================================
+/*! \brief initialize root context (root directory)
+ *
+ * the root context initialisation must be done when the SALOME_NamingService
+ * instance is created and before any othe call. See constructors.
+ */
+// ============================================================================
+
+void SALOME_NamingService::_initialize_root_context()
+{
+ //MESSAGE("Get the root context");
+
+ try
+ {
+ CORBA::Object_var obj = _orb->resolve_initial_references("NameService");
+ _root_context = CosNaming::NamingContext::_narrow(obj);
+ _current_context = _root_context ;
+ ASSERT(!CORBA::is_nil(_root_context));
+ }
+
+ catch (CORBA::SystemException&)
+ {
+ INFOS("CORBA::SystemException: unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+
+ catch (...)
+ {
+ INFOS("Unknown Exception: unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
+}
+
+// ============================================================================
+/*! \brief transform a string path in CosNaming structure.
+ *
+ * Transform a path given as a string in a CosNaming structure.
+ * \param path a relative or absolute path, with or without an object.
+ * An absolute path begins with '/'.
+ * A path without an object ends with '/'.
+ * \param context_name CosNaming structure to put the path.
+ * \param splitPath a vector of string with subdirectories and final
+ * object, if any.
+ * \param onlyDir if true, final object (if any) is ommited
+ * in context_name.
+ * if false, final object (if any) is included in
+ * context_name.
+ * \return dimension of context_name
+ */
+// ============================================================================
+
+int
+SALOME_NamingService::_createContextNameDir(string path,
+ CosNaming::Name& context_name,
+ vector<string>& splitPath,
+ bool onlyDir)
+{
+ if (path.empty())
+ return 0;
+
+ string::size_type begIdx, endIdx;
+ const string delims("/");
+ splitPath.resize(0);
+ bool endWithDelim = false;
+
+ begIdx = path.find_first_not_of(delims);
+ while (begIdx != string::npos)
+ {
+ endIdx = path.find_first_of(delims, begIdx);
+ if (endIdx == path.length()-1)
+ endWithDelim = true;
+ if (endIdx == string::npos)
+ endIdx = path.length();
+ int lsub = endIdx - begIdx;
+ if (lsub >= 1)
+ splitPath.push_back(path.substr(begIdx, lsub));
+ begIdx = path.find_first_not_of(delims, endIdx);
+ }
+
+ int dim;
+ if (onlyDir) // only directory part
+ {
+ dim = splitPath.size()-1; // omit final object
+ if (endWithDelim) // unless the path ends with a delimiter
+ dim++;
+ endWithDelim = true;
+ }
+ else
+ dim = splitPath.size(); // directories and final object
+
+ context_name.length(dim);
+ for (int i=0; i<dim; i++)
+ {
+// SCRUTE(splitPath[i]);
+ context_name[i].id = CORBA::string_dup(splitPath[i].c_str());
+ if (!endWithDelim && (i == dim-1)) // here, the last string is an object
+ {
+ context_name[i].kind = CORBA::string_dup("object");
+// MESSAGE("--- " <<splitPath[i] <<".object");
+ }
+ else
+ {
+ context_name[i].kind = CORBA::string_dup("dir");
+// MESSAGE("--- " <<splitPath[i] <<".dir");
+ }
+ }
+ return dim;
+}
+
+// ============================================================================
+/*! \brief search a name in current directory.
+ *
+ * Search a name in the current directory. after call, the current directory
+ * is changed to the directory containing the last occurence of name found.
+ * If no occurence found (see return value), current directory remains
+ * unchanged. The call is recursive.
+ *
+ * \param name the name to search.
+ * \param occurence_number number of occurence already found (incremented)
+ */
+// ============================================================================
+
+void SALOME_NamingService::_Find(const char* name,
+ CORBA::Long& occurence_number)
+{
+ MESSAGE("BEGIN OF _Find "<< occurence_number << " " << name);
+
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding;
+
+ unsigned long nb = 0 ; // --- only for the use of the BindingIterator,
+ // to access the bindings
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+ CosNaming::NamingContext_var found_context = _current_context;
+
+ _current_context->list(nb, binding_list, binding_iterator) ;
+
+ if (! CORBA::is_nil(binding_iterator))
+ {
+ while (binding_iterator->next_one(binding))
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::ncontext)
+ {
+ // --- We work on a directory,
+ // the search should be done in this directory
+
+ Change_Directory(bindingName[0].id);
+ _Find(name, occurence_number);
+
+ // --- We'll go back to the initial context
+
+ _current_context = ref_context ;
+ }
+
+ else if (binding->binding_type == CosNaming::nobject)
+ {
+ // --- We work on an object...
+
+ if (!strcmp( bindingName[0].id, name))
+ {
+ //MESSAGE("One occurence was found");
+ occurence_number++;
+
+ // --- We keep in memory the directory where
+ // one occurence was found
+
+ found_context = _current_context ;
+ }
+ }
+ }
+
+ binding_iterator->destroy();
+ }
+ // --- We go to the last directory where an occurence was found
+
+ _current_context = found_context;
+
+ SCRUTE(occurence_number);
+}
+
+// ============================================================================
+/*! \brief find the current directory path.
+ *
+ * Parse the naming service tree to find the current context and give the
+ * associated directory path (relative to root context).
+ * \param splitPath
+ * \param lengthResult
+ * \param contextToFind
+ * \param _notFound
+ */
+// ============================================================================
+
+void
+SALOME_NamingService::
+_current_directory(vector<string>& splitPath,
+ int& lengthResult,
+ CosNaming::NamingContext_var contextToFind,
+ bool& notFound)
+{
+ MESSAGE("BEGIN OF _current_Directory");
+
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding;
+
+ unsigned long nb = 0 ; // --- only for the BindingIterator use,
+ // to access the bindings
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+ CosNaming::NamingContext_var temp_context = _current_context;
+
+ _current_context->list(nb, binding_list, binding_iterator);
+
+ if ( !binding_iterator->_is_nil() )
+ {
+ while ((binding_iterator->next_one(binding)) && notFound)
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::ncontext)
+ {
+ // --- directory, search in it
+
+ splitPath.push_back(CORBA::string_dup(bindingName[0].id));
+ lengthResult++;
+
+ CORBA::Object_var obj = _current_context->resolve(bindingName);
+ temp_context = CosNaming::NamingContext::_narrow(obj);
+
+ if (temp_context->_is_equivalent(contextToFind))
+ {
+ MESSAGE("The context is found, we stop the search");
+ notFound = false;
+ SCRUTE(notFound);
+ }
+
+ if (notFound)
+ {
+ SCRUTE(bindingName[0].id);
+ Change_Directory(bindingName[0].id);
+ _current_directory(splitPath,
+ lengthResult,
+ contextToFind,
+ notFound);
+
+ if (notFound)
+ {
+ // --- go back to the initial context
+
+ _current_context = ref_context;
+
+ MESSAGE("Just before the delete of "
+ << splitPath[lengthResult-1]);
+ splitPath.pop_back();
+ lengthResult--;
+ }
+ }
+ }
+ }
+
+ binding_iterator->destroy();
+ }
+
+ // --- return to the last directory where an occurence was found
+
+ _current_context = ref_context ;
+}
+
+
+// ============================================================================
+/*! \brief list recursively all objects in the given directory and subdirs.
+ *
+ * get a list of all the objects in the current directory, with recursion
+ * on the subdirectories. Only the objects are listed, not the directories.
+ * If the NamingService is out, the exception ServiceUnreachable is thrown.
+ * \param myList the list of objects
+ * \
+Function :_list_directory_recurs.
+ * Purpose : method to list recursively all the objects contained in the tree of absCurDirectory/relativeSubDir.
+ * \param myList The list that will be filled.
+ * \param relativeSubDir The directory from absCurDirectory in which the objects are found.
+ * \param absCurDirectory The directory in ABSOLUTE form.
+ * _current_context must refer to absCurDirectory.
+ */
+// ============================================================================
+
+void SALOME_NamingService::_list_directory_recurs(vector<string>& myList,
+ string relativeSubDir,
+ string absCurDirectory)
+{
+ CosNaming::BindingList_var binding_list;
+ CosNaming::BindingIterator_var binding_iterator;
+ CosNaming::Binding_var binding ;
+
+ unsigned long nb = 0 ; // --- only for thethe use of BindingIterator
+ // to access the bindings
+
+ string absDir;
+
+ CosNaming::NamingContext_var ref_context = _current_context;
+
+ if (! relativeSubDir.empty())
+ {
+ Change_Directory(relativeSubDir.c_str());
+ absDir = absCurDirectory + "/" + relativeSubDir;
+ }
+
+ else
+ absDir = absCurDirectory;
+
+ SCRUTE(absDir);
+ _current_context->list(nb, binding_list, binding_iterator) ;
+
+ if (! CORBA::is_nil(binding_iterator))
+ {
+ while (binding_iterator->next_one(binding))
+ {
+ CosNaming::Name bindingName = binding->binding_name;
+
+ if (binding->binding_type == CosNaming::ncontext)
+ {
+ string relativeSdir(bindingName[0].id);
+ _list_directory_recurs(myList, relativeSdir, absDir);
+ }
+
+ else if (binding->binding_type == CosNaming::nobject)
+ {
+ string objName(bindingName[0].id);
+ string elt = absDir + "/" + objName;
+ SCRUTE(elt);
+ myList.push_back(elt);
+ }
+ }
+
+ binding_iterator->destroy();
+ }
+ if (! relativeSubDir.empty())
+ {
+ _current_context = ref_context;
+ }
+}
+
+// ============================================================================
+/*! \brief return a stringified reference of root context
+ *
+ * \return a stringified reference of root context
+ */
+// ============================================================================
+
+char * SALOME_NamingService::getIORaddr()
+{
+ return _orb->object_to_string(_root_context);
+}
+
--- /dev/null
+// SALOME NamingService : wrapping NamingService services
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_NamingService.hxx
+// Author : Estelle Deville
+// Module : SALOME
+// $Header$
+
+#ifndef SALOME_NAMINGSERVICE_H
+#define SALOME_NAMINGSERVICE_H
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+
+#include <vector>
+#include <string>
+#include "utilities.h"
+#include "Utils_Mutex.hxx"
+#include "ServiceUnreachable.hxx"
+
+#if defined NAMINGSERVICE_EXPORTS
+#if defined WIN32
+#define NAMINGSERVICE_EXPORT __declspec( dllexport )
+#else
+#define NAMINGSERVICE_EXPORT
+#endif
+#else
+#if defined WNT
+#define NAMINGSERVICE_EXPORT __declspec( dllimport )
+#else
+#define NAMINGSERVICE_EXPORT
+#endif
+#endif
+
+class NAMINGSERVICE_EXPORT SALOME_NamingService
+{
+public:
+ SALOME_NamingService();
+ SALOME_NamingService(CORBA::ORB_ptr orb);
+
+ virtual ~SALOME_NamingService();
+
+ void init_orb(CORBA::ORB_ptr orb);
+ void Register(CORBA::Object_ptr ObjRef,
+ const char* Path)
+ throw(ServiceUnreachable);
+ CORBA::Object_ptr Resolve(const char* Path)
+ throw( ServiceUnreachable);
+ CORBA::Object_ptr ResolveFirst(const char* Path)
+ throw( ServiceUnreachable);
+ CORBA::Object_ptr ResolveComponent(const char* hostname,
+ const char* containerName,
+ const char* componentName,
+ const int nbproc=0)
+ throw(ServiceUnreachable);
+ std::string ContainerName(const char *ContainerName);
+ std::string ContainerName(const Engines::MachineParameters& params);
+ std::string BuildContainerNameForNS(const char *ContainerName,
+ const char *hostname);
+ std::string
+ BuildContainerNameForNS(const Engines::MachineParameters& params,
+ const char *hostname);
+ int Find(const char* name)
+ throw(ServiceUnreachable);
+ bool Create_Directory(const char* Path)
+ throw(ServiceUnreachable);
+ bool Change_Directory(const char* Path)
+ throw(ServiceUnreachable);
+ char* Current_Directory()
+ throw(ServiceUnreachable);
+ void list()
+ throw(ServiceUnreachable);
+ std::vector<std::string> list_directory()
+ throw(ServiceUnreachable);
+ std::vector<std::string> list_subdirs()
+ throw(ServiceUnreachable);
+ std::vector<std::string> list_directory_recurs()
+ throw(ServiceUnreachable);
+ void Destroy_Name(const char* Path)
+ throw(ServiceUnreachable);
+ virtual void Destroy_Directory(const char* Path)
+ throw(ServiceUnreachable);
+ virtual void Destroy_FullDirectory(const char* Path)
+ throw(ServiceUnreachable);
+ char* getIORaddr();
+
+protected:
+ Utils_Mutex _myMutex;
+ CORBA::ORB_ptr _orb;
+ CosNaming::NamingContext_var _root_context, _current_context;
+
+ void _initialize_root_context();
+ int _createContextNameDir(std::string path,
+ CosNaming::Name& context_name,
+ std::vector<std::string>& splitPath,
+ bool onlyDir);
+ void _Find(const char* name, CORBA::Long& occurence_number);
+ void _current_directory(std::vector<std::string>& splitPath,
+ int& lengthResult,
+ CosNaming::NamingContext_var contextToFind,
+ bool& notFound);
+ void _list_directory_recurs(std::vector<std::string>& myList,
+ std::string relativeSubDir,
+ std::string absCurDirectory);
+
+};
+
+#endif // SALOME_NAMINGSERVICE_H
+
--- /dev/null
+#! /usr/bin/env python
+#
+# SALOME NamingService : wrapping NamingService services
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : SALOME_NamingServicePy.py
+# Author : Estelle Deville, CEA
+# Module : SALOME
+# $Header$
+
+import sys
+import time
+from omniORB import CORBA
+import CosNaming
+from string import *
+
+from SALOME_utilities import *
+#=============================================================================
+
+class SALOME_NamingServicePy_i:
+ _orb = None
+ _root_context=None
+ _current_context=None
+ _obj=None
+
+ #-------------------------------------------------------------------------
+
+ def __init__(self, orb):
+ #MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
+ self._orb = orb
+ # initialize root context and current context
+ ok = 0
+ steps = 240
+ while steps > 0 and ok == 0:
+ try:
+ obj =self._orb.resolve_initial_references("NameService")
+ self._root_context =obj._narrow(CosNaming.NamingContext)
+ self._current_context = self._root_context
+
+
+ if self._root_context is None :
+ #MESSAGE ( "Name Service Reference is invalid" )
+ #sys.exit(1)
+ MESSAGE(" Name service not found")
+ else:
+ ok = 1
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ MESSAGE(" Name service not found")
+ time.sleep(0.25)
+ steps = steps - 1
+ if steps == 0 and self._root_context is None:
+ MESSAGE ( "Name Service Reference is invalid" )
+ sys.exit(1)
+ #-------------------------------------------------------------------------
+ def Register(self,ObjRef, Path):
+ MESSAGE ( "SALOME_NamingServicePy_i::Register" )
+ _not_exist = 0
+ path_list = list(Path)
+ if path_list[0]=='/':
+ self._current_context = self._root_context
+ #delete first '/' before split
+ Path=Path[1:]
+
+ result_resolve_path = split(Path,'/')
+ if len(result_resolve_path)>1:
+ # A directory is treated (not only an object name)
+ # We had to test if the directory where ObjRef should be recorded
+ # is already done
+ # If not, the new context has to be created
+ _context_name = []
+ for i in range(len(result_resolve_path)-1):
+ _context_name.append(CosNaming.NameComponent(result_resolve_path[i],"dir"))
+
+ try:
+ obj = self._current_context.resolve(_context_name)
+ self._current_context = obj._narrow(CosNaming.NamingContext)
+ except CosNaming.NamingContext.NotFound, ex:
+ _not_exist = 1
+ except CosNaming.NamingContext.InvalidName, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.InvalidName" )
+ except CosNaming.NamingContext.CannotProceed, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.CannotProceed" )
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
+
+ if _not_exist:
+ # at least one context of the complete path is not created, we had
+ # to create it or them
+ _context_name = []
+ for i in range(len(result_resolve_path)-1):
+ _context_name = [CosNaming.NameComponent(result_resolve_path[i],"dir")]
+
+ try:
+ obj = self._current_context.resolve(_context_name)
+ self._current_context = obj._narrow(CosNaming.NamingContext)
+ except CosNaming.NamingContext.NotFound, ex:
+ #This context is not created. It will be done
+ self._current_context = self._current_context.bind_new_context(_context_name)
+
+ #The current directory is now the directory where the object should
+ #be recorded
+
+ _context_name = [CosNaming.NameComponent(result_resolve_path[len(result_resolve_path)-1],"object")]
+ try:
+ self._current_context.bind(_context_name,ObjRef)
+ except CosNaming.NamingContext.NotFound, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.NotFound" )
+ except CosNaming.NamingContext.InvalidName, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.InvalidName" )
+ except CosNaming.NamingContext.CannotProceed, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.CannotProceed" )
+ except CosNaming.NamingContext.AlreadyBound, ex:
+ MESSAGE ( "Register : CosNaming.NamingContext.AlreadyBound, object will be rebind" )
+ self._current_context.rebind(_context_name,ObjRef)
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
+
+
+ #-------------------------------------------------------------------------
+ def Resolve(self, Path):
+ #MESSAGE ( "SALOME_NamingServicePy_i::Resolve" )
+ path_list = list(Path)
+ if path_list[0]=='/':
+ self._current_context = self._root_context
+ #delete first '/' before split
+ Path=Path[1:]
+
+ result_resolve_path = split(Path,'/')
+ _context_name=[]
+ for i in range(len(result_resolve_path)-1):
+ _context_name.append(CosNaming.NameComponent(result_resolve_path[i],"dir"))
+ _context_name.append(CosNaming.NameComponent(result_resolve_path[len(result_resolve_path)-1],"object"))
+ try:
+ self._obj = self._current_context.resolve(_context_name)
+ except CosNaming.NamingContext.NotFound, ex:
+ MESSAGE ( "Resolve : CosNaming.NamingContext.NotFound" )
+ self._obj = None
+ except CosNaming.NamingContext.InvalidName, ex:
+ MESSAGE ( "Resolve : CosNaming.NamingContext.InvalidName" )
+ self._obj = None
+ except CosNaming.NamingContext.CannotProceed, ex:
+ MESSAGE ( "Resolve : CosNaming.NamingContext.CannotProceed" )
+ self._obj = None
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ MESSAGE ( "Resolve : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
+ self._obj = None
+ return self._obj
+
+
+
+ #-------------------------------------------------------------------------
+ def Create_Directory(self,ObjRef, Path):
+ MESSAGE ( "SALOME_NamingServicePy_i::Create_Directory" )
+ _not_exist = 0
+ path_list = list(Path)
+ if path_list[0]=='/':
+ self._current_context = self._root_context
+ #delete first '/' before split
+ Path=Path[1:]
+
+ result_resolve_path = split(Path,'/')
+ _context_name = []
+ for i in range(len(result_resolve_path)):
+ _context_name[CosNaming.NameComponent(result_resolve_path[i],"dir")]
+ try:
+ obj = self._current_context.resolve(_context_name)
+ self._current_context = obj._narrow(CosNaming.NamingContext)
+ except CosNaming.NamingContext.NotFound, ex:
+ self._current_context = self._current_context.bind_new_context(_context_name)
+ except CosNaming.NamingContext.InvalidName, ex:
+ MESSAGE ( "Create_Directory : CosNaming.NamingContext.InvalidName" )
+ except CosNaming.NamingContext.CannotProceed, ex:
+ MESSAGE ( "Create_Directory : CosNaming.NamingContext.CannotProceed" )
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ MESSAGE ( "Create_Directory : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
+
+
+
+
--- /dev/null
+# SALOMELocalTrace : log on local machine
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE (EDF)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= NamingServiceTest.hxx
+
+EXPORT_PYSCRIPTS = TestNamingService.py
+
+# Libraries targets
+
+LIB = libNamingServiceTest.la
+LIB_SRC = NamingServiceTest.cxx
+
+LIB_SERVER_IDL = nstest.idl
+
+LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
+ SALOME_Exception.idl
+
+# Executables targets
+
+BIN = TestNamingService
+BIN_SRC =
+
+CXXFLAGS += @CPPUNIT_INCLUDES@
+CPPFLAGS += @CPPUNIT_INCLUDES@
+
+LIBS= @LIBS@ @CPPUNIT_LIBS@
+
+LDFLAGS+=
+
+LDFLAGSFORBIN+= \
+ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \
+ -lSALOMETraceCollectorTest \
+ -lUtilsTest -lOpUtil \
+ -lSalomeNS
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include "NamingServiceTest.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include <cstdio>
+
+using namespace std;
+
+// --- uncomment to have some traces on standard error
+// (useful only when adding new tests...)
+//#define _DEVDEBUG_
+
+#ifdef _DEVDEBUG_
+#define MYDEVTRACE {std::cerr << __FILE__ << " [" << __LINE__ << "] : ";}
+#define DEVTRACE(msg) {MYDEVTRACE; std::cerr<<msg<<std::endl<<std::flush;}
+#else
+#define MYDEVTRACE
+#define DEVTRACE(msg)
+#endif
+
+#define TRACEFILE "/tmp/traceUnitTest.log"
+
+// ============================================================================
+/*!
+ * a basic CORBA object implementation for use with namingService tests
+ */
+// ============================================================================
+
+NSTEST_echo_i::NSTEST_echo_i()
+{
+ _num=-1;
+}
+
+NSTEST_echo_i::NSTEST_echo_i(CORBA::Long num)
+{
+ _num=num;
+}
+
+NSTEST_echo_i::~NSTEST_echo_i()
+{
+}
+
+CORBA::Long NSTEST_echo_i::getId()
+{
+ return _num;
+}
+
+// ============================================================================
+/*!
+ * a factory of CORBA objects for use with namingService tests
+ */
+// ============================================================================
+
+NSTEST_aFactory_i::NSTEST_aFactory_i()
+{
+ _num=0;
+}
+
+NSTEST_aFactory_i::~NSTEST_aFactory_i()
+{
+}
+
+NSTEST::echo_ptr NSTEST_aFactory_i::createInstance()
+{
+ NSTEST_echo_i * anEcho = new NSTEST_echo_i(_num);
+ _num++;
+ NSTEST::echo_var anEchoRef = anEcho->_this();
+ return anEchoRef._retn();
+}
+
+// ============================================================================
+/*!
+ * Set Trace mecanism
+ * - delete preexisting trace classes if any
+ * - set trace on file
+ * Get or initialize the orb
+ * Create a SALOME_NamingService instance
+ */
+// ============================================================================
+
+void
+NamingServiceTest::setUp()
+{
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+
+ // --- trace on file
+ char *theFileName = TRACEFILE;
+
+ string s = "file:";
+ s += theFileName;
+ //s="local";
+ //s="with_logger";
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ ofstream traceFile;
+ // traceFile.open(theFileName, ios::out | ios::trunc);
+ traceFile.open(theFileName, ios::out | ios::app);
+ CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+ traceFile.close();
+
+ bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+
+ // --- Get or initialize the orb
+
+ int _argc = 1;
+ char* _argv[] = {""};
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(_argc , _argv ) ;
+
+ // --- Create a SALOME_NamingService instance
+
+ _NS.init_orb(_orb) ;
+
+ // --- Create an NSTEST::factory
+
+ CORBA::Object_var obj = _orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ _root_poa = PortableServer::POA::_narrow(obj);
+ _pman = _root_poa->the_POAManager();
+ _myFactory = new NSTEST_aFactory_i();
+ _myFactoryId = _root_poa->activate_object(_myFactory);
+ _factoryRef = _myFactory->_this();
+ _pman->activate();
+
+}
+
+// ============================================================================
+/*!
+ * - delete trace classes
+ */
+// ============================================================================
+
+void
+NamingServiceTest::tearDown()
+{
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+// ============================================================================
+/*!
+ * Test default constructor: must be followed by a call to init_orb(ORB)
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testConstructorDefault()
+{
+ SALOME_NamingService NS;
+ //CPPUNIT_ASSERT_THROW(NS.getIORaddr(),CORBA::Exception);
+ NS.init_orb(_orb);
+
+ char *root = NS.getIORaddr();
+ CORBA::Object_var obj = _orb->string_to_object(root);
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+
+ CosNaming::NamingContext_var rootContext =
+ CosNaming::NamingContext::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(rootContext));
+}
+
+// ============================================================================
+/*!
+ * Test constructor with ORB parameter
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testConstructorOrb()
+{
+ SALOME_NamingService NS(_orb);
+ char *root = NS.getIORaddr();
+ CORBA::Object_var obj = _orb->string_to_object(root);
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+
+ CosNaming::NamingContext_var rootContext =
+ CosNaming::NamingContext::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(rootContext));
+}
+
+// ============================================================================
+/*!
+ * Test Register and resolve of a single CORBA object with absolute pathname,
+ * without subdirectories
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testRegisterResolveAbsNoPath()
+{
+ _NS.Register(_factoryRef,"/nstest_factory");
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+}
+
+// ============================================================================
+/*!
+ * Test Register and resolve of a single CORBA object with relative pathname,
+ * without subdirectories
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testRegisterResolveRelativeNoPath()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ _NS.Create_Directory("/myContext");
+ _NS.Change_Directory("/myContext");
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,"echo_0");
+
+ obj = _NS.Resolve("echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef2 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef2));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRef2->getId());
+
+ obj = _NS.Resolve("/myContext/echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef3 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef3));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRef3->getId());
+}
+
+// ============================================================================
+/*!
+ * Test Register and resolve of a single CORBA object with absolute pathname,
+ * in a subdirectory
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testRegisterResolveAbsWithPath()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,"/nstest/echo_0");
+
+ obj = _NS.Resolve("/nstest/echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRefa->getId());
+
+ NSTEST::echo_var anEchoRef1 = myFactory->createInstance();
+ _NS.Register(anEchoRef1,"/nstest2/rep2/rep3/echo_1");
+ CPPUNIT_ASSERT(anEchoRef->getId() != anEchoRef1->getId());
+
+ obj = _NS.Resolve("/nstest2/rep2/rep3/echo_1");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef1a = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef1a));
+ CPPUNIT_ASSERT(anEchoRef1->getId() == anEchoRef1a->getId());
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,"/nstest2/1/2/3/4/echo_1");
+
+ obj = _NS.Resolve("/nstest2/1/2/3/4/echo_1");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef2a = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef2a));
+ CPPUNIT_ASSERT(anEchoRef2->getId() == anEchoRef2a->getId());
+}
+
+// ============================================================================
+/*!
+ * Test Register and resolve of a single CORBA object with relative pathname,
+ * in a subdirectory.
+ * Relative Path is changed to the created subdirectory when Register()
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testRegisterResolveRelativeWithPath()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+ _NS.Create_Directory("/myContext");
+ _NS.Change_Directory("/myContext");
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,"subdir/echo_0");
+
+ obj = _NS.Resolve("echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef2 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef2));
+
+ obj = _NS.Resolve("/myContext/subdir/echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef3 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef3));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRef3->getId());
+
+ _NS.Change_Directory("/myContext");
+ obj = _NS.Resolve("subdir/echo_0");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef4 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef4));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRef4->getId());
+}
+
+// ============================================================================
+/*!
+ * Test resolve with a name not known
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveBadName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.Resolve("/nstest/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.Resolve("/unknownPath/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.Resolve("/anUnknown/ComplicatedPath/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test resolve with a name not known, with a relative path
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveBadNameRelative()
+{
+ _NS.Create_Directory("/myContext");
+ _NS.Change_Directory("/myContext");
+
+ CORBA::Object_var obj = _NS.Resolve("notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.Resolve("unknownPath/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.Resolve("anUnknown/ComplicatedPath/notRegisteredName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test register and resolve multiple objects, test resolveFirst.
+ * Register a few objects in /nstestfirst/echo_n where n is the object id.
+ * Resolve all the objects.
+ * ResolveFirst /nstestfirst/echo must give /nstestfirst/echo_i, corresponding
+ * to the first object.
+ */
+// ============================================================================
+
+#define NB_OBJS 10
+
+void
+NamingServiceTest::testResolveFirst()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ int ref[NB_OBJS];
+
+ for (int i=0; i<NB_OBJS; i++)
+ {
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ ref[i] = anEchoRef->getId();
+ string name = "/nstestfirst/echo_";
+ char anum[10];
+ sprintf(anum,"%d",ref[i]);
+ name += anum;
+ _NS.Register(anEchoRef,name.c_str());
+ }
+
+ for (int i=0; i<NB_OBJS; i++)
+ {
+ string name = "/nstestfirst/echo_";
+ char anum[10];
+ sprintf(anum,"%d",ref[i]);
+ name += anum;
+ obj = _NS.Resolve(name.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef));
+ CPPUNIT_ASSERT(anEchoRef->getId() == ref[i]);
+ }
+
+ string name = "/nstestfirst/echo";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef));
+ CPPUNIT_ASSERT(anEchoRef->getId() == ref[0]);
+}
+
+// ============================================================================
+/*!
+ * Test register and resolve multiple objects, test resolveFirst, relative path
+ * Register a few objects in /nstestfirstrel/echo_n where n is the object id.
+ * Resolve all the objects.
+ * ResolveFirst echo with a relative path /nstestfirstrel must give
+ * /nstestfirst/echo_i, corresponding to the first object.
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveFirstRelative()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ int ref[NB_OBJS];
+
+ for (int i=0; i<NB_OBJS; i++)
+ {
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ ref[i] = anEchoRef->getId();
+ string name = "/nstestfirstrel/echo_";
+ char anum[10];
+ sprintf(anum,"%d",ref[i]);
+ name += anum;
+ _NS.Register(anEchoRef,name.c_str());
+ }
+
+ for (int i=0; i<NB_OBJS; i++)
+ {
+ _NS.Change_Directory("/nstestfirstrel");
+ string name = "echo_";
+ char anum[10];
+ sprintf(anum,"%d",ref[i]);
+ name += anum;
+ obj = _NS.Resolve(name.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef));
+ CPPUNIT_ASSERT(anEchoRef->getId() == ref[i]);
+ }
+
+ _NS.Change_Directory("/nstestfirstrel");
+ string name = "echo";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test resolveFirst with unknown name
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveFirstUnknown()
+{
+ string name = "/notYeyRegistered";
+ CORBA::Object_var obj= _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ name = "/nstestfirst/notYeyRegistered";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ name = "/rrr/sss/ttt/notYeyRegistered";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test resolveFirst with unknown name, relative Path
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveFirstUnknownRelative()
+{
+ _NS.Create_Directory("/myContext");
+ _NS.Change_Directory("/myContext");
+
+ string name = "RelnotYeyRegistered";
+ CORBA::Object_var obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ name = "Relnstestfirst/notYeyRegistered";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ name = "Relrrr/sss/ttt/notYeyRegistered";
+ obj = _NS.ResolveFirst(name.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test ResolveComponent works as specified
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentOK()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "theContainerName",
+ "theComponentName");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
+ CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef->getId());
+
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/theContainerName_2/theComponentName");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "theContainerName",
+ "theComponentName",
+ 2);
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRefb = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefb));
+ CPPUNIT_ASSERT(anEchoRefb->getId() == anEchoRef2->getId());
+}
+
+// ============================================================================
+/*!
+ * Test ResolveComponent gives nil pointer if hostname is not given (empty)
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentEmptyHostname()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("",
+ "theContainerName",
+ "theComponentName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test ResolveComponent gives nil pointer if hostname is unknown
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentUnknownHostname()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("anUnknownHostName",
+ "theContainerName",
+ "theComponentName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test ResolveComponent when containerName is empty.
+ * check bad hostname gives nil pointer.
+ * If componentName registered on a container from hostname, a component
+ * reference is found (the first one).
+ * Else give nil pointer.
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentEmptyContainerName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/aContainerName/aComponentName");
+
+ NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
+ _NS.Register(anEchoRef3,
+ "/Containers/theHostName/otherContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("anUnknownHostName",
+ "",
+ "theComponentName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.ResolveComponent("theHostName",
+ "",
+ "theComponentName");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
+ CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef->getId());
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentUnknownContainerName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/aContainerName/aComponentName");
+
+ NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
+ _NS.Register(anEchoRef3,
+ "/Containers/theHostName/otherContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "anUnknownContainerName",
+ "theComponentName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentEmptyComponentName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/EmptyContainerName/");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "EmptyContainerName",
+ "");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentUnknownComponentName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "theContainerName",
+ "anUnknownComponentName");
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test with a false number nbproc.
+ * A positive number not corresponding to a registered component gives nil ref.
+ * A negative number is not taken into account and may give a non nil ref.
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testResolveComponentFalseNbproc()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ obj = _NS.ResolveComponent("theHostName",
+ "theContainerName",
+ "theComponentName",
+ 25);
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+
+ obj = _NS.ResolveComponent("theHostName",
+ "theContainerName",
+ "theComponentName",
+ -25);
+ CPPUNIT_ASSERT(! CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testContainerName()
+{
+ string ref0 = "FactoryServer";
+ string ret = _NS.ContainerName("");
+ CPPUNIT_ASSERT(ret == ref0);
+
+ ref0 = "MyContainerName";
+ ret = _NS.ContainerName(ref0.c_str());
+ CPPUNIT_ASSERT(ret == ref0);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testContainerNameParams()
+{
+ Engines::MachineParameters params;
+ params.container_name = "";
+ params.hostname = "";
+ params.OS = "";
+ params.mem_mb = 0;
+ params.cpu_clock = 0;
+ params.nb_proc_per_node = 0;
+ params.nb_node = 0;
+ params.isMPI = false;
+
+ string ref0 = "FactoryServer";
+ string ret = _NS.ContainerName(params);
+ CPPUNIT_ASSERT(ret == ref0);
+
+ ref0 = "MyContainerName";
+ params.container_name = ref0.c_str();
+ ret = _NS.ContainerName(params);
+ CPPUNIT_ASSERT(ret == ref0);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testBuildContainerNameForNS()
+{
+ string ref0 = "/Containers/theHostName/theContainerName";
+ string ret = _NS.BuildContainerNameForNS("theContainerName","theHostName");
+ CPPUNIT_ASSERT(ret == ref0);
+
+ ref0 = "/Containers/theHostName/FactoryServer";
+ ret = _NS.BuildContainerNameForNS("","theHostName");
+ CPPUNIT_ASSERT(ret == ref0);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testBuildContainerNameForNSParams()
+{
+ Engines::MachineParameters params;
+ params.container_name = "";
+ params.hostname = "";
+ params.OS = "";
+ params.mem_mb = 0;
+ params.cpu_clock = 0;
+ params.nb_proc_per_node = 0;
+ params.nb_node = 0;
+ params.isMPI = false;
+
+ params.container_name = "theContainerName";
+ string ref0 = "/Containers/theHostName/theContainerName";
+ string ret = _NS.BuildContainerNameForNS(params,"theHostName");
+ CPPUNIT_ASSERT(ret == ref0);
+
+ params.container_name = "";
+ ref0 = "/Containers/theHostName/FactoryServer";
+ ret = _NS.BuildContainerNameForNS(params,"theHostName");
+ CPPUNIT_ASSERT(ret == ref0);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testFind()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/aContainerName/aComponentName");
+
+ NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
+ _NS.Register(anEchoRef3,
+ "/Containers/theHostName/otherContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
+ _NS.Register(anEchoRef4,
+ "/Containers/anHostName/oneContainerName/theComponentName");
+
+ _NS.Change_Directory("/Containers");
+ int occ= _NS.Find("theComponentName");
+ CPPUNIT_ASSERT(occ >= 3); // see previous tests
+
+ _NS.Change_Directory("/Containers");
+ occ= _NS.Find("aComponentName");
+ CPPUNIT_ASSERT(occ == 1);
+
+ _NS.Change_Directory("/Containers");
+ occ= _NS.Find("UnknownCompnentName");
+ CPPUNIT_ASSERT(occ == 0);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testCreateDirectory()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ bool ret = _NS.Create_Directory("/aaa/bbb/ccc/ddd/eee");
+ CPPUNIT_ASSERT(ret);
+
+ _NS.Change_Directory("/aaa/bbb/ccc/ddd/eee");
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ int val = anEchoRef->getId();
+ string name = "echo_";
+ char anum[10];
+ sprintf(anum,"%d",val);
+ name += anum;
+ _NS.Register(anEchoRef,name.c_str());
+
+ string dirname = "/aaa/bbb/ccc/ddd/eee/";
+ dirname += name;
+ obj = _NS.Resolve(dirname.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::echo_var anEchoRef2 = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRef2));
+ CPPUNIT_ASSERT(anEchoRef->getId() == anEchoRef2->getId());
+
+ ret = _NS.Create_Directory("/aaa/bbb/ccc/ddd/eee");
+ CPPUNIT_ASSERT(ret);
+
+ _NS.Change_Directory("/aaa/bbb");
+ ret = _NS.Create_Directory("cccccc/dddddd/eeeeee");
+ _NS.Register(anEchoRef,"echo_abcde");
+
+ CPPUNIT_ASSERT(ret);
+ _NS.Change_Directory("/aaa/bbb/cccccc/dddddd/eeeeee");
+ obj = _NS.Resolve("echo_abcde");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testChangeDirectory()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef,
+ "/Containers/theHostName/theContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
+ _NS.Register(anEchoRef2,
+ "/Containers/theHostName/aContainerName/aComponentName");
+
+ NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
+ _NS.Register(anEchoRef3,
+ "/Containers/theHostName/otherContainerName/theComponentName");
+
+ NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
+ _NS.Register(anEchoRef4,
+ "/Containers/anHostName/oneContainerName/theComponentName");
+
+ _NS.Change_Directory("/Containers/theHostName/otherContainerName");
+ obj = _NS.Resolve("theComponentName");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+
+ NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
+ CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef3->getId());
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testCurrentDirectory()
+{
+ string path = "/aaa/bbb/ccc/ddd/eee";
+ bool ret = _NS.Create_Directory(path.c_str());
+ CPPUNIT_ASSERT(ret);
+
+ _NS.Change_Directory(path.c_str());
+ string curdir = _NS.Current_Directory();
+ CPPUNIT_ASSERT(curdir == path);
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testList()
+{
+ _NS.Change_Directory("/Containers/theHostName/theContainerName");
+ _NS.list();
+ _NS.Change_Directory("/Containers");
+ _NS.list();
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testListDirectory()
+{
+ _NS.Change_Directory("/Containers/theHostName/theContainerName");
+ _NS.list_directory();
+ _NS.Change_Directory("/Containers");
+ _NS.list_directory();
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testListDirectoryRecurs()
+{
+ _NS.Change_Directory("/Containers/theHostName/theContainerName");
+ _NS.list_directory_recurs();
+ _NS.Change_Directory("/Containers");
+ _NS.list_directory_recurs();
+ _NS.Change_Directory("/");
+ _NS.list_directory_recurs();
+}
+
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testListSubdirs()
+{
+ _NS.Change_Directory("/Containers/theHostName/theContainerName");
+ _NS.list_subdirs();
+ _NS.Change_Directory("/Containers");
+ _NS.list_subdirs();
+ _NS.Change_Directory("/");
+ _NS.list_subdirs();
+}
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testDestroyName()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ string path = "/Containers/theHostName/theContainerName/theComponentName";
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef, path.c_str());
+
+ obj=_NS.Resolve(path.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+
+ _NS.Destroy_Name(path.c_str());
+ obj=_NS.Resolve(path.c_str());
+ CPPUNIT_ASSERT(CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testDestroyDirectory()
+{
+ CORBA::Object_var obj = _NS.Resolve("/nstest_factory");
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+ NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
+
+ string path = "/Containers/theHostName/theContainerName/theComponentName";
+
+ NSTEST::echo_var anEchoRef = myFactory->createInstance();
+ _NS.Register(anEchoRef, path.c_str());
+
+ _NS.Destroy_Directory("/Containers/theHostName/theContainerName");
+ obj=_NS.Resolve(path.c_str());
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj)); // directory not empty: not destroyed
+
+ _NS.Destroy_Name(path.c_str());
+ _NS.Destroy_Directory("/Containers/theHostName/theContainerName");
+ _NS.Change_Directory("/Containers/theHostName");
+ _NS.list_subdirs();
+}
+
+// ============================================================================
+/*!
+ * DestroyFullDirectory is not recursive
+ * Need Housekeeping of /Containers for further tests !
+ */
+// ============================================================================
+
+void NamingServiceTest::_destroyDirectoryRecurs(string path)
+{
+ string current = path;
+ SCRUTE(path);
+ if (_NS.Change_Directory(path.c_str()))
+ {
+ vector<string> subdirs = _NS.list_subdirs();
+ for (int i=0; i<subdirs.size(); i++)
+ {
+ string subpath=path + "/" +subdirs[i];
+ _destroyDirectoryRecurs(subpath);
+ }
+ if (_NS.Change_Directory(path.c_str()))
+ {
+ _NS.Destroy_FullDirectory(path.c_str());
+ }
+ }
+}
+
+void
+NamingServiceTest::testDestroyFullDirectory()
+{
+ _NS.Destroy_FullDirectory("/Containers");
+ CPPUNIT_ASSERT(_NS.Change_Directory("/Containers"));
+ vector<string> subdirs = _NS.list_subdirs();
+ CPPUNIT_ASSERT(subdirs.size() >0);
+ _NS.list_directory_recurs();
+ string path = "/Containers";
+ _destroyDirectoryRecurs(path);
+ CPPUNIT_ASSERT( ! _NS.Change_Directory("/Containers"));
+ _NS.Change_Directory("/");
+ _NS.list_subdirs();
+ _NS.list_directory_recurs();
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+void
+NamingServiceTest::testGetIorAddr()
+{
+ char *root = _NS.getIORaddr();
+ CORBA::Object_var obj = _orb->string_to_object(root);
+ CPPUNIT_ASSERT(!CORBA::is_nil(obj));
+}
+
+// ============================================================================
+/*!
+ * Test
+ */
+// ============================================================================
+
+// void
+// NamingServiceTest::()
+// {
+// CPPUNIT_ASSERT(0);
+// }
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _NAMINGSERVICETEST_HXX_
+#define _NAMINGSERVICETEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include "SALOME_NamingService.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(nstest)
+
+class NSTEST_echo_i : public virtual POA_NSTEST::echo,
+ public virtual PortableServer::RefCountServantBase
+{
+public:
+ NSTEST_echo_i();
+ NSTEST_echo_i(CORBA::Long num);
+ ~NSTEST_echo_i();
+ CORBA::Long getId();
+private:
+ int _num;
+};
+
+class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory,
+ public virtual PortableServer::RefCountServantBase
+{
+public:
+ NSTEST_aFactory_i();
+ ~NSTEST_aFactory_i();
+ NSTEST::echo_ptr createInstance();
+private:
+ int _num;
+};
+
+class NamingServiceTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( NamingServiceTest );
+ CPPUNIT_TEST( testConstructorDefault );
+ CPPUNIT_TEST( testConstructorOrb );
+ CPPUNIT_TEST( testRegisterResolveAbsNoPath );
+ CPPUNIT_TEST( testRegisterResolveRelativeNoPath );
+ CPPUNIT_TEST( testRegisterResolveAbsWithPath );
+ CPPUNIT_TEST( testRegisterResolveRelativeWithPath );
+ CPPUNIT_TEST( testResolveBadName );
+ CPPUNIT_TEST( testResolveBadNameRelative );
+ CPPUNIT_TEST( testResolveFirst );
+ CPPUNIT_TEST( testResolveFirstRelative );
+ CPPUNIT_TEST( testResolveFirstUnknown );
+ CPPUNIT_TEST( testResolveFirstUnknownRelative );
+ CPPUNIT_TEST( testResolveComponentOK );
+ CPPUNIT_TEST( testResolveComponentEmptyHostname );
+ CPPUNIT_TEST( testResolveComponentUnknownHostname );
+ CPPUNIT_TEST( testResolveComponentEmptyContainerName );
+ CPPUNIT_TEST( testResolveComponentUnknownContainerName );
+ CPPUNIT_TEST( testResolveComponentEmptyComponentName );
+ CPPUNIT_TEST( testResolveComponentUnknownComponentName );
+ CPPUNIT_TEST( testResolveComponentFalseNbproc );
+ CPPUNIT_TEST( testContainerName );
+ CPPUNIT_TEST( testContainerNameParams );
+ CPPUNIT_TEST( testBuildContainerNameForNS );
+ CPPUNIT_TEST( testBuildContainerNameForNSParams );
+ CPPUNIT_TEST( testFind );
+ CPPUNIT_TEST( testCreateDirectory );
+ CPPUNIT_TEST( testChangeDirectory );
+ CPPUNIT_TEST( testCurrentDirectory );
+ CPPUNIT_TEST( testList );
+ CPPUNIT_TEST( testListDirectory );
+ CPPUNIT_TEST( testListDirectoryRecurs );
+ CPPUNIT_TEST( testListSubdirs );
+ CPPUNIT_TEST( testDestroyName );
+ CPPUNIT_TEST( testDestroyDirectory );
+ CPPUNIT_TEST( testDestroyFullDirectory );
+ CPPUNIT_TEST( testGetIorAddr );
+// CPPUNIT_TEST( );
+// CPPUNIT_TEST( );
+// CPPUNIT_TEST( );
+
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+
+ void setUp();
+ void tearDown();
+
+ void testConstructorDefault();
+ void testConstructorOrb();
+ void testRegisterResolveAbsNoPath();
+ void testRegisterResolveRelativeNoPath();
+ void testRegisterResolveAbsWithPath();
+ void testRegisterResolveRelativeWithPath();
+ void testResolveBadName();
+ void testResolveBadNameRelative();
+ void testResolveFirst();
+ void testResolveFirstRelative();
+ void testResolveFirstUnknown();
+ void testResolveFirstUnknownRelative();
+ void testResolveComponentOK();
+ void testResolveComponentEmptyHostname();
+ void testResolveComponentUnknownHostname();
+ void testResolveComponentEmptyContainerName();
+ void testResolveComponentUnknownContainerName();
+ void testResolveComponentEmptyComponentName();
+ void testResolveComponentUnknownComponentName();
+ void testResolveComponentFalseNbproc();
+ void testContainerName();
+ void testContainerNameParams();
+ void testBuildContainerNameForNS();
+ void testBuildContainerNameForNSParams();
+ void testFind();
+ void testCreateDirectory();
+ void testChangeDirectory();
+ void testCurrentDirectory();
+ void testList();
+ void testListDirectory();
+ void testListDirectoryRecurs();
+ void testListSubdirs();
+ void testDestroyName();
+ void testDestroyDirectory();
+ void testDestroyFullDirectory();
+ void testGetIorAddr();
+
+protected:
+ void _destroyDirectoryRecurs(std::string path);
+
+ CORBA::ORB_var _orb;
+ SALOME_NamingService _NS;
+
+ PortableServer::POA_var _root_poa;
+ PortableServer::POAManager_var _pman;
+ PortableServer::ObjectId_var _myFactoryId;
+ NSTEST_aFactory_i * _myFactory;
+ CORBA::Object_var _factoryRef;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMETraceCollectorTest.hxx"
+#include "UtilsTest.hxx"
+#include "NamingServiceTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( UtilsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( NamingServiceTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+import sys, os,signal,string,commands
+import runSalome
+import orbmodule
+import TestKiller
+
+# get SALOME environment :
+
+args, modules_list, modules_root_dir = runSalome.get_config()
+runSalome.set_env(args, modules_list, modules_root_dir)
+
+# set environment for trace in logger
+# (with file, servers may be killed before the write to the file...)
+
+#os.environ["SALOME_trace"] = "file:/tmp/traceUnitTest.log"
+#os.environ["SALOME_trace"] = "local"
+os.environ["SALOME_trace"] = "with_logger"
+
+# launch CORBA naming server
+
+clt=orbmodule.client()
+
+# launch CORBA logger server
+
+myServer=runSalome.LoggerServer(args)
+myServer.run()
+clt.waitLogger("Logger")
+
+# execute Unit Test
+
+command = ['TestNamingService']
+ret = os.spawnvp(os.P_WAIT, command[0], command)
+
+# kill Test process
+
+TestKiller.killProcess(runSalome.process_id)
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_LoadRateManager.hxx"
+#include "utilities.h"
+#include <iostream>
+
+using namespace std;
+
+string SALOME_LoadRateManager::FindBest(const Engines::MachineList& hosts)
+{
+ // for the moment then "maui" will be used for dynamic selection ...
+ MESSAGE("SALOME_LoadRateManager::FindBest " << hosts.length());
+
+ if (hosts.length() == 0)
+ return string("");
+
+ return string(hosts[0]);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef __SALOME_LOADRATEMANAGER_HXX__
+#define __SALOME_LOADRATEMANAGER_HXX__
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include <string>
+
+
+#if defined RESOURCESMANAGER_EXPORTS
+#if defined WIN32
+#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#else
+#if defined WNT
+#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#endif
+
+class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager
+ {
+
+ public:
+ std::string FindBest(const Engines::MachineList& hosts);
+ };
+
+#endif
--- /dev/null
+// SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ResourcesCatalog_Handler.cxx
+// Author : Estelle Deville
+// Module : SALOME
+//$Header$
+
+#include "SALOME_ResourcesCatalog_Handler.hxx"
+#include <iostream>
+#include <map>
+#include <qdom.h>
+#include "utilities.h"
+
+using namespace std;
+
+//=============================================================================
+/*!
+ * Constructor
+ * \param listOfResources: map of ParserResourcesType to fill when parsing
+ */
+//=============================================================================
+
+SALOME_ResourcesCatalog_Handler::
+SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources):
+ _resources_list(listOfResources)
+{
+ MESSAGE("SALOME_ResourcesCatalog_Handler creation");
+ //XML tags initialisation
+ test_machine = "machine";
+ test_resources = "resources";
+
+ test_hostname = "hostname";
+ test_alias = "alias";
+ test_protocol = "protocol";
+ test_mode = "mode";
+ test_user_name = "userName";
+ test_appli_path = "appliPath";
+ test_modules = "modules";
+ test_module_name = "moduleName";
+ test_module_path = "modulePath";
+ test_pre_req_file_path = "preReqFilePath";
+ test_os = "OS";
+ test_mem_in_mb = "memInMB";
+ test_cpu_freq_mhz = "CPUFreqMHz";
+ test_nb_of_nodes = "nbOfNodes";
+ test_nb_of_proc_per_node = "nbOfProcPerNode";
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
+{
+ // MESSAGE("SALOME_ResourcesCatalog_Handler destruction");
+}
+
+//=============================================================================
+/*!
+ * Retrieves DS after the file parse.
+ */
+//=============================================================================
+
+const MapOfParserResourcesType&
+SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
+ {
+ return _resources_list;
+ }
+
+//=============================================================================
+/*!
+ * Overload handler function startDocument.
+ * Called before an xml file is parsed.
+ * Clears the list of resources.
+ * \return true (if no error detected...)
+ */
+//=============================================================================
+
+bool SALOME_ResourcesCatalog_Handler::startDocument()
+{
+ // MESSAGE("Begin parse document");
+
+ // --- Empty private elements
+
+ _resources_list.clear();
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function startElement.
+ * \param QString argument by reference (not used here ?)
+ * \param QString argument by reference (not used here ?)
+ * \param name (not used here ?)
+ * \param atts
+ * \return true if no error was detected
+ */
+//=============================================================================
+
+bool
+SALOME_ResourcesCatalog_Handler::
+startElement( const QString&,
+ const QString&,
+ const QString& name,
+ const QXmlAttributes& attrs )
+{
+ for (int i = 0;i < attrs.count();i++)
+ {
+ QString qName(attrs.localName(i));
+ std::string content(attrs.value(i).latin1());
+
+ if ((qName.compare(QString(test_hostname)) == 0))
+ _resource.DataForSort._hostName = content;
+
+ if ((qName.compare(QString(test_alias)) == 0))
+ _resource.Alias = content;
+
+ if ((qName.compare(QString(test_protocol)) == 0))
+ {
+ switch (content[0])
+ {
+
+ case 'r':
+ _resource.Protocol = rsh;
+ break;
+
+ case 's':
+ _resource.Protocol = ssh;
+ break;
+
+ default:
+ // If it'not in all theses cases, the protocol is affected to rsh
+ _resource.Protocol = rsh;
+ break;
+ }
+ }
+
+ if ((qName.compare(QString(test_mode)) == 0))
+ {
+ switch (content[0])
+ {
+
+ case 'i':
+ _resource.Mode = interactive;
+ break;
+
+ case 'b':
+ _resource.Mode = batch;
+ break;
+
+ default:
+ // If it'not in all theses cases, the mode is affected to interactive
+ _resource.Mode = interactive;
+ break;
+ }
+ }
+
+ if ((qName.compare(QString(test_user_name)) == 0))
+ _resource.UserName = content;
+
+ if ((qName.compare(QString(test_appli_path)) == 0))
+ _resource.AppliPath = content;
+
+ if ((qName.compare(QString(test_module_name)) == 0))
+ previous_module_name = content;
+
+ if ((qName.compare(QString(test_module_path)) == 0))
+ previous_module_path = content;
+
+ if ((qName.compare(QString(test_pre_req_file_path)) == 0))
+ _resource.PreReqFilePath = content;
+
+ if ((qName.compare(QString(test_os)) == 0))
+ _resource.OS = content;
+
+ if ((qName.compare(QString(test_mem_in_mb)) == 0))
+ _resource.DataForSort._memInMB = atoi(content.c_str());
+
+ if ((qName.compare(QString(test_cpu_freq_mhz)) == 0))
+ _resource.DataForSort._CPUFreqMHz = atoi(content.c_str());
+
+ if ((qName.compare(QString(test_nb_of_nodes)) == 0))
+ _resource.DataForSort._nbOfNodes = atoi(content.c_str());
+
+ if ((qName.compare(QString(test_nb_of_proc_per_node)) == 0))
+ _resource.DataForSort._nbOfProcPerNode = atoi(content.c_str());
+ }
+
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function endElement.
+ * \param QString argument by reference (not used here ?)
+ * \param QString argument by reference (not used here ?)
+ * \param qName
+ * \return true (if no error detected ...)
+ */
+//=============================================================================
+
+bool SALOME_ResourcesCatalog_Handler::
+endElement(const QString&,
+ const QString&,
+ const QString& qName)
+{
+ if ((qName.compare(QString(test_modules)) == 0))
+ _resource.ModulesPath[previous_module_name] = previous_module_path;
+
+ if ((qName.compare(QString(test_machine)) == 0))
+ _resources_list[_resource.DataForSort._hostName] = _resource;
+
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function characters.
+ * fills the private attribute string 'content'.
+ * \param chars
+ * \return true (if no error detected ...)
+ */
+//=============================================================================
+
+bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars)
+{
+ content = (const char *)chars ;
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function endDocument.
+ * Called after the document has been parsed.
+ * \return true (if no error detected ...)
+ */
+//=============================================================================
+
+bool SALOME_ResourcesCatalog_Handler::endDocument()
+{
+// for (map<string, ParserResourcesType>::const_iterator iter =
+// _resources_list.begin();
+// iter != _resources_list.end();
+// iter++)
+// {
+// SCRUTE((*iter).second.Alias);
+// SCRUTE((*iter).second.UserName);
+// SCRUTE((*iter).second.AppliPath);
+// SCRUTE((*iter).second.PreReqFilePath);
+// SCRUTE((*iter).second.OS);
+// SCRUTE((*iter).second.Protocol);
+// SCRUTE((*iter).second.Mode);
+// }
+
+// MESSAGE("This is the end of document");
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function errorProtocol.
+ * \return the error message.
+ */
+//=============================================================================
+
+QString SALOME_ResourcesCatalog_Handler::errorProtocol()
+{
+ INFOS(" ------------- error protocol !");
+ return errorProt;
+}
+
+//=============================================================================
+/*!
+ * Overload handler function fatalError.
+ * Fills the private string errorProt with details on error.
+ * \param exception from parser
+ * \return boolean (meaning ?)
+ */
+//=============================================================================
+
+bool
+SALOME_ResourcesCatalog_Handler::fatalError
+(const QXmlParseException& exception)
+{
+ INFOS(" ------------- fatal error !");
+ errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
+ .arg( exception.message() )
+ .arg( exception.lineNumber() )
+ .arg( exception.columnNumber() );
+
+ return QXmlDefaultHandler::fatalError( exception );
+}
+
+//=============================================================================
+/*!
+ * Fill the document tree in xml file, used to write in an xml file.
+ * \param doc document to fill.
+ */
+//=============================================================================
+
+void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(QDomDocument& doc)
+{
+ QDomElement root = doc.createElement("resources");
+ doc.appendChild(root);
+
+ for (map<string, ParserResourcesType>::iterator iter =
+ _resources_list.begin();
+ iter != _resources_list.end();
+ iter++)
+ {
+ QDomElement eltRoot = doc.createElement(test_machine);
+ root.appendChild( eltRoot );
+ eltRoot.setAttribute((char *)test_hostname, (*iter).first.c_str());
+ eltRoot.setAttribute((char *)test_alias, (*iter).second.Alias.c_str());
+
+ switch ((*iter).second.Protocol)
+ {
+
+ case rsh:
+ eltRoot.setAttribute((char *)test_protocol, "rsh");
+ break;
+
+ case ssh:
+ eltRoot.setAttribute((char *)test_protocol, "ssh");
+ break;
+
+ default:
+ eltRoot.setAttribute((char *)test_protocol, "rsh");
+ }
+
+ switch ((*iter).second.Mode)
+ {
+
+ case interactive:
+ eltRoot.setAttribute((char *)test_mode, "interactive");
+ break;
+
+ case batch:
+ eltRoot.setAttribute((char *)test_mode, "batch");
+ break;
+
+ default:
+ eltRoot.setAttribute((char *)test_mode, "interactive");
+ }
+
+ eltRoot.setAttribute((char *)test_user_name,
+ (*iter).second.UserName.c_str());
+
+ for (map<string, string>::const_iterator iter2 =
+ (*iter).second.ModulesPath.begin();
+ iter2 != (*iter).second.ModulesPath.end();
+ iter2++)
+ {
+ QDomElement rootForModulesPaths = doc.createElement(test_modules);
+ rootForModulesPaths.setAttribute(test_module_name,
+ (*iter2).first.c_str());
+ rootForModulesPaths.setAttribute(test_module_path,
+ (*iter2).second.c_str());
+ eltRoot.appendChild(rootForModulesPaths);
+ }
+
+ eltRoot.setAttribute(test_pre_req_file_path,
+ (*iter).second.PreReqFilePath.c_str());
+ eltRoot.setAttribute(test_os, (*iter).second.OS.c_str());
+ eltRoot.setAttribute(test_mem_in_mb,
+ (*iter).second.DataForSort._memInMB);
+ eltRoot.setAttribute(test_cpu_freq_mhz,
+ (*iter).second.DataForSort._CPUFreqMHz);
+ eltRoot.setAttribute(test_nb_of_nodes,
+ (*iter).second.DataForSort._nbOfNodes);
+ eltRoot.setAttribute(test_nb_of_proc_per_node,
+ (*iter).second.DataForSort._nbOfProcPerNode);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_ResourcesCatalog_Parser.hxx"
+#include "utilities.h"
+#include <iostream>
+
+#define NULL_VALUE 0
+
+using namespace std;
+
+unsigned int ResourceDataToSort::_nbOfNodesWanted = NULL_VALUE;
+unsigned int ResourceDataToSort::_nbOfProcPerNodeWanted = NULL_VALUE;
+unsigned int ResourceDataToSort::_CPUFreqMHzWanted = NULL_VALUE;
+unsigned int ResourceDataToSort::_memInMBWanted = NULL_VALUE;
+
+ResourceDataToSort::ResourceDataToSort()
+{}
+
+ResourceDataToSort::ResourceDataToSort(const string& hostname,
+ unsigned int nbOfNodes,
+ unsigned int nbOfProcPerNode,
+ unsigned int CPUFreqMHz,
+ unsigned int memInMB):
+ _hostName(hostname),
+ _nbOfNodes(nbOfNodes),
+ _nbOfProcPerNode(nbOfProcPerNode),
+ _CPUFreqMHz(CPUFreqMHz),
+ _memInMB(memInMB)
+{}
+
+//! Method used by list::sort to sort the resources used in SALOME_ResourcesManager::GetResourcesFitting
+bool ResourceDataToSort::operator< (const ResourceDataToSort& other) const
+ {
+ unsigned int nbPts = GetNumberOfPoints();
+ return nbPts < other.GetNumberOfPoints();
+ }
+
+unsigned int ResourceDataToSort::GetNumberOfPoints() const
+ {
+ unsigned int ret = 0;
+ //priority 1 : Nb of nodes
+
+ if (_nbOfNodesWanted != NULL_VALUE)
+ {
+ if (_nbOfNodes == _nbOfNodesWanted)
+ ret += 3000;
+ else if (_nbOfNodes > _nbOfNodesWanted)
+ ret += 2000;
+ else
+ ret += 1000;
+ }
+
+ //priority 2 : Nb of proc by node
+ if (_nbOfProcPerNodeWanted != NULL_VALUE)
+ {
+ if (_nbOfProcPerNode == _nbOfProcPerNodeWanted)
+ ret += 300;
+ else if (_nbOfProcPerNode > _nbOfProcPerNodeWanted)
+ ret += 200;
+ else
+ ret += 100;
+ }
+
+ //priority 3 : Cpu freq
+ if (_CPUFreqMHzWanted != NULL_VALUE)
+ {
+ if (_CPUFreqMHz == _CPUFreqMHzWanted)
+ ret += 30;
+ else if (_CPUFreqMHz > _CPUFreqMHzWanted)
+ ret += 20;
+ else
+ ret += 10;
+ }
+
+ //priority 4 : memory
+ if (_memInMBWanted != NULL_VALUE)
+ {
+ if (_memInMB == _memInMBWanted)
+ ret += 3;
+ else if (_memInMB > _memInMBWanted)
+ ret += 2;
+ else
+ ret += 1;
+ }
+
+ return ret;
+ }
+
+//! Method used for debug
+void ResourceDataToSort::Print() const
+ {
+ SCRUTE(_nbOfNodes);
+ SCRUTE(_nbOfProcPerNode);
+ SCRUTE(_CPUFreqMHz);
+ SCRUTE(_memInMB);
+ }
+
+void ParserResourcesType::Print()
+{
+ MESSAGE("##############*****");
+ MESSAGE("HostName : " << DataForSort._hostName);
+ MESSAGE("Alias : " << Alias);
+ MESSAGE("Protocol : " << Protocol);
+ MESSAGE("Mode : " << Mode);
+ MESSAGE("UserName : " << UserName);
+ MESSAGE("Modules : ");
+ int i = 1;
+
+ for (std::map<std::string, std::string>::iterator iter = ModulesPath.begin();
+ iter != ModulesPath.end();
+ iter++)
+ {
+ MESSAGE("Module " << i++ << " called : " << (*iter).first
+ << " with path : " << (*iter).second);
+ }
+
+ MESSAGE("PreReqFilePath : " << PreReqFilePath);
+ MESSAGE("OS : " << OS);
+ DataForSort.Print();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#include "SALOME_ResourcesManager.hxx"
+//#include "SALOME_Container_i.hxx"
+#include "Utils_ExceptHandlers.hxx"
+#include "OpUtil.hxx"
+
+#include <qdom.h>
+
+#include <stdlib.h>
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <io.h>
+#include <process.h>
+#endif
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string.h>
+#include <map>
+#include <list>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "utilities.h"
+
+#define MAX_SIZE_FOR_HOSTNAME 256;
+
+using namespace std;
+
+//=============================================================================
+/*!
+ * just for test
+ */
+//=============================================================================
+
+SALOME_ResourcesManager::
+SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+ const char *xmlFilePath) :
+ _path_resources(xmlFilePath)
+{
+ _NS = new SALOME_NamingService(orb);
+}
+
+//=============================================================================
+/*!
+ * Standard constructor, parse resource file.
+ * - if ${APPLI} exists in environment,
+ * look for ${HOME}/*{APPLI}/CatalogResources.xml
+ * - else look for default:
+ * ${KERNEL_ROOT_DIR}/share/salome/resources/CatalogResources.xml
+ * - parse XML resource file.
+ */
+//=============================================================================
+
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb)
+{
+ _NS = new SALOME_NamingService(orb);
+ _isAppliSalomeDefined = (getenv("APPLI") != 0);
+
+ if (_isAppliSalomeDefined)
+ {
+ _path_resources = getenv("HOME");
+ _path_resources += "/";
+ _path_resources += getenv("APPLI");
+ _path_resources += "/CatalogResources.xml";
+ }
+
+ else
+ {
+ _path_resources = getenv("KERNEL_ROOT_DIR");
+ _path_resources += "/share/salome/resources/CatalogResources.xml";
+ }
+
+ ParseXmlFile();
+}
+
+//=============================================================================
+/*!
+ * Standard Destructor
+ */
+//=============================================================================
+
+SALOME_ResourcesManager::~SALOME_ResourcesManager()
+{
+ delete _NS;
+}
+
+//=============================================================================
+/*!
+ * get the list of name of ressources fitting for the specified module.
+ * If hostname specified, check it is local or known in resources catalog.
+ *
+ * Else
+ * - select first machines with corresponding OS (all machines if
+ * parameter OS empty),
+ * - then select the sublist of machines on witch the module is known
+ * (if the result is empty, that probably means that the inventory of
+ * modules is probably not done, so give complete list from previous step)
+ */
+//=============================================================================
+
+vector<string>
+SALOME_ResourcesManager::
+GetFittingResources(const Engines::MachineParameters& params,
+ const char *moduleName)
+throw(SALOME_Exception)
+{
+// MESSAGE("ResourcesManager::GetFittingResources");
+ vector <std::string> ret;
+
+ // --- To be sure that we search in a correct list.
+ ParseXmlFile();
+
+ const char *hostname = (const char *)params.hostname;
+ MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str());
+
+ if (hostname[0] != '\0')
+ {
+// MESSAGE("ResourcesManager::GetFittingResources : hostname specified" );
+
+ if ( strcmp(hostname, "localhost") == 0 ||
+ strcmp(hostname, GetHostname().c_str()) == 0 )
+ {
+// MESSAGE("ResourcesManager::GetFittingResources : localhost" );
+ ret.push_back(GetHostname().c_str());
+// MESSAGE("ResourcesManager::GetFittingResources : " << ret.size());
+ }
+
+ else if (_resourcesList.find(hostname) != _resourcesList.end())
+ {
+ // --- params.hostname is in the list of resources so return it.
+ ret.push_back(hostname);
+ }
+
+ else
+ {
+ // --- user specified an unknown hostame so notify him.
+ MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception");
+ throw SALOME_Exception("unknown host");
+ }
+ }
+
+ else
+ // --- Search for available resources sorted by priority
+ {
+ SelectOnlyResourcesWithOS(ret, params.OS);
+
+ KeepOnlyResourcesWithModule(ret, moduleName);
+
+ if (ret.size() == 0)
+ SelectOnlyResourcesWithOS(ret, params.OS);
+
+ // --- set wanted parameters
+ ResourceDataToSort::_nbOfNodesWanted = params.nb_node;
+
+ ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node;
+
+ ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock;
+
+ ResourceDataToSort::_memInMBWanted = params.mem_mb;
+
+ // --- end of set
+
+ list<ResourceDataToSort> li;
+
+ for (vector<string>::iterator iter = ret.begin();
+ iter != ret.end();
+ iter++)
+ li.push_back(_resourcesList[(*iter)].DataForSort);
+
+ li.sort();
+
+ unsigned int i = 0;
+
+ for (list<ResourceDataToSort>::iterator iter2 = li.begin();
+ iter2 != li.end();
+ iter2++)
+ ret[i++] = (*iter2)._hostName;
+ }
+
+ // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size());
+ return ret;
+}
+
+//=============================================================================
+/*!
+ * add an entry in the ressources catalog xml file.
+ * Return 0 if OK (KERNEL found in new resources modules) else throw exception
+ */
+//=============================================================================
+
+int
+SALOME_ResourcesManager::
+AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
+ const map<string, string>& modulesOnNewResources,
+ const char *environPathOfPrerequired,
+ const char *alias,
+ const char *userName,
+ AccessModeType mode,
+ AccessProtocolType prot)
+throw(SALOME_Exception)
+{
+ map<string, string>::const_iterator iter =
+ modulesOnNewResources.find("KERNEL");
+
+ if (iter != modulesOnNewResources.end())
+ {
+ ParserResourcesType newElt;
+ newElt.DataForSort._hostName = paramsOfNewResources.hostname;
+ newElt.Alias = alias;
+ newElt.Protocol = prot;
+ newElt.Mode = mode;
+ newElt.UserName = userName;
+ newElt.ModulesPath = modulesOnNewResources;
+ newElt.PreReqFilePath = environPathOfPrerequired;
+ newElt.OS = paramsOfNewResources.OS;
+ newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
+ newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
+ newElt.DataForSort._nbOfNodes = paramsOfNewResources.nb_node;
+ newElt.DataForSort._nbOfProcPerNode =
+ paramsOfNewResources.nb_proc_per_node;
+ _resourcesList[newElt.DataForSort._hostName] = newElt;
+ return 0;
+ }
+
+ else
+ throw SALOME_Exception("KERNEL is not present in this resource");
+}
+
+//=============================================================================
+/*!
+ * Deletes a resource from the catalog
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::DeleteResourceInCatalog(const char *hostname)
+{
+ _resourcesList.erase(hostname);
+}
+
+//=============================================================================
+/*!
+ * write the current data in memory in file.
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::WriteInXmlFile()
+{
+ QDomDocument doc("ResourcesCatalog");
+ SALOME_ResourcesCatalog_Handler* handler =
+ new SALOME_ResourcesCatalog_Handler(_resourcesList);
+ handler->PrepareDocToXmlFile(doc);
+ delete handler;
+
+ QFile file( _path_resources );
+
+ if ( !file.open( IO_WriteOnly ) )
+ INFOS("WRITING ERROR !");
+
+ QTextStream ts( &file );
+
+ ts << doc.toString();
+
+ file.close();
+
+ MESSAGE("WRITING DONE!");
+}
+
+//=============================================================================
+/*!
+ * parse the data type catalog
+ */
+//=============================================================================
+
+const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile()
+{
+ SALOME_ResourcesCatalog_Handler* handler =
+ new SALOME_ResourcesCatalog_Handler(_resourcesList);
+ QFile xmlFile(_path_resources);
+
+ QXmlInputSource source(xmlFile);
+
+ QXmlSimpleReader reader;
+ reader.setContentHandler( handler );
+ reader.setErrorHandler( handler );
+ reader.parse( source );
+ xmlFile.close();
+ delete handler;
+ return _resourcesList;
+}
+
+//=============================================================================
+/*!
+ * consult the content of the list
+ */
+//=============================================================================
+
+const MapOfParserResourcesType& SALOME_ResourcesManager::GetList() const
+ {
+ return _resourcesList;
+ }
+
+
+//=============================================================================
+/*!
+ * dynamically obtains the best machines
+ */
+//=============================================================================
+
+string
+SALOME_ResourcesManager::FindBest(const Engines::MachineList& listOfMachines)
+{
+ return _dynamicResourcesSelecter.FindBest(listOfMachines);
+}
+
+
+//=============================================================================
+/*!
+ * This is no longer valid (C++ container are also python containers)
+ */
+//=============================================================================
+
+bool isPythonContainer(const char* ContainerName)
+{
+ bool ret = false;
+ int len = strlen(ContainerName);
+
+ if (len >= 2)
+ if (strcmp(ContainerName + len - 2, "Py") == 0)
+ ret = true;
+
+ return ret;
+}
+
+
+//=============================================================================
+/*!
+ * Builds the script to be launched
+ *
+ * If SALOME Application not defined ($APPLI),
+ * see BuildTempFileToLaunchRemoteContainer()
+ *
+ * Else rely on distant configuration. Command is under the form (example):
+ * ssh user@machine distantPath/runRemote.sh hostNS portNS \
+ * SALOME_Container containerName &"
+
+ * - where user is ommited if not specified in CatalogResources,
+ * - where distant path is always relative to user@machine $HOME, and
+ * equal to $APPLI if not specified in CatalogResources,
+ * - where hostNS is the hostname of CORBA naming server (set by scripts to
+ * use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
+ * - where portNS is the port used by CORBA naming server (set by scripts to
+ * use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
+ */
+//=============================================================================
+
+string
+SALOME_ResourcesManager::BuildCommandToLaunchRemoteContainer
+(const string& machine,
+ const Engines::MachineParameters& params, const long id)
+{
+ string command;
+ int nbproc;
+ char idc[3*sizeof(long)];
+
+ if ( ! _isAppliSalomeDefined )
+ command = BuildTempFileToLaunchRemoteContainer(machine, params);
+
+ else
+ {
+ const ParserResourcesType& resInfo = _resourcesList[machine];
+
+ if (params.isMPI)
+ {
+ if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+ nbproc = 1;
+ else if ( params.nb_node == 0 )
+ nbproc = params.nb_proc_per_node;
+ else if ( params.nb_proc_per_node == 0 )
+ nbproc = params.nb_node;
+ else
+ nbproc = params.nb_node * params.nb_proc_per_node;
+ }
+
+ // "ssh user@machine distantPath/runRemote.sh hostNS portNS \
+ // SALOME_Container containerName &"
+
+ if (resInfo.Protocol == rsh)
+ command = "rsh ";
+ else if (resInfo.Protocol == ssh)
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (resInfo.UserName != "")
+ {
+ command += resInfo.UserName;
+ command += "@";
+ }
+
+ command += machine;
+ command += " ";
+
+ if (resInfo.AppliPath != "")
+ command += resInfo.AppliPath; // path relative to user@machine $HOME
+ else
+ {
+ ASSERT(getenv("APPLI"));
+ command += getenv("APPLI"); // path relative to user@machine $HOME
+ }
+
+ command += "/runRemote.sh ";
+
+ ASSERT(getenv("NSHOST"));
+ command += getenv("NSHOST"); // hostname of CORBA name server
+
+ command += " ";
+ ASSERT(getenv("NSPORT"));
+ command += getenv("NSPORT"); // port of CORBA name server
+
+ if(params.isMPI)
+ {
+ command += " mpirun -np ";
+ std::ostringstream o;
+ o << nbproc << " ";
+ command += o.str();
+#ifdef WITHLAM
+ command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+#endif
+ command += " SALOME_MPIContainer ";
+ }
+ else
+ command += " SALOME_Container ";
+
+ command += _NS->ContainerName(params);
+ command += " -id ";
+ sprintf(idc,"%ld",id);
+ command += idc;
+ command += " -";
+ AddOmninamesParams(command);
+ command += " > /tmp/";
+ command += _NS->ContainerName(params);
+ command += "_";
+ command += GetHostname();
+ command += "_";
+ command += getenv( "USER" ) ;
+ command += ".log 2>&1 &" ;
+
+ MESSAGE("command =" << command);
+ }
+
+ return command;
+}
+
+
+//=============================================================================
+/*!
+ * builds the command to be launched.
+ */
+//=============================================================================
+
+string
+SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer
+(const Engines::MachineParameters& params, const long id)
+{
+ _TmpFileName = "";
+ string command;
+ int nbproc = 0;
+ char idc[3*sizeof(long)];
+
+ if (params.isMPI)
+ {
+ command = "mpirun -np ";
+
+ if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+ nbproc = 1;
+ else if ( params.nb_node == 0 )
+ nbproc = params.nb_proc_per_node;
+ else if ( params.nb_proc_per_node == 0 )
+ nbproc = params.nb_node;
+ else
+ nbproc = params.nb_node * params.nb_proc_per_node;
+
+ std::ostringstream o;
+
+ o << nbproc << " ";
+
+ command += o.str();
+#ifdef WITHLAM
+ command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+#endif
+
+ if (isPythonContainer(params.container_name))
+ command += "pyMPI SALOME_ContainerPy.py ";
+ else
+ command += "SALOME_MPIContainer ";
+ }
+
+ else
+ {
+ if (isPythonContainer(params.container_name))
+ command = "SALOME_ContainerPy.py ";
+ else
+ command = "SALOME_Container ";
+ }
+
+ command += _NS->ContainerName(params);
+ command += " -id ";
+ sprintf(idc,"%ld",id);
+ command += idc;
+ command += " -";
+ AddOmninamesParams(command);
+ command += " > /tmp/";
+ command += _NS->ContainerName(params);
+ command += "_";
+ command += GetHostname();
+ command += "_";
+ command += getenv( "USER" ) ;
+ command += ".log 2>&1 &" ;
+ MESSAGE("Command is ... " << command);
+ return command;
+}
+
+
+//=============================================================================
+/*!
+ * removes the generated temporary file in case of a remote launch.
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::RmTmpFile()
+{
+ if (_TmpFileName != "")
+ {
+ string command = "rm ";
+ command += _TmpFileName;
+ char *temp = strdup(command.c_str());
+ int lgthTemp = strlen(temp);
+ temp[lgthTemp - 3] = '*';
+ temp[lgthTemp - 2] = '\0';
+ system(temp);
+ free(temp);
+ }
+}
+
+
+//=============================================================================
+/*!
+ * builds the script to be launched
+ */
+//=============================================================================
+
+string
+SALOME_ResourcesManager::BuildCommand
+(const string& machine,
+ const char *containerName)
+{
+ // rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
+ const ParserResourcesType& resInfo = _resourcesList[machine];
+ bool pyCont = isPythonContainer(containerName);
+
+ string command;
+
+ if (resInfo.Protocol == rsh)
+ command = "rsh -n " ;
+ else if (resInfo.Protocol == ssh)
+ command = "ssh -f -n ";
+ else
+ throw SALOME_Exception("Not implemented yet...");
+
+ command += machine;
+ command += " ";
+ string path = (*(resInfo.ModulesPath.find("KERNEL"))).second;
+ command += path;
+ command += "/bin/salome/";
+
+ if ( pyCont )
+ command += "SALOME_ContainerPy.py ";
+ else
+ command += "SALOME_Container ";
+
+ command += containerName;
+ command += " -";
+ AddOmninamesParams(command);
+ command += " > /tmp/";
+ command += containerName;
+ command += "_";
+ command += machine;
+ command += ".log 2>&1 &" ;
+
+ SCRUTE( command );
+ return command;
+}
+
+//=============================================================================
+/*!
+ * Gives a sublist of machines with matching OS.
+ * If parameter OS is empty, gives the complete list of machines
+ */
+//=============================================================================
+
+// Warning need an updated parsed list : _resourcesList
+void
+SALOME_ResourcesManager::SelectOnlyResourcesWithOS
+( vector<string>& hosts,
+ const char *OS) const
+throw(SALOME_Exception)
+{
+ string base(OS);
+
+ for (map<string, ParserResourcesType>::const_iterator iter =
+ _resourcesList.begin();
+ iter != _resourcesList.end();
+ iter++)
+ {
+ if ( (*iter).second.OS == base || base.size() == 0)
+ hosts.push_back((*iter).first);
+ }
+}
+
+
+//=============================================================================
+/*!
+ * Gives a sublist of machines on which the module is known.
+ */
+//=============================================================================
+
+//Warning need an updated parsed list : _resourcesList
+void
+SALOME_ResourcesManager::KeepOnlyResourcesWithModule
+( vector<string>& hosts,
+ const char *moduleName) const
+throw(SALOME_Exception)
+{
+ for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
+ {
+ MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
+ const map<string, string>& mapOfModulesOfCurrentHost =
+ (((*it).second).ModulesPath);
+
+ if (mapOfModulesOfCurrentHost.find(moduleName) ==
+ mapOfModulesOfCurrentHost.end())
+ hosts.erase(iter);
+ else
+ iter++;
+ }
+}
+
+
+//=============================================================================
+/*!
+ * add to command all options relative to naming service.
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::AddOmninamesParams(string& command) const
+ {
+ // If env variable OMNIORB_CONFIG is not defined or the file is more complex than one line
+ // does not work
+ // Even if we use it we have to check if env variable exists
+ //string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
+ //ifstream omniORBfile( omniORBcfg.c_str() ) ;
+ //char ORBInitRef[11] ;
+ //char egal[3] ;
+ //char nameservice[132] ;
+ //omniORBfile >> ORBInitRef ;
+ //command += "ORBInitRef " ;
+ //omniORBfile >> egal ;
+ //omniORBfile >> nameservice ;
+ //omniORBfile.close() ;
+ //char * bsn = strchr( nameservice , '\n' ) ;
+ //if ( bsn ) {
+ //bsn[ 0 ] = '\0' ;
+ //}
+ //command += nameservice ;
+
+ char *iorstr = _NS->getIORaddr();
+ command += "ORBInitRef NameService=";
+ command += iorstr;
+ }
+
+
+//=============================================================================
+/*!
+ * add to command all options relative to naming service.
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const
+ {
+ string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
+ ifstream omniORBfile( omniORBcfg.c_str() ) ;
+ char ORBInitRef[11] ;
+ char egal[3] ;
+ char nameservice[132] ;
+ omniORBfile >> ORBInitRef ;
+ fileStream << "ORBInitRef ";
+ omniORBfile >> egal ;
+ omniORBfile >> nameservice ;
+ omniORBfile.close() ;
+ char * bsn = strchr( nameservice , '\n' ) ;
+
+ if ( bsn )
+ {
+ bsn[ 0 ] = '\0' ;
+ }
+
+ fileStream << nameservice;
+ }
+
+
+//=============================================================================
+/*!
+ * generate a file name in /tmp directory
+ */
+//=============================================================================
+
+string SALOME_ResourcesManager::BuildTemporaryFileName() const
+ {
+ //build more complex file name to support multiple salome session
+ char *temp = new char[19];
+ strcpy(temp, "/tmp/command");
+ strcat(temp, "XXXXXX");
+#ifndef WNT
+
+ mkstemp(temp);
+#else
+
+ char aPID[80];
+ itoa(getpid(), aPID, 10);
+ strcat(temp, aPID);
+#endif
+
+ string command(temp);
+ delete [] temp;
+ command += ".sh";
+ return command;
+ }
+
+
+//=============================================================================
+/*!
+ * Builds in a temporary file the script to be launched.
+ *
+ * Used if SALOME Application ($APPLI) is not defined.
+ * The command is build with data from CatalogResources, in which every path
+ * used on remote computer must be defined.
+ */
+//=============================================================================
+
+string
+SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
+(const string& machine,
+ const Engines::MachineParameters& params)
+{
+ _TmpFileName = BuildTemporaryFileName();
+ ofstream tempOutputFile;
+ tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
+ const ParserResourcesType& resInfo = _resourcesList[machine];
+ tempOutputFile << "#! /bin/sh" << endl;
+
+ // --- set env vars
+
+ for (map<string, string>::const_iterator iter = resInfo.ModulesPath.begin();
+ iter != resInfo.ModulesPath.end();
+ iter++)
+ {
+ string curModulePath((*iter).second);
+ tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl;
+ tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl;
+ tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath
+ << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl;
+ tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:"
+ << curModulePath << "/lib/salome:" << curModulePath
+ << "/lib/python2.2/site-packages/salome:";
+ tempOutputFile << curModulePath
+ << "/lib/python2.2/site-packages/salome/shared_modules:${PYTHONPATH}"
+ << endl;
+ }
+
+ tempOutputFile << "export LD_LIBRARY_PATH" << endl;
+ tempOutputFile << "export PYTHONPATH" << endl;
+ tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
+
+ // ! env vars
+
+ if (params.isMPI)
+ {
+ tempOutputFile << "mpirun -np ";
+ int nbproc;
+
+ if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+ nbproc = 1;
+ else if ( params.nb_node == 0 )
+ nbproc = params.nb_proc_per_node;
+ else if ( params.nb_proc_per_node == 0 )
+ nbproc = params.nb_node;
+ else
+ nbproc = params.nb_node * params.nb_proc_per_node;
+
+ std::ostringstream o;
+
+ tempOutputFile << nbproc << " ";
+#ifdef WITHLAM
+ tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+#endif
+ }
+
+ tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second
+ << "/bin/salome/";
+
+ if (params.isMPI)
+ {
+ if (isPythonContainer(params.container_name))
+ tempOutputFile << "pyMPI SALOME_ContainerPy.py ";
+ else
+ tempOutputFile << "SALOME_MPIContainer ";
+ }
+
+ else
+ {
+ if (isPythonContainer(params.container_name))
+ tempOutputFile << "SALOME_ContainerPy.py ";
+ else
+ tempOutputFile << "SALOME_Container ";
+ }
+
+ tempOutputFile << _NS->ContainerName(params) << " -";
+ AddOmninamesParams(tempOutputFile);
+ tempOutputFile << " &" << endl;
+ tempOutputFile.flush();
+ tempOutputFile.close();
+ chmod(_TmpFileName.c_str(), 0x1ED);
+
+ // --- Build command
+
+ string command;
+
+ if (resInfo.Protocol == rsh)
+ {
+ command = "rsh ";
+ string commandRcp = "rcp ";
+ commandRcp += _TmpFileName;
+ commandRcp += " ";
+ commandRcp += machine;
+ commandRcp += ":";
+ commandRcp += _TmpFileName;
+ system(commandRcp.c_str());
+ }
+
+ else if (resInfo.Protocol == ssh)
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ command += machine;
+ _CommandForRemAccess = command;
+ command += " ";
+ command += _TmpFileName;
+ command += " > ";
+ command += "/tmp/";
+ command += _NS->ContainerName(params);
+ command += "_";
+ command += machine;
+ command += ".log 2>&1 &";
+ SCRUTE(command);
+
+ return command;
+
+}
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef __SALOME_RESOURCESMANAGER_HXX__
+#define __SALOME_RESOURCESMANAGER_HXX__
+
+#include "Utils_SALOME_Exception.hxx"
+#include "utilities.h"
+#include <SALOMEconfig.h>
+#include "SALOME_ResourcesCatalog_Handler.hxx"
+#include "SALOME_LoadRateManager.hxx"
+#include "SALOME_NamingService.hxx"
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include <string>
+#include <fstream>
+#include <vector>
+
+
+
+#if defined RESOURCESMANAGER_EXPORTS
+#if defined WIN32
+#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#else
+#if defined WNT
+#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#endif
+
+// --- WARNING ---
+// The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
+// in a critical section to be sure to be clean.
+// Only one thread should use the SALOME_ResourcesManager class in a SALOME
+// session.
+
+class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
+ {
+
+ public:
+
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb, const char *xmlFilePath);
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb);
+
+ ~SALOME_ResourcesManager();
+
+ std::vector<std::string>
+ GetFittingResources(const Engines::MachineParameters& params,
+ const char *moduleName)
+ throw(SALOME_Exception);
+
+ std::string FindBest(const Engines::MachineList& listOfMachines);
+
+ std::string BuildCommandToLaunchRemoteContainer
+ (const std::string& machine,
+ const Engines::MachineParameters& params, const long id);
+
+ std::string BuildCommandToLaunchLocalContainer
+ (const Engines::MachineParameters& params, const long id);
+
+ void RmTmpFile();
+
+ std::string BuildCommand(const std::string& machine,
+ const char *containerName);
+
+ int AddResourceInCatalog
+ (const Engines::MachineParameters& paramsOfNewResources,
+ const std::map<std::string, std::string>& modulesOnNewResources,
+ const char *environPathOfPrerequired,
+ const char *alias,
+ const char *userName,
+ AccessModeType mode,
+ AccessProtocolType prot)
+ throw(SALOME_Exception);
+
+ void DeleteResourceInCatalog(const char *hostname);
+
+ void WriteInXmlFile();
+
+ const MapOfParserResourcesType& ParseXmlFile();
+
+ const MapOfParserResourcesType& GetList() const;
+
+ protected:
+ SALOME_NamingService *_NS;
+
+ std::string BuildTempFileToLaunchRemoteContainer
+ (const std::string& machine,
+ const Engines::MachineParameters& params);
+
+ void SelectOnlyResourcesWithOS(std::vector<std::string>& hosts,
+ const char *OS) const
+ throw(SALOME_Exception);
+
+ void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
+ const char *moduleName) const
+ throw(SALOME_Exception);
+
+ void AddOmninamesParams(std::string& command) const;
+
+ void AddOmninamesParams(std::ofstream& fileStream) const;
+
+ std::string BuildTemporaryFileName() const;
+
+
+ //! will contain the path to the ressources catalog
+ QString _path_resources;
+
+ //! attribute that contains current tmp files generated
+ std::string _TmpFileName;
+
+ //! contains the rsh or ssh command to access directly to machine.
+ // Only used by this->RmTmpFile in case of a remote launch.
+ std::string _CommandForRemAccess;
+
+ //! will contain the informations on the data type catalog(after parsing)
+ MapOfParserResourcesType _resourcesList;
+
+ SALOME_LoadRateManager _dynamicResourcesSelecter;
+
+ //! different behaviour if $APPLI exists (SALOME Application)
+ bool _isAppliSalomeDefined;
+ };
+
+#endif // RESSOURCESCATALOG_IMPL_H
--- /dev/null
+#
+# File : Makefile.in
+# Author : Sergey RUIN
+# Module : SALOME
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS = SALOME_DriverPy.py
+
+EXPORT_HEADERS= \
+ SALOMEDS_StudyManager_i.hxx \
+ SALOMEDS_Driver_i.hxx \
+ SALOMEDS_StudyManager.hxx \
+ SALOMEDS_Study_i.hxx \
+ SALOMEDS_Study.hxx \
+ SALOMEDS_SObject_i.hxx \
+ SALOMEDS_SObject.hxx \
+ SALOMEDS_SComponent_i.hxx \
+ SALOMEDS_SComponent.hxx \
+ SALOMEDS_GenericAttribute_i.hxx \
+ SALOMEDS_GenericAttribute.hxx
+
+# Libraries targets
+
+LIB = libSalomeDS.la
+LIB_SRC = \
+ SALOMEDS.cxx \
+ SALOMEDS_Driver_i.cxx \
+ SALOMEDS_StudyManager_i.cxx \
+ SALOMEDS_UseCaseBuilder_i.cxx \
+ SALOMEDS_UseCaseIterator_i.cxx \
+ SALOMEDS_ChildIterator_i.cxx \
+ SALOMEDS_SComponentIterator_i.cxx \
+ SALOMEDS_Study_i.cxx \
+ SALOMEDS_StudyBuilder_i.cxx \
+ SALOMEDS_SObject_i.cxx \
+ SALOMEDS_SComponent_i.cxx \
+ SALOMEDS_GenericAttribute_i.cxx \
+ SALOMEDS_AttributeComment_i.cxx \
+ SALOMEDS_AttributeExternalFileDef_i.cxx \
+ SALOMEDS_AttributeFileType_i.cxx \
+ SALOMEDS_AttributeIOR_i.cxx \
+ SALOMEDS_AttributeInteger_i.cxx \
+ SALOMEDS_AttributeName_i.cxx \
+ SALOMEDS_AttributePersistentRef_i.cxx \
+ SALOMEDS_AttributeReal_i.cxx \
+ SALOMEDS_AttributeSequenceOfReal_i.cxx \
+ SALOMEDS_AttributeSequenceOfInteger_i.cxx \
+ SALOMEDS_AttributeDrawable_i.cxx \
+ SALOMEDS_AttributeSelectable_i.cxx \
+ SALOMEDS_AttributeOpened_i.cxx \
+ SALOMEDS_AttributeFlags_i.cxx \
+ SALOMEDS_AttributeGraphic_i.cxx \
+ SALOMEDS_AttributeExpandable_i.cxx \
+ SALOMEDS_AttributeTextColor_i.cxx \
+ SALOMEDS_AttributeTextHighlightColor_i.cxx \
+ SALOMEDS_AttributePixMap_i.cxx \
+ SALOMEDS_AttributeTreeNode_i.cxx \
+ SALOMEDS_AttributeLocalID_i.cxx \
+ SALOMEDS_AttributeUserID_i.cxx \
+ SALOMEDS_AttributeTarget_i.cxx \
+ SALOMEDS_AttributeTableOfInteger_i.cxx \
+ SALOMEDS_AttributeTableOfReal_i.cxx \
+ SALOMEDS_AttributeTableOfString_i.cxx \
+ SALOMEDS_AttributeStudyProperties_i.cxx \
+ SALOMEDS_AttributePythonObject_i.cxx \
+ SALOMEDS_SObject.cxx \
+ SALOMEDS_SComponent.cxx \
+ SALOMEDS_GenericAttribute.cxx \
+ SALOMEDS_ChildIterator.cxx \
+ SALOMEDS_SComponentIterator.cxx \
+ SALOMEDS_UseCaseIterator.cxx \
+ SALOMEDS_UseCaseBuilder.cxx \
+ SALOMEDS_StudyBuilder.cxx \
+ SALOMEDS_Study.cxx \
+ SALOMEDS_StudyManager.cxx \
+ SALOMEDS_AttributeStudyProperties.cxx \
+ SALOMEDS_AttributeComment.cxx \
+ SALOMEDS_AttributeDrawable.cxx \
+ SALOMEDS_AttributeExpandable.cxx \
+ SALOMEDS_AttributeExternalFileDef.cxx \
+ SALOMEDS_AttributeFileType.cxx \
+ SALOMEDS_AttributeFlags.cxx \
+ SALOMEDS_AttributeGraphic.cxx \
+ SALOMEDS_AttributeIOR.cxx \
+ SALOMEDS_AttributeInteger.cxx \
+ SALOMEDS_AttributeLocalID.cxx \
+ SALOMEDS_AttributeName.cxx \
+ SALOMEDS_AttributeOpened.cxx \
+ SALOMEDS_AttributePythonObject.cxx \
+ SALOMEDS_AttributeReal.cxx \
+ SALOMEDS_AttributeSelectable.cxx \
+ SALOMEDS_AttributeSequenceOfInteger.cxx \
+ SALOMEDS_AttributePersistentRef.cxx \
+ SALOMEDS_AttributePixMap.cxx \
+ SALOMEDS_AttributeSequenceOfReal.cxx \
+ SALOMEDS_AttributeTableOfInteger.cxx \
+ SALOMEDS_AttributeTableOfReal.cxx \
+ SALOMEDS_AttributeTableOfString.cxx \
+ SALOMEDS_AttributeTarget.cxx \
+ SALOMEDS_AttributeTextColor.cxx \
+ SALOMEDS_AttributeTextHighlightColor.cxx \
+ SALOMEDS_AttributeTreeNode.cxx \
+ SALOMEDS_AttributeUserID.cxx
+
+
+# Executables targets
+BIN = SALOMEDS_Server SALOMEDS_Client
+BIN_SRC =
+LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_GenericObj.idl
+BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
+BIN_CLIENT_IDL =
+
+CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
+CXXFLAGS+=$(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl -lSalomeGenericObj $(CAS_KERNEL) -lSalomeGenericObj -lSalomeLifeCycleCORBA
+
+# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
+# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
+# On est donc obligé ici, pour permettre l'édition de lien avec les bibliothèques OCC, de spécifier le
+# chemin d'accès aux bibliothèques Xmu
+#
+
+# _CS_gbo_090604 Ajout Sp.cifique Calibre 3, pour l'utilisation de la version 5.12 de la biblioth.que OCC.
+# La biblioth.que OCC5.12 a .t. compil.e sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
+# On est donc oblig. ici, pour permettre l'.dition de lien avec les biblioth.ques OCC, de sp.cifier le
+# chemin d'acc.s aux biblioth.ques Xmu
+#
+LDXMUFLAGS= -L/usr/X11R6/lib -lXmu
+LDFLAGS+=$(LDXMUFLAGS)
+LDFLAGSFORBIN= $(LDFLAGS) $(CAS_OCAF) -lRegistry -lSalomeNotification -lSalomeContainer -lSalomeResourcesManager -lSALOMEBasics
+
+@CONCLUDE@
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+package SALOMEDS
+
+uses TDocStd,
+ TDF,
+ TCollection,
+ TColStd,
+ TDataStd
+
+
+is
+
+ class OCAFApplication ;
+ class IORAttribute ;
+ class PersRefAttribute;
+ class SequenceOfRealAttribute;
+ class SequenceOfIntegerAttribute;
+ class DrawableAttribute;
+ class SelectableAttribute;
+ class ExpandableAttribute;
+ class OpenedAttribute;
+ class PixMapAttribute;
+ class TextColorAttribute;
+ class TextHighlightColorAttribute;
+ class LocalIDAttribute;
+ class UserIDAttribute;
+ class TableOfIntegerAttribute;
+ class TableOfRealAttribute;
+ class StudyPropertiesAttribute;
+ class PythonObjectAttribute;
+
+ class DataMapStringLabel instantiates DataMap from TCollection
+ (ExtendedString from TColleciton,
+ Label from TDF,
+ ExtendedString from TCollection);
+
+end SALOMEDS;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeComment.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeComment.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeComment::~SALOMEDS_AttributeComment()
+{}
+
+std::string SALOMEDS_AttributeComment::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeComment::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeComment.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeComment_HeaderFile
+#define SALOMEDS_AttributeComment_HeaderFile
+
+#include "SALOMEDSClient_AttributeComment.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeComment: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeComment
+{
+public:
+ SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr);
+ SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr);
+ ~SALOMEDS_AttributeComment();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeComment_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeComment_i.hxx"
+
+#include <TCollection_ExtendedString.hxx>
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+char* SALOMEDS_AttributeComment_i::Value()
+{
+ SALOMEDS::Locker lock;
+
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeComment_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+
+ CheckLocked();
+ TCollection_AsciiString aStr((char*)value);
+ Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeComment_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeComment_i_HeaderFile
+#define SALOMEDS_AttributeComment_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+
+class SALOMEDS_AttributeComment_i: public virtual POA_SALOMEDS::AttributeComment,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+ SALOMEDS_AttributeComment_i(const Handle(SALOMEDSImpl_AttributeComment)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ virtual ~SALOMEDS_AttributeComment_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeDrawable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeDrawable.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeDrawable::~SALOMEDS_AttributeDrawable()
+{}
+
+bool SALOMEDS_AttributeDrawable::IsDrawable()
+{
+ bool aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable();
+ else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable();
+ return aValue;
+}
+
+void SALOMEDS_AttributeDrawable::SetDrawable(bool value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value);
+ else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeDrawable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeDrawable_HeaderFile
+#define SALOMEDS_AttributeDrawable_HeaderFile
+
+#include "SALOMEDSClient_AttributeDrawable.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeDrawable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeDrawable
+{
+public:
+ SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr);
+ SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr);
+ ~SALOMEDS_AttributeDrawable();
+
+ virtual bool IsDrawable();
+ virtual void SetDrawable(bool value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeDrawable_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_AttributeDrawable_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable()
+{
+ SALOMEDS::Locker lock;
+ return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1);
+}
+
+void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeDrawable_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeDrawable_i_HeaderFile
+#define SALOMEDS_AttributeDrawable_i_HeaderFile
+
+// IDL headers
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+
+class SALOMEDS_AttributeDrawable_i: public virtual POA_SALOMEDS::AttributeDrawable,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeDrawable_i(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ virtual ~SALOMEDS_AttributeDrawable_i() {};
+ CORBA::Boolean IsDrawable();
+ void SetDrawable(CORBA::Boolean value);
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExpandable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeExpandable.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeExpandable::~SALOMEDS_AttributeExpandable()
+{}
+
+bool SALOMEDS_AttributeExpandable::IsExpandable()
+{
+ bool aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable();
+ else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable();
+ return aValue;
+}
+
+void SALOMEDS_AttributeExpandable::SetExpandable(bool value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value);
+ else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExpandable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeExpandable_HeaderFile
+#define SALOMEDS_AttributeExpandable_HeaderFile
+
+#include "SALOMEDSClient_AttributeExpandable.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeExpandable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExpandable
+{
+public:
+ SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr);
+ SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr);
+ ~SALOMEDS_AttributeExpandable();
+
+ virtual bool IsExpandable();
+ virtual void SetExpandable(bool value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExpandable_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeExpandable_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable()
+{
+ SALOMEDS::Locker lock;
+ return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1);
+}
+
+void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExpandable_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeExpandable_i_HeaderFile
+#define SALOMEDS_AttributeExpandable_i_HeaderFile
+
+// IDL headers
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+
+class SALOMEDS_AttributeExpandable_i: public virtual POA_SALOMEDS::AttributeExpandable,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeExpandable_i(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeExpandable_i() {};
+ CORBA::Boolean IsExpandable();
+ void SetExpandable(CORBA::Boolean value);
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExternalFileDef.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeExternalFileDef.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeExternalFileDef::~SALOMEDS_AttributeExternalFileDef()
+{}
+
+std::string SALOMEDS_AttributeExternalFileDef::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeExternalFileDef::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExternalFileDef.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeExternalFileDef_HeaderFile
+#define SALOMEDS_AttributeExternalFileDef_HeaderFile
+
+#include "SALOMEDSClient_AttributeExternalFileDef.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeExternalFileDef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExternalFileDef
+{
+public:
+ SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr);
+ SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr);
+ ~SALOMEDS_AttributeExternalFileDef();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExternalFileDef_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributeExternalFileDef_i::Value()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeExternalFileDef_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeExternalFileDef_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeExternalFileDef_i_HeaderFile
+#define SALOMEDS_AttributeExternalFileDef_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+
+class SALOMEDS_AttributeExternalFileDef_i: public virtual POA_SALOMEDS::AttributeExternalFileDef,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {}
+ ~SALOMEDS_AttributeExternalFileDef_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFileType.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeFileType.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeFileType::~SALOMEDS_AttributeFileType()
+{}
+
+std::string SALOMEDS_AttributeFileType::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeFileType::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFileType.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeFileType_HeaderFile
+#define SALOMEDS_AttributeFileType_HeaderFile
+
+#include "SALOMEDSClient_AttributeFileType.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeFileType: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFileType
+{
+public:
+ SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr);
+ SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr);
+ ~SALOMEDS_AttributeFileType();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFileType_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeFileType_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributeFileType_i::Value()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeFileType_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFileType_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeFileType_i_HeaderFile
+#define SALOMEDS_AttributeFileType_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+
+class SALOMEDS_AttributeFileType_i: public virtual POA_SALOMEDS::AttributeFileType,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeFileType_i(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+ ~SALOMEDS_AttributeFileType_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFlags.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeFlags.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeFlags::~SALOMEDS_AttributeFlags()
+{}
+
+int SALOMEDS_AttributeFlags::GetFlags()
+{
+ int aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get();
+ else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags();
+ return aValue;
+}
+
+void SALOMEDS_AttributeFlags::SetFlags(int theFlags)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags);
+ else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags);
+}
+
+bool SALOMEDS_AttributeFlags::Get(int theFlag)
+{
+ return (GetFlags() & theFlag) ? true : false;
+}
+
+void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue)
+{
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl);
+ if ( theValue )
+ anAttr->Set( anAttr->Get() | theFlag );
+ else
+ anAttr->Set( anAttr->Get() & ~theFlag );
+ }
+ else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->Set(theFlag, theValue);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFlags.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeFlags_HeaderFile
+#define SALOMEDS_AttributeFlags_HeaderFile
+
+#include "SALOMEDSClient_AttributeFlags.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeFlags: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFlags
+{
+public:
+ SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr);
+ SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr);
+ ~SALOMEDS_AttributeFlags();
+
+ virtual int GetFlags();
+ virtual void SetFlags(int theFlags);
+
+ virtual bool Get(int theFlag);
+ virtual void Set(int theFlag, bool theValue);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFlags_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeFlags_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+/*
+ Class : SALOMEDS_AttributeFlags_i
+ Description : This class is intended for storing different object attributes that
+ have only two states (0 and 1).
+
+ Avalable attributes:
+
+ IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
+ This attribute is valid for active view only.
+*/
+
+
+//=======================================================================
+// function : SALOMEDS_AttributeFlags_i::GetFlags
+// purpose : Get all flags as integer value
+//=======================================================================
+CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get();
+}
+
+//=======================================================================
+// function : SALOMEDS_AttributeFlags_i::SetFlags
+// purpose : Set all flags as integer value
+//=======================================================================
+void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags );
+}
+
+//=======================================================================
+// function : SALOMEDS_AttributeFlags_i::Get
+// purpose : Get specified flag
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false;
+}
+
+//=======================================================================
+// function : SALOMEDS_AttributeFlags_i::Set
+// purpose : Set/Unset specified flag
+//=======================================================================
+void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl);
+ if ( theValue )
+ anAttr->Set( anAttr->Get() | theFlag );
+ else
+ anAttr->Set( anAttr->Get() & ~theFlag );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFlags_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeFlags_i_HeaderFile
+#define SALOMEDS_AttributeFlags_i_HeaderFile
+
+// IDL headers
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+
+/*
+ Class : SALOMEDS_AttributeFlags_i
+ Description : This class is intended for storing different object attributes that
+ have only two states (0 and 1).
+
+ Avalable attributes:
+
+ IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
+ This attribute is valid for active view only.
+*/
+
+class SALOMEDS_AttributeFlags_i: public virtual POA_SALOMEDS::AttributeFlags,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeFlags_i( const Handle(SALOMEDSImpl_AttributeFlags)& theAttr, CORBA::ORB_ptr orb )
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ virtual ~SALOMEDS_AttributeFlags_i() {};
+
+ CORBA::Long GetFlags();
+ void SetFlags( CORBA::Long theFlags );
+
+ CORBA::Boolean Get( CORBA::Long theFlag );
+ void Set( CORBA::Long theFlag, CORBA::Boolean theValue );
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeGraphic.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeGraphic.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeGraphic::~SALOMEDS_AttributeGraphic()
+{}
+
+
+bool SALOMEDS_AttributeGraphic:: GetVisibility(int theViewId)
+{
+ bool aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId);
+ else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId);
+ return aValue;
+}
+
+void SALOMEDS_AttributeGraphic::SetVisibility(int theViewId, bool theValue)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue);
+ else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeGraphic.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeGraphic_HeaderFile
+#define SALOMEDS_AttributeGraphic_HeaderFile
+
+#include "SALOMEDSClient_AttributeGraphic.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeGraphic: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeGraphic
+{
+public:
+ SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr);
+ SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr);
+ ~SALOMEDS_AttributeGraphic();
+
+ virtual void SetVisibility(int theViewId, bool theValue);
+ virtual bool GetVisibility(int theViewId);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeGraphic_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeGraphic_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+/*
+ Class : SALOMEDS_AttributeGraphic_i
+ Description : This class is intended for storing information about
+ graphic representation of objects in dirrent views
+*/
+
+
+//=======================================================================
+// function : SALOMEDS_AttributeGraphic_i::~SetVisibility
+// purpose : Set visibility of object in given view
+//=======================================================================
+void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId,
+ CORBA::Boolean theValue )
+{
+ SALOMEDS::Locker lock;
+ if ( !_impl.IsNull() )
+ Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->SetVisibility( theViewId, theValue );
+}
+
+//=======================================================================
+// function : SALOMEDS_AttributeGraphic_i::~SALOMEDS_AttributeGraphic_i
+// purpose : Get visibility of object in given view
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeGraphic_i::GetVisibility( CORBA::Long theViewId )
+{
+ SALOMEDS::Locker lock;
+ return !_impl.IsNull() ? Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->GetVisibility( theViewId ) : false;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeFlags_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeGraphic_i_HeaderFile
+#define SALOMEDS_AttributeGraphic_i_HeaderFile
+
+// IDL headers
+
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+
+/*
+ Class : SALOMEDS_AttributeGraphic_i
+ Description : This class is intended for storing information about
+ graphic representation of objects in dirrent views
+*/
+
+class SALOMEDS_AttributeGraphic_i: public virtual POA_SALOMEDS::AttributeGraphic,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeGraphic_i( const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr, CORBA::ORB_ptr orb )
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ virtual ~SALOMEDS_AttributeGraphic_i() {};
+
+ void SetVisibility( CORBA::Long theViewId,
+ CORBA::Boolean theValue );
+ CORBA::Boolean GetVisibility( CORBA::Long theViewId );
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeIOR.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeIOR.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeIOR::~SALOMEDS_AttributeIOR()
+{}
+
+std::string SALOMEDS_AttributeIOR::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeIOR::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeIOR_HeaderFile
+#define SALOMEDS_AttributeIOR_HeaderFile
+
+#include "SALOMEDSClient_AttributeIOR.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeIOR: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeIOR
+{
+public:
+ SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr);
+ SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr);
+ ~SALOMEDS_AttributeIOR();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeIOR_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeIOR_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributeIOR_i::Value()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeIOR_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeIOR_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeIOR_i_HeaderFile
+#define SALOMEDS_AttributeIOR_i_HeaderFile
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+
+class SALOMEDS_AttributeIOR_i: public virtual POA_SALOMEDS::AttributeIOR,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeIOR_i(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeIOR_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeInteger.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeInteger.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeInteger::~SALOMEDS_AttributeInteger()
+{}
+
+int SALOMEDS_AttributeInteger::Value()
+{
+ int aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value();
+ else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeInteger::SetValue(int value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value);
+ else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeInteger_HeaderFile
+#define SALOMEDS_AttributeInteger_HeaderFile
+
+#include "SALOMEDSClient_AttributeInteger.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeInteger
+{
+public:
+ SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr);
+ SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr);
+ ~SALOMEDS_AttributeInteger();
+
+ virtual int Value();
+ virtual void SetValue(int value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeInteger_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeInteger_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Long SALOMEDS_AttributeInteger_i::Value()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Value();
+}
+
+void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->SetValue(value);
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeInteger_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeInteger_i_HeaderFile
+#define SALOMEDS_AttributeInteger_i_HeaderFile
+
+// IDL headers
+
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+
+class SALOMEDS_AttributeInteger_i: public virtual POA_SALOMEDS::AttributeInteger,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeInteger_i(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeInteger_i() {};
+
+ CORBA::Long Value();
+ void SetValue(CORBA::Long value);
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeLocalID.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeLocalID.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeLocalID::~SALOMEDS_AttributeLocalID()
+{}
+
+int SALOMEDS_AttributeLocalID::Value()
+{
+ int aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value();
+ else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeLocalID::SetValue(int value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value);
+ else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeLocalID.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeLocalID_HeaderFile
+#define SALOMEDS_AttributeLocalID_HeaderFile
+
+#include "SALOMEDSClient_AttributeLocalID.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeLocalID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeLocalID
+{
+public:
+ SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr);
+ SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr);
+ ~SALOMEDS_AttributeLocalID();
+
+ virtual int Value();
+ virtual void SetValue(int value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeLocalID_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeLocalID_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Long SALOMEDS_AttributeLocalID_i::Value()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->Value();
+}
+
+void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->SetValue(value);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeLocalID_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeLocalID_i_HeaderFile
+#define SALOMEDS_AttributeLocalID_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+
+class SALOMEDS_AttributeLocalID_i: public virtual POA_SALOMEDS::AttributeLocalID,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeLocalID_i(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeLocalID_i() {};
+
+ CORBA::Long Value();
+ void SetValue(CORBA::Long value);
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeName.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeName.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeName::SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeName::SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeName::~SALOMEDS_AttributeName()
+{}
+
+std::string SALOMEDS_AttributeName::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeName::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeName.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeName_HeaderFile
+#define SALOMEDS_AttributeName_HeaderFile
+
+#include "SALOMEDSClient_AttributeName.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeName.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeName: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeName
+{
+public:
+ SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr);
+ SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr);
+ ~SALOMEDS_AttributeName();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeName_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeName_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributeName_i::Value()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeName_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->SetValue(TCollection_ExtendedString((char*)value));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeName_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeName_i_HeaderFile
+#define SALOMEDS_AttributeName_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeName.hxx"
+
+class SALOMEDS_AttributeName_i: public virtual POA_SALOMEDS::AttributeName,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeName_i(const Handle(SALOMEDSImpl_AttributeName)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeName_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeOpened.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeOpened.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeOpened::~SALOMEDS_AttributeOpened()
+{}
+
+bool SALOMEDS_AttributeOpened::IsOpened()
+{
+ bool aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened();
+ else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened();
+ return aValue;
+}
+
+void SALOMEDS_AttributeOpened::SetOpened(bool value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value);
+ else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeOpened.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeOpened_HeaderFile
+#define SALOMEDS_AttributeOpened_HeaderFile
+
+#include "SALOMEDSClient_AttributeOpened.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeOpened: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeOpened
+{
+public:
+ SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr);
+ SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr);
+ ~SALOMEDS_AttributeOpened();
+
+ virtual bool IsOpened();
+ virtual void SetOpened(bool value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeOpened_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeOpened_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened()
+{
+ SALOMEDS::Locker lock;
+ return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->IsOpened() == 1);
+}
+
+void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value)
+{
+ SALOMEDS::Locker lock;
+
+ Standard_Integer val = 0;
+ if (value != 0) val = 1;
+ Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->SetOpened(val);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeOpened_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDS_AttributeOpened_i_HeaderFile
+#define SALOMEDS_AttributeOpened_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+
+class SALOMEDS_AttributeOpened_i: public virtual POA_SALOMEDS::AttributeOpened,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeOpened_i(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+ ~SALOMEDS_AttributeOpened_i() {};
+
+ CORBA::Boolean IsOpened();
+ void SetOpened(CORBA::Boolean value);
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePersistentRef.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributePersistentRef.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePersistentRef::~SALOMEDS_AttributePersistentRef()
+{}
+
+std::string SALOMEDS_AttributePersistentRef::Value()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->Value()).ToCString();
+ else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributePersistentRef::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePersistentRef.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePersistentRef_HeaderFile
+#define SALOMEDS_AttributePersistentRef_HeaderFile
+
+#include "SALOMEDSClient_AttributePersistentRef.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributePersistentRef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePersistentRef
+{
+public:
+ SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr);
+ SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr);
+ ~SALOMEDS_AttributePersistentRef();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePersistentRef_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributePersistentRef_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributePersistentRef_i::Value()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Value()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributePersistentRef_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePersistentRef_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePersistentRef_i_HeaderFile
+#define SALOMEDS_AttributePersistentRef_i_HeaderFile
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+
+class SALOMEDS_AttributePersistentRef_i: public virtual POA_SALOMEDS::AttributePersistentRef,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributePersistentRef_i(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributePersistentRef_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePixMap.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributePixMap.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePixMap::~SALOMEDS_AttributePixMap()
+{}
+
+bool SALOMEDS_AttributePixMap::HasPixMap()
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap();
+ else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap();
+ return ret;
+}
+
+std::string SALOMEDS_AttributePixMap::GetPixMap()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->GetPixMap()).ToCString();
+ else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap();
+ return aValue;
+}
+
+void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str());
+ else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePixMap.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePixMap_HeaderFile
+#define SALOMEDS_AttributePixMap_HeaderFile
+
+#include "SALOMEDSClient_AttributePixMap.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributePixMap: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePixMap
+{
+public:
+ SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr);
+ SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr);
+ ~SALOMEDS_AttributePixMap();
+
+ virtual bool HasPixMap();
+ virtual std::string GetPixMap();
+ virtual void SetPixMap(const std::string& value);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePixMap_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributePixMap_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap()
+{
+ return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap();
+}
+
+char* SALOMEDS_AttributePixMap_i::GetPixMap()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var S =
+ CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->GetPixMap()).ToCString());
+ return S._retn();
+}
+
+void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->SetPixMap(TCollection_ExtendedString(Str));
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePixMap_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePixMap_i_HeaderFile
+#define SALOMEDS_AttributePixMap_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+
+class SALOMEDS_AttributePixMap_i: public virtual POA_SALOMEDS::AttributePixMap,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributePixMap_i(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributePixMap_i() {};
+
+ CORBA::Boolean HasPixMap();
+ char* GetPixMap();
+ void SetPixMap(const char* value);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePythonObject.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributePythonObject.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributePythonObject::~SALOMEDS_AttributePythonObject()
+{}
+
+bool SALOMEDS_AttributePythonObject::IsScript()
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript();
+ else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript();
+ return ret;
+}
+
+std::string SALOMEDS_AttributePythonObject::GetObject()
+{
+ std::string aValue;
+ if(_isLocal)
+ aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->GetObject()).ToCString();
+ else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject();
+ return aValue;
+}
+
+void SALOMEDS_AttributePythonObject::SetObject(const std::string& theSequence, bool IsScript)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript);
+ else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePythonObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePythonObject_HeaderFile
+#define SALOMEDS_AttributePythonObject_HeaderFile
+
+#include "SALOMEDSClient_AttributePythonObject.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+
+#ifdef GetObject
+#undef GetObject
+#endif
+
+class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject
+{
+public:
+ SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr);
+ SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr);
+ ~SALOMEDS_AttributePythonObject();
+
+ virtual void SetObject(const std::string& theSequence, bool IsScript);
+ virtual std::string GetObject();
+ virtual bool IsScript();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePythonObject_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributePythonObject_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HArray1OfCharacter.hxx>
+
+using namespace std;
+
+void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ char *aSeq = CORBA::string_dup(theSequence);
+ Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript);
+}
+
+char* SALOMEDS_AttributePythonObject_i::GetObject()
+{
+ SALOMEDS::Locker lock;
+ char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString();
+ CORBA::String_var aStr = CORBA::string_dup(aSeq);
+ return aStr._retn();
+}
+
+CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript();
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributePythonObject_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributePythonObject_i_HeaderFile
+#define SALOMEDS_AttributePythonObject_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+
+class SALOMEDS_AttributePythonObject_i: public virtual POA_SALOMEDS::AttributePythonObject,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributePythonObject_i(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributePythonObject_i() {};
+
+ virtual void SetObject(const char* theSequence, CORBA::Boolean IsScript);
+ virtual char* GetObject();
+ virtual CORBA::Boolean IsScript();
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeReal.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeReal.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeReal::~SALOMEDS_AttributeReal()
+{}
+
+double SALOMEDS_AttributeReal::Value()
+{
+ double aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
+ else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeReal::SetValue(double value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value);
+ else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeReal_HeaderFile
+#define SALOMEDS_AttributeReal_HeaderFile
+
+#include "SALOMEDSClient_AttributeReal.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeReal.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeReal
+{
+public:
+ SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr);
+ SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr);
+ ~SALOMEDS_AttributeReal();
+
+ virtual double Value();
+ virtual void SetValue(double value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeReal_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeReal_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS.hxx"
+#include <sstream>
+
+using namespace std;
+
+CORBA::Double SALOMEDS_AttributeReal_i::Value()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Value();
+}
+
+void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->SetValue(value);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeReal_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeReal_i_HeaderFile
+#define SALOMEDS_AttributeReal_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeReal.hxx"
+
+class SALOMEDS_AttributeReal_i: public virtual POA_SALOMEDS::AttributeReal,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeReal_i(const Handle(SALOMEDSImpl_AttributeReal)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeReal_i() {};
+
+ CORBA::Double Value();
+ void SetValue(CORBA::Double value);
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSelectable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeSelectable.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSelectable::~SALOMEDS_AttributeSelectable()
+{}
+
+bool SALOMEDS_AttributeSelectable::IsSelectable()
+{
+ bool aValue;
+ if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable();
+ else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable();
+ return aValue;
+}
+
+void SALOMEDS_AttributeSelectable::SetSelectable(bool value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value);
+ else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSelectable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSelectable_HeaderFile
+#define SALOMEDS_AttributeSelectable_HeaderFile
+
+#include "SALOMEDSClient_AttributeSelectable.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeSelectable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSelectable
+{
+public:
+ SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr);
+ SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr);
+ ~SALOMEDS_AttributeSelectable();
+
+ virtual bool IsSelectable();
+ virtual void SetSelectable(bool value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSelectable_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeSelectable_i.hxx"
+#include "SALOMEDS.hxx"
+
+using namespace std;
+
+CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable()
+{
+ SALOMEDS::Locker lock;
+ return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->IsSelectable() == 1);
+}
+
+void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value)
+{
+ SALOMEDS::Locker lock;
+ Standard_Integer val = 0;
+ if (value != 0) val = 1;
+ Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->SetSelectable(val);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSelectable_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSelectable_i_HeaderFile
+#define SALOMEDS_AttributeSelectable_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+
+class SALOMEDS_AttributeSelectable_i: public virtual POA_SALOMEDS::AttributeSelectable,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeSelectable_i(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeSelectable_i() {};
+
+ CORBA::Boolean IsSelectable();
+ void SetSelectable(CORBA::Boolean value);
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfInteger.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeSequenceOfInteger.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+SALOMEDS_AttributeSequenceOfInteger
+::SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger()
+{}
+
+void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector<int>& other)
+{
+ int i, aLength = other.size();
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ for(i = 0; i < aLength; i++) aSeq->Append(other[i]);
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq);
+ }
+ else {
+ SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = other[i];
+ SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq);
+ }
+}
+
+std::vector<int> SALOMEDS_AttributeSequenceOfInteger::CorbaSequence()
+{
+ std::vector<int> aVector;
+ int i, aLength;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr;
+ aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl);
+ aLength = aSeqAttr->Length();
+ for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+ }
+ else {
+ SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
+ aLength = aSeqAttr->Length();
+ for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeSequenceOfInteger::Add(int value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value);
+ else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
+}
+
+void SALOMEDS_AttributeSequenceOfInteger::Remove(int index)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index);
+ else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
+}
+
+void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value);
+ else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
+}
+
+int SALOMEDS_AttributeSequenceOfInteger::Value(int index)
+{
+ int aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index);
+ else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index);
+ return aValue;
+}
+
+int SALOMEDS_AttributeSequenceOfInteger::Length()
+{
+ int aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length();
+ else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();
+ return aValue;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSequenceOfInteger_HeaderFile
+#define SALOMEDS_AttributeSequenceOfInteger_HeaderFile
+
+#include "SALOMEDSClient_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeSequenceOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfInteger
+{
+public:
+ SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr);
+ SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr);
+ ~SALOMEDS_AttributeSequenceOfInteger();
+
+ virtual void Assign(const std::vector<int>& other);
+ virtual std::vector<int> CorbaSequence();
+ virtual void Add(int value);
+ virtual void Remove(int index);
+ virtual void ChangeValue(int index, int value);
+ virtual int Value(int index);
+ virtual int Length();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfInteger_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TColStd_HSequenceOfInteger.hxx>
+
+using namespace std;
+
+
+void SALOMEDS_AttributeSequenceOfInteger_i::Assign(const SALOMEDS::LongSeq& other)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < other.length(); i++) {
+ CasCadeSeq->Append(other[i]);
+ }
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Assign(CasCadeSeq);
+}
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeSequenceOfInteger_i::CorbaSequence()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) CasCadeSeq;
+ CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl);
+ CorbaSeq->length(CasCadeSeq->Length());
+ for (int i = 0; i < CasCadeSeq->Length(); i++) {
+ CorbaSeq[i] = CasCadeSeq->Value(i+1);;
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeSequenceOfInteger_i::Add(CORBA::Long value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Add(value);
+}
+
+void SALOMEDS_AttributeSequenceOfInteger_i::Remove(CORBA::Long index)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Remove(index);
+}
+
+void SALOMEDS_AttributeSequenceOfInteger_i::ChangeValue(CORBA::Long index, CORBA::Long value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->ChangeValue(index, value);
+}
+
+CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Value(CORBA::Short index)
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Value(index);
+}
+
+CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Length();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfInteger_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSequenceOfInteger_i_HeaderFile
+#define SALOMEDS_AttributeSequenceOfInteger_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+
+class SALOMEDS_AttributeSequenceOfInteger_i: public virtual POA_SALOMEDS::AttributeSequenceOfInteger,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeSequenceOfInteger_i(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr,CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeSequenceOfInteger_i() {};
+
+ void Assign(const SALOMEDS::LongSeq& other);
+ SALOMEDS::LongSeq* CorbaSequence();
+ void Add(CORBA::Long value);
+ void Remove(CORBA::Long index);
+ void ChangeValue(CORBA::Long index, CORBA::Long value);
+ CORBA::Long Value(CORBA::Short index);
+ CORBA::Long Length();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfReal.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeSequenceOfReal.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfReal.hxx>
+
+SALOMEDS_AttributeSequenceOfReal
+::SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeSequenceOfReal::~SALOMEDS_AttributeSequenceOfReal()
+{}
+
+void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector<double>& other)
+{
+ int i, aLength = other.size();
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
+ for(i = 0; i < aLength; i++) aSeq->Append(other[i]);
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq);
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = other[i];
+ SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Assign(aSeq);
+ }
+}
+
+std::vector<double> SALOMEDS_AttributeSequenceOfReal::CorbaSequence()
+{
+ std::vector<double> aVector;
+ int i, aLength;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr;
+ aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl);
+ aLength = aSeqAttr->Length();
+ for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+ }
+ else {
+ SALOMEDS::AttributeSequenceOfReal_var aSeqAttr = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl);
+ aLength = aSeqAttr->Length();
+ for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeSequenceOfReal::Add(double value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value);
+ else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value);
+}
+
+void SALOMEDS_AttributeSequenceOfReal::Remove(int index)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index);
+ else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index);
+}
+
+void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value);
+ else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value);
+}
+
+double SALOMEDS_AttributeSequenceOfReal::Value(int index)
+{
+ double aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index);
+ else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index);
+ return aValue;
+}
+
+int SALOMEDS_AttributeSequenceOfReal::Length()
+{
+ int aValue;
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length();
+ else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length();
+ return aValue;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSequenceOfReal_HeaderFile
+#define SALOMEDS_AttributeSequenceOfReal_HeaderFile
+
+#include "SALOMEDSClient_AttributeSequenceOfReal.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeSequenceOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfReal
+{
+public:
+ SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr);
+ SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr);
+ ~SALOMEDS_AttributeSequenceOfReal();
+
+ virtual void Assign(const std::vector<double>& other);
+ virtual std::vector<double> CorbaSequence();
+ virtual void Add(double value);
+ virtual void Remove(int index);
+ virtual void ChangeValue(int index, double value);
+ virtual double Value(int index);
+ virtual int Length();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfReal_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TColStd_HSequenceOfReal.hxx>
+
+using namespace std;
+
+void SALOMEDS_AttributeSequenceOfReal_i::Assign(const SALOMEDS::DoubleSeq& other)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < other.length(); i++) {
+ CasCadeSeq->Append(other[i]);
+ }
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Assign(CasCadeSeq);
+}
+
+SALOMEDS::DoubleSeq* SALOMEDS_AttributeSequenceOfReal_i::CorbaSequence()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal) CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl);
+ CorbaSeq->length(CasCadeSeq->Length());
+ for (int i = 0; i < CasCadeSeq->Length(); i++) {
+ CorbaSeq[i] = CasCadeSeq->Value(i+1);;
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeSequenceOfReal_i::Add(CORBA::Double value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Add(value);
+}
+
+void SALOMEDS_AttributeSequenceOfReal_i::Remove(CORBA::Long index)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Remove(index);
+}
+
+void SALOMEDS_AttributeSequenceOfReal_i::ChangeValue(CORBA::Long index, CORBA::Double value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->ChangeValue(index, value);
+}
+
+CORBA::Double SALOMEDS_AttributeSequenceOfReal_i::Value(CORBA::Short index)
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Value(index);
+}
+
+CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Length();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeSequenceOfSequenceOfReal_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeSequenceOfSequenceOfReal_i_HeaderFile
+#define SALOMEDS_AttributeSequenceOfSequenceOfReal_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+
+class SALOMEDS_AttributeSequenceOfReal_i: public virtual POA_SALOMEDS::AttributeSequenceOfReal,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeSequenceOfReal_i(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeSequenceOfReal_i() {};
+
+ void Assign(const SALOMEDS::DoubleSeq& other);
+ SALOMEDS::DoubleSeq* CorbaSequence();
+ void Add(CORBA::Double value);
+ void Remove(CORBA::Long index);
+ void ChangeValue(CORBA::Long index, CORBA::Double value);
+ CORBA::Double Value(CORBA::Short index);
+ CORBA::Long Length();
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeStudyProperties.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeStudyProperties.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
+ (const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
+ (SALOMEDS::AttributeStudyProperties_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties()
+{
+}
+
+void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName)
+{
+ if (_isLocal) {
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ anImpl->ChangeCreatorName((char*)theName.c_str());
+ } else
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
+}
+
+std::string SALOMEDS_AttributeStudyProperties::GetUserName()
+{
+ std::string aName;
+ if (_isLocal) {
+ TCollection_ExtendedString S =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName();
+ aName = TCollection_AsciiString(S).ToCString();
+ }
+#ifndef WNT
+ else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
+#else
+ else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
+#endif
+ return aName;
+}
+
+void SALOMEDS_AttributeStudyProperties::SetCreationDate
+ (int theMinute, int theHour, int theDay, int theMonth, int theYear)
+{
+ if (_isLocal) {
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ int aTmp;
+ if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
+ TCollection_ExtendedString S;
+ anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
+ } else {
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
+ theHour,
+ theDay,
+ theMonth,
+ theYear);
+ }
+}
+
+bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear)
+{
+ bool ret;
+ if (_isLocal) {
+ ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
+ (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
+ } else {
+ CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
+ ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute,
+ anHour,
+ aDay,
+ aMonth,
+ anYear);
+ theMinute = (int)aMinute;
+ theHour = (int)anHour;
+ theDay = (int)aDay;
+ theMonth = (int)aMonth;
+ theYear = (int)anYear;
+ }
+ return ret;
+}
+
+void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode)
+{
+ if (_isLocal) {
+ if (theMode == "from scratch")
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1);
+ else if (theMode == "copy from")
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2);
+ else //Not defined
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0);
+ }
+ else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
+}
+
+std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
+{
+ std::string aMode;
+ if (_isLocal) {
+ int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode();
+ if (mode == 1) aMode = "from scratch";
+ if (mode == 2) aMode = "copy from";
+ }
+ else
+ aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode();
+ return aMode;
+}
+
+void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
+{
+ if (_isLocal)
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified);
+ else
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
+}
+
+bool SALOMEDS_AttributeStudyProperties::IsModified()
+{
+ bool ret;
+ if (_isLocal)
+ ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified();
+ else
+ ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
+ return ret;
+}
+
+int SALOMEDS_AttributeStudyProperties::GetModified()
+{
+ int isModified;
+ if (_isLocal)
+ isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified();
+ else
+ isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
+ return isModified;
+}
+
+void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
+{
+ if (_isLocal)
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked);
+ else
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
+}
+
+bool SALOMEDS_AttributeStudyProperties::IsLocked()
+{
+ bool ret;
+ if (_isLocal)
+ ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked();
+ else
+ ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
+ return ret;
+}
+
+void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theName,
+ int theMinute,
+ int theHour,
+ int theDay,
+ int theMonth,
+ int theYear)
+{
+ if (_isLocal) {
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear);
+ } else
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
+ theMinute,
+ theHour,
+ theDay,
+ theMonth,
+ theYear);
+}
+
+void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector<std::string>& theNames,
+ std::vector<int>& theMinutes,
+ std::vector<int>& theHours,
+ std::vector<int>& theDays,
+ std::vector<int>& theMonths,
+ std::vector<int>& theYears,
+ bool theWithCreator)
+{
+ int i, aLength;
+
+ if (_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+ aLength = aNames->Length();
+ i = ((theWithCreator) ? 1 : 2);
+ for (; i <= aLength; i++) {
+ theNames.push_back(TCollection_AsciiString(aNames->Value(i)).ToCString());
+ theMinutes.push_back(aMinutes->Value(i));
+ theHours.push_back(aHours->Value(i));
+ theDays.push_back(aDays->Value(i));
+ theMonths.push_back(aMonths->Value(i));
+ theYears.push_back(aYears->Value(i));
+ }
+ } else {
+ SALOMEDS::StringSeq_var aNames;
+ SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
+ SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(),
+ aMinutes.out(),
+ aHours.out(),
+ aDays.out(),
+ aMonths.out(),
+ aYears.out(),
+ theWithCreator);
+ aLength = aNames->length();
+ for (i = 0; i<aLength; i++) {
+ theNames.push_back(aNames[i].in());
+ theMinutes.push_back(aMinutes[i]);
+ theHours.push_back(aHours[i]);
+ theDays.push_back(aDays[i]);
+ theMonths.push_back(aMonths[i]);
+ theYears.push_back(aYears[i]);
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeStudyProperties.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeStudyProperties_HeaderFile
+#define SALOMEDS_AttributeStudyProperties_HeaderFile
+
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient_AttributeStudyProperties.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#ifdef GetUserName
+#undef GetUserName
+#endif
+
+class Standard_EXPORT SALOMEDS_AttributeStudyProperties: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeStudyProperties
+{
+public:
+
+ SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr);
+ SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr);
+ ~SALOMEDS_AttributeStudyProperties();
+
+ virtual void SetUserName(const std::string& theName);
+ virtual std::string GetUserName();
+ virtual void SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear);
+ virtual bool GetCreationDate(int& theMinute, int& theHour, int& theDay, int& theMonth, int& theYear);
+ virtual void SetCreationMode(const std::string& theMode);
+ virtual std::string GetCreationMode();
+ virtual void SetModified(int theModified);
+ virtual bool IsModified();
+ virtual int GetModified();
+ virtual void SetLocked(bool theLocked);
+ virtual bool IsLocked();
+ virtual void SetModification(const std::string& theName,
+ int theMinute,
+ int theHour,
+ int theDay,
+ int theMonth,
+ int theYear);
+ virtual void GetModificationsList(std::vector<std::string>& theNames,
+ std::vector<int>& theMinutes,
+ std::vector<int>& theHours,
+ std::vector<int>& theDays,
+ std::vector<int>& theMonths,
+ std::vector<int>& theYears,
+ bool theWithCreator);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeStudyProperties_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeStudyProperties_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+#define CREATION_MODE_NOTDEFINED 0
+#define CREATION_MODE_SCRATCH 1
+#define CREATION_MODE_COPY 2
+
+void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName);
+}
+
+char* SALOMEDS_AttributeStudyProperties_i::GetUserName()
+{
+ SALOMEDS::Locker lock;
+ TCollection_ExtendedString S =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName();
+ CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute,
+ CORBA::Long theHour,
+ CORBA::Long theDay,
+ CORBA::Long theMonth,
+ CORBA::Long theYear)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ int aTmp;
+ if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
+ TCollection_ExtendedString S;
+ aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
+}
+
+CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& theMinute,
+ CORBA::Long& theHour,
+ CORBA::Long& theDay,
+ CORBA::Long& theMonth,
+ CORBA::Long& theYear)
+{
+ SALOMEDS::Locker lock;
+ Standard_Integer aMinute;
+ Standard_Integer aHour;
+ Standard_Integer aDay;
+ Standard_Integer aMonth;
+ Standard_Integer aYear;
+ if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
+ (_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) {
+ theMinute = aMinute;
+ theHour = aHour;
+ theDay = aDay;
+ theMonth = aMonth;
+ theYear = aYear;
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH);
+ else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY);
+ else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED);
+}
+
+char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var c_s;
+ switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) {
+ case CREATION_MODE_SCRATCH: c_s = "from scratch"; break;
+ case CREATION_MODE_COPY: c_s = "copy from"; break;
+ default: c_s = "";
+ }
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified);
+}
+
+CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified();
+}
+
+CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified();
+}
+
+void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked);
+}
+
+CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked();
+}
+
+void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
+ CORBA::Long theMinute,
+ CORBA::Long theHour,
+ CORBA::Long theDay,
+ CORBA::Long theMonth,
+ CORBA::Long theYear)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ aProp->SetModification((char*)theName, (int)theMinute, (int)theHour,
+ (int)theDay, (int)theMonth, (int)theYear);
+}
+
+void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
+ SALOMEDS::LongSeq_out theMinutes,
+ SALOMEDS::LongSeq_out theHours,
+ SALOMEDS::LongSeq_out theDays,
+ SALOMEDS::LongSeq_out theMonths,
+ SALOMEDS::LongSeq_out theYears,
+ CORBA::Boolean theWithCreator)
+{
+ SALOMEDS::Locker lock;
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+ int aLength = aNames->Length();
+ int aRetLength = aLength - ((theWithCreator) ? 0 : 1);
+ theNames = new SALOMEDS::StringSeq;
+ theMinutes = new SALOMEDS::LongSeq;
+ theHours = new SALOMEDS::LongSeq;
+ theDays = new SALOMEDS::LongSeq;
+ theMonths = new SALOMEDS::LongSeq;
+ theYears = new SALOMEDS::LongSeq;
+ theNames->length(aRetLength);
+ theMinutes->length(aRetLength);
+ theHours->length(aRetLength);
+ theDays->length(aRetLength);
+ theMonths->length(aRetLength);
+ theYears->length(aRetLength);
+ int a = 0, ind = ((theWithCreator) ? 1 : 2);
+ for (; ind <= aLength; a++, ind++) {
+ (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(ind)).ToCString());
+ (*theMinutes)[a] = aMinutes->Value(ind);
+ (*theHours)[a] = aHours->Value(ind);
+ (*theDays)[a] = aDays->Value(ind);
+ (*theMonths)[a] = aMonths->Value(ind);
+ (*theYears)[a] = aYears->Value(ind);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeStudyProperties_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeStudyProperties_i_HeaderFile
+#define SALOMEDS_AttributeStudyProperties_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+
+class SALOMEDS_AttributeStudyProperties_i: public virtual POA_SALOMEDS::AttributeStudyProperties,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeStudyProperties_i(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeStudyProperties_i() {};
+
+ virtual void SetUserName(const char* theName);
+ virtual char* GetUserName() ;
+ virtual void SetCreationDate(CORBA::Long theMinute, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, CORBA::Long theYear);
+ virtual CORBA::Boolean GetCreationDate(CORBA::Long& theMinute, CORBA::Long& theHour, CORBA::Long& theDay, CORBA::Long& theMonth, CORBA::Long& theYear);
+ virtual void SetCreationMode(const char* theMode);
+ virtual char* GetCreationMode();
+ virtual void SetModified(CORBA::Long theModified);
+ virtual CORBA::Boolean IsModified();
+ virtual CORBA::Long GetModified();
+ virtual void SetLocked(CORBA::Boolean theLocked);
+ virtual CORBA::Boolean IsLocked();
+ virtual void SetModification(const char* theName,
+ CORBA::Long theMinute,
+ CORBA::Long theHour,
+ CORBA::Long theDay,
+ CORBA::Long theMonth,
+ CORBA::Long theYear);
+ virtual void GetModificationsList(SALOMEDS::StringSeq_out theNames,
+ SALOMEDS::LongSeq_out theMinutes,
+ SALOMEDS::LongSeq_out theHours,
+ SALOMEDS::LongSeq_out theDays,
+ SALOMEDS::LongSeq_out theMonths,
+ SALOMEDS::LongSeq_out theYears,
+ CORBA::Boolean theWithCreator);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfInteger.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTableOfInteger.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+
+SALOMEDS_AttributeTableOfInteger
+::SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfInteger::~SALOMEDS_AttributeTableOfInteger()
+{}
+
+
+void SALOMEDS_AttributeTableOfInteger::SetTitle(const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
+}
+
+std::string SALOMEDS_AttributeTableOfInteger::GetTitle()
+{
+ std::string aStr;
+ if(_isLocal)
+ aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetTitle()).ToCString();
+ else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle();
+ return aStr;
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetRowTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetRowTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitles(aSeq);
+ }
+
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString((aSeq->Value(i))).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetColumnTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal)
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetColumnTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitles(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetColumnTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetRowUnit(int theIndex, const std::string& theUnit)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnit(theIndex,
+ (char*)theUnit.c_str());
+ else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vector<std::string>& theUnits)
+{
+ CheckLocked();
+ int aLength = theUnits.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnits(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfInteger::GetRowUnits()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowUnits();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+int SALOMEDS_AttributeTableOfInteger::GetNbRows()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows();
+ else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows();
+ return aNb;
+}
+
+int SALOMEDS_AttributeTableOfInteger::GetNbColumns()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns();
+ else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns();
+ return aNb;
+
+}
+
+void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector<int>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->AddRow(aSeq);
+ }
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector<int>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(theRow, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theRow, aSeq);
+ }
+}
+
+std::vector<int> SALOMEDS_AttributeTableOfInteger::GetRow(int theRow)
+{
+ std::vector<int> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aRow;
+ aRow = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowData(theRow);
+ aLength = aRow->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i));
+ }
+ else {
+ SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
+ }
+
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector<int>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->AddColumn(aColumn);
+ }
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vector<int>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetRowData(theColumn, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
+ }
+}
+
+std::vector<int> SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn)
+{
+ std::vector<int> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aColumn;
+ aColumn = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnData(theColumn);
+ aLength = aColumn->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i));
+ }
+ else {
+ SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn);
+ for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int theColumn)
+{
+ CheckLocked();
+ if(_isLocal) {
+ try {
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ }
+ }
+ else {
+ SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->PutValue(theValue, theRow, theColumn);
+ }
+}
+
+bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn)
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn);
+ return ret;
+}
+
+int SALOMEDS_AttributeTableOfInteger::GetValue(int theRow, int theColumn)
+{
+ int aValue;
+ if(_isLocal) {
+ try {
+ aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetValue(theRow, theColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ }
+ }
+ else {
+ aValue = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetValue(theRow, theColumn);
+ }
+ return aValue;
+}
+
+std::vector<int> SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow)
+{
+ std::vector<int> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aSet;
+ aSet = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetSetRowIndices(theRow);
+ aLength = aSet->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+ }
+ else {
+ SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfInteger::SetNbColumns(int theNbColumns)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfInteger_HeaderFile
+#define SALOMEDS_AttributeTableOfInteger_HeaderFile
+
+#include "SALOMEDSClient_AttributeTableOfInteger.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeTableOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfInteger
+{
+public:
+ SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr);
+ SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr);
+ ~SALOMEDS_AttributeTableOfInteger();
+
+ virtual void SetTitle(const std::string& theTitle);
+ virtual std::string GetTitle();
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle);
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetRowTitles();
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle);
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetColumnTitles();
+
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit);
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits);
+ virtual std::vector<std::string> GetRowUnits();
+
+ virtual int GetNbRows();
+ virtual int GetNbColumns();
+ virtual void AddRow(const std::vector<int>& theData);
+ virtual void SetRow(int theRow, const std::vector<int>& theData);
+ virtual std::vector<int> GetRow(int theRow);
+ virtual void AddColumn(const std::vector<int>& theData);
+ virtual void SetColumn(int theColumn, const std::vector<int>& theData);
+ virtual std::vector<int> GetColumn(int theColumn);
+ virtual void PutValue(int theValue, int theRow, int theColumn);
+ virtual bool HasValue(int theRow, int theColumn);
+ virtual int GetValue(int theRow, int theColumn);
+
+ virtual std::vector<int> GetRowSetIndices(int theRow);
+ virtual void SetNbColumns(int theNbColumns);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfInteger_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeTableOfInteger_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include "Utils_ExceptHandlers.hxx"
+
+#include <stdexcept>
+#include <strstream>
+#include <string>
+
+using namespace std;
+
+UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+UNEXPECT_CATCH(ATI_IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+
+void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var aStr = CORBA::string_dup(theTitle);
+ Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->SetTitle(TCollection_ExtendedString(aStr));
+}
+
+char* SALOMEDS_AttributeTableOfInteger_i::GetTitle()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATI_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ SetRowTitle(i + 1, theTitles[i]);
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbRows());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATI_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ CORBA::String_var aStr = CORBA::string_dup(theTitle);
+ aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr));
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbColumns());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+//Units support
+void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATI_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ for (int i = 0; i < theUnits.length(); i++) {
+ aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
+ aUnits->length(aTable->GetNbRows());
+ for(int i = 0; i < aUnits->length(); i++)
+ aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ return aUnits._retn();
+}
+
+CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbRows();
+}
+
+CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbColumns();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(theRow, aRow);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+}
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(TColStd_HSequenceOfInteger) aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow->Length());
+ for (int i = 0; i < aRow->Length(); i++) {
+ CorbaSeq[i] = aRow->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetColumnData(theColumn, aColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
+ }
+}
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(TColStd_HSequenceOfInteger) aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn->Length());
+ for (int i = 0; i < aColumn->Length(); i++) {
+ CorbaSeq[i] = aColumn->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ try {
+ aTable->PutValue(theValue, theRow, theColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ }
+}
+
+CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->HasValue(theRow, theColumn);
+}
+
+CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATI_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+
+ CORBA::Long aValue;
+ try {
+ aValue = aTable->GetValue(theRow, theColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+ }
+ return aValue;
+}
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
+
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
+ CorbaSeq->length(aSeq->Length());
+ for (int i = 0; i < aSeq->Length(); i++) {
+ CorbaSeq[i] = aSeq->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+
+void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ aTable->SetNbColumns(theNbColumns);
+}
+
+bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ istrstream aStream((char*)&theStream[0], theStream.length());
+ return aTable->RestoreFromString(aStream);
+}
+
+SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+
+ ostrstream ostr;
+ string aString;
+ aTable->ConvertToString(ostr);
+
+ aString = ostr.rdbuf()->str();
+
+ char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
+ int aBufferSize = strlen((char*)aBuffer);
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+
+ SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+
+ return aStreamFile._retn();
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfInteger_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfInteger_i_HeaderFile
+#define SALOMEDS_AttributeTableOfInteger_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+
+class SALOMEDS_AttributeTableOfInteger_i: public virtual POA_SALOMEDS::AttributeTableOfInteger,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+
+public:
+
+ SALOMEDS_AttributeTableOfInteger_i(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTableOfInteger_i() {};
+
+ virtual void SetTitle(const char* theTitle);
+ virtual char* GetTitle();
+ virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual void SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowTitles();
+ virtual void SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual void SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetColumnTitles();
+
+ virtual void SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual void SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowUnits();
+
+ virtual CORBA::Long GetNbRows();
+ virtual CORBA::Long GetNbColumns();
+ virtual void AddRow(const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+ virtual void SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual SALOMEDS::LongSeq* GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual void AddColumn(const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+ virtual void SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual SALOMEDS::LongSeq* GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual void PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+ virtual CORBA::Boolean HasValue(CORBA::Long theRow, CORBA::Long theColumn);
+ virtual CORBA::Long GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+
+ virtual SALOMEDS::LongSeq* GetRowSetIndices(CORBA::Long theRow);
+ virtual void SetNbColumns(CORBA::Long theNbColumns);
+
+ virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
+ virtual SALOMEDS::TMPFile* SaveToFile();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfReal.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTableOfReal.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfReal.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+
+SALOMEDS_AttributeTableOfReal
+::SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfReal::~SALOMEDS_AttributeTableOfReal()
+{}
+
+
+void SALOMEDS_AttributeTableOfReal::SetTitle(const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
+}
+
+std::string SALOMEDS_AttributeTableOfReal::GetTitle()
+{
+ std::string aStr;
+ if(_isLocal)
+ aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetTitle()).ToCString();
+ else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle();
+ return aStr;
+}
+
+void SALOMEDS_AttributeTableOfReal::SetRowTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitles(aSeq);
+ }
+
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetRowTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfReal::SetColumnTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitles(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetColumnTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfReal::SetRowUnit(int theIndex, const std::string& theUnit)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnit(theIndex,
+ (char*)theUnit.c_str());
+ else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
+}
+
+void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector<std::string>& theUnits)
+{
+ CheckLocked();
+ int aLength = theUnits.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnits(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfReal::GetRowUnits()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowUnits();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowUnits();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aSeq[i].in()).ToCString());
+ }
+ return aVector;
+}
+
+int SALOMEDS_AttributeTableOfReal::GetNbRows()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows();
+ else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows();
+ return aNb;
+}
+
+int SALOMEDS_AttributeTableOfReal::GetNbColumns()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns();
+ else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns();
+ return aNb;
+
+}
+
+void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector<double>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddRow(aSeq);
+ }
+}
+
+void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector<double>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ try {
+ aTable->SetRowData(theRow, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = theData[i];
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theRow, aSeq);
+ }
+}
+
+std::vector<double> SALOMEDS_AttributeTableOfReal::GetRow(int theRow)
+{
+ std::vector<double> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfReal) aRow;
+ aRow = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowData(theRow);
+ aLength = aRow->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aRow->Value(i));
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back(aRow[i]);
+ }
+
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector<double>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->AddColumn(aColumn);
+ }
+}
+
+void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vector<double>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ try {
+ aTable->SetRowData(theColumn, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aColumn = new SALOMEDS::DoubleSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = theData[i];
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
+ }
+}
+
+std::vector<double> SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn)
+{
+ std::vector<double> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfReal) aColumn;
+ aColumn = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnData(theColumn);
+ aLength = aColumn->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aColumn->Value(i));
+ }
+ else {
+ SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn);
+ for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i]);
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int theColumn)
+{
+ CheckLocked();
+ if(_isLocal) {
+ try {
+ Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ }
+ }
+ else {
+ SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->PutValue(theValue, theRow, theColumn);
+ }
+}
+
+bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn)
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn);
+ return ret;
+}
+
+double SALOMEDS_AttributeTableOfReal::GetValue(int theRow, int theColumn)
+{
+ double aValue;
+ if(_isLocal) {
+ try {
+ aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ }
+ }
+ else {
+ aValue = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetValue(theRow, theColumn);
+ }
+ return aValue;
+}
+
+std::vector<int> SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow)
+{
+ std::vector<int> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aSet;
+ aSet = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetSetRowIndices(theRow);
+ aLength = aSet->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+ }
+ else {
+ SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfReal::SetNbColumns(int theNbColumns)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfReal_HeaderFile
+#define SALOMEDS_AttributeTableOfReal_HeaderFile
+
+#include "SALOMEDSClient_AttributeTableOfReal.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeTableOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfReal
+{
+public:
+ SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr);
+ SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr);
+ ~SALOMEDS_AttributeTableOfReal();
+
+ virtual void SetTitle(const std::string& theTitle);
+ virtual std::string GetTitle();
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle);
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetRowTitles();
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle);
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetColumnTitles();
+
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit);
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits);
+ virtual std::vector<std::string> GetRowUnits();
+
+ virtual int GetNbRows();
+ virtual int GetNbColumns();
+ virtual void AddRow(const std::vector<double>& theData);
+ virtual void SetRow(int theRow, const std::vector<double>& theData);
+ virtual std::vector<double> GetRow(int theRow);
+ virtual void AddColumn(const std::vector<double>& theData);
+ virtual void SetColumn(int theColumn, const std::vector<double>& theData);
+ virtual std::vector<double> GetColumn(int theColumn);
+ virtual void PutValue(double theValue, int theRow, int theColumn);
+ virtual bool HasValue(int theRow, int theColumn);
+ virtual double GetValue(int theRow, int theColumn);
+
+ virtual std::vector<int> GetRowSetIndices(int theRow);
+ virtual void SetNbColumns(int theNbColumns);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfReal_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeTableOfReal_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include <TColStd_HSequenceOfReal.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#include <strstream>
+#include <string>
+
+using namespace std;
+
+#include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(ATR_IncorrectIndex, SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+
+void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ CORBA::String_var aStr = CORBA::string_dup(theTitle);
+ aTable->SetTitle(TCollection_ExtendedString(aStr));
+}
+
+char* SALOMEDS_AttributeTableOfReal_i::GetTitle()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATR_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ aTable->SetRowTitle(i + 1, (char*)theTitles[i].in());
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbRows());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATR_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ CORBA::String_var aStr = CORBA::string_dup(theTitle);
+ aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr));
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbColumns());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+//Units support
+void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATR_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch (ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
+ for (int i = 0; i < theUnits.length(); i++) {
+ aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
+ aUnits->length(aTable->GetNbRows());
+ for(int i = 0; i < aUnits->length(); i++)
+ aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ return aUnits._retn();
+}
+
+
+CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbRows();
+}
+
+CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbColumns();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ aTable->SetRowData(theRow, aRow);
+}
+
+SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+
+ SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
+ Handle(TColStd_HSequenceOfReal) aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow->Length());
+ for (int i = 0; i < aRow->Length(); i++) {
+ CorbaSeq[i] = aRow->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+}
+
+void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ aTable->SetColumnData(theColumn, aColumn);
+}
+
+SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+
+ SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
+ Handle(TColStd_HSequenceOfReal) aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn->Length());
+ for (int i = 0; i < aColumn->Length(); i++) {
+ CorbaSeq[i] = aColumn->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ aTable->PutValue(theValue, theRow, theColumn);
+}
+
+CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->HasValue(theRow, theColumn);
+}
+
+CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATR_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+
+ CORBA::Double aValue;
+
+ try {
+ aValue = aTable->GetValue(theRow, theColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+ }
+
+ return aValue;
+}
+
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
+
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
+ CorbaSeq->length(aSeq->Length());
+ for (int i = 0; i < aSeq->Length(); i++) {
+ CorbaSeq[i] = aSeq->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+
+void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ aTable->SetNbColumns(theNbColumns);
+}
+
+bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ istrstream aStream((char*)&theStream[0], theStream.length());
+ return aTable->RestoreFromString(aStream);
+}
+
+SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+
+ ostrstream ostr;
+ string aString;
+ aTable->ConvertToString(ostr);
+
+ aString = ostr.rdbuf()->str();
+
+ char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
+ int aBufferSize = strlen((char*)aBuffer);
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+
+ SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+
+ return aStreamFile._retn();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfReal_i.hxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfReal_i_HeaderFile
+#define SALOMEDS_AttributeTableOfReal_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
+
+class SALOMEDS_AttributeTableOfReal_i: public virtual POA_SALOMEDS::AttributeTableOfReal,
+ public virtual SALOMEDS_GenericAttribute_i {
+
+public:
+
+ SALOMEDS_AttributeTableOfReal_i(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTableOfReal_i() {};
+
+ virtual void SetTitle(const char* theTitle);
+ virtual char* GetTitle();
+ virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual void SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowTitles();
+ virtual void SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual void SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetColumnTitles();
+
+ virtual void SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual void SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowUnits();
+
+ virtual CORBA::Long GetNbRows();
+ virtual CORBA::Long GetNbColumns();
+ virtual void AddRow(const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+ virtual void SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual SALOMEDS::DoubleSeq* GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual void AddColumn(const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+ virtual void SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual SALOMEDS::DoubleSeq* GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual void PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+ virtual CORBA::Boolean HasValue(CORBA::Long theRow, CORBA::Long theColumn);
+ virtual CORBA::Double GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+
+ virtual SALOMEDS::LongSeq* GetRowSetIndices(CORBA::Long theRow);
+ virtual void SetNbColumns(CORBA::Long theNbColumns);
+
+ virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
+ virtual SALOMEDS::TMPFile* SaveToFile();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfString.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTableOfString.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfReal.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+SALOMEDS_AttributeTableOfString
+::SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTableOfString::~SALOMEDS_AttributeTableOfString()
+{}
+
+
+void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
+}
+
+std::string SALOMEDS_AttributeTableOfString::GetTitle()
+{
+ std::string aStr;
+ if(_isLocal)
+ aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetTitle()).ToCString();
+ else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle();
+ return aStr;
+}
+
+void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq);
+ }
+
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::string& theTitle)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitle(theIndex,
+ (char*)theTitle.c_str());
+ else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
+}
+
+void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector<std::string>& theTitles)
+{
+ CheckLocked();
+ int aLength = theTitles.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumnTitles()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string& theUnit)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnit(theIndex,
+ (char*)theUnit.c_str());
+ else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
+}
+
+void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector<std::string>& theUnits)
+{
+ CheckLocked();
+ int aLength = theUnits.size(), i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ for(i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
+ Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowUnits()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits();
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits();
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+int SALOMEDS_AttributeTableOfString::GetNbRows()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows();
+ else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows();
+ return aNb;
+}
+
+int SALOMEDS_AttributeTableOfString::GetNbColumns()
+{
+ int aNb;
+ if(_isLocal) aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns();
+ else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns();
+ return aNb;
+
+}
+
+void SALOMEDS_AttributeTableOfString::AddRow(const std::vector<std::string>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str());
+ try {
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq);
+ }
+}
+
+void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector<std::string>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str());
+ try {
+ aTable->SetRowData(theRow, aRow);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
+ aSeq->length(aLength);
+ for(i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRow(int theRow)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aRow;
+ aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow);
+ aLength = aRow->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in());
+ }
+
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector<std::string>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str());
+ try {
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn);
+ }
+}
+
+void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector<std::string>& theData)
+{
+ CheckLocked();
+ int aLength = theData.size(), i;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
+ aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
+ Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str());
+ try {
+ aTable->SetRowData(theColumn, aColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ }
+ }
+ else {
+ SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
+ aColumn->length(aLength);
+ for(i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn);
+ }
+}
+
+std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumn(int theColumn)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfExtendedString) aColumn;
+ aColumn = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnData(theColumn);
+ aLength = aColumn->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString());
+ }
+ else {
+ SALOMEDS::StringSeq_var aColumn = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn);
+ for(i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in());
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int theRow, int theColumn)
+{
+ CheckLocked();
+ if(_isLocal) {
+ try {
+ Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->PutValue((char*)theValue.c_str(),
+ theRow,
+ theColumn);
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+ }
+ }
+ else {
+ SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->PutValue(theValue.c_str(), theRow, theColumn);
+ }
+}
+
+bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn)
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn);
+ return ret;
+}
+
+std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn)
+{
+ std::string aValue;
+ if(_isLocal) {
+ try {
+ aValue =
+ TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetValue(theRow,
+ theColumn)).ToCString();
+ }
+ catch(...) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+ }
+ }
+ else {
+ aValue = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetValue(theRow, theColumn);
+ }
+ return aValue;
+}
+
+std::vector<int> SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow)
+{
+ std::vector<int> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfInteger) aSet;
+ aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow);
+ aLength = aSet->Length();
+ for(i = 1; i<= aLength; i++) aVector.push_back(aSet->Value(i));
+ }
+ else {
+ SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow);
+ for(i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
+ }
+ return aVector;
+}
+
+void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns)
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfString.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfString_HeaderFile
+#define SALOMEDS_AttributeTableOfString_HeaderFile
+
+#include "SALOMEDSClient_AttributeTableOfString.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTableOfString.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeTableOfString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfString
+{
+public:
+ SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr);
+ SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr);
+ ~SALOMEDS_AttributeTableOfString();
+
+ virtual void SetTitle(const std::string& theTitle);
+ virtual std::string GetTitle();
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle);
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetRowTitles();
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle);
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles);
+ virtual std::vector<std::string> GetColumnTitles();
+
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit);
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits);
+ virtual std::vector<std::string> GetRowUnits();
+
+ virtual int GetNbRows();
+ virtual int GetNbColumns();
+ virtual void AddRow(const std::vector<std::string>& theData);
+ virtual void SetRow(int theRow, const std::vector<std::string>& theData);
+ virtual std::vector<std::string> GetRow(int theRow);
+ virtual void AddColumn(const std::vector<std::string>& theData);
+ virtual void SetColumn(int theColumn, const std::vector<std::string>& theData);
+ virtual std::vector<std::string> GetColumn(int theColumn);
+ virtual void PutValue(const std::string& theValue, int theRow, int theColumn);
+ virtual bool HasValue(int theRow, int theColumn);
+ virtual std::string GetValue(int theRow, int theColumn);
+
+ virtual std::vector<int> GetRowSetIndices(int theRow);
+ virtual void SetNbColumns(int theNbColumns);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfString_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include <TCollection_ExtendedString.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include "SALOMEDS_AttributeTableOfString_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#include <strstream>
+#include <string>
+
+#include "Utils_ExceptHandlers.hxx"
+
+using namespace std;
+
+UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTableOfString::IncorrectIndex);
+UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+
+void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ CORBA::String_var aStr = CORBA::string_dup(theTitle);
+ aTable->SetTitle(TCollection_ExtendedString(aStr));
+}
+
+char* SALOMEDS_AttributeTableOfString_i::GetTitle()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+
+ aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ aTable->SetRowTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in()));
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbRows());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] =CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+ aTable->SetColumnTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ for (int i = 0; i < theTitles.length(); i++) {
+ aTable->SetColumnTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in()));
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
+ aTitles->length(aTable->GetNbColumns());
+ for(int i = 0; i < aTitles->length(); i++)
+ aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ return aTitles._retn();
+}
+
+//Units support
+void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+ aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
+ for (int i = 0; i < theUnits.length(); i++) {
+ aTable->SetRowUnit(i + 1, TCollection_ExtendedString((char*)theUnits[i].in()));
+ }
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
+ aUnits->length(aTable->GetNbRows());
+ for(int i = 0; i < aUnits->length(); i++)
+ aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ return aUnits._retn();
+}
+
+
+CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbRows();
+}
+
+CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbColumns();
+}
+
+void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ aTable->SetRowData(theRow, aRow);
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+
+ SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
+ Handle(TColStd_HSequenceOfExtendedString) aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow->Length());
+ for (int i = 0; i < aRow->Length(); i++) {
+ CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aRow->Value(i + 1))).ToCString());
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+}
+
+void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectArgumentLength);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
+ for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ aTable->SetColumnData(theColumn, aColumn);
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+
+ SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
+ Handle(TColStd_HSequenceOfExtendedString) aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn->Length());
+ for (int i = 0; i < aColumn->Length(); i++) {
+ CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aColumn->Value(i + 1))).ToCString());
+ }
+ return CorbaSeq._retn();
+}
+
+void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ char* aValue = CORBA::string_dup(theValue);
+
+ aTable->PutValue(aValue, theRow, theColumn);
+}
+
+CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->HasValue(theRow, theColumn);
+}
+
+char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(ATS_IncorrectIndex);
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+
+ TCollection_AsciiString aValue;
+
+ try {
+ aValue = aTable->GetValue(theRow, theColumn);
+ }
+ catch(Standard_Failure) {
+ throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+ }
+
+ return CORBA::string_dup(aValue.ToCString());
+}
+
+
+SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
+
+ SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
+ Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
+ CorbaSeq->length(aSeq->Length());
+ for (int i = 0; i < aSeq->Length(); i++) {
+ CorbaSeq[i] = aSeq->Value(i + 1);
+ }
+ return CorbaSeq._retn();
+}
+
+
+void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ aTable->SetNbColumns(theNbColumns);
+}
+
+bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ istrstream aStream((char*)&theStream[0], theStream.length());
+ return aTable->RestoreFromString(aStream);
+}
+
+SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+
+ ostrstream ostr;
+ aTable->ConvertToString(ostr);
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)ostr.rdbuf()->str();
+ unsigned long aSize = ostr.pcount();
+ SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aSize, aSize, anOctetBuf, 1);
+ return aStreamFile._retn();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTableOfString_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTableOfString_i_HeaderFile
+#define SALOMEDS_AttributeTableOfString_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTableOfString.hxx"
+
+class SALOMEDS_AttributeTableOfString_i: public virtual POA_SALOMEDS::AttributeTableOfString,
+ public virtual SALOMEDS_GenericAttribute_i {
+
+public:
+
+ SALOMEDS_AttributeTableOfString_i(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTableOfString_i() {};
+
+ virtual void SetTitle(const char* theTitle);
+ virtual char* GetTitle();
+ virtual void SetRowTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual void SetRowTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowTitles();
+ virtual void SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual void SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetColumnTitles();
+
+ virtual void SetRowUnit(CORBA::Long theIndex, const char* theUnit)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual void SetRowUnits(const SALOMEDS::StringSeq& theUnits)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+ virtual SALOMEDS::StringSeq* GetRowUnits();
+
+ virtual CORBA::Long GetNbRows();
+ virtual CORBA::Long GetNbColumns();
+ virtual void AddRow(const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+ virtual void SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual SALOMEDS::StringSeq* GetRow(CORBA::Long theRow)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual void AddColumn(const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+ virtual void SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual SALOMEDS::StringSeq* GetColumn(CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual void PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+ virtual CORBA::Boolean HasValue(CORBA::Long theRow, CORBA::Long theColumn);
+ virtual char* GetValue(CORBA::Long theRow, CORBA::Long theColumn)
+ throw (SALOMEDS::AttributeTableOfString::IncorrectIndex);
+
+ virtual SALOMEDS::LongSeq* GetRowSetIndices(CORBA::Long theRow);
+ virtual void SetNbColumns(CORBA::Long theNbColumns);
+
+ virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
+ virtual SALOMEDS::TMPFile* SaveToFile();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTarget.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTarget.hxx"
+
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS_SObject.hxx"
+
+
+SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTarget::~SALOMEDS_AttributeTarget()
+{}
+
+void SALOMEDS_AttributeTarget::Add(const _PTR(SObject)& theObject)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl());
+ else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl());
+}
+
+std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get()
+{
+ std::vector<_PTR(SObject)> aVector;
+ int aLength, i;
+ SALOMEDSClient_SObject* aSO = NULL;
+
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfTransient) aSeq = Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get();
+ aLength = aSeq->Length();
+ for(i=1; i<=aLength; i++) {
+ aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)));
+ aVector.push_back(_PTR(SObject)(aSO));
+ }
+ }
+ else {
+ SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get();
+ aLength = aSeq->length();
+ aSO = new SALOMEDS_SObject(aSeq[i].in());
+ for(i = 0; i<aLength; i++) aVector.push_back(_PTR(SObject)(aSO));
+ }
+
+ return aVector;
+}
+
+void SALOMEDS_AttributeTarget::Remove(const _PTR(SObject)& theObject)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl());
+ else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl());
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTarget.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTarget_HeaderFile
+#define SALOMEDS_AttributeTarget_HeaderFile
+
+#include <vector>
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeTarget: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTarget
+{
+public:
+ SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr);
+ SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr);
+ ~SALOMEDS_AttributeTarget();
+
+ virtual void Add(const _PTR(SObject)& theObject);
+ virtual std::vector<_PTR(SObject)> Get();
+ virtual void Remove(const _PTR(SObject)& theObject);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTarget_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_AttributeTarget_i.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDS.hxx"
+
+#include <TColStd_HSequenceOfTransient.hxx>
+
+using namespace std;
+
+void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject)
+{
+ SALOMEDS::Locker lock;
+ TDF_Label aLabel;
+ TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1);
+ (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Add(SALOMEDSImpl_Study::SObject(aLabel));
+}
+
+SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get()
+{
+ SALOMEDS::Locker lock;
+ Handle(TColStd_HSequenceOfTransient) aSeq = (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Get();
+ SALOMEDS::Study::ListOfSObject_var aSList = new SALOMEDS::Study::ListOfSObject;
+ int aLength = aSeq->Length(), i;
+ if (aLength == 0) return aSList._retn();
+ aSList->length(aLength);
+ for(i=1; i <=aLength; i++) {
+ SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)), _orb);
+ aSList[i-1] = anSO;
+ }
+ return aSList._retn();
+}
+
+void SALOMEDS_AttributeTarget_i::Remove(SALOMEDS::SObject_ptr anObject)
+{
+ SALOMEDS::Locker lock;
+ TDF_Label aLabel;
+ TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1);
+ (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(SALOMEDSImpl_Study::SObject(aLabel));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTarget_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTarget_i_HeaderFile
+#define SALOMEDS_AttributeTarget_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+
+class SALOMEDS_AttributeTarget_i: public virtual POA_SALOMEDS::AttributeTarget,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeTarget_i(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTarget_i() {};
+
+ virtual void Add(SALOMEDS::SObject_ptr anObject) ;
+ virtual SALOMEDS::Study::ListOfSObject* Get();
+ virtual void Remove(SALOMEDS::SObject_ptr anObject);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextColor.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTextColor.hxx"
+
+#include <TColStd_HArray1OfReal.hxx>
+
+SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTextColor::~SALOMEDS_AttributeTextColor()
+{}
+
+
+STextColor SALOMEDS_AttributeTextColor::TextColor()
+{
+ STextColor aColor;
+ if(_isLocal) {
+ Handle(TColStd_HArray1OfReal) aSeq = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor();
+ aColor.R = aSeq->Value(1);
+ aColor.G = aSeq->Value(2);
+ aColor.B = aSeq->Value(3);
+ }
+ else {
+ SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->TextColor();
+ aColor.R = anImplColor.R;
+ aColor.G = anImplColor.G;
+ aColor.B = anImplColor.B;
+ }
+ return aColor;
+}
+
+void SALOMEDS_AttributeTextColor::SetTextColor(STextColor value)
+{
+ CheckLocked();
+ if(_isLocal) {
+ Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
+ aSeq->SetValue(1, value.R);
+ aSeq->SetValue(2, value.G);
+ aSeq->SetValue(3, value.B);
+ Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->ChangeArray(aSeq);
+ }
+ else {
+ SALOMEDS::Color aColor;
+ aColor.R = value.R;
+ aColor.G = value.G;
+ aColor.B = value.B;
+ SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->SetTextColor(aColor);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTextColor_HeaderFile
+#define SALOMEDS_AttributeTextColor_HeaderFile
+
+#include "SALOMEDSClient_AttributeTextColor.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+#include "SALOMEDSClient_definitions.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeTextColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextColor
+{
+public:
+ SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr);
+ SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr);
+ ~SALOMEDS_AttributeTextColor();
+
+ virtual STextColor TextColor();
+ virtual void SetTextColor(STextColor value);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextColor_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeTextColor_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TColStd_HArray1OfReal.hxx>
+
+using namespace std;
+
+SALOMEDS::Color SALOMEDS_AttributeTextColor_i::TextColor()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::Color TextColor;
+ Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->TextColor();
+ if (anArray.IsNull() || anArray->Length()!=3) {
+ TextColor.R = 0;
+ TextColor.G = 0;
+ TextColor.B = 0;
+ }
+ else {
+ TextColor.R = anArray->Value(1);
+ TextColor.G = anArray->Value(2);
+ TextColor.B = anArray->Value(3);
+ }
+ return TextColor;
+}
+
+void SALOMEDS_AttributeTextColor_i::SetTextColor(const SALOMEDS::Color& value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3);
+ anArray->SetValue(1, value.R);
+ anArray->SetValue(2, value.G);
+ anArray->SetValue(3, value.B);
+ Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->ChangeArray(anArray);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextColor_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header$
+
+#ifndef SALOMEDS_AttributeTextColor_i_HeaderFile
+#define SALOMEDS_AttributeTextColor_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+
+class SALOMEDS_AttributeTextColor_i: public virtual POA_SALOMEDS::AttributeTextColor,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeTextColor_i(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTextColor_i() {};
+
+ SALOMEDS::Color TextColor();
+ void SetTextColor(const SALOMEDS::Color& value);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextHighlightColor.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTextHighlightColor.hxx"
+
+#include <TColStd_HArray1OfReal.hxx>
+
+SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTextHighlightColor::~SALOMEDS_AttributeTextHighlightColor()
+{}
+
+
+STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor()
+{
+ STextColor aColor;
+ if(_isLocal) {
+ Handle(TColStd_HArray1OfReal) aSeq;
+ aSeq = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->TextHighlightColor();
+ aColor.R = aSeq->Value(1);
+ aColor.G = aSeq->Value(2);
+ aColor.B = aSeq->Value(3);
+ }
+ else {
+ SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->TextHighlightColor();
+ aColor.R = anImplColor.R;
+ aColor.G = anImplColor.G;
+ aColor.B = anImplColor.B;
+ }
+ return aColor;
+}
+
+void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(STextColor value)
+{
+ if(_isLocal) {
+ Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
+ aSeq->SetValue(1, value.R);
+ aSeq->SetValue(2, value.G);
+ aSeq->SetValue(3, value.B);
+ Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->ChangeArray(aSeq);
+ }
+ else {
+ SALOMEDS::Color aColor;
+ aColor.R = value.R;
+ aColor.G = value.G;
+ aColor.B = value.B;
+ SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->SetTextHighlightColor(aColor);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextHighlightColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTextHighlightColor_HeaderFile
+#define SALOMEDS_AttributeTextHighlightColor_HeaderFile
+
+#include "SALOMEDSClient_AttributeTextHighlightColor.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+#include "SALOMEDSClient_definitions.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <vector>
+
+class SALOMEDS_AttributeTextHighlightColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextHighlightColor
+{
+public:
+ SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr);
+ SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr);
+ ~SALOMEDS_AttributeTextHighlightColor();
+
+ virtual STextColor TextHighlightColor();
+ virtual void SetTextHighlightColor(STextColor value);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextHighlightColor_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TColStd_HArray1OfReal.hxx>
+
+using namespace std;
+
+SALOMEDS::Color SALOMEDS_AttributeTextHighlightColor_i::TextHighlightColor()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::Color TextHighlightColor;
+ Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->TextHighlightColor();
+ if (anArray.IsNull() || anArray->Length()!=3) {
+ TextHighlightColor.R = 0;
+ TextHighlightColor.G = 0;
+ TextHighlightColor.B = 0;
+ }
+ else {
+ TextHighlightColor.R = anArray->Value(1);
+ TextHighlightColor.G = anArray->Value(2);
+ TextHighlightColor.B = anArray->Value(3);
+ }
+ return TextHighlightColor;
+}
+
+void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMEDS::Color& value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3);
+ anArray->SetValue(1, value.R);
+ anArray->SetValue(2, value.G);
+ anArray->SetValue(3, value.B);
+ Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->ChangeArray(anArray);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTextHighlightColor_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTextHighlightColor_i_HeaderFile
+#define SALOMEDS_AttributeTextHighlightColor_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+
+class SALOMEDS_AttributeTextHighlightColor_i: public virtual POA_SALOMEDS::AttributeTextHighlightColor,
+ public virtual SALOMEDS_GenericAttribute_i
+{
+public:
+
+ SALOMEDS_AttributeTextHighlightColor_i(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTextHighlightColor_i() {};
+
+ SALOMEDS::Color TextHighlightColor();
+ void SetTextHighlightColor(const SALOMEDS::Color& value);
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTreeNode.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeTreeNode.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+#include "SALOMEDS_AttributeTreeNode.hxx"
+
+SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeTreeNode::~SALOMEDS_AttributeTreeNode()
+{}
+
+void SALOMEDS_AttributeTreeNode::SetFather(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->SetFather(aFather);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var aFather = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->SetFather(aFather);
+ }
+}
+
+bool SALOMEDS_AttributeTreeNode::HasFather()
+{
+ bool ret;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ ret = aNode->HasFather();
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ ret = aNode->HasFather();
+ }
+ return ret;
+}
+
+_PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFather()
+{
+ SALOMEDSClient_AttributeTreeNode* aTN = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather());
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather());
+ }
+ return _PTR(AttributeTreeNode)(aTN);
+}
+
+void SALOMEDS_AttributeTreeNode::SetPrevious(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->SetPrevious(aPrev);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var aPrev = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->SetPrevious(aPrev);
+ }
+}
+
+bool SALOMEDS_AttributeTreeNode::HasPrevious()
+{
+ bool ret;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ ret = aNode->HasPrevious();
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ ret = aNode->HasPrevious();
+ }
+ return ret;
+}
+
+_PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetPrevious()
+{
+ SALOMEDSClient_AttributeTreeNode* aTN = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious());
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious());
+ }
+ return _PTR(AttributeTreeNode)(aTN);
+}
+
+void SALOMEDS_AttributeTreeNode::SetNext(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->SetNext(aNext);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var aNext = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->SetNext(aNext);
+ }
+}
+
+bool SALOMEDS_AttributeTreeNode::HasNext()
+{
+ bool ret;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ ret = aNode->HasNext();
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ ret = aNode->HasNext();
+ }
+ return ret;
+}
+
+_PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetNext()
+{
+ SALOMEDSClient_AttributeTreeNode* aTN = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext());
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext());
+ }
+ return _PTR(AttributeTreeNode)(aTN);
+}
+
+void SALOMEDS_AttributeTreeNode::SetFirst(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->SetFirst(aFirst);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var aFirst = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->SetFirst(aFirst);
+ }
+}
+
+bool SALOMEDS_AttributeTreeNode::HasFirst()
+{
+ bool ret;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ ret = aNode->HasFirst();
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ ret = aNode->HasFirst();
+ }
+ return ret;
+}
+
+_PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst()
+{
+ SALOMEDSClient_AttributeTreeNode* aTN = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst());
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst());
+ }
+ return _PTR(AttributeTreeNode)(aTN);
+}
+
+void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value)
+{
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ aNode->SetTreeID(Standard_GUID((char*)value.c_str()));
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aNode->SetTreeID(value.c_str());
+ }
+}
+
+std::string SALOMEDS_AttributeTreeNode::GetTreeID()
+{
+ TCollection_AsciiString aGUID;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ char guid[40];
+ aNode->GetTreeID().ToCString(guid);
+ aGUID = TCollection_AsciiString(guid);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ aGUID = TCollection_AsciiString(aNode->GetTreeID());
+ }
+
+ return std::string(aGUID.ToCString());
+}
+
+void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->Append(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->Append(anOther);
+ }
+}
+
+void SALOMEDS_AttributeTreeNode::Prepend(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->Prepend(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->Prepend(anOther);
+ }
+}
+
+void SALOMEDS_AttributeTreeNode::InsertBefore(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->InsertBefore(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->InsertBefore(anOther);
+ }
+}
+
+void SALOMEDS_AttributeTreeNode::InsertAfter(const _PTR(AttributeTreeNode)& value)
+{
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ aNode->InsertAfter(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ aNode->InsertAfter(anOther);
+ }
+}
+
+void SALOMEDS_AttributeTreeNode::Remove()
+{
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove();
+ else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove();
+}
+
+int SALOMEDS_AttributeTreeNode::Depth()
+{
+ int aDepth;
+ if(_isLocal) aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth();
+ else aDepth = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth();
+ return aDepth;
+}
+
+bool SALOMEDS_AttributeTreeNode::IsRoot()
+{
+ bool ret;
+ if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot();
+ else ret = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot();
+ return ret;
+}
+
+bool SALOMEDS_AttributeTreeNode::IsDescendant(const _PTR(AttributeTreeNode)& value)
+{
+ bool ret;
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ ret = aNode->IsDescendant(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ ret = aNode->IsDescendant(anOther);
+ }
+ return ret;
+}
+
+bool SALOMEDS_AttributeTreeNode::IsFather(const _PTR(AttributeTreeNode)& value)
+{
+ bool ret;
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ ret = aNode->IsFather(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ ret = aNode->IsFather(anOther);
+ }
+ return ret;
+}
+
+bool SALOMEDS_AttributeTreeNode::IsChild(const _PTR(AttributeTreeNode)& value)
+{
+ bool ret;
+ SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
+ aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ ret = aNode->IsChild(anOther);
+ }
+ else {
+ SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
+ SALOMEDS::AttributeTreeNode_var anOther = SALOMEDS::AttributeTreeNode::_narrow(aTN->_corba_impl);
+ ret = aNode->IsChild(anOther);
+ }
+ return ret;
+}
+
+std::string SALOMEDS_AttributeTreeNode::Label()
+{
+ TCollection_AsciiString aLabel;
+ if(_isLocal) TDF_Tool::Entry(_local_impl->Label(), aLabel);
+ else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label();
+ return std::string(aLabel.ToCString());
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTreeNode.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTreeNode_HeaderFile
+#define SALOMEDS_AttributeTreeNode_HeaderFile
+
+#include "SALOMEDSClient_AttributeTreeNode.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeTreeNode: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTreeNode
+{
+public:
+ SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr);
+ SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr);
+ ~SALOMEDS_AttributeTreeNode();
+
+ virtual void SetFather(const _PTR(AttributeTreeNode)& value);
+ virtual bool HasFather();
+ virtual _PTR(AttributeTreeNode) GetFather();
+ virtual void SetPrevious(const _PTR(AttributeTreeNode)& value);
+ virtual bool HasPrevious();
+ virtual _PTR(AttributeTreeNode) GetPrevious();
+ virtual void SetNext(const _PTR(AttributeTreeNode)& value);
+ virtual bool HasNext();
+ virtual _PTR(AttributeTreeNode) GetNext();
+ virtual void SetFirst(const _PTR(AttributeTreeNode)& value);
+ virtual bool HasFirst();
+ virtual _PTR(AttributeTreeNode) GetFirst();
+ virtual void SetTreeID(const std::string& value);
+ virtual std::string GetTreeID();
+ virtual void Append(const _PTR(AttributeTreeNode)& value);
+ virtual void Prepend(const _PTR(AttributeTreeNode)& value);
+ virtual void InsertBefore(const _PTR(AttributeTreeNode)& value);
+ virtual void InsertAfter(const _PTR(AttributeTreeNode)& value);
+ virtual void Remove();
+ virtual int Depth();
+ virtual bool IsRoot();
+ virtual bool IsDescendant(const _PTR(AttributeTreeNode)& value);
+ virtual bool IsFather(const _PTR(AttributeTreeNode)& value);
+ virtual bool IsChild(const _PTR(AttributeTreeNode)& value);
+ virtual std::string Label();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTreeNode_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeTreeNode_i.hxx"
+#include "utilities.h"
+#include "SALOMEDS.hxx"
+#include <TDocStd_Document.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+
+using namespace std;
+
+static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value,
+ const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode)
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) aResult = new SALOMEDSImpl_AttributeTreeNode;
+ TCollection_AsciiString anEntry = value->Label();
+ TDF_Label aLabel;
+ TDF_Tool::Label(aNode->Label().Data(), anEntry, aLabel);
+ if (aLabel.IsNull()) {
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
+ return aResult;
+ }
+ if (!aLabel.FindAttribute(aNode->ID(), aResult)) {
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
+ MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
+ }
+ return aResult;
+}
+
+void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->SetFather(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather();
+}
+
+SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_AttributeTreeNode_i* aFather;
+ aFather = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFather(), _orb);
+#ifndef WNT
+ return aFather->POA_SALOMEDS::AttributeTreeNode::_this();
+#else
+ return aFather->AttributeTreeNode::_this();
+#endif
+}
+
+void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->SetPrevious(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious();
+}
+
+SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_AttributeTreeNode_i* aPrevious;
+ aPrevious=new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetPrevious(), _orb);
+#ifndef WNT
+ return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this();
+#else
+ return aPrevious->AttributeTreeNode::_this();
+#endif
+}
+
+void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->SetNext(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext();
+}
+
+SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_AttributeTreeNode_i* aNext;
+ aNext = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetNext(), _orb);
+#ifndef WNT
+ return aNext->POA_SALOMEDS::AttributeTreeNode::_this();
+#else
+ return aNext->AttributeTreeNode::_this();
+#endif
+}
+
+void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->SetFirst(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst()
+{
+ SALOMEDS::Locker lock;
+ return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst();
+}
+
+SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_AttributeTreeNode_i* aFirst;
+ aFirst = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFirst(), _orb);
+#ifndef WNT
+ return aFirst->POA_SALOMEDS::AttributeTreeNode::_this();
+#else
+ return aFirst->AttributeTreeNode::_this();
+#endif
+}
+
+void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->SetTreeID(Standard_GUID(aNode->ID()));
+}
+
+char* SALOMEDS_AttributeTreeNode_i::GetTreeID()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ char aGUID[40];
+ aNode->ID().ToCString(aGUID);
+ return CORBA::String_var(CORBA::string_dup(aGUID))._retn();
+}
+
+void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->Append(GetNode(value, aNode));
+}
+
+void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->Prepend(GetNode(value, aNode));
+}
+
+void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->InsertBefore(GetNode(value, aNode));
+}
+
+void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->InsertAfter(GetNode(value, aNode));
+}
+
+void SALOMEDS_AttributeTreeNode_i::Remove()
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ aNode->Remove();
+}
+
+CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ return aNode->Depth();
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ return aNode->IsRoot();
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ return aNode->IsDescendant(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ return aNode->IsFather(GetNode(value, aNode));
+}
+
+CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ return aNode->IsChild(GetNode(value, aNode));
+}
+
+char* SALOMEDS_AttributeTreeNode_i::Label()
+{
+ SALOMEDS::Locker lock;
+ TCollection_AsciiString aLabelName;
+ TDF_Tool::Entry(_impl->Label(),aLabelName);
+ return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeTreeNode_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeTreeNode_i_HeaderFile
+#define SALOMEDS_AttributeTreeNode_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+
+class SALOMEDS_AttributeTreeNode_i: public virtual POA_SALOMEDS::AttributeTreeNode,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeTreeNode_i(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeTreeNode_i() {};
+
+ void SetFather(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean HasFather();
+ SALOMEDS::AttributeTreeNode_ptr GetFather();
+ void SetPrevious(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean HasPrevious();
+ SALOMEDS::AttributeTreeNode_ptr GetPrevious();
+ void SetNext(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean HasNext();
+ SALOMEDS::AttributeTreeNode_ptr GetNext();
+ void SetFirst(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean HasFirst();
+ SALOMEDS::AttributeTreeNode_ptr GetFirst();
+ void SetTreeID(const char* value);
+ char* GetTreeID();
+ void Append(SALOMEDS::AttributeTreeNode_ptr value);
+ void Prepend(SALOMEDS::AttributeTreeNode_ptr value);
+ void InsertBefore(SALOMEDS::AttributeTreeNode_ptr value);
+ void InsertAfter(SALOMEDS::AttributeTreeNode_ptr value);
+ void Remove();
+ CORBA::Long Depth();
+ CORBA::Boolean IsRoot();
+ CORBA::Boolean IsDescendant(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean IsFather(SALOMEDS::AttributeTreeNode_ptr value);
+ CORBA::Boolean IsChild(SALOMEDS::AttributeTreeNode_ptr value);
+ char* Label();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeUserID.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_AttributeUserID.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <Standard_GUID.hxx>
+
+SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+SALOMEDS_AttributeUserID::~SALOMEDS_AttributeUserID()
+{}
+
+std::string SALOMEDS_AttributeUserID::Value()
+{
+ std::string aValue;
+ if(_isLocal) {
+ char guid[40];
+ Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid);
+ aValue = std::string(guid);
+ }
+ else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value();
+ return aValue;
+}
+
+void SALOMEDS_AttributeUserID::SetValue(const std::string& value)
+{
+ CheckLocked();
+ if(_isLocal) Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str()));
+ else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(value.c_str());
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeUserID.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeUserID_HeaderFile
+#define SALOMEDS_AttributeUserID_HeaderFile
+
+#include "SALOMEDSClient_AttributeUserID.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeUserID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeUserID
+{
+public:
+ SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr);
+ SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr);
+ ~SALOMEDS_AttributeUserID();
+
+ virtual std::string Value();
+ virtual void SetValue(const std::string& value);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeName_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_AttributeUserID_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+char* SALOMEDS_AttributeUserID_i::Value()
+{
+ SALOMEDS::Locker lock;
+ char aGUID[40];
+ Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->ID().ToCString(aGUID);
+ CORBA::String_var c_s = CORBA::string_dup(aGUID);
+ return c_s._retn();
+}
+
+void SALOMEDS_AttributeUserID_i::SetValue(const char* value)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ CORBA::String_var Str = CORBA::string_dup(value);
+ Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->SetValue(Standard_GUID(Standard_CString(Str)));
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_AttributeUserID_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDS_AttributeUserID_i_HeaderFile
+#define SALOMEDS_AttributeUserID_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+
+class SALOMEDS_AttributeUserID_i: public virtual POA_SALOMEDS::AttributeUserID,
+ public virtual SALOMEDS_GenericAttribute_i {
+public:
+
+ SALOMEDS_AttributeUserID_i(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr, CORBA::ORB_ptr orb)
+ :SALOMEDS_GenericAttribute_i(theAttr, orb) {};
+
+ ~SALOMEDS_AttributeUserID_i() {};
+
+ char* Value();
+ void SetValue(const char* value);
+
+ static const Standard_GUID& DefaultID() {
+ return SALOMEDSImpl_AttributeUserID::DefaultID();
+ }
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Attributes.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_ATTRIBUTES__H__
+#define __SALOMEDS_ATTRIBUTES__H__
+
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeName.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+#include "SALOMEDSImpl_AttributeReal.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+#include "SALOMEDSImpl_AttributeReference.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
+#include "SALOMEDSImpl_AttributeTableOfString.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_AttributeName_i.hxx"
+#include "SALOMEDS_AttributeComment_i.hxx"
+#include "SALOMEDS_AttributeInteger_i.hxx"
+#include "SALOMEDS_AttributeReal_i.hxx"
+#include "SALOMEDS_AttributeTreeNode_i.hxx"
+#include "SALOMEDS_AttributeUserID_i.hxx"
+#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
+#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
+#include "SALOMEDS_AttributeIOR_i.hxx"
+#include "SALOMEDS_AttributePersistentRef_i.hxx"
+#include "SALOMEDS_AttributeDrawable_i.hxx"
+#include "SALOMEDS_AttributeSelectable_i.hxx"
+#include "SALOMEDS_AttributeExpandable_i.hxx"
+#include "SALOMEDS_AttributeOpened_i.hxx"
+#include "SALOMEDS_AttributeTextColor_i.hxx"
+#include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
+#include "SALOMEDS_AttributePixMap_i.hxx"
+#include "SALOMEDS_AttributeLocalID_i.hxx"
+#include "SALOMEDS_AttributeTarget_i.hxx"
+#include "SALOMEDS_AttributeTableOfInteger_i.hxx"
+#include "SALOMEDS_AttributeTableOfReal_i.hxx"
+#include "SALOMEDS_AttributeTableOfString_i.hxx"
+#include "SALOMEDS_AttributeStudyProperties_i.hxx"
+#include "SALOMEDS_AttributePythonObject_i.hxx"
+#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
+#include "SALOMEDS_AttributeFileType_i.hxx"
+#include "SALOMEDS_AttributeFlags_i.hxx"
+#include "SALOMEDS_AttributeGraphic_i.hxx"
+
+#define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
+ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \
+ SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(A, theOrb); \
+ attr_servant = Attr; \
+ anAttribute = Attr->CORBA_Name::_this(); \
+ }
+
+
+#define __CreateGenericCORBAAttribute \
+__CreateCORBAAttribute(AttributeReal) \
+__CreateCORBAAttribute(AttributeInteger) \
+__CreateCORBAAttribute(AttributeSequenceOfReal) \
+__CreateCORBAAttribute(AttributeSequenceOfInteger) \
+__CreateCORBAAttribute(AttributeName) \
+__CreateCORBAAttribute(AttributeComment) \
+__CreateCORBAAttribute(AttributeIOR) \
+__CreateCORBAAttribute(AttributePixMap) \
+__CreateCORBAAttribute(AttributeLocalID) \
+__CreateCORBAAttribute(AttributeTableOfInteger) \
+__CreateCORBAAttribute(AttributeTableOfReal) \
+__CreateCORBAAttribute(AttributeTableOfString) \
+__CreateCORBAAttribute(AttributePythonObject) \
+__CreateCORBAAttribute(AttributePersistentRef) \
+__CreateCORBAAttribute(AttributeDrawable) \
+__CreateCORBAAttribute(AttributeSelectable) \
+__CreateCORBAAttribute(AttributeExpandable) \
+__CreateCORBAAttribute(AttributeOpened) \
+__CreateCORBAAttribute(AttributeTextColor) \
+__CreateCORBAAttribute(AttributeTextHighlightColor) \
+__CreateCORBAAttribute(AttributeTarget) \
+__CreateCORBAAttribute(AttributeStudyProperties) \
+__CreateCORBAAttribute(AttributeExternalFileDef) \
+__CreateCORBAAttribute(AttributeFileType) \
+__CreateCORBAAttribute(AttributeFlags) \
+__CreateCORBAAttribute(AttributeGraphic) \
+__CreateCORBAAttribute(AttributeTreeNode) \
+__CreateCORBAAttribute(AttributeUserID)
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_ChildIterator.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_ChildIterator.hxx"
+#include "SALOMEDS_SObject.hxx"
+
+using namespace std;
+
+SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator)
+{
+ _isLocal = true;
+ _local_impl = theIterator;
+ _corba_impl = SALOMEDS::ChildIterator::_nil();
+}
+
+SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator)
+{
+ _isLocal = false;
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator);
+}
+
+SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator()
+{
+ if(!_isLocal) _corba_impl->Destroy();
+}
+
+void SALOMEDS_ChildIterator::Init()
+{
+ if(_isLocal) _local_impl->Init();
+ else _corba_impl->Init();
+}
+
+void SALOMEDS_ChildIterator::InitEx(bool theAllLevels)
+{
+ if(_isLocal) _local_impl->InitEx(theAllLevels);
+ else _corba_impl->InitEx(theAllLevels);
+}
+
+bool SALOMEDS_ChildIterator::More()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->More();
+ else ret = _corba_impl->More();
+ return ret;
+}
+
+void SALOMEDS_ChildIterator::Next()
+{
+ if(_isLocal) _local_impl->Next();
+ else _corba_impl->Next();
+}
+
+_PTR(SObject) SALOMEDS_ChildIterator::Value()
+{
+ SALOMEDSClient_SObject* aSO;
+ if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
+ else aSO = new SALOMEDS_SObject(_corba_impl->Value());
+ return _PTR(SObject)(aSO);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_ChildIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_CHILDITERATOR_H__
+#define __SALOMEDS_CHILDITERATOR_H__
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class SALOMEDS_ChildIterator: public SALOMEDSClient_ChildIterator
+{
+private:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_ChildIterator) _local_impl;
+ SALOMEDS::ChildIterator_var _corba_impl;
+
+public:
+
+ SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator);
+ SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator);
+ ~SALOMEDS_ChildIterator();
+
+ virtual void Init();
+ virtual void InitEx(bool theAllLevels);
+ virtual bool More();
+ virtual void Next();
+ virtual _PTR(SObject) Value();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_ChildIterator_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_ChildIterator_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)& theImpl,
+ CORBA::ORB_ptr orb)
+ : _it(theImpl)
+{
+ SALOMEDS::Locker lock;
+ _orb = CORBA::ORB::_duplicate(orb);
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i()
+{
+}
+
+//============================================================================
+/*! Function :Init
+ *
+ */
+//============================================================================
+void SALOMEDS_ChildIterator_i::Init()
+{
+ SALOMEDS::Locker lock;
+ _it->Init();
+}
+
+//============================================================================
+/*! Function :InitEx
+ *
+ */
+//============================================================================
+void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean allLevels)
+{
+ SALOMEDS::Locker lock;
+ _it->InitEx (allLevels);
+}
+
+//============================================================================
+/*! Function : More
+ *
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_ChildIterator_i::More()
+{
+ SALOMEDS::Locker lock;
+ return _it->More();
+}
+
+ //============================================================================
+/*! Function : Next
+ *
+ */
+//============================================================================
+void SALOMEDS_ChildIterator_i::Next()
+{
+ SALOMEDS::Locker lock;
+ _it->Next();
+}
+
+
+//============================================================================
+/*! Function : Value
+ * Purpose :
+ */
+//============================================================================
+
+SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_SObject) aSO = _it->Value();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_ChildIterator_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_CHILDITERATOR_I_H__
+#define __SALOMEDS_CHILDITERATOR_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
+
+// Cascade headers
+#include "SALOMEDSImpl_ChildIterator.hxx"
+#include <stdio.h>
+
+class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+private:
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_ChildIterator) _it;
+public:
+
+ //! standard constructor
+ SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)&, CORBA::ORB_ptr);
+
+ //! standard destructor
+ ~SALOMEDS_ChildIterator_i();
+
+ virtual void Init();
+ virtual void InitEx(CORBA::Boolean);
+ virtual CORBA::Boolean More();
+ virtual void Next();
+ virtual SALOMEDS::SObject_ptr Value();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Attributes.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSCLIENT_ATTRIBUTES__H__
+#define __SALOMEDSCLIENT_ATTRIBUTES__H__
+
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeName.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+#include "SALOMEDSImpl_AttributeReal.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
+#include "SALOMEDSImpl_AttributeTableOfString.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDS_AttributeName.hxx"
+#include "SALOMEDS_AttributeComment.hxx"
+#include "SALOMEDS_AttributeInteger.hxx"
+#include "SALOMEDS_AttributeReal.hxx"
+#include "SALOMEDS_AttributeTreeNode.hxx"
+#include "SALOMEDS_AttributeUserID.hxx"
+#include "SALOMEDS_AttributeSequenceOfReal.hxx"
+#include "SALOMEDS_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDS_AttributeIOR.hxx"
+#include "SALOMEDS_AttributePersistentRef.hxx"
+#include "SALOMEDS_AttributeDrawable.hxx"
+#include "SALOMEDS_AttributeSelectable.hxx"
+#include "SALOMEDS_AttributeExpandable.hxx"
+#include "SALOMEDS_AttributeOpened.hxx"
+#include "SALOMEDS_AttributeTextColor.hxx"
+#include "SALOMEDS_AttributeTextHighlightColor.hxx"
+#include "SALOMEDS_AttributePixMap.hxx"
+#include "SALOMEDS_AttributeLocalID.hxx"
+#include "SALOMEDS_AttributeTarget.hxx"
+#include "SALOMEDS_AttributeTableOfInteger.hxx"
+#include "SALOMEDS_AttributeTableOfReal.hxx"
+#include "SALOMEDS_AttributeTableOfString.hxx"
+#include "SALOMEDS_AttributeStudyProperties.hxx"
+#include "SALOMEDS_AttributePythonObject.hxx"
+#include "SALOMEDS_AttributeExternalFileDef.hxx"
+#include "SALOMEDS_AttributeFileType.hxx"
+#include "SALOMEDS_AttributeFlags.hxx"
+#include "SALOMEDS_AttributeGraphic.hxx"
+
+#define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \
+ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \
+ aGA = new SALOMEDS_##CORBA_Name(A); \
+ }
+
+#define __CreateClientAttributeCORBA(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \
+ SALOMEDS::CORBA_Name##_var A = SALOMEDS::CORBA_Name::_narrow(theGA); \
+ aGA = new SALOMEDS_##CORBA_Name(A); \
+ }
+
+#define __CreateGenericClientAttributeLocal \
+__CreateClientAttributeLocal(AttributeReal) \
+__CreateClientAttributeLocal(AttributeInteger) \
+__CreateClientAttributeLocal(AttributeSequenceOfReal) \
+__CreateClientAttributeLocal(AttributeSequenceOfInteger) \
+__CreateClientAttributeLocal(AttributeName) \
+__CreateClientAttributeLocal(AttributeComment) \
+__CreateClientAttributeLocal(AttributeIOR) \
+__CreateClientAttributeLocal(AttributePixMap) \
+__CreateClientAttributeLocal(AttributeLocalID) \
+__CreateClientAttributeLocal(AttributeTableOfInteger) \
+__CreateClientAttributeLocal(AttributeTableOfReal) \
+__CreateClientAttributeLocal(AttributeTableOfString) \
+__CreateClientAttributeLocal(AttributePythonObject) \
+__CreateClientAttributeLocal(AttributePersistentRef) \
+__CreateClientAttributeLocal(AttributeDrawable) \
+__CreateClientAttributeLocal(AttributeSelectable) \
+__CreateClientAttributeLocal(AttributeExpandable) \
+__CreateClientAttributeLocal(AttributeOpened) \
+__CreateClientAttributeLocal(AttributeTextColor) \
+__CreateClientAttributeLocal(AttributeTextHighlightColor) \
+__CreateClientAttributeLocal(AttributeTarget) \
+__CreateClientAttributeLocal(AttributeStudyProperties) \
+__CreateClientAttributeLocal(AttributeExternalFileDef) \
+__CreateClientAttributeLocal(AttributeFileType) \
+__CreateClientAttributeLocal(AttributeFlags) \
+__CreateClientAttributeLocal(AttributeGraphic) \
+__CreateClientAttributeLocal(AttributeTreeNode) \
+__CreateClientAttributeLocal(AttributeUserID)
+
+#define __CreateGenericClientAttributeCORBA \
+__CreateClientAttributeCORBA(AttributeReal) \
+__CreateClientAttributeCORBA(AttributeInteger) \
+__CreateClientAttributeCORBA(AttributeSequenceOfReal) \
+__CreateClientAttributeCORBA(AttributeSequenceOfInteger) \
+__CreateClientAttributeCORBA(AttributeName) \
+__CreateClientAttributeCORBA(AttributeComment) \
+__CreateClientAttributeCORBA(AttributeIOR) \
+__CreateClientAttributeCORBA(AttributePixMap) \
+__CreateClientAttributeCORBA(AttributeLocalID) \
+__CreateClientAttributeCORBA(AttributeTableOfInteger) \
+__CreateClientAttributeCORBA(AttributeTableOfReal) \
+__CreateClientAttributeCORBA(AttributeTableOfString) \
+__CreateClientAttributeCORBA(AttributePythonObject) \
+__CreateClientAttributeCORBA(AttributePersistentRef) \
+__CreateClientAttributeCORBA(AttributeDrawable) \
+__CreateClientAttributeCORBA(AttributeSelectable) \
+__CreateClientAttributeCORBA(AttributeExpandable) \
+__CreateClientAttributeCORBA(AttributeOpened) \
+__CreateClientAttributeCORBA(AttributeTextColor) \
+__CreateClientAttributeCORBA(AttributeTextHighlightColor) \
+__CreateClientAttributeCORBA(AttributeTarget) \
+__CreateClientAttributeCORBA(AttributeStudyProperties) \
+__CreateClientAttributeCORBA(AttributeExternalFileDef) \
+__CreateClientAttributeCORBA(AttributeFileType) \
+__CreateClientAttributeCORBA(AttributeFlags) \
+__CreateClientAttributeCORBA(AttributeGraphic) \
+__CreateClientAttributeCORBA(AttributeTreeNode) \
+__CreateClientAttributeCORBA(AttributeUserID)
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_DrawableAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class DrawableAttribute from SALOMEDS inherits Integer from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; value : Integer from Standard)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns DrawableAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable DrawableAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end DrawableAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+
+#include "SALOMEDS_Driver_i.hxx"
+#include "utilities.h"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS.hxx"
+#include <stdlib.h>
+
+using namespace std;
+
+SALOMEDS_Driver_i::~SALOMEDS_Driver_i()
+{
+}
+
+unsigned char* SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile)
+{
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+ SALOMEDS::TMPFile_var aStream;
+ CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ SALOMEDS::unlock();
+ aStream = _driver->Save(sco.in(), url, isMultiFile);
+ theStreamLength = aStream->length();
+ unsigned char* aRetStream = NULL;
+ if(theStreamLength > 0) {
+ aRetStream = new unsigned char[theStreamLength];
+ memcpy(aRetStream, aStream->NP_data(), theStreamLength);
+ }
+ return aRetStream;
+}
+
+unsigned char* SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile)
+{
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+ SALOMEDS::TMPFile_var aStream;
+ CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ SALOMEDS::unlock();
+ aStream = _driver->SaveASCII(sco.in(), url, isMultiFile);
+ theStreamLength = aStream->length();
+ unsigned char* aRetStream = NULL;
+ if(theStreamLength > 0) {
+ aRetStream = new unsigned char[theStreamLength];
+ memcpy(aRetStream, aStream->NP_data(), theStreamLength);
+ }
+ return aRetStream;
+}
+
+bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile)
+{
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+ CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
+
+ SALOMEDS::TMPFile_var aStream;
+ if(theStreamLength > 0)
+ aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0);
+ else
+ aStream = new SALOMEDS::TMPFile(0);
+
+ SALOMEDS::unlock();
+ return _driver->Load(sco.in(), aStream.in(), url, isMultiFile);
+}
+
+bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile)
+{
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+ CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
+
+ SALOMEDS::TMPFile_var aStream;
+ if(theStreamLength > 0)
+ aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0);
+ else
+ aStream = new SALOMEDS::TMPFile(0);
+
+ SALOMEDS::unlock();
+ return _driver->LoadASCII(sco.in(), aStream.in(), url, isMultiFile);
+}
+
+void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent)
+{
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+ SALOMEDS::unlock();
+ _driver->Close(sco.in());
+}
+
+
+
+TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
+ const TCollection_AsciiString& IORString,
+ bool isMultiFile,
+ bool isASCII)
+{
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb);
+ CORBA::String_var ior = CORBA::string_dup(IORString.ToCString());
+ SALOMEDS::unlock();
+ CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII);
+ return TCollection_AsciiString(pers_string);
+}
+
+
+TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theObject,
+ const TCollection_AsciiString& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII)
+{
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
+ CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.ToCString());
+ SALOMEDS::unlock();
+ CORBA::String_var IOR =_driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII);
+ return TCollection_AsciiString(IOR);
+}
+
+bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
+ SALOMEDS::unlock();
+ return _driver->CanCopy(so.in());
+}
+
+
+unsigned char* SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
+ int& theObjectID,
+ long& theStreamLength)
+{
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
+ SALOMEDS::TMPFile_var aStream;
+ CORBA::Long anObjectID;
+
+ SALOMEDS::unlock();
+ aStream = _driver->CopyFrom(so.in(), anObjectID);
+
+ theObjectID = anObjectID;
+ theStreamLength = aStream->length();
+
+ unsigned char* aRetStream = NULL;
+ if(theStreamLength > 0) {
+ aRetStream = new unsigned char[theStreamLength];
+ memcpy(aRetStream, aStream->NP_data(), theStreamLength);
+ }
+
+ return aRetStream;
+}
+
+bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID)
+{
+ SALOMEDS::unlock();
+ return _driver->CanPaste(theComponentName.ToCString(), theObjectID);
+}
+
+TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream,
+ const long theStreamLength,
+ int theObjectID,
+ const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
+
+ SALOMEDS::TMPFile_var aStream;
+ if(theStreamLength > 0)
+ aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0);
+ else
+ aStream = new SALOMEDS::TMPFile(0);
+
+ SALOMEDS::unlock();
+ SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in());
+
+ return TCollection_AsciiString((char*)ret_so->GetID());
+}
+
+unsigned char* SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength)
+{
+ SALOMEDS_Study_i * st_servant = new SALOMEDS_Study_i (theStudy, _orb);
+ SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this());
+ Engines::TMPFile_var aStream;
+ CORBA::Boolean aValidScript, aPublished;
+ aPublished = isPublished;
+ Engines::Component_ptr aComponent = Engines::Component::_narrow(_driver);
+ SALOMEDS::unlock();
+ aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript);
+ SALOMEDS::lock();
+ isValidScript = aValidScript;
+ theStreamLength = aStream->length();
+ unsigned char* aRetStream = NULL;
+
+ if(theStreamLength > 0) {
+ aRetStream = new unsigned char[theStreamLength];
+ memcpy(aRetStream, aStream->NP_data(), theStreamLength);
+ }
+
+ return aRetStream;
+}
+
+//###############################################################################################################
+// SALOMEDS_DriverFactory
+//###############################################################################################################
+
+SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const TCollection_AsciiString& theComponentType)
+{
+ CORBA::Object_var obj;
+
+ TCollection_AsciiString aFactoryType;
+ if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer";
+ else aFactoryType = "FactoryServer";
+
+ SALOMEDS::unlock();
+ obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.ToCString(),
+ theComponentType.ToCString());
+
+ if (CORBA::is_nil(obj)) {
+ obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.ToCString());
+ }
+
+ if (!CORBA::is_nil(obj)) {
+ SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
+ return new SALOMEDS_Driver_i(aDriver, _orb);
+ }
+
+ return NULL;
+}
+
+SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const TCollection_AsciiString& theIOR)
+{
+ CORBA::Object_var obj;
+ obj = _orb->string_to_object(theIOR.ToCString());
+
+ if (!CORBA::is_nil(obj)) {
+ SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
+ return new SALOMEDS_Driver_i(aDriver, _orb);
+ }
+
+ return NULL;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef __SALOMEDS_DRIVER_I_H__
+#define __SALOMEDS_DRIVER_I_H__
+
+#include <CORBA.h>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_Driver.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOME_Component)
+
+class Standard_EXPORT SALOMEDS_Driver_i : public virtual SALOMEDSImpl_Driver
+{
+protected:
+ SALOMEDS::Driver_var _driver;
+ CORBA::ORB_var _orb;
+
+public:
+
+ SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB)
+ {
+ _driver = SALOMEDS::Driver::_duplicate(theDriver);
+ _orb = CORBA::ORB::_duplicate(theORB);
+ }
+
+ ~SALOMEDS_Driver_i();
+
+ virtual TCollection_AsciiString GetIOR()
+ {
+ CORBA::String_var ior = _orb->object_to_string(_driver);
+ return TCollection_AsciiString(ior);
+ }
+
+ virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile);
+
+ virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile);
+
+ virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile);
+
+ virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile);
+
+ virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent);
+
+ virtual TCollection_AsciiString ComponentDataType()
+ {
+ CORBA::String_var ior = _driver->ComponentDataType();
+ return TCollection_AsciiString(ior);
+ }
+
+
+ virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
+ const TCollection_AsciiString& IORString,
+ bool isMultiFile,
+ bool isASCII);
+
+ virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
+ const TCollection_AsciiString& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII);
+
+ virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
+ int& theObjectID,
+ long& theStreamLength);
+
+ virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID);
+
+ virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
+ const long theStreamLength,
+ int theObjectID,
+ const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength);
+};
+
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory
+{
+protected:
+ CORBA::ORB_ptr _orb;
+ SALOME_NamingService* _name_service;
+
+public:
+
+ SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB)
+ {
+ _orb = CORBA::ORB::_duplicate(theORB);
+ _name_service = new SALOME_NamingService(_orb);
+ }
+
+
+ ~SALOMEDS_DriverFactory_i()
+ {
+ delete _name_service;
+ }
+
+ virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType);
+
+ virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_ExpandableAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class ExpandableAttribute from SALOMEDS inherits Integer from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; value : Integer from Standard)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns ExpandableAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable ExpandableAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end ExpandableAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_ExternalFileDef.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class ExternalFileDef from SALOMEDS inherits Comment from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF;
+ Name : ExtendedString from TCollection)
+ returns ExternalFileDef from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable ExternalFileDef from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end ExternalFileDef;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _Standard_GUID_HeaderFile
+#include <Standard_GUID.hxx>
+#endif
+#ifndef _TDF_Label_HeaderFile
+#include <TDF_Label.hxx>
+#endif
+#ifndef _TCollection_ExtendedString_HeaderFile
+#include <TCollection_ExtendedString.hxx>
+#endif
+#ifndef _TDF_Attribute_HeaderFile
+#include <TDF_Attribute.hxx>
+#endif
+#ifndef _TDF_RelocationTable_HeaderFile
+#include <TDF_RelocationTable.hxx>
+#endif
+#ifndef _SALOMEDS_ExternalFileDef_HeaderFile
+#include <SALOMEDS_ExternalFileDef.hxx>
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_FileType.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class FileType from SALOMEDS inherits Comment from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF;
+ Name : ExtendedString from TCollection)
+ returns FileType from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable FileType from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end FileType;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef _Standard_GUID_HeaderFile
+#include <Standard_GUID.hxx>
+#endif
+#ifndef _TDF_Label_HeaderFile
+#include <TDF_Label.hxx>
+#endif
+#ifndef _TCollection_ExtendedString_HeaderFile
+#include <TCollection_ExtendedString.hxx>
+#endif
+#ifndef _TDF_Attribute_HeaderFile
+#include <TDF_Attribute.hxx>
+#endif
+#ifndef _TDF_RelocationTable_HeaderFile
+#include <TDF_RelocationTable.hxx>
+#endif
+#ifndef _SALOMEDS_FileType_HeaderFile
+#include <SALOMEDS_FileType.hxx>
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_GenericAttribute.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_ClientAttributes.hxx"
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
+{
+ _isLocal = true;
+ _local_impl = theGA;
+ _corba_impl = SALOMEDS::GenericAttribute::_nil();
+}
+
+SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+
+ long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ if(_isLocal) {
+ _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr));
+ _corba_impl = SALOMEDS::GenericAttribute::_nil();
+ }
+ else {
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::GenericAttribute::_duplicate(theGA);
+ }
+}
+
+SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute()
+{
+ if (!_isLocal) {
+ _corba_impl->Destroy();
+ }
+}
+
+void SALOMEDS_GenericAttribute::CheckLocked()
+{
+ if(_isLocal) {
+ try {
+ _local_impl->CheckLocked();
+ }
+ catch(...) {
+ throw SALOMEDS::GenericAttribute::LockProtection();
+ }
+ }
+ else {
+ _corba_impl->CheckLocked();
+ }
+}
+
+std::string SALOMEDS_GenericAttribute::Type()
+{
+ std::string aType;
+ if(_isLocal) {
+ aType = _local_impl->Type().ToCString();
+ }
+ else {
+ aType = _corba_impl->Type();
+ }
+ return aType;
+}
+
+std::string SALOMEDS_GenericAttribute::GetClassType()
+{
+ std::string aType;
+ if(_isLocal) {
+ aType = _local_impl->GetClassType().ToCString();
+ }
+ else {
+ aType = _corba_impl->GetClassType();
+ }
+ return aType;
+}
+
+_PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+ if(_isLocal) {
+ aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
+ }
+ else {
+ aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
+ }
+
+ return _PTR(SObject)(aSO);
+}
+
+
+SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
+{
+ SALOMEDS_GenericAttribute* aGA = NULL;
+ std::string aTypeOfAttribute = theGA->GetClassType().ToCString();
+ __CreateGenericClientAttributeLocal
+ return aGA;
+}
+
+SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
+{
+ SALOMEDS_GenericAttribute* aGA = NULL;
+ std::string aTypeOfAttribute = theGA->GetClassType();
+ __CreateGenericClientAttributeCORBA
+ return aGA;
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_GenericAttribute.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _GENERIC_ATTRIBUTE_HXX_
+#define _GENERIC_ATTRIBUTE_HXX_
+
+#include <exception>
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+
+class Standard_EXPORT SALOMEDS_GenericAttribute: public virtual SALOMEDSClient_GenericAttribute
+{
+protected:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_GenericAttribute) _local_impl;
+ SALOMEDS::GenericAttribute_var _corba_impl;
+
+public:
+ SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA);
+ SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA);
+ virtual ~SALOMEDS_GenericAttribute();
+
+ void CheckLocked();
+ std::string Type();
+ std::string GetClassType();
+ _PTR(SObject) GetSObject();
+
+ static SALOMEDS_GenericAttribute* CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA);
+ static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_GenericAttribute_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "utilities.h"
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_Attributes.hxx"
+#include "SALOMEDS.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "Utils_ExceptHandlers.hxx"
+#include <TCollection_AsciiString.hxx>
+#include <map>
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
+
+SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb)
+{
+ _orb = CORBA::ORB::_duplicate(theOrb);
+ _impl = theImpl;
+}
+
+void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(GALockProtection);
+
+ if (!_impl.IsNull() && _impl->IsValid() && !CORBA::is_nil(_orb)) {
+ try {
+ SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(_impl);
+ }
+ catch (...) {
+ throw SALOMEDS::GenericAttribute::LockProtection();
+ }
+ }
+}
+
+SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject()
+{
+ SALOMEDS::Locker lock;
+ if (_impl.IsNull() || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil();
+ Handle(SALOMEDSImpl_SObject) so_impl = SALOMEDSImpl_Study::SObject(_impl->Label());
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (so_impl, _orb);
+ return so._retn();
+}
+
+
+char* SALOMEDS_GenericAttribute_i::Type()
+{
+ SALOMEDS::Locker lock;
+ if (!_impl.IsNull()) {
+ return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl));
+ }
+
+ return "";
+}
+
+char* SALOMEDS_GenericAttribute_i::GetClassType()
+{
+ SALOMEDS::Locker lock;
+ if (!_impl.IsNull()) {
+ return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl));
+ }
+
+ return "";
+}
+
+
+SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(const Handle(TDF_Attribute)& theAttr,
+ CORBA::ORB_ptr theOrb)
+{
+/*
+ SALOMEDS::Locker lock;
+
+ static std::map<TDF_Attribute*, SALOMEDS_GenericAttribute_i*> _mapOfAttrib;
+ SALOMEDS::GenericAttribute_var anAttribute;
+ SALOMEDS_GenericAttribute_i* attr_servant = NULL;
+
+ if(_mapOfAttrib.find(theAttr.operator->()) != _mapOfAttrib.end()) {
+ attr_servant = _mapOfAttrib[theAttr.operator->()];
+ anAttribute = SALOMEDS::GenericAttribute::_narrow(attr_servant->_this());
+ }
+ else {
+ char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString();
+ __CreateGenericCORBAAttribute
+ _mapOfAttrib[theAttr.operator->()] = attr_servant;
+ }
+*/
+ // mpv: now servants Destroyed by common algos of CORBA
+ char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString();
+ SALOMEDS::GenericAttribute_var anAttribute;
+ SALOMEDS_GenericAttribute_i* attr_servant = NULL;
+ __CreateGenericCORBAAttribute
+
+ return anAttribute._retn();
+}
+
+//===========================================================================
+// PRIVATE FUNCTIONS
+//===========================================================================
+long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+ isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ TDF_Attribute* local_impl = _impl.operator->();
+ return ((long)local_impl);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_GenericAttribute_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _GENERIC_ATTRIBUTE_I_HXX_
+#define _GENERIC_ATTRIBUTE_I_HXX_
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
+#include <TDF_Attribute.hxx>
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS::GenericAttribute,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+
+protected:
+ Handle(TDF_Attribute) _impl;
+ CORBA::ORB_ptr _orb;
+
+public:
+ SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb);
+ virtual ~SALOMEDS_GenericAttribute_i() {};
+
+ void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection);
+
+ virtual char* Type();
+
+ char* GetClassType();
+
+ SALOMEDS::SObject_ptr GetSObject();
+
+ virtual Handle(TDF_Attribute) GetImpl() { return _impl; }
+
+ static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb);
+
+ virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_IORAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class IORAttribute from SALOMEDS inherits Comment from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns IORAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable IORAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end IORAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_LocalIDAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class LocalIDAttribute from SALOMEDS inherits Integer from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; value : Integer from Standard)
+ returns OpenedAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable OpenedAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end LocalIDAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_OCAFApplication.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class OCAFApplication from SALOMEDS inherits Application from TDocStd
+
+ ---Purpose:
+
+uses
+ Label from TDF,
+ SequenceOfExtendedString from TColStd,
+ CString from Standard,
+ Document from TDocStd
+
+
+is
+
+ Create
+ returns mutable OCAFApplication from SALOMEDS;
+
+ Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
+ is redefined;
+
+ ResourcesName (me: mutable) returns CString from Standard;
+
+end OCAFApplication;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_OpenedAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class OpenedAttribute from SALOMEDS inherits Integer from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; value : Integer from Standard)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns OpenedAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable OpenedAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end OpenedAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_PersRefAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class PersRefAttribute from SALOMEDS inherits Comment from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns PersRefAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable PersRefAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end PersRefAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_PixMapAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class PixMapAttribute from SALOMEDS inherits Comment from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns PixMapAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable PixMapAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end PixMapAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 CEA/DEN, EDF R&D
+--
+--
+--
+-- File : SALOMEDS_PythonObjectAttribute.cdl
+-- Author : Michael Ponikarov
+-- Module : SALOME
+
+class PythonObjectAttribute from SALOMEDS inherits Attribute from TDF
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ Data from TDF,
+ HArray1OfCharacter from TColStd
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF)
+ returns PythonObjectAttribute from SALOMEDS;
+
+ ---Purpose: Common methods
+ -- ============
+
+ Create
+ returns mutable PythonObjectAttribute from SALOMEDS;
+
+ SetObject(me: mutable; theSequence : CString from Standard; theScript : Boolean from Standard);
+
+ GetObject(me) returns CString from Standard;
+
+ IsScript(me) returns Boolean from Standard;
+
+ GetLength(me) returns Integer from Standard;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+fields
+
+ mySequence : CString from Standard;
+ myIsScript : Boolean from Standard;
+
+end PythonObjectAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponent.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDS_SComponent_i.hxx"
+#include <string>
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+SALOMEDS_SComponent::SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent)
+:SALOMEDS_SObject(theSComponent)
+{}
+
+SALOMEDS_SComponent::SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent)
+:SALOMEDS_SObject(theSComponent)
+{}
+
+SALOMEDS_SComponent::~SALOMEDS_SComponent()
+{}
+
+std::string SALOMEDS_SComponent::ComponentDataType()
+{
+ std::string aType;
+ if(_isLocal) {
+ aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType().ToCString();
+ }
+ else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType();
+
+ return aType;
+}
+
+bool SALOMEDS_SComponent::ComponentIOR(std::string& theID)
+{
+ bool ret;
+ if(_isLocal) {
+ TCollection_AsciiString anIOR;
+ ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR);
+ theID = anIOR.ToCString();
+ }
+ else {
+ CORBA::String_var anIOR;
+ ret = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentIOR(anIOR.out());
+ theID = std::string(anIOR.in());
+ }
+
+ return ret;
+}
+
+SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent()
+{
+ if(_isLocal) {
+ if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
+ SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()),
+ _orb);
+ return aSCO._retn();
+ }
+ else {
+ return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
+ }
+
+ return SALOMEDS::SComponent::_nil();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponent.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SCOMPONENT_H__
+#define __SALOMEDS_SCOMPONENT_H__
+
+#include "SALOMEDSClient_SComponent.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class Standard_EXPORT SALOMEDS_SComponent: public SALOMEDS_SObject, public SALOMEDSClient_SComponent
+{
+public:
+
+ SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent);
+ SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent);
+ ~SALOMEDS_SComponent();
+
+ virtual std::string ComponentDataType();
+ virtual bool ComponentIOR(std::string& theID);
+
+ SALOMEDS::SComponent_ptr GetSComponent();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponentIterator.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDS_SComponentIterator.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDS_SComponent.hxx"
+
+SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
+:_local_impl(theIterator)
+{
+ _isLocal = true;
+ _corba_impl = SALOMEDS::SComponentIterator::_nil();
+}
+
+SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator)
+{
+ _isLocal = false;
+ _corba_impl = SALOMEDS::SComponentIterator::_duplicate(theIterator);
+}
+
+SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator()
+{
+ if(!_isLocal) _corba_impl->Destroy();
+}
+
+void SALOMEDS_SComponentIterator::Init()
+{
+ if(_isLocal) _local_impl.Init();
+ else _corba_impl->Init();
+}
+
+bool SALOMEDS_SComponentIterator::More()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl.More();
+ else ret = _corba_impl->More();
+ return ret;
+}
+
+void SALOMEDS_SComponentIterator::Next()
+{
+ if(_isLocal) _local_impl.Next();
+ else _corba_impl->Next();
+}
+
+_PTR(SComponent) SALOMEDS_SComponentIterator::Value()
+{
+ SALOMEDSClient_SComponent* aSCO = NULL;
+ if(_isLocal) aSCO = new SALOMEDS_SComponent(_local_impl.Value());
+ else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
+ return _PTR(SComponent)(aSCO);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponentIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SCOMPONENTITERATOR_H__
+#define __SALOMEDS_SCOMPONENTITERATOR_H__
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class SALOMEDS_SComponentIterator: public SALOMEDSClient_SComponentIterator
+{
+public:
+ SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator);
+ SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator);
+ ~SALOMEDS_SComponentIterator();
+
+private:
+ bool _isLocal;
+ SALOMEDSImpl_SComponentIterator _local_impl;
+ SALOMEDS::SComponentIterator_var _corba_impl;
+
+public:
+ virtual void Init();
+ virtual bool More();
+ virtual void Next();
+ virtual _PTR(SComponent) Value();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponentIterator_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_SComponentIterator_i.hxx"
+#include "SALOMEDS.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+
+using namespace std;
+
+//============================================================================
+/*! Function : constructor
+ *
+ */
+//============================================================================
+
+SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl,
+ CORBA::ORB_ptr orb)
+:_impl(theImpl)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+}
+
+//============================================================================
+/*! Function : destructor
+ *
+ */
+//============================================================================
+SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i()
+{
+}
+
+//============================================================================
+/*! Function : Init
+ *
+ */
+//============================================================================
+void SALOMEDS_SComponentIterator_i::Init()
+{
+ SALOMEDS::Locker lock;
+ _impl.Init();
+}
+
+//============================================================================
+/*! Function : More
+ *
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_SComponentIterator_i::More()
+{
+ SALOMEDS::Locker lock;
+ return _impl.More();
+}
+
+ //============================================================================
+/*! Function : Next
+ */
+//============================================================================
+void SALOMEDS_SComponentIterator_i::Next()
+{
+ SALOMEDS::Locker lock;
+ _impl.Next();
+}
+
+
+//============================================================================
+/*! Function : Value
+ *
+ */
+//============================================================================
+SALOMEDS::SComponent_ptr SALOMEDS_SComponentIterator_i::Value()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl.Value(), _orb);
+ return sco._retn();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponentIterator_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SCOMPONENTITERATOR_I_H__
+#define __SALOMEDS_SCOMPONENTITERATOR_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
+
+//SALOMEDS headers
+#include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+
+class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+
+private:
+
+ CORBA::ORB_ptr _orb;
+ SALOMEDSImpl_SComponentIterator _impl;
+
+public:
+
+ SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, CORBA::ORB_ptr);
+
+ ~SALOMEDS_SComponentIterator_i();
+
+ virtual void Init();
+ virtual CORBA::Boolean More();
+ virtual void Next();
+ virtual SALOMEDS::SComponent_ptr Value();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponent_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDS.hxx"
+#include "utilities.h"
+#include <map>
+
+using namespace std;
+
+SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB)
+{
+/*
+ static std::map<SALOMEDSImpl_SComponent*, SALOMEDS_SComponent_i*> _mapOfSCO;
+ SALOMEDS::SComponent_var sco;
+ SALOMEDS_SComponent_i* sco_servant = NULL;
+
+ if(_mapOfSCO.find(theImpl.operator->()) != _mapOfSCO.end()) {
+ sco_servant = _mapOfSCO[theImpl.operator->()];
+ }
+ else {
+ sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
+ _mapOfSCO[theImpl.operator->()] = sco_servant;
+ }
+
+ sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
+*/
+ SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
+ SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
+
+ return sco._retn();
+}
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb)
+ :SALOMEDS_SObject_i(theImpl, orb)
+{}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i()
+{}
+
+//============================================================================
+/*! Function : ComponentDataType
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_SComponent_i::ComponentDataType()
+{
+ SALOMEDS::Locker lock;
+ TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType();
+ return CORBA::string_dup(aType.ToCString());
+}
+
+
+//============================================================================
+/*! Function : ComponentIOR
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR)
+{
+ SALOMEDS::Locker lock;
+ TCollection_AsciiString ior;
+ if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) {
+ IOR = CORBA::string_dup("");
+ return false;
+ }
+ IOR = CORBA::string_dup(ior.ToCString());
+ return true;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SComponent_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SCOMPONENT_I_H__
+#define __SALOMEDS_SCOMPONENT_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+//SALOMEDS headers
+#include "SALOMEDS_SObject_i.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+
+class Standard_EXPORT SALOMEDS_SComponent_i: public POA_SALOMEDS::SComponent,
+ public SALOMEDS_SObject_i
+{
+
+public:
+
+ static SALOMEDS::SComponent_ptr New(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr);
+
+ SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr);
+
+ virtual ~SALOMEDS_SComponent_i();
+
+ virtual char* ComponentDataType();
+ virtual CORBA::Boolean ComponentIOR(CORBA::String_out theID);
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+
+ long addr = theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ if(_isLocal) {
+ _local_impl = ((SALOMEDSImpl_SObject*)(addr));
+ _corba_impl = SALOMEDS::SObject::_duplicate(theSObject);
+ }
+ else {
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::SObject::_duplicate(theSObject);
+ }
+
+ init_orb();
+}
+
+SALOMEDS_SObject::SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject)
+:_isLocal(true)
+{
+ _corba_impl = SALOMEDS::SObject::_nil();
+ _local_impl = theSObject;
+
+ init_orb();
+}
+
+SALOMEDS_SObject::~SALOMEDS_SObject()
+{
+ if (!_isLocal) {
+ _corba_impl->Destroy();
+ }
+}
+
+std::string SALOMEDS_SObject::GetID()
+{
+ std::string aValue;
+ if(_isLocal) aValue = _local_impl->GetID().ToCString();
+ else aValue = _corba_impl->GetID();
+ return aValue;
+}
+
+_PTR(SComponent) SALOMEDS_SObject::GetFatherComponent()
+{
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent());
+ return _PTR(SComponent)(new SALOMEDS_SComponent(aSCO));
+ }
+ return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()));
+}
+
+_PTR(SObject) SALOMEDS_SObject::GetFather()
+{
+ if(_isLocal) return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather()));
+ return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather()));
+}
+
+bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute)
+{
+ bool ret = false;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_GenericAttribute) anAttr;
+ ret = _local_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute.c_str());
+ if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr));
+ }
+ else {
+ SALOMEDS::GenericAttribute_var anAttr;
+ ret = _corba_impl->FindAttribute(anAttr.out(), aTypeOfAttribute.c_str());
+ if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr));
+ }
+
+ return ret;
+}
+
+bool SALOMEDS_SObject::ReferencedObject(_PTR(SObject)& theObject)
+{
+ bool ret = false;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO;
+ ret = _local_impl->ReferencedObject(aSO);
+ if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
+ }
+ else {
+ SALOMEDS::SObject_var aSO;
+ ret = _corba_impl->ReferencedObject(aSO.out());
+ if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
+ }
+
+ return ret;
+}
+
+
+bool SALOMEDS_SObject::FindSubObject(int theTag, _PTR(SObject)& theObject)
+{
+ bool ret = false;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO;
+ ret = _local_impl->FindSubObject(theTag, aSO);
+ if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
+ }
+ else {
+ SALOMEDS::SObject_var aSO;
+ ret = _corba_impl->FindSubObject(theTag, aSO.out());
+ if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
+ }
+
+ return ret;
+}
+
+_PTR(Study) SALOMEDS_SObject::GetStudy()
+{
+ if(_isLocal) return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
+ return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy()));
+}
+
+std::string SALOMEDS_SObject::Name()
+{
+ std::string aName;
+ if(_isLocal) aName = _local_impl->Name().ToCString();
+ else aName = _corba_impl->Name();
+
+ return aName;
+}
+
+void SALOMEDS_SObject::Name(const std::string& theName)
+{
+ if(_isLocal) _local_impl->Name((char*)theName.c_str());
+ else _corba_impl->Name(theName.c_str());
+}
+
+vector<_PTR(GenericAttribute)> SALOMEDS_SObject::GetAllAttributes()
+{
+ vector<_PTR(GenericAttribute)> aVector;
+ int aLength = 0;
+ SALOMEDSClient_GenericAttribute* anAttr;
+
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetAllAttributes();
+ aLength = aSeq->Length();
+ for(int i = 1; i <= aLength; i++) {
+ anAttr = SALOMEDS_GenericAttribute::CreateAttribute(Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)));
+ aVector.push_back(_PTR(GenericAttribute)(anAttr));
+ }
+ }
+ else {
+ SALOMEDS::ListOfAttributes_var aSeq = _corba_impl->GetAllAttributes();
+ aLength = aSeq->length();
+ for(int i = 0; i < aLength; i++) {
+ anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aSeq[i]);
+ aVector.push_back(_PTR(GenericAttribute)(anAttr));
+ }
+ }
+
+ return aVector;
+}
+
+std::string SALOMEDS_SObject::GetName()
+{
+ std::string aName;
+ if(_isLocal) aName = _local_impl->GetName().ToCString();
+ else aName = _corba_impl->GetName();
+
+ return aName;
+}
+
+std::string SALOMEDS_SObject::GetComment()
+{
+ std::string aComment;
+ if(_isLocal) aComment = _local_impl->GetComment().ToCString();
+ else aComment = _corba_impl->GetComment();
+
+ return aComment;
+}
+
+std::string SALOMEDS_SObject::GetIOR()
+{
+ std::string anIOR;
+ if(_isLocal) anIOR = _local_impl->GetIOR().ToCString();
+ else anIOR = _corba_impl->GetIOR();
+
+ return anIOR;
+}
+
+int SALOMEDS_SObject::Tag()
+{
+ if(_isLocal) return _local_impl->Tag();
+ return _corba_impl->Tag();
+}
+
+int SALOMEDS_SObject::Depth()
+{
+ if(_isLocal) return _local_impl->Depth();
+ return _corba_impl->Depth();
+}
+
+CORBA::Object_ptr SALOMEDS_SObject::GetObject()
+{
+ CORBA::Object_var obj;
+ if(_isLocal) {
+ std::string anIOR = GetIOR();
+ if (!anIOR.empty())
+ obj = _orb->string_to_object(anIOR.c_str());
+ return obj._retn();
+ }
+ else {
+ obj = _corba_impl->GetObject();
+ return obj._retn();
+ }
+
+ return CORBA::Object::_nil();
+}
+
+SALOMEDS::SObject_ptr SALOMEDS_SObject::GetSObject()
+{
+ if(_isLocal) {
+ if(!CORBA::is_nil(_corba_impl)) return _corba_impl;
+ SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(_local_impl, _orb);
+ return aSO._retn();
+ }
+ else {
+ return _corba_impl;
+ }
+ return SALOMEDS::SObject::_nil();
+}
+
+
+void SALOMEDS_SObject::init_orb()
+{
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(0 , 0 ) ;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SOBJECT_H__
+#define __SALOMEDS_SOBJECT_H__
+
+// std C++ headers
+#include <vector>
+
+#include <SALOMEDSClient.hxx>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+
+class Standard_EXPORT SALOMEDS_SObject: public virtual SALOMEDSClient_SObject
+{
+protected:
+
+ bool _isLocal;
+ Handle(SALOMEDSImpl_SObject) _local_impl;
+ SALOMEDS::SObject_var _corba_impl;
+ CORBA::ORB_var _orb;
+
+public:
+
+ SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject);
+ SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject);
+ virtual ~SALOMEDS_SObject();
+
+ virtual std::string GetID();
+ virtual _PTR(SComponent) GetFatherComponent();
+ virtual _PTR(SObject) GetFather();
+ virtual bool FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute);
+ virtual bool ReferencedObject(_PTR(SObject)& theObject);
+ virtual bool FindSubObject(int theTag, _PTR(SObject)& theObject);
+ virtual _PTR(Study) GetStudy();
+ virtual std::string Name();
+ virtual void Name(const std::string& theName);
+ virtual vector<_PTR(GenericAttribute)> GetAllAttributes();
+ virtual std::string GetName();
+ virtual std::string GetComment();
+ virtual std::string GetIOR();
+ virtual int Tag();
+ virtual int Depth();
+
+ CORBA::Object_ptr GetObject();
+ SALOMEDS::SObject_ptr GetSObject();
+
+ SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); }
+ Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; }
+
+private:
+ void init_orb();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SObject_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "utilities.h"
+#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"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+
+// OCC Headers
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <map>
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB)
+{
+ SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
+ SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
+
+ return so._retn();
+}
+
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb)
+ : _impl(impl)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy());
+}
+
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_SObject_i::~SALOMEDS_SObject_i()
+{}
+
+
+//============================================================================
+/*! Function :GetID
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetID()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->GetID().ToCString());
+}
+
+//============================================================================
+/*! Function : GetFatherComponent
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl->GetFatherComponent(), _orb);
+ return sco._retn();
+}
+
+//============================================================================
+/*! Function : GetFather
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (_impl->GetFather(), _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function :
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_Study) aStudy = _impl->GetStudy();
+ if(aStudy.IsNull()) {
+ MESSAGE("Problem GetStudy");
+ return SALOMEDS::Study::_nil();
+ }
+
+ TCollection_AsciiString IOR = aStudy->GetTransientReference();
+ CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString());
+ SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
+ ASSERT(!CORBA::is_nil(Study));
+ return SALOMEDS::Study::_duplicate(Study);
+}
+
+//============================================================================
+/*! Function : FindAttribute
+ * Purpose : Find attribute of given type on this SObject
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute,
+ const char* aTypeOfAttribute)
+{
+ SALOMEDS::Locker lock;
+ Handle(TDF_Attribute) anAttr;
+ if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) {
+ anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//============================================================================
+/*! Function : GetAllAttributes
+ * Purpose : Returns list of all attributes for this sobject
+ */
+//============================================================================
+
+SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
+{
+ SALOMEDS::Locker lock;
+ Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllAttributes();
+ SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes;
+ Standard_Integer length = aSeq->Length();
+
+ SeqOfAttr->length(length);
+
+ if (length != 0) {
+ for(int i = 1; i<= length; i++) {
+ Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i));
+ SALOMEDS::GenericAttribute_var anAttribute;
+ anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ if (!CORBA::is_nil(anAttribute)) {
+ SeqOfAttr[i - 1] = anAttribute;
+ }
+ }
+ }
+ return SeqOfAttr._retn();
+}
+
+
+//============================================================================
+/*! Function : ReferencedObject
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_SObject) aRefObj;
+ if(!_impl->ReferencedObject(aRefObj)) return false;
+
+ obj = SALOMEDS_SObject_i::New (aRefObj, _orb);
+ return true;
+}
+
+//============================================================================
+/*! Function : FindSubObject
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_out obj)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_SObject) aSubObj;
+ if(!_impl->FindSubObject(atag, aSubObj)) return false;
+
+ obj = SALOMEDS_SObject_i::New (aSubObj, _orb);
+ return true;
+
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : gets a name
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::Name()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->Name().ToCString());
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : sets a name
+ */
+//============================================================================
+void SALOMEDS_SObject_i::Name(const char* name)
+{
+ SALOMEDS::Locker lock;
+ TCollection_AsciiString aName((char*)name);
+ _impl->Name(aName);
+}
+
+//============================================================================
+/*! Function : Tag
+ * Purpose :
+ */
+//============================================================================
+CORBA::Short SALOMEDS_SObject_i::Tag()
+{
+ SALOMEDS::Locker lock;
+ return _impl->Tag();
+}
+
+//============================================================================
+/*! Function : Depth
+ * Purpose :
+ */
+//============================================================================
+CORBA::Short SALOMEDS_SObject_i::Depth()
+{
+ SALOMEDS::Locker lock;
+ return _impl->Depth();
+}
+
+//============================================================================
+/*! Function : GetObject
+ * Purpose :
+ */
+//============================================================================
+CORBA::Object_ptr SALOMEDS_SObject_i::GetObject()
+{
+ SALOMEDS::Locker lock;
+ CORBA::Object_ptr obj = CORBA::Object::_nil();
+ try {
+ TCollection_AsciiString IOR = _impl->GetIOR();
+ char* c_ior = CORBA::string_dup(IOR.ToCString());
+ obj = _orb->string_to_object(c_ior);
+ CORBA::string_free(c_ior);
+ } catch(...) {}
+ return obj;
+}
+
+//============================================================================
+/*! Function : GetName
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetName()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString());
+ return aStr._retn();
+}
+
+//============================================================================
+/*! Function : GetComment
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetComment()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString());
+ return aStr._retn();
+}
+
+//============================================================================
+/*! Function : GetIOR
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetIOR()
+{
+ SALOMEDS::Locker lock;
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString());
+ return aStr._retn();
+}
+
+//===========================================================================
+// PRIVATE FUNCTIONS
+//===========================================================================
+long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+ isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ SALOMEDSImpl_SObject* local_impl = _impl.operator->();
+ return ((long)local_impl);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_SObject_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_SOBJECT_I_H__
+#define __SALOMEDS_SOBJECT_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
+
+// Cascade headers
+#include "SALOMEDSImpl_SObject.hxx"
+
+#ifdef GetObject
+#undef GetObject
+#endif
+
+class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+protected:
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_SObject) _impl;
+
+public:
+
+ static SALOMEDS::SObject_ptr New(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr);
+
+ SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr);
+
+ virtual ~SALOMEDS_SObject_i();
+
+ virtual char* GetID();
+ virtual SALOMEDS::SComponent_ptr GetFatherComponent();
+ virtual SALOMEDS::SObject_ptr GetFather() ;
+ virtual CORBA::Boolean FindAttribute(SALOMEDS::GenericAttribute_out anAttribute, const char* aTypeOfAttribute);
+ virtual CORBA::Boolean ReferencedObject(SALOMEDS::SObject_out obj) ;
+ virtual CORBA::Boolean FindSubObject(long atag, SALOMEDS::SObject_out obj );
+
+ virtual SALOMEDS::Study_ptr GetStudy() ;
+ virtual char* Name();
+ virtual void Name(const char*);
+ virtual SALOMEDS::ListOfAttributes* GetAllAttributes();
+
+ virtual CORBA::Object_ptr GetObject();
+
+ virtual char* GetName();
+ virtual char* GetComment();
+ virtual char* GetIOR();
+
+ virtual CORBA::Short Tag();
+ virtual CORBA::Short Depth();
+
+ virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_SelectableAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class SelectableAttribute from SALOMEDS inherits Integer from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF; value : Integer from Standard)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns SelectableAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable SelectableAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end SelectableAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_SequenceOfIntegerAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class SequenceOfIntegerAttribute from SALOMEDS inherits Attribute from TDF
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ HSequenceOfInteger from TColStd,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns SequenceOfIntegerAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable SequenceOfIntegerAttribute from SALOMEDS;
+
+ ---Category: IntegerArray methods
+ -- ===============
+
+ Assign(me : mutable; other : HSequenceOfInteger from TColStd);
+ ---Purpose: Initialize the inner sequence by other one
+
+ ChangeValue (me : mutable; Index, Value : Integer from Standard);
+ ---Purpose: Sets the <Index>th element of the sequence to <Value>
+
+ Add (me : mutable; value : Integer from Standard);
+ ---Purpose: Add new value
+
+ Value (me : mutable; Index : Integer from Standard) returns Integer;
+ ---Purpose: Value of index
+
+ Remove (me : mutable; Index : Integer from Standard);
+ ---Purpose: Remove element on index <Index>
+
+ Length (me : mutable) returns Integer;
+ ---Purpose: Returns length of sequence
+
+
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+fields
+
+ myValue : HSequenceOfInteger from TColStd;
+
+end SequenceOfIntegerAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_SequenceOfRealAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class SequenceOfRealAttribute from SALOMEDS inherits Attribute from TDF
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ HSequenceOfReal from TColStd,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF)
+ ---Purpose: Find, or create a Comment attribute and set the string.
+ -- the Comment attribute is returned.
+ returns SequenceOfRealAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable SequenceOfRealAttribute from SALOMEDS;
+
+ ---Category: IntegerArray methods
+ -- ===============
+
+ Assign(me : mutable; other : HSequenceOfReal from TColStd);
+ ---Purpose: Initialize the inner sequence by other one
+
+ ChangeValue (me : mutable; Index : Integer from Standard; Value : Real);
+ ---Purpose: Sets the <Index>th element of the sequence to <Value>
+
+ Add (me : mutable; Value : Real from Standard);
+ ---Purpose: Add new value
+
+ Value (me : mutable; Index : Integer from Standard) returns Real;
+ ---Purpose: Value of index
+
+ Remove (me : mutable; Index : Integer from Standard);
+ ---Purpose: Remove element on index <Index>
+
+ Length (me : mutable) returns Integer;
+ ---Purpose: Returns length of sequence
+
+
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+fields
+
+ myValue : HSequenceOfReal from TColStd;
+
+end SequenceOfRealAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Study.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "utilities.h"
+
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS_StudyBuilder.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDS_ChildIterator.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+#include "SALOMEDS_SComponentIterator.hxx"
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+#include "SALOMEDS_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDS_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
+
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy)
+{
+ _isLocal = true;
+ _local_impl = theStudy;
+ _corba_impl = SALOMEDS::Study::_nil();
+ init_orb();
+}
+
+SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+
+ long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ if(_isLocal) {
+ _local_impl = ((SALOMEDSImpl_Study*)(addr));
+ _corba_impl = SALOMEDS::Study::_duplicate(theStudy);
+ }
+ else {
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::Study::_duplicate(theStudy);
+ }
+
+ init_orb();
+}
+
+SALOMEDS_Study::~SALOMEDS_Study()
+{
+}
+
+std::string SALOMEDS_Study::GetPersistentReference()
+{
+ std::string aRef;
+ if(_isLocal) aRef = _local_impl->GetPersistentReference().ToCString();
+ else aRef = _corba_impl->GetPersistentReference();
+ return aRef;
+}
+
+std::string SALOMEDS_Study::GetTransientReference()
+{
+ std::string aRef;
+ if(_isLocal) aRef = _local_impl->GetTransientReference().ToCString();
+ else aRef = _corba_impl->GetTransientReference();
+ return aRef;
+}
+
+bool SALOMEDS_Study::IsEmpty()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->IsEmpty();
+ else ret = _corba_impl->IsEmpty();
+ return ret;
+}
+
+_PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentName)
+{
+ SALOMEDSClient_SComponent* aSCO = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponent((char*)aComponentName.c_str());
+ if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+ else {
+ SALOMEDS::SComponent_var aSCO_impl = _corba_impl->FindComponent((char*)aComponentName.c_str());
+ if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+ return _PTR(SComponent)(aSCO);
+}
+
+_PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID)
+{
+ SALOMEDSClient_SComponent* aSCO = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponentID((char*)aComponentID.c_str());
+ if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+ else {
+ SALOMEDS::SComponent_var aSCO_impl = _corba_impl->FindComponentID((char*)aComponentID.c_str());
+ if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+ return _PTR(SComponent)(aSCO);
+
+}
+
+_PTR(SObject) SALOMEDS_Study::FindObject(const std::string& anObjectName)
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObject((char*)anObjectName.c_str());
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO_impl);
+ if(!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObject((char*)anObjectName.c_str());
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ SALOMEDS::SComponent_var aSCO_impl = SALOMEDS::SComponent::_narrow(aSO_impl);
+ if(!CORBA::is_nil(aSCO_impl)) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+
+ return _PTR(SObject)(aSO);
+}
+
+std::vector<_PTR(SObject)> SALOMEDS_Study::FindObjectByName(const std::string& anObjectName,
+ const std::string& aComponentName)
+{
+ std::vector<_PTR(SObject)> aVector;
+ int i, aLength = 0;
+
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str());
+ aLength = aSeq->Length();
+ for(i = 1; i<= aLength; i++)
+ aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
+ }
+ else {
+ SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(),
+ (char*)aComponentName.c_str());
+ aLength = aSeq->length();
+ for(i = 0; i< aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
+ }
+
+ return aVector;
+}
+
+_PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID)
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str());
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectID((char*)anObjectID.c_str());
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
+ }
+ return _PTR(SObject)(aSO);
+}
+
+_PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID)
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+ if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str()));
+ else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID((char*)anObjectID.c_str()));
+ return _PTR(SObject)(aSO);
+}
+
+_PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR)
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str());
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectIOR((char*)anObjectIOR.c_str());
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ return _PTR(SObject)(aSO);
+}
+
+_PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath)
+{
+ SALOMEDSClient_SObject* aSO = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str());
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectByPath((char*)thePath.c_str());
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ return _PTR(SObject)(aSO);
+}
+
+std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ std::string aPath;
+ if(_isLocal) aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString();
+ else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl());
+ return aPath;
+}
+
+void SALOMEDS_Study::SetContext(const std::string& thePath)
+{
+ if(_isLocal) _local_impl->SetContext((char*)thePath.c_str());
+ else _corba_impl->SetContext((char*)thePath.c_str());
+}
+
+std::string SALOMEDS_Study::GetContext()
+{
+ std::string aPath;
+ if(_isLocal) aPath = _local_impl->GetContext().ToCString();
+ else aPath = _corba_impl->GetContext();
+ return aPath;
+}
+
+std::vector<std::string> SALOMEDS_Study::GetObjectNames(const std::string& theContext)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames((char*)theContext.c_str());
+ aLength = aSeq->Length();
+ for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ }
+ else {
+ SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str());
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back(std::string((std::string)aSeq[i].in()));
+ }
+ return aVector;
+}
+
+std::vector<std::string> SALOMEDS_Study::GetDirectoryNames(const std::string& theContext)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetDirectoryNames((char*)theContext.c_str());
+ aLength = aSeq->Length();
+ for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ }
+ else {
+ SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str());
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+std::vector<std::string> SALOMEDS_Study::GetFileNames(const std::string& theContext)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames((char*)theContext.c_str());
+ aLength = aSeq->Length();
+ for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ }
+ else {
+ SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str());
+ aLength = aSeq->length();
+
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+std::vector<std::string> SALOMEDS_Study::GetComponentNames(const std::string& theContext)
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames((char*)theContext.c_str());
+ aLength = aSeq->Length();
+ for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ }
+ else {
+ SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str());
+ aLength = aSeq->length();
+ for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+_PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ SALOMEDSClient_ChildIterator* aCI = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl());
+ aCI = new SALOMEDS_ChildIterator(aCIimpl);
+ }
+ else {
+ SALOMEDS::ChildIterator_var aCIimpl = _corba_impl->NewChildIterator(aSO->GetCORBAImpl());
+ aCI = new SALOMEDS_ChildIterator(aCIimpl);
+ }
+
+ return _PTR(ChildIterator)(aCI);
+}
+
+_PTR(SComponentIterator) SALOMEDS_Study::NewComponentIterator()
+{
+ SALOMEDSClient_SComponentIterator* aCI = NULL;
+ if(_isLocal) {
+ SALOMEDSImpl_SComponentIterator aCIimpl = _local_impl->NewComponentIterator();
+ aCI = new SALOMEDS_SComponentIterator(aCIimpl);
+ }
+ else {
+ SALOMEDS::SComponentIterator_var aCIimpl = _corba_impl->NewComponentIterator();
+ aCI = new SALOMEDS_SComponentIterator(aCIimpl);
+ }
+
+ return _PTR(SComponentIterator)(aCI);
+}
+
+_PTR(StudyBuilder) SALOMEDS_Study::NewBuilder()
+{
+ SALOMEDSClient_StudyBuilder* aSB = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder();
+ aSB = new SALOMEDS_StudyBuilder(aSBimpl);
+ }
+ else {
+ SALOMEDS::StudyBuilder_var aSBimpl = _corba_impl->NewBuilder();
+ aSB = new SALOMEDS_StudyBuilder(aSBimpl);
+ }
+
+ return _PTR(StudyBuilder)(aSB);
+}
+
+std::string SALOMEDS_Study::Name()
+{
+ std::string aName;
+ if(_isLocal) aName = _local_impl->Name().ToCString();
+ else aName = _corba_impl->Name();
+ return aName;
+}
+
+void SALOMEDS_Study::Name(const std::string& theName)
+{
+ if(_isLocal) _local_impl->Name((char*)theName.c_str());
+ else _corba_impl->Name((char*)theName.c_str());
+}
+
+bool SALOMEDS_Study::IsSaved()
+{
+ bool isSaved;
+ if(_isLocal) isSaved = _local_impl->IsSaved();
+ else isSaved = _corba_impl->IsSaved();
+ return isSaved;
+}
+
+void SALOMEDS_Study::IsSaved(bool save)
+{
+ if(_isLocal) _local_impl->IsSaved(save);
+ else _corba_impl->IsSaved(save);
+}
+
+bool SALOMEDS_Study::IsModified()
+{
+ bool isModified;
+ if(_isLocal) isModified = _local_impl->IsModified();
+ else isModified = _corba_impl->IsModified();
+ return isModified;
+}
+
+std::string SALOMEDS_Study::URL()
+{
+ std::string aURL;
+ if(_isLocal) aURL = _local_impl->URL().ToCString();
+ else aURL = _corba_impl->URL();
+ return aURL;
+}
+
+void SALOMEDS_Study::URL(const std::string& url)
+{
+ if(_isLocal) _local_impl->URL((char*)url.c_str());
+ else _corba_impl->URL((char*)url.c_str());
+}
+
+int SALOMEDS_Study::StudyId()
+{
+ int anID;
+ if(_isLocal) anID = _local_impl->StudyId();
+ else anID = _corba_impl->StudyId();
+ return anID;
+}
+
+void SALOMEDS_Study::StudyId(int id)
+{
+ if(_isLocal) _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;
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl());
+ if ( !aSeq.IsNull() )
+ {
+ aLength = aSeq->Length();
+ for(i=1; i<=aLength; i++)
+ aVector.push_back(_PTR(SObject)(
+ new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
+ }
+ }
+ else {
+ SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindDependances(aSO->GetCORBAImpl());
+ aLength = aSeq->length();
+ for(i=0; i<aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
+ }
+ return aVector;
+}
+
+_PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties()
+{
+ SALOMEDSClient_AttributeStudyProperties* aProp;
+ if(_isLocal) aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
+ else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties());
+ return _PTR(AttributeStudyProperties)(aProp);
+}
+
+std::string SALOMEDS_Study::GetLastModificationDate()
+{
+ std::string aDate;
+ if(_isLocal) aDate = _local_impl->GetLastModificationDate().ToCString();
+ else aDate = _corba_impl->GetLastModificationDate();
+ return aDate;
+}
+
+std::vector<std::string> SALOMEDS_Study::GetModificationsDate()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate();
+ aLength = aSeq->Length();
+ for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ }
+ else {
+ SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate();
+ aLength = aSeq->length();
+ for(i=0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
+}
+
+_PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder()
+{
+ SALOMEDSClient_UseCaseBuilder* aUB = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder();
+ aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
+ }
+ else {
+ SALOMEDS::UseCaseBuilder_var aUBimpl = _corba_impl->GetUseCaseBuilder();
+ aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
+ }
+
+ return _PTR(UseCaseBuilder)(aUB);
+}
+
+void SALOMEDS_Study::Close()
+{
+ if(_isLocal) _local_impl->Close();
+ else _corba_impl->Close();
+}
+
+void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled)
+{
+ if(_isLocal) _local_impl->EnableUseCaseAutoFilling(isEnabled);
+ else _corba_impl->EnableUseCaseAutoFilling(isEnabled);
+}
+
+bool SALOMEDS_Study::DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished)
+{
+ bool ret;
+ if(_isLocal) {
+ SALOMEDS_DriverFactory_i* aFactory = new SALOMEDS_DriverFactory_i(_orb);
+ ret = _local_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished, aFactory);
+ delete aFactory;
+ }
+ else ret = _corba_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished);
+ return ret;
+}
+
+std::string SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject)
+{
+ return _orb->object_to_string(theObject);
+}
+
+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_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(0 , 0 ) ;
+}
+
+SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
+{
+ if(_isLocal) {
+ if(!CORBA::is_nil(_corba_impl)) return _corba_impl;
+ std::string anIOR = _local_impl->GetTransientReference().ToCString();
+ SALOMEDS::Study_var aStudy;
+ if(!_local_impl->IsError() && anIOR != "") {
+ 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();
+ _local_impl->SetTransientReference(_orb->object_to_string(aStudy));
+ }
+ return aStudy._retn();
+ }
+ else {
+ return _corba_impl;
+ }
+
+ return SALOMEDS::Study::_nil();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Study.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDY_H__
+#define __SALOMEDS_STUDY_H__
+
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class Standard_EXPORT SALOMEDS_Study: public SALOMEDSClient_Study
+{
+
+private:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_Study) _local_impl;
+ SALOMEDS::Study_var _corba_impl;
+ CORBA::ORB_var _orb;
+
+public:
+
+ SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy);
+ SALOMEDS_Study(SALOMEDS::Study_ptr theStudy);
+ ~SALOMEDS_Study();
+
+ virtual std::string GetPersistentReference();
+ virtual std::string GetTransientReference();
+ virtual bool IsEmpty();
+ virtual _PTR(SComponent) FindComponent (const std::string& aComponentName);
+ virtual _PTR(SComponent) FindComponentID(const std::string& aComponentID);
+ virtual _PTR(SObject) FindObject(const std::string& anObjectName);
+ virtual std::vector<_PTR(SObject)> FindObjectByName( const std::string& anObjectName, const std::string& aComponentName ) ;
+ virtual _PTR(SObject) FindObjectID(const std::string& anObjectID);
+ virtual _PTR(SObject) CreateObjectID(const std::string& anObjectID);
+ virtual _PTR(SObject) FindObjectIOR(const std::string& anObjectIOR);
+ virtual _PTR(SObject) FindObjectByPath(const std::string& thePath);
+ virtual std::string GetObjectPath(const _PTR(SObject)& theSO);
+ virtual void SetContext(const std::string& thePath);
+ virtual std::string GetContext();
+ virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
+ virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
+ virtual std::vector<std::string> GetFileNames(const std::string& theContext);
+ virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
+ virtual _PTR(ChildIterator) NewChildIterator(const _PTR(SObject)& theSO);
+ 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 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<std::string> 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);
+
+ std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
+ CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);
+
+ SALOMEDS::Study_ptr GetStudy();
+
+private:
+ void init_orb();
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyBuilder.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "utilities.h"
+
+#include "SALOMEDS_StudyBuilder.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Attribute.hxx>
+#include "SALOMEDS_StudyManager.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+using namespace std;
+
+SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder)
+{
+ _isLocal = true;
+ _local_impl = theBuilder;
+ _corba_impl = SALOMEDS::StudyBuilder::_nil();
+
+ init_orb();
+}
+
+SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder)
+{
+ _isLocal = false;
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::StudyBuilder::_duplicate(theBuilder);
+
+ init_orb();
+}
+
+SALOMEDS_StudyBuilder::~SALOMEDS_StudyBuilder()
+{
+}
+
+_PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& ComponentDataType)
+{
+ CheckLocked();
+
+ SALOMEDSClient_SComponent* aSCO = NULL;
+
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->NewComponent((char*)ComponentDataType.c_str());
+ if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+ else {
+ SALOMEDS::SComponent_var aSCO_impl = _corba_impl->NewComponent((char*)ComponentDataType.c_str());
+ if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
+ aSCO = new SALOMEDS_SComponent(aSCO_impl);
+ }
+
+ return _PTR(SComponent)(aSCO);
+}
+
+void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& theSCO,
+ const std::string& ComponentIOR)
+{
+ CheckLocked();
+
+ SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
+ if(_isLocal) _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()),
+ (char*)ComponentIOR.c_str());
+ else {
+ CORBA::Object_var obj = _orb->string_to_object(ComponentIOR.c_str());
+ _corba_impl->DefineComponentInstance(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), obj);
+ }
+}
+
+void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO)
+{
+ CheckLocked();
+
+ SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
+ if(_isLocal) _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+ else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
+}
+
+_PTR(SObject) SALOMEDS_StudyBuilder::NewObject(const _PTR(SObject)& theFatherObject)
+{
+ CheckLocked();
+
+ SALOMEDSClient_SObject* aSO = NULL;
+ SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject.get());
+ if(father == NULL) return _PTR(SObject)(aSO);
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObject(father->GetLocalImpl());
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->NewObject(father->GetCORBAImpl());
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+
+ return _PTR(SObject)(aSO);
+}
+
+_PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag)
+{
+ CheckLocked();
+
+ SALOMEDSClient_SObject* aSO = NULL;
+ SALOMEDS_SObject* father = dynamic_cast< SALOMEDS_SObject*>(theFatherObject.get());
+ if(father == NULL) return _PTR(SObject)(aSO);
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObjectToTag(father->GetLocalImpl(), theTag);
+ if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+ else {
+ SALOMEDS::SObject_var aSO_impl = _corba_impl->NewObjectToTag(father->GetCORBAImpl(), theTag);
+ if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
+ aSO = new SALOMEDS_SObject(aSO_impl);
+ }
+
+ return _PTR(SObject)(aSO);
+
+}
+
+void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath)
+{
+ CheckLocked();
+
+ if(_isLocal) {
+ _local_impl->AddDirectory((char*)thePath.c_str());
+ if(_local_impl->IsError()) {
+ std::string anErrorCode = _local_impl->GetErrorCode().ToCString();
+ if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed();
+ if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory();
+ if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();
+ }
+ }
+ else _corba_impl->AddDirectory((char*)thePath.c_str());
+}
+
+void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR)
+{
+ SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
+ CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str());
+ SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
+
+ if(_isLocal) {
+ SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb);
+ Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl());
+ bool isDone = _local_impl->LoadWith(aSCO_impl, drv);
+ delete drv;
+ if(!isDone && _local_impl->IsError())
+ THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM);
+ }
+ else {
+ _corba_impl->LoadWith(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), aDriver);
+ }
+}
+
+void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO)
+{
+ SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
+ if(_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+ else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
+}
+
+void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->RemoveObject(aSO->GetLocalImpl());
+ else _corba_impl->RemoveObject(aSO->GetCORBAImpl());
+}
+
+void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl());
+ else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl());
+}
+
+_PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(SObject)& theSO,
+ const std::string& aTypeOfAttribute)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ SALOMEDSClient_GenericAttribute* anAttr = NULL;
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_GenericAttribute) aGA;
+ try {
+ aGA=Handle(SALOMEDSImpl_GenericAttribute)::DownCast(_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(),
+ (char*)aTypeOfAttribute.c_str()));
+ }
+ catch (...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+ anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA);
+ }
+ else {
+ SALOMEDS::GenericAttribute_var aGA = _corba_impl->FindOrCreateAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
+ anAttr = SALOMEDS_GenericAttribute::CreateAttribute(aGA);
+ }
+
+ return _PTR(GenericAttribute)(anAttr);
+}
+
+bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO,
+ _PTR(GenericAttribute)& anAttribute,
+ const std::string& aTypeOfAttribute)
+{
+ bool ret;
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_GenericAttribute) aGA;
+ ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, (char*)aTypeOfAttribute.c_str());
+ if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA));
+ }
+ else {
+ SALOMEDS::GenericAttribute_var aGA;
+ ret = _corba_impl->FindAttribute(aSO->GetCORBAImpl(), aGA.out(), (char*)aTypeOfAttribute.c_str());
+ if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA));
+ }
+
+ return ret;
+}
+
+void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str());
+ else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
+}
+
+void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(me.get());
+ SALOMEDS_SObject* aRefSO = dynamic_cast<SALOMEDS_SObject*>(thereferencedObject.get());
+ if(_isLocal) _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl());
+ else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl());
+}
+
+void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(me.get());
+ if(_isLocal) _local_impl->RemoveReference(aSO->GetLocalImpl());
+ else _corba_impl->RemoveReference(aSO->GetCORBAImpl());
+}
+
+void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+ else _corba_impl->SetGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
+}
+
+bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID)
+{
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ bool ret;
+ if(_isLocal) ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+ else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
+
+ return ret;
+}
+
+void SALOMEDS_StudyBuilder::NewCommand()
+{
+ if(_isLocal) _local_impl->NewCommand();
+ else _corba_impl->NewCommand();
+}
+
+void SALOMEDS_StudyBuilder::CommitCommand()
+{
+ if(_isLocal) {
+ try {
+ _local_impl->CommitCommand();
+ }
+ catch(...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+ }
+ else _corba_impl->CommitCommand();
+}
+
+bool SALOMEDS_StudyBuilder::HasOpenCommand()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->HasOpenCommand();
+ else ret = _corba_impl->HasOpenCommand();
+ return ret;
+}
+
+void SALOMEDS_StudyBuilder::AbortCommand()
+{
+ if(_isLocal) _local_impl->AbortCommand();
+ else _corba_impl->AbortCommand();
+}
+
+void SALOMEDS_StudyBuilder::Undo()
+{
+ if(_isLocal) {
+ try {
+ _local_impl->Undo();
+ }
+ catch(...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+ }
+ else _corba_impl->Undo();
+}
+
+void SALOMEDS_StudyBuilder::Redo()
+{
+ if(_isLocal) {
+ try {
+ _local_impl->Redo();
+ }
+ catch(...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+ }
+ else _corba_impl->Redo();
+}
+
+bool SALOMEDS_StudyBuilder::GetAvailableUndos()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->GetAvailableUndos();
+ else ret = _corba_impl->GetAvailableUndos();
+ return ret;
+}
+
+bool SALOMEDS_StudyBuilder::GetAvailableRedos()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->GetAvailableRedos();
+ else ret = _corba_impl->GetAvailableRedos();
+ return ret;
+}
+
+int SALOMEDS_StudyBuilder::UndoLimit()
+{
+ int aLimit;
+ if(_isLocal) aLimit = _local_impl->UndoLimit();
+ else aLimit = _corba_impl->UndoLimit();
+ return aLimit;
+}
+
+void SALOMEDS_StudyBuilder::UndoLimit(int theLimit)
+{
+ CheckLocked();
+
+ if(_isLocal) _local_impl->UndoLimit(theLimit);
+ else _corba_impl->UndoLimit(theLimit);
+}
+
+void SALOMEDS_StudyBuilder::CheckLocked()
+{
+ //There is only local part as CORBA part throws the correct exeception
+ if(_isLocal) {
+ try {
+ _local_impl->CheckLocked();
+ }
+ catch(...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+ }
+}
+
+void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::string& theValue)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ else _corba_impl->SetName(aSO->GetCORBAImpl(), (char*)theValue.c_str());
+}
+
+void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::string& theValue)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ else _corba_impl->SetComment(aSO->GetCORBAImpl(), (char*)theValue.c_str());
+}
+
+void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string& theValue)
+{
+ CheckLocked();
+
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
+ if(_isLocal) _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str());
+}
+
+void SALOMEDS_StudyBuilder::init_orb()
+{
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(0 , 0 ) ;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDYBUILDER_H__
+#define __SALOMEDS_STUDYBUILDER_H__
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+
+class SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder
+{
+private:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_StudyBuilder) _local_impl;
+ SALOMEDS::StudyBuilder_var _corba_impl;
+ CORBA::ORB_var _orb;
+
+public:
+
+ SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder);
+ SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder);
+ ~SALOMEDS_StudyBuilder();
+
+ virtual _PTR(SComponent) NewComponent(const std::string& ComponentDataType);
+ virtual void DefineComponentInstance (const _PTR(SComponent)&, const std::string& ComponentIOR);
+ virtual void RemoveComponent(const _PTR(SComponent)& theSCO);
+ virtual _PTR(SObject) NewObject(const _PTR(SObject)& theFatherObject);
+ virtual _PTR(SObject) NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag);
+ virtual void AddDirectory(const std::string& thePath);
+ virtual void LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR);
+ virtual void Load(const _PTR(SObject)& theSCO);
+ virtual void RemoveObject(const _PTR(SObject)& theSO);
+ virtual void RemoveObjectWithChildren(const _PTR(SObject)& theSO);
+ virtual _PTR(GenericAttribute) FindOrCreateAttribute(const _PTR(SObject)& theSO,
+ const std::string& aTypeOfAttribute);
+ virtual bool FindAttribute(const _PTR(SObject)& theSO,
+ _PTR(GenericAttribute)& theAttribute,
+ const std::string& aTypeOfAttribute);
+ virtual void RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute);
+ virtual void Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject);
+ virtual void RemoveReference(const _PTR(SObject)& me);
+ virtual void SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID);
+ virtual bool IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID);
+ virtual void NewCommand();
+ virtual void CommitCommand();
+ virtual bool HasOpenCommand();
+ virtual void AbortCommand();
+ virtual void Undo();
+ virtual void Redo();
+ virtual bool GetAvailableUndos();
+ virtual bool GetAvailableRedos();
+ virtual int UndoLimit();
+ virtual void UndoLimit(int theLimit);
+ virtual void SetName(const _PTR(SObject)& theSO, const std::string& theValue);
+ virtual void SetComment(const _PTR(SObject)& theSO, const std::string& theValue);
+ virtual void SetIOR(const _PTR(SObject)& theSO, const std::string& theValue);
+
+private:
+ void CheckLocked();
+ void init_orb();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyBuilder_i.cxx
+// Author : Seregy RUIN
+// Module : SALOME
+
+
+#include "utilities.h"
+#include "SALOMEDS_StudyBuilder_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "Utils_ExceptHandlers.hxx"
+
+#include <TDF_Attribute.hxx>
+#include <stdlib.h>
+
+using namespace std;
+
+UNEXPECT_CATCH(SBSalomeException, SALOME::SALOME_Exception);
+UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection);
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder) theImpl,
+ CORBA::ORB_ptr orb)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _impl = theImpl;
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_StudyBuilder_i::~SALOMEDS_StudyBuilder_i()
+{}
+
+//============================================================================
+/*! Function : NewComponent
+ * Purpose : Create a new component (Scomponent)
+ */
+//============================================================================
+SALOMEDS::SComponent_ptr SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ //char* aDataType = CORBA::string_dup(DataType);
+ Handle(SALOMEDSImpl_SComponent) aSCO = _impl->NewComponent(TCollection_AsciiString((char*)DataType));
+ //CORBA::free_string(aDataType);
+ if(aSCO.IsNull()) return SALOMEDS::SComponent::_nil();
+
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO,_orb);
+ return sco._retn();
+}
+
+//============================================================================
+/*! Function : DefineComponentInstance
+ * Purpose : Add IOR attribute of a Scomponent
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr aComponent,
+ CORBA::Object_ptr IOR)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_SComponent) aSCO;
+ aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID());
+
+ CORBA::String_var iorstr = _orb->object_to_string(IOR);
+ _impl->DefineComponentInstance(aSCO, (char*)iorstr);
+}
+
+//============================================================================
+/*! Function : RemoveComponent
+ * Purpose : Delete a Scomponent
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponent)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ ASSERT(!CORBA::is_nil(aComponent));
+ Handle(SALOMEDSImpl_SComponent) aSCO;
+ aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID());
+ _impl->RemoveComponent(aSCO);
+}
+
+//============================================================================
+/*! Function : NewObject
+ * Purpose : Create a new SObject
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+
+ Handle(SALOMEDSImpl_SObject) aFO, aSO;
+ aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID());
+ aSO = _impl->NewObject(aFO);
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb);
+
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : NewObjectToTag
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
+ CORBA::Long atag)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_SObject) aFO, aSO;
+ aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID());
+ aSO = _impl->NewObjectToTag(aFO, atag);
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : RemoveObject
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ _impl->RemoveObject(aSO);
+}
+
+//============================================================================
+/*! Function : RemoveObjectWithChildren
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ _impl->RemoveObjectWithChildren(aSO);
+}
+
+//============================================================================
+/*! Function : LoadWith
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
+ SALOMEDS::Driver_ptr aDriver) throw(SALOME::SALOME_Exception)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBSalomeException);
+
+ Handle(SALOMEDSImpl_SComponent) aSCO;
+ aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)anSCO->GetID());
+ SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb);
+ bool isDone = _impl->LoadWith(aSCO, driver);
+ delete driver;
+
+ if(!isDone && _impl->IsError()) {
+ THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM);
+ }
+}
+
+
+//============================================================================
+/*! Function : Load
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::Load(SALOMEDS::SObject_ptr sco)
+{
+ MESSAGE ( "This function is not yet implemented");
+}
+
+//============================================================================
+/*! Function : FindOrCreateAttribute
+ * Purpose : Add attribute of given type to SObject, if there is attribute of such type, returns
+ * existing one
+ */
+//============================================================================
+SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr anObject,
+ const char* aTypeOfAttribute)
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_SObject) aSO;
+ CORBA::String_var anID = anObject->GetID();
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject(anID.inout());
+ Handle(TDF_Attribute) anAttr;
+ try {
+ anAttr = _impl->FindOrCreateAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute));
+ }
+ catch (...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+
+ SALOMEDS::GenericAttribute_var anAttribute;
+ anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+
+ return anAttribute._retn();
+}
+
+//============================================================================
+/*! Function : FindAttribute
+ * Purpose : Find attribute of given type assigned SObject, returns Standard_True if it is found
+ */
+//============================================================================
+
+CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anObject,
+ SALOMEDS::GenericAttribute_out anAttribute,
+ const char* aTypeOfAttribute)
+{
+ SALOMEDS::Locker lock;
+ ASSERT(!CORBA::is_nil(anObject));
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ Handle(TDF_Attribute) anAttr;
+
+ if(!_impl->FindAttribute(aSO, anAttr, TCollection_AsciiString((char*)aTypeOfAttribute))) return false;
+
+ anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ return true;
+}
+
+//============================================================================
+/*! Function : RemoveAttribute
+ * Purpose : Remove attribute of given type assigned SObject
+ */
+//============================================================================
+
+void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject,
+ const char* aTypeOfAttribute)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ ASSERT(!CORBA::is_nil(anObject));
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ _impl->RemoveAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute));
+}
+
+//============================================================================
+/*! Function : Addreference
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me,
+ SALOMEDS::SObject_ptr theReferencedObject)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ ASSERT(!CORBA::is_nil(me));
+ ASSERT(!CORBA::is_nil(theReferencedObject));
+
+ Handle(SALOMEDSImpl_SObject) aSO, aRefSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID());
+ aRefSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theReferencedObject->GetID());
+ _impl->Addreference(aSO, aRefSO);
+}
+
+//============================================================================
+/*! Function : RemoveReference
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ ASSERT(!CORBA::is_nil(me));
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID());
+ _impl->RemoveReference(aSO);
+}
+
+
+//============================================================================
+/*! Function : AddDirectory
+ * Purpose : adds a new directory with a path = thePath
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory();
+ if(!_impl->AddDirectory(TCollection_AsciiString((char*)thePath))) {
+ TCollection_AsciiString anErrorCode = _impl->GetErrorCode();
+ if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed();
+ if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory();
+ if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();
+ }
+}
+
+
+//============================================================================
+/*! Function : SetGUID
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ ASSERT(!CORBA::is_nil(anObject));
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ _impl->SetGUID(aSO, TCollection_AsciiString((char*)theGUID));
+}
+
+//============================================================================
+/*! Function : IsGUID
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID)
+{
+ SALOMEDS::Locker lock;
+ ASSERT(!CORBA::is_nil(anObject));
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ return _impl->IsGUID(aSO, TCollection_AsciiString((char*)theGUID));
+}
+
+
+//============================================================================
+/*! Function : NewCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::NewCommand()
+{
+ SALOMEDS::Locker lock;
+ _impl->NewCommand();
+}
+
+//============================================================================
+/*! Function : CommitCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ try {
+ _impl->CommitCommand();
+ }
+ catch(...) {
+ MESSAGE("Locked document modification !!!");
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+}
+
+//============================================================================
+/*! Function : HasOpenCommand
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
+{
+ SALOMEDS::Locker lock;
+ return _impl->HasOpenCommand();
+}
+
+//============================================================================
+/*! Function : AbortCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::AbortCommand()
+{
+ SALOMEDS::Locker lock;
+ _impl->AbortCommand();
+}
+
+//============================================================================
+/*! Function : Undo
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ try {
+ _impl->Undo();
+ }
+ catch(...) {
+ MESSAGE("Locked document modification !!!");
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+}
+
+//============================================================================
+/*! Function : Redo
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ try {
+ _impl->Redo();
+ }
+ catch(...) {
+ MESSAGE("Locked document modification !!!");
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+}
+
+//============================================================================
+/*! Function : GetAvailableUndos
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableUndos()
+{
+ SALOMEDS::Locker lock;
+ return _impl->GetAvailableUndos();
+}
+
+//============================================================================
+/*! Function : GetAvailableRedos
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableRedos()
+{
+ SALOMEDS::Locker lock;
+ return _impl->GetAvailableRedos();
+}
+
+//============================================================================
+/*! Function : UndoLimit
+ * Purpose :
+ */
+//============================================================================
+CORBA::Long SALOMEDS_StudyBuilder_i::UndoLimit()
+{
+ SALOMEDS::Locker lock;
+ return _impl->UndoLimit();
+}
+
+//============================================================================
+/*! Function : UndoLimit
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n)
+{
+ SALOMEDS::Locker lock;
+ CheckLocked();
+ _impl->UndoLimit(n);
+}
+
+//============================================================================
+/*! Function : CheckLocked
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ try {
+ _impl->CheckLocked();
+ }
+ catch(...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+}
+
+//============================================================================
+/*! Function : SetName
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* theValue)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ CheckLocked();
+
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
+ _impl->SetName(aSO, TCollection_AsciiString((char*)theValue));
+}
+
+//============================================================================
+/*! Function : SetComment
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ CheckLocked();
+
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
+ _impl->SetComment(aSO, TCollection_AsciiString((char*)theValue));
+}
+
+//============================================================================
+/*! Function : SetIOR
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+ Unexpect aCatch(SBLockProtection);
+ CheckLocked();
+
+ Handle(SALOMEDSImpl_SObject) aSO;
+ aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
+ _impl->SetIOR(aSO, TCollection_AsciiString((char*)theValue));
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyBuilder_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDYBUILDER_I_H__
+#define __SALOMEDS_STUDYBUILDER_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+
+// Cascade header
+#include <TDocStd_Document.hxx>
+
+class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder,
+ public PortableServer::RefCountServantBase
+{
+private:
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_StudyBuilder) _impl; // OCAF Document
+public:
+
+ SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder), CORBA::ORB_ptr);
+
+ ~SALOMEDS_StudyBuilder_i();
+
+ //! NewComponent
+ /*!
+ \param ComponentDataType
+ \return <ReturnValue>
+ */
+ virtual SALOMEDS::SComponent_ptr NewComponent(const char* ComponentDataType);
+
+ //! DefineComponentInstance
+ /*!
+ \param SComponent_ptr
+ \param ComponentIOR
+ */
+ virtual void DefineComponentInstance (SALOMEDS::SComponent_ptr, CORBA::Object_ptr ComponentIOR);
+
+ //!
+ /*!
+ <long-description>
+
+ \param aComponent
+ */
+ virtual void RemoveComponent(SALOMEDS::SComponent_ptr aComponent);
+
+ //!
+ /*!
+ <long-description>
+
+ \param theFatherObject
+ \return <ReturnValue>
+ */
+ virtual SALOMEDS::SObject_ptr NewObject(SALOMEDS::SObject_ptr theFatherObject);
+ //!
+ /*!
+ <long-description>
+
+ \param theFatherObject
+ \param atag
+ \return <ReturnValue>
+ */
+ virtual SALOMEDS::SObject_ptr NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject, CORBA::Long atag);
+
+ /*!
+ The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
+ */
+ virtual void AddDirectory(const char* thePath);
+
+ virtual void LoadWith(SALOMEDS::SComponent_ptr sco, SALOMEDS::Driver_ptr Engine)
+ throw(SALOME::SALOME_Exception);
+ virtual void Load(SALOMEDS::SObject_ptr sco);
+
+ virtual void RemoveObject(SALOMEDS::SObject_ptr anObject);
+ virtual void RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject);
+
+ virtual SALOMEDS::GenericAttribute_ptr FindOrCreateAttribute(SALOMEDS::SObject_ptr anObject, const char* aTypeOfAttribute);
+ virtual CORBA::Boolean FindAttribute(SALOMEDS::SObject_ptr anObject, SALOMEDS::GenericAttribute_out anAttribute, const char* aTypeOfAttribute);
+ virtual void RemoveAttribute(SALOMEDS::SObject_ptr anObject, const char* aTypeOfAttribute);
+
+ virtual void Addreference(SALOMEDS::SObject_ptr me, SALOMEDS::SObject_ptr thereferencedObject);
+
+ virtual void RemoveReference(SALOMEDS::SObject_ptr me);
+
+ virtual void SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID);
+ virtual bool IsGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID);
+
+ virtual void NewCommand();
+ virtual void CommitCommand() throw(SALOMEDS::StudyBuilder::LockProtection);
+ virtual CORBA::Boolean HasOpenCommand();
+ virtual void AbortCommand();
+ virtual void Undo() throw(SALOMEDS::StudyBuilder::LockProtection);
+ virtual void Redo() throw(SALOMEDS::StudyBuilder::LockProtection);
+ CORBA::Boolean GetAvailableUndos();
+ CORBA::Boolean GetAvailableRedos();
+ CORBA::Boolean IsSaved();
+ CORBA::Boolean IsModified();
+ virtual CORBA::Long UndoLimit();
+ virtual void UndoLimit(CORBA::Long);
+
+ void CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection);
+
+ virtual void SetName(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
+ virtual void SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
+ virtual void SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_StudyManager.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_StudyManager.hxx"
+
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_Driver_i.hxx"
+
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include <string>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+SALOMEDS_Driver_i* GetDriver(const Handle(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
+
+ long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ if(_isLocal) {
+ _local_impl = ((SALOMEDSImpl_StudyManager*)(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
+
+ long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ if(_isLocal) {
+ _local_impl = ((SALOMEDSImpl_StudyManager*)(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);
+}
+
+void 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());
+ _corba_impl->Save(aStudy, theMultiFile);
+}
+
+void 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());
+ _corba_impl->SaveASCII(aStudy, theMultiFile);
+}
+
+void 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());
+ _corba_impl->SaveAs((char*)theUrl.c_str(), aStudy, theMultiFile);
+}
+
+void 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());
+ _corba_impl->SaveAsASCII((char*)theUrl.c_str(), aStudy, theMultiFile);
+}
+
+std::vector<std::string> SALOMEDS_StudyManager::GetOpenStudies()
+{
+ std::vector<std::string> aVector;
+ int aLength, i;
+
+ if(_isLocal) {
+ Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetOpenStudies();
+ aLength = aSeq->Length();
+ for(i = 1; i <= aLength; i++)
+ aVector.push_back(Handle(SALOMEDSImpl_Study)::DownCast(aSeq->Value(i))->Name().ToCString());
+ }
+ 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) {
+ Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByName((char*)theStudyName.c_str());
+ if(aStudy_impl.IsNull()) 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) {
+ Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByID(theStudyID);
+ if(aStudy_impl.IsNull()) 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<SALOMEDS_SObject*>(theSO.get());
+ bool ret;
+
+ if(_isLocal) {
+ Handle(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<SALOMEDS_SObject*>(theSO.get());
+ bool ret;
+ if(_isLocal) {
+ Handle(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<SALOMEDS_SObject*>(theSO.get());
+ bool ret;
+
+ if(_isLocal) {
+ Handle(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<SALOMEDS_SObject*>(theSO.get());
+ SALOMEDSClient_SObject* aResult = NULL;
+
+ if(_isLocal) {
+ Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
+ SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
+ Handle(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_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ _orb = init(0 , 0 ) ;
+}
+
+SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb)
+{
+ SALOMEDS_Driver_i* driver = NULL;
+
+ Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent();
+ if(!aSCO.IsNull()) {
+ TCollection_AsciiString IOREngine = aSCO->GetIOR();
+ if(!IOREngine.IsEmpty()) {
+ CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString());
+ SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+ driver = new SALOMEDS_Driver_i(Engine, orb);
+ }
+ }
+
+ return driver;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyManager.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDYMANAGER_H__
+#define __SALOMEDS_STUDYMANAGER_H__
+
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_StudyManager.hxx"
+
+// IDL headers
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class Standard_EXPORT SALOMEDS_StudyManager: public SALOMEDSClient_StudyManager
+{
+private:
+ bool _isLocal;
+ Handle(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 void Save(const _PTR(Study)& theStudy, bool theMultiFile);
+ virtual void SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile);
+ virtual void SaveAs(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile);
+ virtual void SaveAsASCII(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile);
+ virtual std::vector<std::string> 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
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// 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 <TColStd_HArray1OfCharacter.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include "Utils_CorbaException.hxx"
+
+#include <strstream>
+#include <map>
+using namespace std;
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+#include "SALOME_GenericObj_i.hh"
+
+#include "Utils_ExceptHandlers.hxx"
+
+UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception);
+UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection);
+
+static SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb);
+
+static std::map<int, PortableServer::POA_ptr> _mapOfPOA;
+
+//============================================================================
+/*! Function : SALOMEDS_StudyManager_i
+ * Purpose : SALOMEDS_StudyManager_i constructor
+ */
+//============================================================================
+SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _poa = PortableServer::POA::_duplicate(thePOA);
+ _name_service = new SALOME_NamingService(_orb);
+ // Study directory creation in the naming service : to register all
+ // open studies in the session
+ _name_service->Create_Directory("/Study");
+ _impl = new SALOMEDSImpl_StudyManager;
+ _factory = new SALOMEDS_DriverFactory_i(_orb);
+}
+
+//============================================================================
+/*! Function : ~SALOMEDS_StudyManager_i
+ * Purpose : SALOMEDS_StudyManager_i destructor
+ */
+//============================================================================
+SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i()
+{
+ // Destroy directory to register open studies
+ _name_service->Destroy_Directory("/Study");
+ delete _factory;
+}
+
+//============================================================================
+/*! Function : register_name
+ * Purpose : Register the study Manager in the naming service under the
+ * context name
+ */
+//============================================================================
+void SALOMEDS_StudyManager_i::register_name(char * name)
+{
+ SALOMEDS::StudyManager_var aManager(_this());
+ _name_service->Register(aManager.in(), name);
+}
+
+
+//============================================================================
+/*! Function : NewStudy
+ * Purpose : Create a New Study of name study_name
+ */
+//============================================================================
+SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->NewStudy(TCollection_AsciiString((char*)study_name));
+ if(aStudyImpl.IsNull()) {
+ MESSAGE("NewStudy : Error : " << _impl->GetErrorCode());
+ return SALOMEDS::Study::_nil();
+ }
+
+ MESSAGE("NewStudy : Creating the CORBA servant holding it... ");
+
+ SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
+ SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+
+ // Register study in the naming service
+ // Path to acces the study
+ if(!_name_service->Change_Directory("/Study"))
+ MESSAGE( "Unable to access the study directory" )
+ else
+ _name_service->Register(Study, study_name);
+
+ // Assign the value of the IOR in the study->root
+ const char* IORStudy = _orb->object_to_string(Study);
+
+ aStudyImpl->SetTransientReference((char*)IORStudy);
+
+ _mapOfPOA[Study->StudyId()] = _poa;
+
+ return Study;
+}
+
+//============================================================================
+/*! Function : Open
+ * Purpose : Open a Study from it's persistent reference
+ */
+//============================================================================
+SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl)
+ throw(SALOME::SALOME_Exception)
+{
+ SALOMEDS::Locker lock;
+
+ Unexpect aCatch(SalomeException);
+ MESSAGE("Begin of SALOMEDS_StudyManager_i::Open");
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->Open(TCollection_AsciiString((char*)aUrl));
+
+ MESSAGE("Open : Creating the CORBA servant holding it... ");
+
+ // Temporary aStudyUrl in place of study name
+ SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
+ SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+
+ // Assign the value of the IOR in the study->root
+ CORBA::String_var IORStudy = _orb->object_to_string(Study);
+ aStudyImpl->SetTransientReference((char*)IORStudy);
+
+ // Register study in the naming service
+ // Path to acces the study
+ if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
+ else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().ToCString()));
+
+ return Study;
+}
+
+
+
+//============================================================================
+/*! Function : Close
+ * Purpose : Close a study.
+ * If the study hasn't been saved, ask the user to confirm the
+ * close action without saving
+ */
+//============================================================================
+void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy)
+{
+ SALOMEDS::Locker lock;
+
+ if(aStudy->_is_nil()) return;
+
+ // Destroy study name in the naming service
+ if(_name_service->Change_Directory("/Study")){
+ CORBA::String_var aString(aStudy->Name());
+ _name_service->Destroy_Name(aString.in());
+ }
+
+ SALOMEDS::unlock();
+ aStudy->Close();
+ SALOMEDS::lock();
+}
+
+//============================================================================
+/*! Function : Save
+ * Purpose : Save a Study to it's persistent reference
+ */
+//============================================================================
+void SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+{
+ SALOMEDS::Locker lock;
+
+ if(aStudy->_is_nil()) {
+ MESSAGE("Save error: Study is null");
+ return;
+ }
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ _impl->Save(aStudyImpl, _factory, theMultiFile);
+}
+
+void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+{
+ SALOMEDS::Locker lock;
+
+ if(aStudy->_is_nil()) {
+ MESSAGE("SaveASCII error: Study is null");
+ return;
+ }
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ _impl->SaveASCII(aStudyImpl, _factory, theMultiFile);
+}
+
+//=============================================================================
+/*! Function : SaveAs
+ * Purpose : Save a study to the persistent reference aUrl
+ */
+//============================================================================
+void SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+{
+ SALOMEDS::Locker lock;
+
+ if(aStudy->_is_nil()) {
+ MESSAGE("SaveASCII error: Study is null");
+ return;
+ }
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+}
+
+void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
+{
+ SALOMEDS::Locker lock;
+
+ if(aStudy->_is_nil()) {
+ MESSAGE("SaveASCII error: Study is null");
+ return;
+ }
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+}
+
+//============================================================================
+/*! Function : GetOpenStudies
+ * Purpose : Get name list of open studies in the session
+ */
+//============================================================================
+SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies()
+{
+ SALOMEDS::Locker lock;
+
+ Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies();
+ int aLength = anOpened->Length();
+
+ SALOMEDS::ListOfOpenStudies_var _list_open_studies = new SALOMEDS::ListOfOpenStudies;
+ _list_open_studies->length(aLength);
+
+ if(!aLength)
+ {
+ MESSAGE("No active study in this session");
+ }
+ else
+ {
+ for (unsigned int ind=1; ind <= aLength; ind++)
+ {
+ Handle(SALOMEDSImpl_Study) aStudy = Handle(SALOMEDSImpl_Study)::DownCast(anOpened->Value(ind));
+ _list_open_studies[ind-1] = CORBA::string_dup(aStudy->Name().ToCString());
+ SCRUTE(_list_open_studies[ind-1]) ;
+ }
+ }
+ return _list_open_studies._retn();
+}
+
+//============================================================================
+/*! Function : GetStudyByName
+ * Purpose : Get a study from its name
+ */
+//============================================================================
+SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyName)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl =
+ _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName));
+
+ if (aStudyImpl.IsNull())
+ {
+ MESSAGE(_impl->GetErrorCode().ToCString());
+ return SALOMEDS::Study::_nil();
+ }
+
+ SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this());
+
+ return aStudy._retn();
+}
+
+//============================================================================
+/*! Function : GetStudyByID
+ * Purpose : Get a study from its ID
+ */
+//============================================================================
+SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID);
+
+ if (aStudyImpl.IsNull())
+ {
+ MESSAGE(_impl->GetErrorCode().ToCString());
+ return SALOMEDS::Study::_nil();
+ }
+
+ SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this());
+
+ return aStudy._retn();
+}
+
+
+//============================================================================
+/*! Function : CanCopy
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::Study_var aStudy = theObject->GetStudy();
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+
+ SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
+ bool ret = _impl->CanCopy(anObject, aDriver);
+ delete aDriver;
+ return ret;
+}
+
+//============================================================================
+/*! Function : Copy
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::Study_var aStudy = theObject->GetStudy();
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+
+ SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
+ bool ret = _impl->Copy(anObject, aDriver);
+ delete aDriver;
+ return ret;
+}
+
+//============================================================================
+/*! Function : CanPaste
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::Study_var aStudy = theObject->GetStudy();
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+
+ SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
+ bool ret = _impl->CanPaste(anObject, aDriver);
+ delete aDriver;
+ return ret;
+}
+
+//============================================================================
+/*! Function : Paste
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theObject)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+ SALOMEDS::Locker lock;
+
+ Unexpect aCatch(LockProtection);
+ SALOMEDS::Study_var aStudy = theObject->GetStudy();
+
+ Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+ Handle(SALOMEDSImpl_SObject) aNewSO;
+
+ try {
+ SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
+ aNewSO = _impl->Paste(anObject, aDriver);
+ delete aDriver;
+ }
+ catch (...) {
+ throw SALOMEDS::StudyBuilder::LockProtection();
+ }
+
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aNewSO, _orb);
+ return so._retn();
+}
+
+
+SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb)
+{
+ SALOMEDS_Driver_i* driver = NULL;
+
+ Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent();
+ if(!aSCO.IsNull()) {
+ TCollection_AsciiString IOREngine = aSCO->GetIOR();
+ if(!IOREngine.IsEmpty()) {
+ CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString());
+ SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+ driver = new SALOMEDS_Driver_i(Engine, orb);
+ }
+ }
+
+ return driver;
+}
+
+PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_ptr theStudy) {
+ if (_mapOfPOA.find(theStudy->StudyId()) != _mapOfPOA.end()) return _mapOfPOA[theStudy->StudyId()];
+ return PortableServer::POA::_nil();
+}
+
+//===========================================================================
+// PRIVATE FUNCTIONS
+//===========================================================================
+long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+ isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ SALOMEDSImpl_StudyManager* aManager = _impl.operator->();
+ return ((long)aManager);
+}
+
+//===========================================================================
+namespace SALOMEDS
+{
+/*
+ CORBA::Object_var
+ GetObject(const TDF_Label& theLabel, CORBA::ORB_ptr theORB)
+ {
+ try {
+ Handle(SALOMEDS_IORAttribute) anAttr;
+ if(theLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr))
+ return theORB->string_to_object(TCollection_AsciiString(anAttr->Get()).ToCString());
+ }catch(...){
+ }
+ return CORBA::Object::_nil();
+ }
+*/
+
+ PortableServer::ServantBase_var
+ GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA)
+ {
+ if(CORBA::is_nil(theObject))
+ return NULL;
+ try{
+ return thePOA->reference_to_servant(theObject);
+ }catch(...){
+ return NULL;
+ }
+ }
+
+}
+
+//===========================================================================
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_StudyManager_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDYMANAGER_I_H__
+#define __SALOMEDS_STUDYMANAGER_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+// Naming Service header
+#include "SALOME_NamingService.hxx"
+
+#include <stdlib.h>
+
+//Standard not implemented
+#include <Standard_NotImplemented.hxx>
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDSImpl_StudyManager.hxx"
+
+namespace SALOMEDS{
+
+ // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object
+ /* CORBA::Object_var GetObject(const TDF_Label&, CORBA::ORB_ptr); */
+
+ // To convert CORBA::Object to PortableServer::ServantBase
+ PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
+
+}
+
+class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager,
+ public PortableServer::RefCountServantBase {
+private:
+
+ CORBA::ORB_ptr _orb;
+ PortableServer::POA_var _poa;
+ Handle(SALOMEDSImpl_StudyManager) _impl;
+ SALOME_NamingService* _name_service;
+ SALOMEDS_DriverFactory_i* _factory;
+
+public:
+
+ //! standard constructor
+ SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
+
+ //! standard destructor
+ virtual ~SALOMEDS_StudyManager_i();
+
+ //! method to Register study Manager in the naming service
+ /*!
+ \param char* arguments, the context to register the study manager in the NS
+ */
+ void register_name(char * name);
+
+ //! method to Create a New Study of name study_name
+ /*!
+ \param char* arguments, the new study name
+ \return Study_ptr arguments
+ */
+ virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
+
+ //! method to Open a Study from it's persistent reference
+ /*!
+ \param char* arguments, the study URL
+ \return Study_ptr arguments
+ */
+ virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
+
+
+ //! method to close a Study
+ /*!
+ \param Study_ptr arguments
+ */
+ virtual void Close( SALOMEDS::Study_ptr aStudy);
+
+ //! method to save a Study
+ /*!
+ \param Study_ptr arguments
+ */
+ virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+
+ virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+
+ //! method to save a Study to the persistent reference aUrl
+ /*!
+ \param char* arguments, the new URL of the study
+ \param Study_ptr arguments
+ */
+ virtual void SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+ virtual void SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
+
+ //! method to Get name list of open studies in the session
+ /*!
+ \return ListOfOpenStudies* arguments
+ */
+ virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
+
+ //! method to get a Study from it's name
+ /*!
+ \param char* arguments, the study name
+ \return Study_ptr arguments
+ */
+ virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
+
+ //! method to get a Study from it's ID
+ /*!
+ \param char* arguments, the study ID
+ \return Study_ptr arguments
+ */
+ virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
+
+ virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
+ virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
+ virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
+ virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
+
+ virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
+ virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
+
+ void ping(){};
+
+ virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+
+ static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 CEA/DEN, EDF R&D
+--
+--
+--
+-- File : SALOMEDS_StudyPropertiesAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class StudyPropertiesAttribute from SALOMEDS inherits Attribute from TDF
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ Data from TDF,
+ ExtendedString from TCollection,
+ HSequenceOfExtendedString from TColStd,
+ HSequenceOfInteger from TColStd
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF)
+ returns StudyPropertiesAttribute from SALOMEDS;
+
+ ---Purpose: Common methods
+ -- ============
+
+ Create
+ returns mutable StudyPropertiesAttribute from SALOMEDS;
+
+ Init(me: mutable);
+
+ SetUserName(me: mutable; theName : ExtendedString from TCollection);
+ GetCreatorName(me) returns ExtendedString from TCollection;
+ GetUserNames(me) returns HSequenceOfExtendedString from TColStd;
+ SetFirstName(me: mutable; theName : ExtendedString from TCollection);
+
+ SetModificationDate(me: mutable; theMinute, theHour, theDay, theMonth, theYear : Integer from Standard);
+ GetCreationDate(me; theMinute, theHour, theDay, theMonth, theYear : out Integer from Standard)
+ returns Boolean from Standard;
+ GetModificationDates(me; theMinutes, theHours, theDays, theMonths, theYears : out HSequenceOfInteger from TColStd);
+
+ SetCreationMode(me: mutable; theMode : Integer from Standard);
+ GetCreationMode(me) returns Integer from Standard;
+
+ SetModified(me: mutable; theModified : Integer from Standard);
+ IsModified(me) returns Boolean from Standard;
+ GetModified(me) returns Integer from Standard;
+
+ SetLocked(me: mutable; theLocked : Boolean from Standard);
+ IsLocked(me) returns Boolean from Standard;
+ IsLockChanged(me: mutable; theErase : Boolean from Standard) returns Boolean from Standard;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+fields
+
+ myUserName : HSequenceOfExtendedString from TColStd;
+ myMinute : HSequenceOfInteger from TColStd;
+ myHour : HSequenceOfInteger from TColStd;
+ myDay : HSequenceOfInteger from TColStd;
+ myMonth : HSequenceOfInteger from TColStd;
+ myYear : HSequenceOfInteger from TColStd;
+ myMode : Integer from Standard;
+ myModified : Integer from Standard;
+ myLocked : Boolean from Standard;
+ myLockChanged : Boolean from Standard;
+
+end StudyPropertiesAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Study_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "utilities.h"
+#include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS_UseCaseIterator_i.hxx"
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_AttributeStudyProperties_i.hxx"
+#include "SALOMEDS_ChildIterator_i.hxx"
+#include "SALOMEDS_Driver_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+
+#include <TColStd_SequenceOfExtendedString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+#include <TDF_Label.hxx>
+#include <TDF_Attribute.hxx>
+
+#ifdef WIN32
+#include <process.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include "OpUtil.hxx"
+
+using namespace std;
+
+//============================================================================
+/*! Function : SALOMEDS_Study_i
+ * Purpose : SALOMEDS_Study_i constructor
+ */
+//============================================================================
+SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl,
+ CORBA::ORB_ptr orb)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _impl = theImpl;
+
+ _builder = new SALOMEDS_StudyBuilder_i(_impl->NewBuilder(), _orb);
+}
+
+//============================================================================
+/*! Function : ~SALOMEDS_Study_i
+ * Purpose : SALOMEDS_Study_i destructor
+ */
+//============================================================================
+SALOMEDS_Study_i::~SALOMEDS_Study_i()
+{
+}
+
+//============================================================================
+/*! Function : GetPersistentReference
+ * Purpose : Get persistent reference of study (idem URL())
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetPersistentReference()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->GetPersistentReference().ToCString());
+}
+//============================================================================
+/*! Function : GetTransientReference
+ * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetTransientReference()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->GetTransientReference().ToCString());
+}
+
+//============================================================================
+/*! Function : IsEmpty
+ * Purpose : Detect if study is empty
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsEmpty()
+{
+ SALOMEDS::Locker lock;
+ return _impl->IsEmpty();
+}
+
+//============================================================================
+/*! Function : FindComponent
+ * Purpose : Find a Component with ComponentDataType = aComponentName
+ */
+//============================================================================
+SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponent (const char* aComponentName)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName));
+ if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
+
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
+ return sco._retn();
+}
+
+//============================================================================
+/*! Function : FindComponentID
+ * Purpose : Find a Component from it's ID
+ */
+//============================================================================
+SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponentID)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID));
+ if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
+
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
+ return sco._retn();
+}
+
+//============================================================================
+/*! Function : FindObject
+ * Purpose : Find an Object with SALOMEDS::Name = anObjectName
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* anObjectName)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName));
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+
+ if(aSO->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_SComponent)) {
+ Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO);
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO, _orb);
+ return sco._retn();
+ }
+
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : FindObjectID
+ * Purpose : Find an Object with ID = anObjectID
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID));
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : CreateObjectID
+ * Purpose : Creates an Object with ID = anObjectID
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID);
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : FindObjectByName
+ * Purpose : Find Objects with SALOMEDS::Name = anObjectName in a Component
+ * : with ComponentDataType = aComponentName
+ */
+//============================================================================
+SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindObjectByName( const char* anObjectName,
+ const char* aComponentName )
+{
+ SALOMEDS::Locker lock;
+
+ Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName),
+ TCollection_AsciiString((char*)aComponentName));
+ int aLength = aSeq->Length();
+ SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ;
+ listSO->length(aLength);
+ for(int i = 1; i<=aLength; i++) {
+ Handle(SALOMEDSImpl_SObject) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i));
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ listSO[i-1] = so ;
+ }
+ return listSO._retn() ;
+}
+
+//============================================================================
+/*! Function : FindObjectIOR
+ * Purpose : Find an Object with IOR = anObjectIOR
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* anObjectIOR)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectIOR(TCollection_AsciiString((char*)anObjectIOR));
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : FindObjectByPath
+ * Purpose : Find an Object by its path = thePath
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath));
+ if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
+
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : GetObjectPath
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ TCollection_AsciiString aPath("");
+ if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.ToCString());
+ Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDS::SObject_var aSObj = SALOMEDS::SObject::_narrow(theObject);
+
+ if(!CORBA::is_nil(aSObj)) {
+ aSO = _impl->FindObjectID(aSObj->GetID());
+ }
+ else {
+ aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject));
+ }
+
+ if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString());
+
+ aPath = _impl->GetObjectPath(aSO);
+ return CORBA::string_dup(aPath.ToCString());
+}
+
+
+//============================================================================
+/*! Function : SetContext
+ * Purpose : Sets the current context
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetContext(const char* thePath)
+{
+ SALOMEDS::Locker lock;
+
+ _impl->SetContext(TCollection_AsciiString((char*)thePath));
+ if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext")
+ throw SALOMEDS::Study::StudyInvalidContext();
+}
+
+//============================================================================
+/*! Function : GetContext
+ * Purpose : Gets the current context
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetContext()
+{
+ SALOMEDS::Locker lock;
+
+ if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
+ return CORBA::string_dup(_impl->GetContext().ToCString());
+}
+
+//============================================================================
+/*! Function : GetObjectNames
+ * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+ if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetObjectNames(TCollection_AsciiString((char*)theContext));
+ int aLength = aSeq->Length();
+ aResult->length(aLength);
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ }
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : GetDirectoryNames
+ * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+ if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext));
+ int aLength = aSeq->Length();
+ aResult->length(aLength);
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ }
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : GetFileNames
+ * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+ if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetFileNames(TCollection_AsciiString((char*)theContext));
+ int aLength = aSeq->Length();
+ aResult->length(aLength);
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ }
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : GetComponentNames
+ * Purpose : method to get all components names
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+ if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetComponentNames(TCollection_AsciiString((char*)theContext));
+ int aLength = aSeq->Length();
+ aResult->length(aLength);
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ }
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : NewChildIterator
+ * Purpose : Create a ChildIterator from an SObject
+ */
+//============================================================================
+SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr theSO)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID());
+ Handle(SALOMEDSImpl_ChildIterator) anItr = new SALOMEDSImpl_ChildIterator(aSO);
+
+ //Create iterator
+ SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
+ SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this());
+
+ return it;
+}
+
+
+//============================================================================
+/*! Function : NewComponentIterator
+ * Purpose : Create a SComponentIterator
+ */
+//============================================================================
+SALOMEDS::SComponentIterator_ptr SALOMEDS_Study_i::NewComponentIterator()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_SComponentIterator_i* _it = new SALOMEDS_SComponentIterator_i(_impl->NewComponentIterator(), _orb);
+ _it->Init();
+ return _it->_this();
+}
+
+
+//============================================================================
+/*! Function : NewBuilder
+ * Purpose : Create a StudyBuilder
+ */
+//============================================================================
+SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder()
+{
+ SALOMEDS::Locker lock;
+ return _builder->_this();
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : get study name
+ */
+//============================================================================
+char* SALOMEDS_Study_i::Name()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->Name().ToCString());
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : set study name
+ */
+//============================================================================
+void SALOMEDS_Study_i::Name(const char* name)
+{
+ SALOMEDS::Locker lock;
+ _impl->Name(TCollection_AsciiString((char*)name));
+}
+
+//============================================================================
+/*! Function : IsSaved
+ * Purpose : get if study has been saved
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsSaved()
+{
+ SALOMEDS::Locker lock;
+ return _impl->IsSaved();
+}
+
+//============================================================================
+/*! Function : IsSaved
+ * Purpose : set if study has been saved
+ */
+//============================================================================
+void SALOMEDS_Study_i::IsSaved(CORBA::Boolean save)
+{
+ SALOMEDS::Locker lock;
+ _impl->IsSaved(save);
+}
+
+//============================================================================
+/*! Function : IsModified
+ * Purpose : Detect if a Study has been modified since it has been saved
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsModified()
+{
+ SALOMEDS::Locker lock;
+ return _impl->IsModified();
+}
+
+//============================================================================
+/*! Function : URL
+ * Purpose : get URL of the study (persistent reference of the study)
+ */
+//============================================================================
+char* SALOMEDS_Study_i::URL()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->URL().ToCString());
+}
+
+//============================================================================
+/*! Function : URL
+ * Purpose : set URL of the study (persistent reference of the study)
+ */
+//============================================================================
+void SALOMEDS_Study_i::URL(const char* url)
+{
+ SALOMEDS::Locker lock;
+ _impl->URL(TCollection_AsciiString((char*)url));
+}
+
+
+CORBA::Short SALOMEDS_Study_i::StudyId()
+{
+ SALOMEDS::Locker lock;
+ return _impl->StudyId();
+}
+
+void SALOMEDS_Study_i::StudyId(CORBA::Short id)
+{
+ SALOMEDS::Locker lock;
+ _impl->StudyId(id);
+}
+
+void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry)
+{
+ SALOMEDS::Locker lock;
+ _impl->UpdateIORLabelMap(TCollection_AsciiString((char*)anIOR), TCollection_AsciiString((char*)anEntry));
+}
+
+SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb)
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_AttributeIOR) Att;
+ if (theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)){
+ char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Value()).ToCString());
+ CORBA::Object_var obj = orb->string_to_object(IOR);
+ SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
+ ASSERT(!CORBA::is_nil(aStudy));
+ return SALOMEDS::Study::_duplicate(aStudy);
+ } else {
+ MESSAGE("GetStudy: Problem to get study");
+ }
+ return SALOMEDS::Study::_nil();
+}
+
+void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute)
+{
+ SALOMEDS::Locker lock;
+ SALOMEDSImpl_Study::IORUpdated(theAttribute);
+}
+
+SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::GenericAttribute_ptr aTarget;
+ if (anObject->FindAttribute(aTarget,"AttributeTarget")) {
+ return SALOMEDS::AttributeTarget::_narrow(aTarget)->Get();
+ }
+ SALOMEDS::Study::ListOfSObject* aList = new SALOMEDS::Study::ListOfSObject;
+ aList->length(0);
+ return aList;
+}
+
+
+SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties()
+{
+ SALOMEDS::Locker lock;
+
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties();
+ SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb);
+ return SP->AttributeStudyProperties::_this();
+}
+
+char* SALOMEDS_Study_i::GetLastModificationDate()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->GetLastModificationDate().ToCString());
+}
+
+SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate()
+{
+ SALOMEDS::Locker lock;
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate();
+ int aLength = aSeq->Length();
+ SALOMEDS::ListOfDates_var aDates = new SALOMEDS::ListOfDates;
+ aDates->length(aLength);
+
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aDates[anIndex-1] = CORBA::string_dup(aSeq->Value(anIndex).ToCString());
+ }
+ return aDates._retn();
+}
+
+
+
+//============================================================================
+/*! Function : GetUseCaseBuilder
+ * Purpose : Returns a UseCase builder
+ */
+//============================================================================
+SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder()
+{
+ SALOMEDS::Locker lock;
+ SALOMEDS_UseCaseBuilder_i* UCBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb);
+ return UCBuilder->_this();
+}
+
+
+//============================================================================
+/*! Function : Close
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::Close()
+{
+ SALOMEDS::Locker lock;
+
+ RemovePostponed(-1);
+
+ SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
+
+ for (; itcomponent->More(); itcomponent->Next()) {
+ SALOMEDS::SComponent_var sco = itcomponent->Value();
+
+ MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
+ // if there is an associated Engine call its method for closing
+ CORBA::String_var IOREngine;
+ if (sco->ComponentIOR(IOREngine)) {
+ // we have found the associated engine to write the data
+ MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
+ CORBA::Object_var obj = _orb->string_to_object(IOREngine);
+ if (!CORBA::is_nil(obj)) {
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+
+ if (!anEngine->_is_nil()) {
+ SALOMEDS::unlock();
+ anEngine->Close(sco);
+ SALOMEDS::lock();
+ }
+ }
+ }
+ }
+ _impl->Close();
+}
+
+//============================================================================
+/*! Function : AddPostponed
+ * Purpose :
+ */
+ //============================================================================
+void SALOMEDS_Study_i::AddPostponed(const char* theIOR)
+{
+ SALOMEDS::Locker lock;
+
+ CORBA::Object_var obj = _orb->string_to_object(theIOR);
+ if (!CORBA::is_nil(obj)) {
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
+ if (!CORBA::is_nil(aGeneric)) _impl->AddPostponed((char*)theIOR);
+ }
+}
+
+void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR)
+{
+ SALOMEDS::Locker lock;
+
+ CORBA::Object_var obj = _orb->string_to_object(theIOR);
+ if (!CORBA::is_nil(obj)) {
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
+ if (!CORBA::is_nil(aGeneric)) _impl->AddCreatedPostponed((char*)theIOR);
+ }
+}
+
+//============================================================================
+/*! Function : RemovePostponed
+ * Purpose :
+ */
+//============================================================================
+#ifndef WNT
+void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit)
+#else
+void SALOMEDS_Study_i::RemovePostponed(CORBA::Long theUndoLimit)
+#endif
+{
+ SALOMEDS::Locker lock;
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->RemovePostponed(theUndoLimit);
+ int aLegth = aSeq->Length();
+ for(int i = 1; i <= aLegth; i++) {
+ TCollection_AsciiString anIOR = aSeq->Value(i);
+ //mkr : fix for bug IPAL9408 : check the length of anIOR
+ // before take value from it
+ if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'c') {
+ CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+ if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+ }
+ else if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'd') {
+ CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+ if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+ }
+ else {
+ try {
+ CORBA::Object_var obj = _orb->string_to_object(anIOR.ToCString());
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+ if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+ } catch (...) {}
+ }
+ }
+}
+
+//============================================================================
+/*! Function : UndoPostponed
+ * Purpose :
+ */
+//============================================================================
+#ifndef WNT
+void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay)
+#else
+void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
+#endif
+{
+ SALOMEDS::Locker lock;
+
+ _impl->UndoPostponed(theWay);
+}
+
+
+//============================================================================
+/*! Function : DumpStudy
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished)
+{
+ SALOMEDS::Locker lock;
+
+ TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName);
+ SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
+ CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory);
+ delete factory;
+ return ret;
+}
+
+//===========================================================================
+// PRIVATE FUNCTIONS
+//===========================================================================
+long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal)
+{
+#ifdef WIN32
+ long pid = (long)_getpid();
+#else
+ long pid = (long)getpid();
+#endif
+ isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ SALOMEDSImpl_Study* local_impl = _impl.operator->();
+ return ((long)local_impl);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Study_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_STUDY_I_H__
+#define __SALOMEDS_STUDY_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+#include <stdio.h>
+
+//SALOMEDS headers
+#include "SALOMEDS_SComponentIterator_i.hxx"
+#include "SALOMEDS_StudyBuilder_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_UseCaseBuilder_i.hxx"
+
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+
+class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study,
+ public PortableServer::RefCountServantBase
+{
+private:
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_Study) _impl;
+ SALOMEDS_StudyBuilder_i* _builder;
+
+public:
+
+ //! standard constructor
+ SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr);
+
+ //! standard destructor
+ virtual ~SALOMEDS_Study_i();
+
+ //! method to Get persistent reference of study (idem URL())
+ /*!
+ \sa URL()
+ \return char* arguments, the persistent reference of the study
+ */
+ virtual char* GetPersistentReference();
+
+
+ //! method to Get transient reference of study
+ /*!
+ \return char* arguments, the transient reference of the study
+ */
+ virtual char* GetTransientReference();
+
+ //! method to detect if a study is empty
+ /*!
+ \return bool arguments, true if study is empty
+ */
+ virtual CORBA::Boolean IsEmpty();
+
+ //! method to Find a Component with ComponentDataType = aComponentName
+ /*!
+ \param aComponentName char* arguments
+ \return SComponent_ptr arguments, the component found
+ */
+ virtual SALOMEDS::SComponent_ptr FindComponent (const char* aComponentName);
+
+ //! method to Find a Component Find a Component from it's ID
+ /*!
+ \param aComponentID char* arguments
+ \return SComponent_ptr arguments, the component found
+ */
+ virtual SALOMEDS::SComponent_ptr FindComponentID(const char* aComponentID);
+
+ //! method to Find an Object with SALOMEDS::Name = anObjectName
+ /*!
+ \param anObjectName char* arguments
+ \return SObject_ptr arguments, the object found
+ */
+ virtual SALOMEDS::SObject_ptr FindObject(const char* anObjectName);
+
+
+ //! method to Find Object(s) with SALOMEDS::Name = anObjectName in a component with ComponentDataType = aComponentName
+ /*!
+ \param anObjectName char* arguments
+ \param aComponentName char* arguments
+ \return ListOfSObject_ptr arguments, a list of objects found
+ */
+
+ virtual SALOMEDS::Study::ListOfSObject* FindObjectByName( const char* anObjectName, const char* aComponentName ) ;
+
+ //! method to Find an Object with ID = anObjectID
+ /*!
+ \param anObjectID char* arguments
+ \return SObject_ptr arguments, the object found
+ */
+ virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
+
+ //! method to Create an Object with ID = anObjectID
+ /*!
+ \param anObjectID char* arguments
+ \return SObject_ptr arguments, the object found
+ */
+ virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
+
+ //! method to Find an Object with ID = anObjectIOR
+ /*!
+ \param anObjectIOR char* arguments
+ \return SObject_ptr arguments, the object found
+ */
+ virtual SALOMEDS::SObject_ptr FindObjectIOR(const char* anObjectIOR);
+
+ //! method to Find an Object by its path
+ /*!
+ \param thePath char* arguments
+ \return SObject_ptr arguments, the object found
+ */
+ virtual SALOMEDS::SObject_ptr FindObjectByPath(const char* thePath);
+
+ //! method to get a path of SObject
+ /*!
+ \param aSO SObject_ptr arguments
+ \return char* arguments, the path of the SObject
+ */
+ virtual char* GetObjectPath(CORBA::Object_ptr theObject);
+
+ //! method to set a context: root ('/') is UserData component
+ /*!
+ */
+ virtual void SetContext(const char* thePath);
+
+ //! method to get a context
+ /*!
+ */
+ virtual char* GetContext();
+
+ //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
+ /*!
+ */
+ virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
+
+ //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
+ /*!
+ */
+ virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
+
+ //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
+ /*!
+ */
+ virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
+
+ //! method to get all components names
+ /*!
+ */
+ virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
+
+ //! method to Create a ChildIterator from an SObject
+ /*!
+ \param aSO SObject_ptr arguments
+ \return ChildIterator_ptr arguments, the created ChildIterator
+ */
+ virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
+
+ //! method to Create a SComponentIterator
+ /*!
+ \return SComponentIterator_ptr arguments, the created SComponentIterator
+ */
+ virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
+
+ //! method to Create a StudyBuilder
+ /*!
+ \return StudyBuilder_ptr arguments, the created StudyBuilder
+ */
+ virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
+
+ //! method to get study name
+ /*!
+ \return char* arguments, the study name
+ */
+ virtual char* Name();
+
+ //! method to set study name
+ /*!
+ \param name char* arguments, the study name
+ */
+ virtual void Name(const char* name);
+
+ //! method to get if study has been saved
+ /*!
+ \return bool arguments
+ */
+ virtual CORBA::Boolean IsSaved();
+
+ //! method to set if study has been saved
+ /*!
+ \param save bool arguments
+ */
+ virtual void IsSaved(CORBA::Boolean save);
+
+ //! method to Detect if a Study has been modified since it has been saved
+ /*!
+ \return bool arguments
+ */
+ virtual CORBA::Boolean IsModified();
+
+ //! method to get URL of the study (idem GetPersistentReference)
+ /*!
+ \return char* arguments, the study URL
+ */
+ virtual char* URL();
+
+ //! method to set URL of the study
+ /*!
+ \param url char* arguments, the study URL
+ */
+ virtual void URL(const char* url);
+
+ virtual CORBA::Short StudyId();
+ virtual void StudyId(CORBA::Short id);
+
+ static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
+
+ static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute);
+
+ virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
+
+ virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
+
+ virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
+
+ virtual char* GetLastModificationDate();
+
+ virtual SALOMEDS::ListOfDates* GetModificationsDate();
+
+ virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
+ virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
+
+ virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
+
+ virtual void Close();
+
+ void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); }
+
+ // postponed destroying of CORBA object functionality
+ virtual void AddPostponed(const char* theIOR);
+
+ virtual void AddCreatedPostponed(const char* theIOR);
+
+#ifndef WNT
+ virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
+ // if theUndoLimit==0, removes all
+ virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
+ // theWay = -1: get back to the list of postponed
+#else
+ virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
+ // if theUndoLimit==0, removes all
+ virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
+ // theWay = -1: get back to the list of postponed
+#endif
+
+ virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
+
+ virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
+
+ virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_TargetAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class TargetAttribute from SALOMEDS inherits Relation from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ RelocationTable from TDF,
+ LabelList from TDF
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Set (myclass; label : Label from TDF)
+ returns TargetAttribute from SALOMEDS;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable TargetAttribute from SALOMEDS;
+
+ Append(me: mutable; theReferencedObject : mutable Label form TDF);
+ Get(me; theReferencedObjects : mutable : LabelList from TDF);
+ Remove(me: mutable; theReferencedObject : mutable Label form TDF);
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end TargetAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_TextColorAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class TextColorAttribute from SALOMEDS inherits RealArray from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable TextColorAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end TextColorAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+--
+-- Copyright (C) 2003 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.
+--
+-- 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+--
+--
+--
+-- File : SALOMEDS_TextHighlightColorAttribute.cdl
+-- Author : Yves FRICAUD
+-- Module : SALOME
+
+class TextHighlightColorAttribute from SALOMEDS inherits RealArray from TDataStd
+
+ ---Purpose:
+
+
+uses Attribute from TDF,
+ Label from TDF,
+ GUID from Standard,
+ ExtendedString from TCollection,
+ DataSet from TDF,
+ RelocationTable from TDF,
+ AttributeSequence from TDF,
+ Data from TDF,
+ Comment from TDataStd
+
+
+is
+
+
+ ---Purpose: class methods
+ -- =============
+
+ GetID (myclass)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ ---Purpose: Comment methods
+ -- ============
+
+ Create
+ returns mutable TextHighlightColorAttribute from SALOMEDS;
+
+ ID (me)
+ ---C++: return const &
+ returns GUID from Standard;
+
+ Restore (me: mutable; with : Attribute from TDF);
+
+ NewEmpty (me)
+ returns mutable Attribute from TDF;
+
+ Paste (me; into : mutable Attribute from TDF;
+ RT : mutable RelocationTable from TDF);
+
+end TextHighlightColorAttribute;
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseBuilder.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_UseCaseBuilder.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+#include "SALOMEDS_UseCaseIterator.hxx"
+#include <TCollection_AsciiString.hxx>
+#include <string>
+
+using namespace std;
+
+SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder)
+{
+ _isLocal = true;
+ _local_impl = theBuilder;
+ _corba_impl = SALOMEDS::UseCaseBuilder::_nil();
+}
+
+SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder)
+{
+ _isLocal = false;
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::UseCaseBuilder::_duplicate(theBuilder);
+}
+
+SALOMEDS_UseCaseBuilder::~SALOMEDS_UseCaseBuilder()
+{
+ if(!_isLocal) _corba_impl->Destroy();
+}
+
+bool SALOMEDS_UseCaseBuilder::Append(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->Append(obj->GetLocalImpl());
+ else ret = _corba_impl->Append(obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::Remove(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->Remove(obj->GetLocalImpl());
+ else ret = _corba_impl->Remove(obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::AppendTo(const _PTR(SObject)& theFather, _PTR(SObject) theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* father = dynamic_cast<SALOMEDS_SObject*>(theFather.get());
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl());
+ else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::InsertBefore(const _PTR(SObject)& theFirst, _PTR(SObject) theNext)
+{
+ bool ret;
+ SALOMEDS_SObject* first = dynamic_cast<SALOMEDS_SObject*>(theFirst.get());
+ SALOMEDS_SObject* next = dynamic_cast<SALOMEDS_SObject*>(theNext.get());
+ if(_isLocal) ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl());
+ else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::SetCurrentObject(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->SetCurrentObject(obj->GetLocalImpl());
+ else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::SetRootCurrent()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->SetRootCurrent();
+ else ret = _corba_impl->SetRootCurrent();
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::HasChildren(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->HasChildren(obj->GetLocalImpl());
+ else ret = _corba_impl->HasChildren(obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) ret = _local_impl->IsUseCase(obj->GetLocalImpl());
+ else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl());
+ return ret;
+}
+
+bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName)
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->SetName((char*)theName.c_str());
+ else ret = _corba_impl->SetName((char*)theName.c_str());
+ return ret;
+}
+
+_PTR(SObject) SALOMEDS_UseCaseBuilder::GetCurrentObject()
+{
+ SALOMEDS_SObject* obj = NULL;
+ if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->GetCurrentObject());
+ else obj = new SALOMEDS_SObject(_corba_impl->GetCurrentObject());
+ return _PTR(SObject)(obj);
+}
+
+std::string SALOMEDS_UseCaseBuilder::GetName()
+{
+ std::string aName;
+ if(_isLocal) aName = _local_impl->GetName().ToCString();
+ else aName = _corba_impl->GetName();
+ return aName;
+}
+
+_PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName)
+{
+ SALOMEDS_SObject* obj = NULL;
+ if(_isLocal) obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str()));
+ else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase((char*)theName.c_str()));
+ return _PTR(SObject)(obj);
+}
+
+_PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SObject)& theObject)
+{
+ SALOMEDS_UseCaseIterator* it = NULL;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if(_isLocal) it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl()));
+ else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl()));
+ return _PTR(UseCaseIterator)(it);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_USECaseBuilder_H__
+#define __SALOMEDS_USECaseBuilder_H__
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class SALOMEDS_UseCaseBuilder: public SALOMEDSClient_UseCaseBuilder
+{
+
+private:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_UseCaseBuilder) _local_impl;
+ SALOMEDS::UseCaseBuilder_var _corba_impl;
+
+public:
+
+ SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder);
+ SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder);
+ ~SALOMEDS_UseCaseBuilder();
+
+ virtual bool Append(const _PTR(SObject)& theObject);
+ virtual bool Remove(const _PTR(SObject)& theObject);
+ virtual bool AppendTo(const _PTR(SObject)& theFather, _PTR(SObject) theObject);
+ virtual bool InsertBefore(const _PTR(SObject)& theFirst, _PTR(SObject) theNext);
+ virtual bool SetCurrentObject(const _PTR(SObject)& theObject);
+ virtual bool SetRootCurrent();
+ virtual bool HasChildren(const _PTR(SObject)& theObject);
+ virtual bool IsUseCase(const _PTR(SObject)& theObject);
+ virtual bool SetName(const std::string& theName);
+ virtual _PTR(SObject) GetCurrentObject();
+ virtual std::string GetName();
+ virtual _PTR(SObject) AddUseCase(const std::string& theName);
+ virtual _PTR(UseCaseIterator) GetUseCaseIterator(const _PTR(SObject)& anObject);
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseBuilder_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_UseCaseBuilder_i.hxx"
+#include "SALOMEDS_UseCaseIterator_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include "utilities.h"
+
+using namespace std;
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theImpl,
+ CORBA::ORB_ptr orb)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _impl = theImpl;
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_UseCaseBuilder_i::~SALOMEDS_UseCaseBuilder_i()
+{
+}
+
+
+//============================================================================
+/*! Function : Append
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ return _impl->Append(_impl->GetSObject(theObject->GetID()));
+}
+
+ //============================================================================
+/*! Function : Remove
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ return _impl->Remove(_impl->GetSObject(theObject->GetID()));
+}
+
+
+//============================================================================
+/*! Function : AppendTo
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFather,
+ SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0;
+ return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID()));
+}
+
+//============================================================================
+/*! Function : InsertBefore
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr theFirst,
+ SALOMEDS::SObject_ptr theNext)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0;
+ return _impl->AppendTo(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID()));
+}
+
+
+//============================================================================
+/*! Function : SetCurrentObject
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID()));
+}
+
+//============================================================================
+/*! Function : SetRootCurrent
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent()
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull()) return 0;
+ return _impl->SetRootCurrent();
+}
+
+//============================================================================
+/*! Function : HasChildren
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull()) return 0;
+ return _impl->HasChildren(_impl->GetSObject(theObject->GetID()));
+}
+
+//============================================================================
+/*! Function : SetName
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName)
+{
+ SALOMEDS::Locker lock;
+ if(_impl.IsNull()) return 0;
+ return _impl->SetName((char*)theName);
+}
+
+
+//============================================================================
+/*! Function : GetCurrentObject
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject()
+{
+ SALOMEDS::Locker lock;
+
+ if(_impl.IsNull()) return NULL;
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->GetCurrentObject();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : GetName
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_UseCaseBuilder_i::GetName()
+{
+ SALOMEDS::Locker lock;
+ return CORBA::string_dup(_impl->GetName().ToCString());
+}
+
+//============================================================================
+/*! Function : IsUseCase
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ if(_impl.IsNull() || theObject->_is_nil()) return false;
+ return _impl->IsUseCase(_impl->GetSObject(theObject->GetID()));
+}
+
+//============================================================================
+/*! Function : NewUseCase
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::AddUseCase(const char* theName)
+{
+ SALOMEDS::Locker lock;
+
+ if(_impl.IsNull()) return SALOMEDS::SObject::_nil();
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->AddUseCase((char*)theName);
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
+//============================================================================
+/*! Function : GetUseCaseIterator
+ * Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated
+ */
+//============================================================================
+SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil();
+ Handle(SALOMEDSImpl_UseCaseIterator) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID()));
+ SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb);
+ SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this());
+ return anIterator._retn();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseBuilder_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_USECaseBuilder_I_H__
+#define __SALOMEDS_USECaseBuilder_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include <SALOME_GenericObj_i.hh>
+
+// Cascade headers
+#include <Standard_GUID.hxx>
+#include <stdio.h>
+
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+
+class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+private:
+
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_UseCaseBuilder) _impl;
+
+public:
+
+ //! standard constructor
+ SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theDocument,
+ CORBA::ORB_ptr);
+
+ //! standard destructor
+ ~SALOMEDS_UseCaseBuilder_i();
+
+ virtual CORBA::Boolean Append(SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean Remove(SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean AppendTo(SALOMEDS::SObject_ptr theFather, SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean InsertBefore(SALOMEDS::SObject_ptr theFirst, SALOMEDS::SObject_ptr theNext);
+
+ virtual CORBA::Boolean SetCurrentObject(SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean SetRootCurrent();
+
+ virtual CORBA::Boolean HasChildren(SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean IsUseCase(SALOMEDS::SObject_ptr theObject);
+
+ virtual CORBA::Boolean SetName(const char* theName);
+
+ virtual SALOMEDS::SObject_ptr GetCurrentObject();
+
+ virtual char* GetName();
+
+ virtual SALOMEDS::SObject_ptr AddUseCase(const char* theName);
+
+ virtual SALOMEDS::UseCaseIterator_ptr GetUseCaseIterator(SALOMEDS::SObject_ptr anObject);
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseIterator.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDS_UseCaseIterator.hxx"
+#include "SALOMEDS_SObject.hxx"
+
+using namespace std;
+
+SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator)
+{
+ _isLocal = true;
+ _local_impl = theIterator;
+ _corba_impl = SALOMEDS::UseCaseIterator::_nil();
+}
+
+SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator)
+{
+ _isLocal = false;
+ _local_impl = NULL;
+ _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator);
+}
+
+SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator()
+{
+ if(!_isLocal) _corba_impl->Destroy();
+}
+
+void SALOMEDS_UseCaseIterator::Init(bool theAllLevels)
+{
+ if(_isLocal) _local_impl->Init(theAllLevels);
+ else _corba_impl->Init(theAllLevels);
+}
+
+bool SALOMEDS_UseCaseIterator::More()
+{
+ bool ret;
+ if(_isLocal) ret = _local_impl->More();
+ else ret = _corba_impl->More();
+ return ret;
+}
+
+void SALOMEDS_UseCaseIterator::Next()
+{
+ if(_isLocal) _local_impl->Next();
+ else _corba_impl->Next();
+}
+
+_PTR(SObject) SALOMEDS_UseCaseIterator::Value()
+{
+ SALOMEDS_SObject* aSO;
+ if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
+ else aSO = new SALOMEDS_SObject(_corba_impl->Value());
+ return _PTR(SObject)(aSO);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_USECASEITERATOR_H__
+#define __SALOMEDS_USECASEITERATOR_H__
+
+#include "SALOMEDSClient_UseCaseIterator.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+class SALOMEDS_UseCaseIterator: public SALOMEDSClient_UseCaseIterator
+{
+private:
+ bool _isLocal;
+ Handle(SALOMEDSImpl_UseCaseIterator) _local_impl;
+ SALOMEDS::UseCaseIterator_var _corba_impl;
+
+public:
+
+ SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator);
+ SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator);
+ ~SALOMEDS_UseCaseIterator();
+
+ virtual void Init(bool theAllLevels);
+ virtual bool More();
+ virtual void Next();
+ virtual _PTR(SObject) Value();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseIterator_i.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDS_UseCaseIterator_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS.hxx"
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl,
+ CORBA::ORB_ptr orb)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _impl = theImpl;
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i()
+{
+}
+
+//============================================================================
+/*! Function :Init
+ *
+ */
+//============================================================================
+void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels)
+{
+ SALOMEDS::Locker lock;
+ _impl->Init(allLevels);
+}
+
+//============================================================================
+/*! Function : More
+ *
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseIterator_i::More()
+{
+ SALOMEDS::Locker lock;
+ return _impl->More();
+}
+
+//============================================================================
+/*! Function : Next
+ *
+ */
+//============================================================================
+void SALOMEDS_UseCaseIterator_i::Next()
+{
+ SALOMEDS::Locker lock;
+ _impl->Next();
+}
+
+
+//============================================================================
+/*! Function :
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value()
+{
+ SALOMEDS::Locker lock;
+ Handle(SALOMEDSImpl_SObject) aSO = _impl->Value();
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_UseCaseIterator_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDS_USECASEITERATOR_I_H__
+#define __SALOMEDS_USECASEITERATOR_I_H__
+
+// std C++ headers
+#include <iostream>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
+
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+
+class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
+private:
+ CORBA::ORB_ptr _orb;
+ Handle(SALOMEDSImpl_UseCaseIterator) _impl;
+
+public:
+
+ //! standard constructor
+ SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl,
+ CORBA::ORB_ptr);
+
+ //! standard destructor
+ ~SALOMEDS_UseCaseIterator_i();
+
+ virtual void Init(CORBA::Boolean);
+ virtual CORBA::Boolean More();
+ virtual void Next();
+ virtual SALOMEDS::SObject_ptr Value();
+};
+#endif
--- /dev/null
+import SALOMEDS__POA
+
+class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
+ """
+ Python implementation of generic SALOMEDS driver.
+ Should be inherited by any Python module's engine
+ to provide persistence mechanism.
+ """
+ def __init__ (self, componentDataType):
+ print "SALOME_DriverPy.__init__: ",componentDataType
+ self._ComponentDataType = componentDataType
+
+ def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII):
+ return theSObject.GetID()
+
+ def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII):
+ return ""
+
+ def ComponentDataType(self):
+ return self._ComponentDataType
+
+ def Save(self, theComponent, theURL, isMultiFile):
+ return NULL
+
+ def SaveASCII(self, theComponent, theURL, isMultiFile):
+ return self.Save(theComponent, theURL, isMultiFile)
+
+ def Load(self, theComponent, theStream, theURL, isMultiFile):
+ return 1
+
+ def LoadASCII(self, theComponent, theStream, theURL, isMultiFile):
+ return self.Load(theComponent, theStream, theURL, isMultiFile)
+
+ def Close(self, theComponent):
+ pass
+
+ def CanPublishInStudy(self, theIOR):
+ return 1
+
+ def PublishInStudy(self, theStudy, theSObject, theObject, theName):
+ return NULL
+
+ def CanCopy(self, theObject):
+ return 0
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef SALOMEDSCLIENT_HXX
+#define SALOMEDSCLIENT_HXX
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_AttributeComment.hxx"
+#include "SALOMEDSClient_AttributeDrawable.hxx"
+#include "SALOMEDSClient_AttributeExpandable.hxx"
+#include "SALOMEDSClient_AttributeExternalFileDef.hxx"
+#include "SALOMEDSClient_AttributeFileType.hxx"
+#include "SALOMEDSClient_AttributeFlags.hxx"
+#include "SALOMEDSClient_AttributeGraphic.hxx"
+#include "SALOMEDSClient_AttributeIOR.hxx"
+#include "SALOMEDSClient_AttributeInteger.hxx"
+#include "SALOMEDSClient_AttributeLocalID.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+#include "SALOMEDSClient_AttributeOpened.hxx"
+#include "SALOMEDSClient_AttributePersistentRef.hxx"
+#include "SALOMEDSClient_AttributePixMap.hxx"
+#include "SALOMEDSClient_AttributePythonObject.hxx"
+#include "SALOMEDSClient_AttributeReal.hxx"
+#include "SALOMEDSClient_AttributeSelectable.hxx"
+#include "SALOMEDSClient_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDSClient_AttributeSequenceOfReal.hxx"
+#include "SALOMEDSClient_AttributeStudyProperties.hxx"
+#include "SALOMEDSClient_AttributeTableOfInteger.hxx"
+#include "SALOMEDSClient_AttributeTableOfReal.hxx"
+#include "SALOMEDSClient_AttributeTableOfString.hxx"
+#include "SALOMEDSClient_AttributeTarget.hxx"
+#include "SALOMEDSClient_AttributeTextColor.hxx"
+#include "SALOMEDSClient_AttributeTextHighlightColor.hxx"
+#include "SALOMEDSClient_AttributeTreeNode.hxx"
+#include "SALOMEDSClient_AttributeUserID.hxx"
+#include "SALOMEDSClient_ChildIterator.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+#include "SALOMEDSClient_SComponentIterator.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDSClient_StudyBuilder.hxx"
+#include "SALOMEDSClient_StudyManager.hxx"
+#include "SALOMEDSClient_UseCaseBuilder.hxx"
+#include "SALOMEDSClient_UseCaseIterator.hxx"
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeComment.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeComment_HeaderFile
+#define SALOMEDSClient_AttributeComment_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeComment: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeDrawable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeDrawable_HeaderFile
+#define SALOMEDSClient_AttributeDrawable_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeDrawable: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual bool IsDrawable() = 0;
+ virtual void SetDrawable(bool value) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeExpandable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeExpandable_HeaderFile
+#define SALOMEDSClient_AttributeExpandable_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeExpandable: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual bool IsExpandable() = 0;
+ virtual void SetExpandable(bool value) = 0;
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeExternalFileDef.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeExternalFileDef_HeaderFile
+#define SALOMEDSClient_AttributeExternalFileDef_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeExternalFileDef: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeFileType.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeFileType_HeaderFile
+#define SALOMEDSClient_AttributeFileType_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeFileType: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeFlags.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeFlags_HeaderFile
+#define SALOMEDSClient_AttributeFlags_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeFlags: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual int GetFlags() = 0;
+ virtual void SetFlags(int theFlags) = 0;
+
+ virtual bool Get(int theFlag) = 0;
+ virtual void Set(int theFlag, bool theValue) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeFlags.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeGraphic_HeaderFile
+#define SALOMEDSClient_AttributeGraphic_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeGraphic: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void SetVisibility(int theViewId, bool theValue) = 0;
+ virtual bool GetVisibility(int theViewId) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeIOR_HeaderFile
+#define SALOMEDSClient_AttributeIOR_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeIOR: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeInteger_HeaderFile
+#define SALOMEDSClient_AttributeInteger_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeInteger: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual int Value() = 0;
+ virtual void SetValue(int value) = 0;
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeLocalID.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeLocalID_HeaderFile
+#define SALOMEDSClient_AttributeLocalID_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeLocalID: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual int Value() = 0;
+ virtual void SetValue(int value) = 0;
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeName.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeName_HeaderFile
+#define SALOMEDSClient_AttributeName_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeName: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeOpened.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+// $Header:
+
+#ifndef SALOMEDSClient_AttributeOpened_HeaderFile
+#define SALOMEDSClient_AttributeOpened_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeOpened: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual bool IsOpened() = 0;
+ virtual void SetOpened(bool value) = 0;
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributePersistentRef.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributePersistentRef_HeaderFile
+#define SALOMEDSClient_AttributePersistentRef_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributePersistentRef: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributePixMap.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributePixMap_HeaderFile
+#define SALOMEDSClient_AttributePixMap_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributePixMap: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual bool HasPixMap() = 0;
+ virtual std::string GetPixMap() = 0;
+ virtual void SetPixMap(const std::string& value) = 0;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributePythonObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributePythonObject_HeaderFile
+#define SALOMEDSClient_AttributePythonObject_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributePythonObject: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void SetObject(const std::string& theSequence, bool IsScript) = 0;
+ virtual std::string GetObject() = 0;
+ virtual bool IsScript() = 0;
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeReal_HeaderFile
+#define SALOMEDSClient_AttributeReal_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeReal: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual double Value() = 0;
+ virtual void SetValue(double value) = 0;
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeSelectable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeSelectable_HeaderFile
+#define SALOMEDSClient_AttributeSelectable_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeSelectable: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual bool IsSelectable() = 0;
+ virtual void SetSelectable(bool value) = 0;
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeSequenceOfInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeSequenceOfInteger_HeaderFile
+#define SALOMEDSClient_AttributeSequenceOfInteger_HeaderFile
+
+#include <vector>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeSequenceOfInteger: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void Assign(const std::vector<int>& other) = 0;
+ virtual std::vector<int> CorbaSequence() = 0;
+ virtual void Add(int value) = 0;
+ virtual void Remove(int index) = 0;
+ virtual void ChangeValue(int index, int value) = 0;
+ virtual int Value(int index) = 0;
+ virtual int Length() = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeSequenceOfSequenceOfReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeSequenceOfSequenceOfReal_HeaderFile
+#define SALOMEDSClient_AttributeSequenceOfSequenceOfReal_HeaderFile
+
+#include <vector>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeSequenceOfReal: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void Assign(const std::vector<double>& other) = 0;
+ virtual std::vector<double> CorbaSequence() = 0;
+ virtual void Add(double value) = 0;
+ virtual void Remove(int index) = 0;
+ virtual void ChangeValue(int index, double value) = 0;
+ virtual double Value(int index) = 0;
+ virtual int Length() = 0;
+
+};
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeStudyProperties.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeStudyProperties_HeaderFile
+#define SALOMEDSClient_AttributeStudyProperties_HeaderFile
+
+#include <vector>
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeStudyProperties: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void SetUserName(const std::string& theName) = 0;
+ virtual std::string GetUserName() = 0;
+ virtual void SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear) = 0;
+ virtual bool GetCreationDate(int& theMinute, int& theHour, int& theDay, int& theMonth, int& theYear) = 0;
+ virtual void SetCreationMode(const std::string& theMode) = 0;
+ virtual std::string GetCreationMode() = 0;
+ virtual void SetModified(int theModified) = 0;
+ virtual bool IsModified() = 0;
+ virtual int GetModified() = 0;
+ virtual void SetLocked(bool theLocked) = 0;
+ virtual bool IsLocked() = 0;
+ virtual void SetModification(const std::string& theName,
+ int theMinute,
+ int theHour,
+ int theDay,
+ int theMonth,
+ int theYear) = 0;
+ virtual void GetModificationsList(std::vector<std::string>& theNames,
+ std::vector<int>& theMinutes,
+ std::vector<int>& theHours,
+ std::vector<int>& theDays,
+ std::vector<int>& theMonths,
+ std::vector<int>& theYears,
+ bool theWithCreator) = 0;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTableOfInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTableOfInteger_HeaderFile
+#define SALOMEDSClient_AttributeTableOfInteger_HeaderFile
+
+#include <vector>
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeTableOfInteger: public virtual SALOMEDSClient_GenericAttribute
+{
+
+public:
+
+ virtual void SetTitle(const std::string& theTitle) = 0;
+ virtual std::string GetTitle() = 0;
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetRowTitles() = 0;
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetColumnTitles() = 0;
+
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit) = 0;
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits) = 0;
+ virtual std::vector<std::string> GetRowUnits() = 0;
+
+ virtual int GetNbRows() = 0;
+ virtual int GetNbColumns() = 0;
+ virtual void AddRow(const std::vector<int>& theData) = 0;
+ virtual void SetRow(int theRow, const std::vector<int>& theData) = 0;
+ virtual std::vector<int> GetRow(int theRow) = 0;
+ virtual void AddColumn(const std::vector<int>& theData) = 0;
+ virtual void SetColumn(int theColumn, const std::vector<int>& theData) = 0;
+ virtual std::vector<int> GetColumn(int theColumn) = 0;
+ virtual void PutValue(int theValue, int theRow, int theColumn) = 0;
+ virtual bool HasValue(int theRow, int theColumn) = 0;
+ virtual int GetValue(int theRow, int theColumn) = 0;
+
+ virtual std::vector<int> GetRowSetIndices(int theRow) = 0;
+ virtual void SetNbColumns(int theNbColumns) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTableOfReal.hxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTableOfReal_HeaderFile
+#define SALOMEDSClient_AttributeTableOfReal_HeaderFile
+
+#include <vector>
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeTableOfReal: public virtual SALOMEDSClient_GenericAttribute
+{
+
+public:
+
+ virtual void SetTitle(const std::string& theTitle) = 0;
+ virtual std::string GetTitle() = 0;
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetRowTitles() = 0;
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetColumnTitles() = 0;
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit) = 0;
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits) = 0;
+ virtual std::vector<std::string> GetRowUnits() = 0;
+
+ virtual int GetNbRows() = 0;
+ virtual int GetNbColumns() = 0;
+ virtual void AddRow(const std::vector<double>& theData) = 0;
+ virtual void SetRow(int theRow, const std::vector<double>& theData) = 0;
+ virtual std::vector<double> GetRow(int theRow) = 0;
+ virtual void AddColumn(const std::vector<double>& theData) = 0;
+ virtual void SetColumn(int theColumn, const std::vector<double>& theData) = 0;
+ virtual std::vector<double> GetColumn(int theColumn) = 0;
+ virtual void PutValue(double theValue, int theRow, int theColumn) = 0;
+ virtual bool HasValue(int theRow, int theColumn) = 0;
+ virtual double GetValue(int theRow, int theColumn) = 0;
+
+ virtual std::vector<int> GetRowSetIndices(int theRow) = 0;
+ virtual void SetNbColumns(int theNbColumns) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTableOfString.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTableOfString_HeaderFile
+#define SALOMEDSClient_AttributeTableOfString_HeaderFile
+
+#include <vector>
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeTableOfString: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual void SetTitle(const std::string& theTitle) = 0;
+ virtual std::string GetTitle() = 0;
+ virtual void SetRowTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetRowTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetRowTitles() = 0;
+ virtual void SetColumnTitle(int theIndex, const std::string& theTitle) = 0;
+ virtual void SetColumnTitles(const std::vector<std::string>& theTitles) = 0;
+ virtual std::vector<std::string> GetColumnTitles() = 0;
+
+ virtual void SetRowUnit(int theIndex, const std::string& theUnit) = 0;
+ virtual void SetRowUnits(const std::vector<std::string>& theUnits) = 0;
+ virtual std::vector<std::string> GetRowUnits() = 0;
+
+ virtual int GetNbRows() = 0;
+ virtual int GetNbColumns() = 0;
+ virtual void AddRow(const std::vector<std::string>& theData) = 0;
+ virtual void SetRow(int theRow, const std::vector<std::string>& theData) = 0;
+ virtual std::vector<std::string> GetRow(int theRow) = 0;
+ virtual void AddColumn(const std::vector<std::string>& theData) = 0;
+ virtual void SetColumn(int theColumn, const std::vector<std::string>& theData) = 0;
+ virtual std::vector<std::string> GetColumn(int theColumn) = 0;
+ virtual void PutValue(const std::string& theValue, int theRow, int theColumn) = 0;
+ virtual bool HasValue(int theRow, int theColumn) = 0;
+ virtual std::string GetValue(int theRow, int theColumn) = 0;
+
+ virtual std::vector<int> GetRowSetIndices(int theRow) = 0;
+ virtual void SetNbColumns(int theNbColumns) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTarget.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTarget_HeaderFile
+#define SALOMEDSClient_AttributeTarget_HeaderFile
+
+#include <vector>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeTarget: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual void Add(const _PTR(SObject)& theObject) = 0;
+ virtual std::vector<_PTR(SObject)> Get() = 0;
+ virtual void Remove(const _PTR(SObject)& theObject) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTextColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTextColor_HeaderFile
+#define SALOMEDSClient_AttributeTextColor_HeaderFile
+
+#include <vector>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include "SALOMEDSClient_definitions.hxx"
+
+class SALOMEDSClient_AttributeTextColor: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual STextColor TextColor() = 0;
+ virtual void SetTextColor(STextColor value) = 0;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTextHighlightColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTextHighlightColor_HeaderFile
+#define SALOMEDSClient_AttributeTextHighlightColor_HeaderFile
+
+#include <vector>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include "SALOMEDSClient_definitions.hxx"
+
+class SALOMEDSClient_AttributeTextHighlightColor: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual STextColor TextHighlightColor() = 0;
+ virtual void SetTextHighlightColor(STextColor value) = 0;
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeTreeNode.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeTreeNode_HeaderFile
+#define SALOMEDSClient_AttributeTreeNode_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+
+class SALOMEDSClient_AttributeTreeNode
+{
+public:
+
+ virtual void SetFather(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool HasFather() = 0;
+ virtual _PTR(AttributeTreeNode) GetFather() = 0;
+ virtual void SetPrevious(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool HasPrevious() = 0;
+ virtual _PTR(AttributeTreeNode) GetPrevious() = 0;
+ virtual void SetNext(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool HasNext() = 0;
+ virtual _PTR(AttributeTreeNode) GetNext() = 0;
+ virtual void SetFirst(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool HasFirst() = 0;
+ virtual _PTR(AttributeTreeNode) GetFirst() = 0;
+ virtual void SetTreeID(const std::string& value) = 0;
+ virtual std::string GetTreeID() = 0;
+ virtual void Append(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual void Prepend(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual void InsertBefore(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual void InsertAfter(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual void Remove() = 0;
+ virtual int Depth() = 0;
+ virtual bool IsRoot() = 0;
+ virtual bool IsDescendant(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool IsFather(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual bool IsChild(const _PTR(AttributeTreeNode)& value) = 0;
+ virtual std::string Label() = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_AttributeUserID.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSClient_AttributeUserID_HeaderFile
+#define SALOMEDSClient_AttributeUserID_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_AttributeUserID: public virtual SALOMEDSClient_GenericAttribute
+{
+public:
+
+ virtual std::string Value() = 0;
+ virtual void SetValue(const std::string& value) = 0;
+
+};
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_ChildIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_CHILDITERATOR_H__
+#define __SALOMEDSClient_CHILDITERATOR_H__
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+
+class SALOMEDSClient_ChildIterator
+{
+public:
+ virtual ~SALOMEDSClient_ChildIterator() {}
+
+ virtual void Init() = 0;
+ virtual void InitEx(bool) = 0;
+ virtual bool More() = 0;
+ virtual void Next() = 0;
+ virtual _PTR(SObject) Value() = 0;
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient__GenericAttribute.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _GENERICCLIENT_ATTRIBUTE_HXX_
+#define _GENERICCLIENT_ATTRIBUTE_HXX_
+
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+
+class SALOMEDSClient_GenericAttribute
+{
+public:
+ virtual ~SALOMEDSClient_GenericAttribute() {}
+
+ virtual void CheckLocked() = 0;
+ virtual std::string Type() = 0;
+ virtual std::string GetClassType() = 0;
+ virtual _PTR(SObject) GetSObject() = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_SComponent.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSCLIENT_SCOMPONENT_H__
+#define __SALOMEDSCLIENT_SCOMPONENT_H__
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include <string>
+
+class SALOMEDSClient_SComponent: public virtual SALOMEDSClient_SObject
+{
+public:
+ virtual ~SALOMEDSClient_SComponent() {}
+
+ virtual std::string ComponentDataType() = 0;
+ virtual bool ComponentIOR(std::string& theID) = 0;
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_SComponentIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_SCOMPONENTITERATOR_H__
+#define __SALOMEDSClient_SCOMPONENTITERATOR_H__
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+
+class SALOMEDSClient_SComponentIterator
+{
+public:
+ virtual ~SALOMEDSClient_SComponentIterator() {}
+
+ virtual void Init() = 0;
+ virtual bool More() = 0;
+ virtual void Next() = 0;
+ virtual _PTR(SComponent) Value() = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_SObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSCLIENT_SOBJECT_H__
+#define __SALOMEDSCLIENT_SOBJECT_H__
+
+// std C++ headers
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient_definitions.hxx"
+
+class SALOMEDSClient_Study;
+class SALOMEDSClient_SComponent;
+class SALOMEDSClient_GenericAttribute;
+
+class SALOMEDSClient_SObject
+{
+public:
+ virtual ~SALOMEDSClient_SObject() {}
+
+ virtual std::string GetID() = 0;
+ virtual _PTR(SComponent) GetFatherComponent() = 0;
+ virtual _PTR(SObject) GetFather() = 0;
+ virtual bool FindAttribute(_PTR(GenericAttribute)& anAttribute, const std::string& aTypeOfAttribute) = 0;
+ virtual bool ReferencedObject(_PTR(SObject)& theObject) = 0;
+ virtual bool FindSubObject(int theTag, _PTR(SObject)& theObject) = 0;
+ virtual _PTR(Study) GetStudy() = 0;
+ virtual std::string Name() = 0;
+ virtual void Name(const std::string& theName) = 0;
+ virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes() = 0;
+ virtual std::string GetName() = 0;
+ virtual std::string GetComment() = 0;
+ virtual std::string GetIOR() = 0;
+ virtual int Tag() = 0;
+ virtual int Depth() = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_Study.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_STUDY_H__
+#define __SALOMEDSClient_STUDY_H__
+
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SComponentIterator.hxx"
+#include "SALOMEDSClient_StudyBuilder.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+#include "SALOMEDSClient_UseCaseBuilder.hxx"
+#include "SALOMEDSClient_AttributeStudyProperties.hxx"
+#include "SALOMEDSClient_ChildIterator.hxx"
+
+class SALOMEDSClient_Study
+{
+
+public:
+ virtual ~SALOMEDSClient_Study() {}
+
+ virtual std::string GetPersistentReference() = 0;
+ virtual std::string GetTransientReference() = 0;
+ virtual bool IsEmpty() = 0;
+ virtual _PTR(SComponent) FindComponent (const std::string& aComponentName) = 0;
+ virtual _PTR(SComponent) FindComponentID(const std::string& aComponentID) = 0;
+ virtual _PTR(SObject) FindObject(const std::string& anObjectName) = 0;
+ virtual std::vector<_PTR(SObject)> FindObjectByName( const std::string& anObjectName, const std::string& aComponentName ) = 0;
+ virtual _PTR(SObject) FindObjectID(const std::string& anObjectID) = 0;
+ virtual _PTR(SObject) CreateObjectID(const std::string& anObjectID) = 0;
+ virtual _PTR(SObject) FindObjectIOR(const std::string& anObjectIOR) = 0;
+ virtual _PTR(SObject) FindObjectByPath(const std::string& thePath) = 0;
+ virtual std::string GetObjectPath(const _PTR(SObject)& theSO) = 0;
+ virtual void SetContext(const std::string& thePath) = 0;
+ virtual std::string GetContext() = 0;
+ virtual std::vector<std::string> GetObjectNames(const std::string& theContext) = 0;
+ virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext) = 0;
+ virtual std::vector<std::string> GetFileNames(const std::string& theContext) = 0;
+ virtual std::vector<std::string> GetComponentNames(const std::string& theContext) = 0;
+ virtual _PTR(ChildIterator) NewChildIterator(const _PTR(SObject)& theSO) = 0;
+ virtual _PTR(SComponentIterator) NewComponentIterator() = 0;
+ virtual _PTR(StudyBuilder) NewBuilder() = 0;
+ virtual std::string Name() = 0;
+ virtual void Name(const std::string& name) = 0;
+ virtual bool IsSaved() = 0;
+ virtual void IsSaved(bool save) = 0;
+ virtual bool IsModified() = 0;
+ virtual std::string URL() = 0;
+ virtual void URL(const std::string& url) = 0;
+ virtual int StudyId() = 0;
+ virtual void StudyId(int id) = 0;
+ virtual std::vector<_PTR(SObject)> FindDependances(const _PTR(SObject)& theSO) = 0;
+ virtual _PTR(AttributeStudyProperties) GetProperties() = 0;
+ virtual std::string GetLastModificationDate() = 0;
+ virtual std::vector<std::string> GetModificationsDate() = 0;
+ virtual _PTR(UseCaseBuilder) GetUseCaseBuilder() = 0;
+ virtual void Close() = 0;
+ virtual void EnableUseCaseAutoFilling(bool isEnabled) = 0;
+ virtual bool DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished) = 0;
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_StudyBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_STUDYBUILDER_H__
+#define __SALOMEDSClient_STUDYBUILDER_H__
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include <string>
+
+class SALOMEDSClient_StudyBuilder
+{
+public:
+ virtual ~SALOMEDSClient_StudyBuilder() {}
+
+ virtual _PTR(SComponent) NewComponent(const std::string& ComponentDataType) = 0;
+ virtual void DefineComponentInstance (const _PTR(SComponent)&, const std::string& ComponentIOR) = 0;
+ virtual void RemoveComponent(const _PTR(SComponent)& theSCO) = 0;
+ virtual _PTR(SObject) NewObject(const _PTR(SObject)& theFatherObject) = 0;
+ virtual _PTR(SObject) NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag) = 0;
+ virtual void AddDirectory(const std::string& thePath) = 0;
+ virtual void LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR) = 0;
+ virtual void Load(const _PTR(SObject)& theSCO) = 0;
+ virtual void RemoveObject(const _PTR(SObject)& theSO) = 0;
+ virtual void RemoveObjectWithChildren(const _PTR(SObject)& theSO) = 0;
+ virtual _PTR(GenericAttribute) FindOrCreateAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) = 0;
+ virtual bool FindAttribute(const _PTR(SObject)& theSO,
+ _PTR(GenericAttribute)& theAttribute,
+ const std::string& aTypeOfAttribute) = 0;
+ virtual void RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) = 0;
+ virtual void Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject) = 0;
+ virtual void RemoveReference(const _PTR(SObject)& me) = 0;
+ virtual void SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID) = 0;
+ virtual bool IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID) = 0;
+ virtual void NewCommand() = 0;
+ virtual void CommitCommand()= 0;
+ virtual bool HasOpenCommand() = 0;
+ virtual void AbortCommand() = 0;
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+ virtual bool GetAvailableUndos() = 0;
+ virtual bool GetAvailableRedos() = 0;
+ virtual int UndoLimit() = 0;
+ virtual void UndoLimit(int theLimit) = 0;
+ virtual void SetName(const _PTR(SObject)& theSO, const std::string& theValue) = 0;
+ virtual void SetComment(const _PTR(SObject)& theSO, const std::string& theValue) = 0;
+ virtual void SetIOR(const _PTR(SObject)& theSO, const std::string& theValue) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_StudyManager.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_STUDYMANAGER_H__
+#define __SALOMEDSClient_STUDYMANAGER_H__
+
+#include <vector>
+#include <string>
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_Study.hxx"
+
+class SALOMEDSClient_StudyManager
+{
+public:
+ virtual ~SALOMEDSClient_StudyManager() {}
+
+ virtual _PTR(Study) NewStudy(const std::string& study_name) = 0;
+ virtual _PTR(Study) Open(const std::string& theStudyUrl) = 0;
+ virtual void Close(const _PTR(Study)& theStudy) = 0;
+ virtual void Save(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+ virtual void SaveASCII(const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+ virtual void SaveAs(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+ virtual void SaveAsASCII(const std::string& theUrl, const _PTR(Study)& theStudy, bool theMultiFile) = 0;
+ virtual std::vector<std::string> GetOpenStudies() = 0;
+ virtual _PTR(Study) GetStudyByName(const std::string& theStudyName) = 0;
+ virtual _PTR(Study) GetStudyByID(int theStudyID) = 0;
+ virtual bool CanCopy(const _PTR(SObject)& theSO) = 0;
+ virtual bool Copy(const _PTR(SObject)& theSO) = 0;
+ virtual bool CanPaste(const _PTR(SObject)& theSO) = 0;
+ virtual _PTR(SObject) Paste(const _PTR(SObject)& theSO) = 0;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_UseCaseBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_USECaseBuilder_H__
+#define __SALOMEDSClient_USECaseBuilder_H__
+
+#include <string>
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_UseCaseIterator.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+
+class SALOMEDSClient_UseCaseBuilder
+{
+public:
+ virtual ~SALOMEDSClient_UseCaseBuilder() {}
+
+ virtual bool Append(const _PTR(SObject)& theObject) = 0;
+ virtual bool Remove(const _PTR(SObject)& theObject) = 0;
+ virtual bool AppendTo(const _PTR(SObject)& theFather, _PTR(SObject) theObject) = 0;
+ virtual bool InsertBefore(const _PTR(SObject)& theFirst, _PTR(SObject) theNext) = 0;
+ virtual bool SetCurrentObject(const _PTR(SObject)& theObject) = 0;
+ virtual bool SetRootCurrent() = 0;
+ virtual bool HasChildren(const _PTR(SObject)& theObject) = 0;
+ virtual bool IsUseCase(const _PTR(SObject)& theObject) = 0;
+ virtual bool SetName(const std::string& theName) = 0;
+ virtual _PTR(SObject) GetCurrentObject() = 0;
+ virtual std::string GetName() = 0;
+ virtual _PTR(SObject) AddUseCase(const std::string& theName) = 0;
+ virtual _PTR(UseCaseIterator) GetUseCaseIterator(const _PTR(SObject)& anObject) = 0;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSClient_UseCaseIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSClient_USECASEITERATOR_H__
+#define __SALOMEDSClient_USECASEITERATOR_H__
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+
+class SALOMEDSClient_UseCaseIterator
+{
+
+public:
+ virtual ~SALOMEDSClient_UseCaseIterator() {}
+
+ virtual void Init(bool) = 0;
+ virtual bool More() = 0;
+ virtual void Next() = 0;
+ virtual _PTR(SObject) Value() = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef SALOMEDSCLIENT_DEF_HXX
+#define SALOMEDSCLIENT_DEF_HXX
+
+#include <boost/shared_ptr.hpp>
+
+template<class T> class clt_shared_ptr: public boost::shared_ptr<T>
+{
+public:
+ clt_shared_ptr() {}
+
+ template<class Y>
+ explicit clt_shared_ptr(Y * p)
+ {
+ reset(p);
+ }
+
+ template<class Y>
+ clt_shared_ptr(clt_shared_ptr<Y> const & r):
+ boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+ {}
+
+ template<class Y>
+ clt_shared_ptr & operator=(clt_shared_ptr<Y> const & r)
+ {
+ clt_shared_ptr<T>(r).swap(*this);
+ return *this;
+ }
+
+ template<class Y> clt_shared_ptr& operator()(Y * p) // Y must be complete
+ {
+ if(T* pt = dynamic_cast<T*>(p))
+ boost::shared_ptr<T>::reset(pt);
+ else
+ boost::throw_exception(std::bad_cast());
+ return *this;
+ }
+
+};
+
+#define _PTR(Class) clt_shared_ptr<SALOMEDSClient_##Class>
+#define _CAST(Class, shared_ptr_Obj) dynamic_cast<SALOMEDS_##Class*>(shared_ptr_Obj.get())
+
+struct STextColor
+{
+ double R;
+ double G;
+ double B;
+};
+
+#endif
--- /dev/null
+# File : Makefile.in
+# Author : Sergey RUIN
+# Module : SALOME
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS= \
+ SALOMEDSImpl_Attributes.hxx \
+ SALOMEDSImpl_SObject.hxx \
+ SALOMEDSImpl_SComponent.hxx \
+ SALOMEDSImpl_Driver.hxx \
+ SALOMEDSImpl_Callback.hxx \
+ SALOMEDSImpl_ChildIterator.hxx \
+ SALOMEDSImpl_GenericAttribute.hxx \
+ SALOMEDSImpl_AttributeIOR.hxx \
+ SALOMEDSImpl_AttributeExternalFileDef.hxx \
+ SALOMEDSImpl_AttributeFileType.hxx \
+ SALOMEDSImpl_AttributePersistentRef.hxx \
+ SALOMEDSImpl_AttributeSequenceOfReal.hxx \
+ SALOMEDSImpl_AttributeSequenceOfInteger.hxx \
+ SALOMEDSImpl_AttributeDrawable.hxx \
+ SALOMEDSImpl_AttributeSelectable.hxx \
+ SALOMEDSImpl_AttributeExpandable.hxx \
+ SALOMEDSImpl_AttributeOpened.hxx \
+ SALOMEDSImpl_AttributeFlags.hxx \
+ SALOMEDSImpl_AttributeGraphic.hxx \
+ SALOMEDSImpl_AttributeTextColor.hxx \
+ SALOMEDSImpl_AttributeTextHighlightColor.hxx \
+ SALOMEDSImpl_AttributePixMap.hxx \
+ SALOMEDSImpl_AttributeLocalID.hxx \
+ SALOMEDSImpl_AttributeTarget.hxx \
+ SALOMEDSImpl_AttributeTableOfInteger.hxx \
+ SALOMEDSImpl_AttributeTableOfReal.hxx \
+ SALOMEDSImpl_AttributeTableOfString.hxx \
+ SALOMEDSImpl_AttributeStudyProperties.hxx \
+ SALOMEDSImpl_AttributePythonObject.hxx \
+ SALOMEDSImpl_AttributeReal.hxx \
+ SALOMEDSImpl_AttributeInteger.hxx \
+ SALOMEDSImpl_AttributeUserID.hxx \
+ SALOMEDSImpl_AttributeTreeNode.hxx \
+ SALOMEDSImpl_AttributeName.hxx \
+ SALOMEDSImpl_AttributeComment.hxx \
+ SALOMEDSImpl_AttributeReference.hxx \
+ SALOMEDSImpl_UseCaseBuilder.hxx \
+ SALOMEDSImpl_UseCaseIterator.hxx \
+ SALOMEDSImpl_SComponentIterator.hxx \
+ SALOMEDSImpl_StudyBuilder.hxx \
+ SALOMEDSImpl_Study.hxx \
+ SALOMEDSImpl_StudyManager.hxx \
+ SALOMEDSImpl_OCAFApplication.hxx \
+ SALOMEDSImpl_ChildNodeIterator.hxx \
+
+LIB_CLIENT_IDL =
+LIB_SERVER_IDL =
+
+# Executables targets
+BIN = testDS
+BIN_SRC =
+BIN_CLIENT_IDL =
+BIN_SERVER_IDL =
+
+# Libraries targets
+
+LIB = libSalomeDSImpl.la
+LIB_SRC = SALOMEDSImpl_Tool.cxx \
+ SALOMEDSImpl_Callback.cxx \
+ SALOMEDSImpl_StudyHandle.cxx \
+ SALOMEDSImpl_GenericAttribute.cxx \
+ SALOMEDSImpl_SObject.cxx \
+ SALOMEDSImpl_SComponent.cxx \
+ SALOMEDSImpl_ChildIterator.cxx \
+ SALOMEDSImpl_OCAFApplication.cxx \
+ SALOMEDSImpl_AttributeIOR.cxx \
+ SALOMEDSImpl_AttributeExternalFileDef.cxx \
+ SALOMEDSImpl_AttributeFileType.cxx \
+ SALOMEDSImpl_AttributePersistentRef.cxx \
+ SALOMEDSImpl_AttributeSequenceOfReal.cxx \
+ SALOMEDSImpl_AttributeSequenceOfInteger.cxx \
+ SALOMEDSImpl_AttributeDrawable.cxx \
+ SALOMEDSImpl_AttributeSelectable.cxx \
+ SALOMEDSImpl_AttributeExpandable.cxx \
+ SALOMEDSImpl_AttributeOpened.cxx \
+ SALOMEDSImpl_AttributeFlags.cxx \
+ SALOMEDSImpl_AttributeGraphic.cxx \
+ SALOMEDSImpl_AttributeTextColor.cxx \
+ SALOMEDSImpl_AttributeTextHighlightColor.cxx \
+ SALOMEDSImpl_AttributePixMap.cxx \
+ SALOMEDSImpl_AttributeLocalID.cxx \
+ SALOMEDSImpl_AttributeTarget.cxx \
+ SALOMEDSImpl_AttributeTableOfInteger.cxx \
+ SALOMEDSImpl_AttributeTableOfReal.cxx \
+ SALOMEDSImpl_AttributeTableOfString.cxx \
+ SALOMEDSImpl_AttributeStudyProperties.cxx \
+ SALOMEDSImpl_AttributePythonObject.cxx \
+ SALOMEDSImpl_AttributeReal.cxx \
+ SALOMEDSImpl_AttributeInteger.cxx \
+ SALOMEDSImpl_AttributeUserID.cxx \
+ SALOMEDSImpl_AttributeTreeNode.cxx \
+ SALOMEDSImpl_AttributeName.cxx \
+ SALOMEDSImpl_AttributeComment.cxx \
+ SALOMEDSImpl_AttributeReference.cxx \
+ SALOMEDSImpl_ChildNodeIterator.cxx \
+ SALOMEDSImpl_UseCaseBuilder.cxx \
+ SALOMEDSImpl_UseCaseIterator.cxx \
+ SALOMEDSImpl_SComponentIterator.cxx \
+ SALOMEDSImpl_StudyBuilder.cxx \
+ SALOMEDSImpl_Study.cxx \
+ SALOMEDSImpl_StudyManager.cxx
+
+
+
+CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
+CXXFLAGS+=$(OCC_CXXFLAGS)
+LDFLAGS+= $(HDF5_LIBS) -lSalomeHDFPersist $(CAS_OCAF)
+
+# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
+# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
+# On est donc obligé ici, pour permettre l'édition de lien avec les bibliothèques OCC, de spécifier le
+# chemin d'accès aux bibliothèques Xmu
+#
+LDXMUFLAGS= -L/usr/X11R6/lib -lXmu
+LDFLAGS+=$(LDXMUFLAGS)
+LDFLAGSFORBIN=$(LDFLAGS) -lSalomeHDFPersist
+
+@CONCLUDE@
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeComment.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef WNT
+using namespace std;
+#endif
+#include "SALOMEDSImpl_AttributeComment.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID ()
+{
+ static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
+ return CommentID;
+}
+
+Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& Val)
+{
+ Handle(SALOMEDSImpl_AttributeComment) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) {
+ A = new SALOMEDSImpl_AttributeComment();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(Val);
+
+ return A;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeComment();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeComment_HeaderFile
+#define _SALOMEDSImpl_AttributeComment_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx>
+#include <Standard_GUID.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute
+{
+private:
+
+ TCollection_ExtendedString myString;
+
+public:
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {}
+
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeComment) Set(const TDF_Label& L, const TCollection_ExtendedString& Val);
+Standard_EXPORT void SetValue (const TCollection_ExtendedString& S);
+Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+
+Standard_EXPORT ~SALOMEDSImpl_AttributeComment() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeComment )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeDrawable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef WNT
+using namespace std;
+#endif
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeDrawableID;
+}
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeDrawable) SALOMEDSImpl_AttributeDrawable::Set (const TDF_Label& L,
+ const Standard_Integer value)
+{
+ Handle(SALOMEDSImpl_AttributeDrawable) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeDrawable();
+ L.AddAttribute(A);
+ }
+
+ A->SetDrawable (value);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeDrawable::SALOMEDSImpl_AttributeDrawable()
+:SALOMEDSImpl_GenericAttribute("AttributeDrawable")
+{
+ myValue = 0;
+}
+
+//=======================================================================
+//function : SetDrawable
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue)
+{
+ CheckLocked();
+
+ Backup();
+
+ (theValue!=0)?myValue=1:myValue=0;
+}
+
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeDrawable();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (with)->IsDrawable ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeDrawable::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (into)->SetDrawable (myValue);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeDrawable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile
+#define _SALOMEDSImpl_AttributeDrawable_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeDrawable : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeDrawable Set(const TDF_Label& label,const Standard_Integer value) ;
+
+Standard_EXPORT void SetDrawable(const Standard_Integer theValue);
+Standard_EXPORT Standard_Integer IsDrawable() const { return myValue; }
+Standard_EXPORT SALOMEDSImpl_AttributeDrawable();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeDrawable() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeExpandable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef WNT
+using namespace std;
+#endif
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeExpandableID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set (const TDF_Label& L,
+ const Standard_Integer value)
+{
+ Handle(SALOMEDSImpl_AttributeExpandable) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeExpandable();
+ L.AddAttribute(A);
+ }
+
+ A->SetExpandable(value);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeExpandable::SALOMEDSImpl_AttributeExpandable()
+:SALOMEDSImpl_GenericAttribute("AttributeExpandable")
+{
+ myValue = 0;
+}
+
+//=======================================================================
+//function : SetExpandable
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theValue)
+{
+ CheckLocked();
+
+ Backup();
+
+ (theValue!=0)?myValue=1:myValue=0;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeExpandable();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (with)->IsExpandable ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeExpandable::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (into)->SetExpandable (myValue);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeExpandable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile
+#define _SALOMEDSImpl_AttributeExpandable_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Standard_GUID.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeExpandable : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExpandable Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT SALOMEDSImpl_AttributeExpandable();
+Standard_EXPORT void SetExpandable(const Standard_Integer value);
+Standard_EXPORT int IsExpandable() const { return myValue; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeExpandable() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExpandable )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeExternalFileDef.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
+ return SALOMEDSImpl_AttributeExternalFileDefID;
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeExternalFileDef)
+SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S)
+{
+
+ Handle(SALOMEDSImpl_AttributeExternalFileDef) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeExternalFileDef();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue (S);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeExternalFileDef::SALOMEDSImpl_AttributeExternalFileDef()
+:SALOMEDSImpl_GenericAttribute("AttributeExternalFileDef")
+{
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeExternalFileDef();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into);
+ anAttr->SetValue(myString);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
+#define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeExternalFileDef : public SALOMEDSImpl_GenericAttribute
+{
+private:
+
+ TCollection_ExtendedString myString;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExternalFileDef Set(const TDF_Label& label,
+ const TCollection_ExtendedString& Name);
+Standard_EXPORT SALOMEDSImpl_AttributeExternalFileDef();
+Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
+Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeExternalFileDef() {}
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExternalFileDef )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeFileType.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
+ return SALOMEDSImpl_AttributeFileTypeID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeFileType) SALOMEDSImpl_AttributeFileType::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& S)
+{
+
+ Handle(SALOMEDSImpl_AttributeFileType) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeFileType();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue (S);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeFileType::SALOMEDSImpl_AttributeFileType()
+:SALOMEDSImpl_GenericAttribute("AttributeFileType")
+{
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeFileType();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributeFileType)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeFileType::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeFileType)::DownCast (into)->SetValue (myString);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile
+#define _SALOMEDSImpl_AttributeFileType_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <Standard_GUID.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeFileType : public SALOMEDSImpl_GenericAttribute
+{
+private:
+
+ TCollection_ExtendedString myString;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeFileType Set(const TDF_Label& label,
+ const TCollection_ExtendedString& Name) ;
+Standard_EXPORT SALOMEDSImpl_AttributeFileType();
+Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
+Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeFileType() {}
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFileType )
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeFlags.cxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+
+/*
+ Class : SALOMEDSImpl_AttributeFlags
+ Description : This class is intended for storing different object attributes that
+ have only two states (0 and 1).
+*/
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::GetID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
+ return SALOMEDSImpl_AttributeFlagsID;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::Set
+//purpose : Set value of the attribute
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L,
+ const Standard_Integer value )
+{
+ Handle(SALOMEDSImpl_AttributeFlags) A;
+ if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) )
+ {
+ A = new SALOMEDSImpl_AttributeFlags();
+ L.AddAttribute( A );
+ }
+
+ A->Set( value );
+ return A;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags
+//purpose : Constructor
+//=======================================================================
+SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags()
+:SALOMEDSImpl_GenericAttribute("AttributeFlags")
+{
+ myValue = 0;
+}
+
+SALOMEDSImpl_AttributeFlags::~SALOMEDSImpl_AttributeFlags()
+{
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::ID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const
+{
+ return GetID();
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::NewEmpty
+//purpose : Create new empty attribute
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeFlags();
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::Restore
+//purpose : Assign given value to the attribute
+//=======================================================================
+void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with )
+{
+ myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get();
+ return;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::Paste
+//purpose : Assign internal value to the given attribute
+//=======================================================================
+void SALOMEDSImpl_AttributeFlags::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT ) const
+{
+ Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue );
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::Set
+//purpose : Set value
+//=======================================================================
+void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v )
+{
+ Backup();
+ myValue=v;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeFlags::Get
+//purpose : GetValue
+//=======================================================================
+Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const
+{
+ return myValue;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeFlags.hxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#ifndef SALOMEDSImpl_AttributeFlags_HeaderFile
+#define SALOMEDSImpl_AttributeFlags_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+/*
+ Class : SALOMEDSImpl_AttributeFlags
+ Description : This class is intended for storing different object attributes that
+ have only two states (0 and 1).
+*/
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
+
+#ifndef WNT
+class Standard_EXPORT SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
+#else
+class SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
+#endif
+{
+private:
+Standard_Integer myValue;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeFlags) Set(const TDF_Label&, const Standard_Integer );
+
+ SALOMEDSImpl_AttributeFlags();
+Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags();
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore( const Handle(TDF_Attribute)& with );
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste( const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT ) const;
+Standard_EXPORT void Set( const Standard_Integer );
+Standard_EXPORT Standard_Integer Get() const;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFlags )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeGraphic.cxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+
+/*
+ Class : SALOMEDSImpl_AttributeGraphic
+ Description : This class is intended for storing information about
+ graphic representation of objects in dirrent views
+*/
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeGraphic::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
+ return SALOMEDSImpl_AttributeGraphicID;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_AttributeGraphic
+//purpose : Empty Constructor
+//=======================================================================
+SALOMEDSImpl_AttributeGraphic::SALOMEDSImpl_AttributeGraphic()
+:SALOMEDSImpl_GenericAttribute("AttributeGraphic")
+{
+}
+
+//=======================================================================
+//function : ~SALOMEDSImpl_AttributeGraphic
+//purpose : Destructor
+//=======================================================================
+SALOMEDSImpl_AttributeGraphic::~SALOMEDSImpl_AttributeGraphic()
+{
+}
+
+//=======================================================================
+//function : SetVisibility
+//purpose : Set visibility of object in given view
+//=======================================================================
+void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theViewId,
+ const Standard_Boolean theValue )
+{
+ if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue )
+ return;
+
+ Backup();
+ if ( myVisibility.IsBound( theViewId ) )
+ myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0;
+ else
+ myVisibility.Bind( theViewId, theValue ? 1 : 0 );
+}
+
+
+//=======================================================================
+//function : Get
+//purpose : Get visibility of object in given view
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Integer theViewId ) const
+{
+ return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false;
+}
+
+
+//=======================================================================
+//function : ID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const
+{
+ return GetID();
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose : Create new empty attribute
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeGraphic ();
+}
+
+//=======================================================================
+//function : SetVisibility
+//purpose : Set visibility of object in all views
+//=======================================================================
+void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap )
+{
+ myVisibility = theMap;
+}
+
+//=======================================================================
+//function : SetVisibility
+//purpose : Get visibility of object in all views
+//=======================================================================
+const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibility()
+{
+ return myVisibility;
+}
+
+//=======================================================================
+//function : Restore
+//purpose : Restore value of attribute with value of theWith one
+//=======================================================================
+void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWith )
+{
+ Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
+ Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theWith );
+
+ if ( !anAttr.IsNull() )
+ SetVisibility( anAttr->GetVisibility() );
+}
+
+//=======================================================================
+//function : Paste
+//purpose : Paste value of current attribute to the value of entry one
+//=======================================================================
+void SALOMEDSImpl_AttributeGraphic::Paste( const Handle(TDF_Attribute)& theInto,
+ const Handle(TDF_RelocationTable)& ) const
+{
+ Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
+ Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theInto );
+
+ if ( !anAttr.IsNull() )
+ anAttr->SetVisibility( myVisibility );
+}
+
+//=======================================================================
+//function : Dump
+//purpose : Dump
+//=======================================================================
+Standard_OStream& SALOMEDSImpl_AttributeGraphic::Dump( Standard_OStream& anOS ) const
+{
+ anOS << "Visibility of object:" << endl;
+ TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ char str[ 100 ];
+
+ if ( GetVisibility( anIter.Key() ) )
+ sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() );
+ else
+ sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() );
+
+ anOS << str;
+ }
+
+ anOS << "Integer";
+ return anOS;
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeGraphic.hxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile
+#define SALOMEDSImpl_AttributeGraphic_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TColStd_DataMapOfIntegerInteger.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+/*
+ Class : SALOMEDSImpl_AttributeGraphic
+ Description : This class is intended for storing information about
+ graphic representation of objects in dirrent views
+*/
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute)
+
+
+
+#ifndef WNT
+class Standard_EXPORT SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
+#else
+class SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
+#endif
+{
+
+public:
+Standard_EXPORT SALOMEDSImpl_AttributeGraphic();
+Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic();
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT void SetVisibility( const Standard_Integer,
+ const Standard_Boolean );
+Standard_EXPORT Standard_Boolean GetVisibility( const Standard_Integer ) const;
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
+Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
+Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
+ const Handle(TDF_RelocationTable)& ) const;
+Standard_EXPORT virtual Standard_OStream& Dump( Standard_OStream& anOS ) const;
+
+Standard_EXPORT void SetVisibility( const TColStd_DataMapOfIntegerInteger& );
+
+Standard_EXPORT const TColStd_DataMapOfIntegerInteger& GetVisibility();
+
+private:
+ TColStd_DataMapOfIntegerInteger myVisibility;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeGraphic )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeIOR.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef WNT
+using namespace std;
+#endif
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_Study.hxx"
+#include <Standard_GUID.hxx>
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
+ return SALOMEDSImpl_AttributeIORID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& S)
+{
+ Handle(SALOMEDSImpl_AttributeIOR) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeIOR();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(S);
+ SALOMEDSImpl_Study::IORUpdated(A);
+ return A;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
+{
+ CheckLocked();
+
+ Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
+ aStudy->AddCreatedPostponed(theValue);
+ aStudy->AddPostponed(theValue);
+
+ Backup();
+ myString = theValue;
+
+ SALOMEDSImpl_Study::IORUpdated(this);
+
+ //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
+{
+ return myString;
+}
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
+:SALOMEDSImpl_GenericAttribute("AttributeIOR")
+{
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeIOR();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
+ return;
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile
+#define _SALOMEDSImpl_AttributeIOR_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeIOR : public SALOMEDSImpl_GenericAttribute
+{
+private:
+
+ TCollection_ExtendedString myString;
+
+public:
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeIOR Set(const TDF_Label& label,
+ const TCollection_ExtendedString& string);
+Standard_EXPORT SALOMEDSImpl_AttributeIOR();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void SetValue(const TCollection_ExtendedString& theValue);
+Standard_EXPORT TCollection_ExtendedString Value() const ;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeIOR() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeIOR )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeInteger.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef WNT
+using namespace std;
+#endif
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute)
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID ()
+{
+ static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
+ return IntegerID;
+}
+
+Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val)
+{
+ Handle(SALOMEDSImpl_AttributeInteger) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) {
+ A = new SALOMEDSImpl_AttributeInteger();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(Val);
+ return A;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v)
+{
+ if(myValue == v) return;
+
+ Backup();
+ myValue = v;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeInteger();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile
+#define _SALOMEDSImpl_AttributeInteger_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {}
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeInteger) Set (const TDF_Label& L, Standard_Integer Val);
+Standard_EXPORT void SetValue(const Standard_Integer theVal);
+Standard_EXPORT Standard_Integer Value() const { return myValue; }
+Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeInteger() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeInteger )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeLocalID.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeLocalID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L,
+ const Standard_Integer value)
+{
+ Handle(SALOMEDSImpl_AttributeLocalID) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeLocalID();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(value);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeLocalID::SALOMEDSImpl_AttributeLocalID()
+:SALOMEDSImpl_GenericAttribute("AttributeLocalID")
+{
+ myValue = 0;
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue)
+{
+ CheckLocked();
+
+ Backup();
+
+ myValue = theValue;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeLocalID();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeLocalID.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile
+#define _SALOMEDSImpl_AttributeLocalID_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
+
+
+
+class SALOMEDSImpl_AttributeLocalID : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeLocalID Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT void SetValue(const Standard_Integer value);
+Standard_EXPORT Standard_Integer Value() const { return myValue; }
+Standard_EXPORT SALOMEDSImpl_AttributeLocalID();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeLocalID )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeName.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeName.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeName::GetID ()
+{
+ static Standard_GUID NameID ("8650000D-63A0-4651-B621-CC95C9308598");
+ return NameID;
+}
+
+Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& Val)
+{
+ Handle(SALOMEDSImpl_AttributeName) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), A)) {
+ A = new SALOMEDSImpl_AttributeName();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(Val);
+ return A;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeName::ID () const { return GetID(); }
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeName();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributeName)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeName::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeName)::DownCast (into)->SetValue(myString);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeName_HeaderFile
+#define _SALOMEDSImpl_AttributeName_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeName : public SALOMEDSImpl_GenericAttribute
+{
+
+private:
+
+ TCollection_ExtendedString myString;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {}
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeName) Set (const TDF_Label& L, const TCollection_ExtendedString& Val);
+Standard_EXPORT void SetValue(const TCollection_ExtendedString& theVal);
+Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+
+Standard_EXPORT ~SALOMEDSImpl_AttributeName() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeName )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeOpened.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeOpenedID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeOpened) SALOMEDSImpl_AttributeOpened::Set (const TDF_Label& L,
+ const Standard_Integer value)
+{
+ Handle(SALOMEDSImpl_AttributeOpened) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeOpened();
+ L.AddAttribute(A);
+ }
+
+ A->SetOpened (value);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeOpened::SALOMEDSImpl_AttributeOpened()
+:SALOMEDSImpl_GenericAttribute("AttributeOpened")
+{
+ myValue = 0;
+}
+
+//=======================================================================
+//function : SetOpened
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue)
+{
+ Backup();
+
+ (theValue!=0)?myValue=1:myValue=0;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeOpened();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeOpened)::DownCast (with)->IsOpened ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeOpened::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeOpened)::DownCast (into)->SetOpened (myValue);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeOpened.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile
+#define _SALOMEDSImpl_AttributeOpened_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeOpened : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeOpened Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT SALOMEDSImpl_AttributeOpened();
+Standard_EXPORT void SetOpened(const Standard_Integer value);
+Standard_EXPORT int IsOpened() const { return myValue; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeOpened() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeOpened )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePersistentRef.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03");
+ return SALOMEDSImpl_AttributePersistentRefID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributePersistentRef) SALOMEDSImpl_AttributePersistentRef::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& S)
+{
+ Handle(SALOMEDSImpl_AttributePersistentRef) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributePersistentRef();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue (S);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributePersistentRef::SALOMEDSImpl_AttributePersistentRef()
+:SALOMEDSImpl_GenericAttribute("AttributePersistentRef")
+{
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributePersistentRef();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributePersistentRef::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (into)->SetValue(myString);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePersistentRef.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile
+#define _SALOMEDSImpl_AttributePersistentRef_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributePersistentRef : public SALOMEDSImpl_GenericAttribute
+{
+private:
+ TCollection_ExtendedString myString;
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributePersistentRef Set(const TDF_Label& label,
+ const TCollection_ExtendedString& string) ;
+Standard_EXPORT SALOMEDSImpl_AttributePersistentRef();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
+Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributePersistentRef() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePersistentRef )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePixMap.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+#include <TCollection_ExtendedString.hxx>
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributePixMapID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L,
+ const TCollection_ExtendedString& S)
+{
+ Handle(SALOMEDSImpl_AttributePixMap) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributePixMap();
+ L.AddAttribute(A);
+ }
+
+ A->SetPixMap (S);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributePixMap::SALOMEDSImpl_AttributePixMap()
+:SALOMEDSImpl_GenericAttribute("AttributePixMap")
+{
+ myString = "None";
+}
+
+//=======================================================================
+//function : SetPixMap
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S)
+{
+ CheckLocked();
+
+ if(myString == S) return;
+
+ Backup();
+
+ myString = S;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributePixMap();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with)
+{
+ myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePixMap.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile
+#define _SALOMEDSImpl_AttributePixMap_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
+
+
+
+class SALOMEDSImpl_AttributePixMap : public SALOMEDSImpl_GenericAttribute
+{
+private:
+
+ TCollection_ExtendedString myString;
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributePixMap Set(const TDF_Label& label,
+ const TCollection_ExtendedString& string) ;
+Standard_EXPORT SALOMEDSImpl_AttributePixMap();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void SetPixMap(const TCollection_ExtendedString& value);
+Standard_EXPORT TCollection_ExtendedString GetPixMap() const { return myString; }
+Standard_EXPORT Standard_Boolean HasPixMap() const { return (myString != "None"); }
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributePixMap() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePixMap )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePythonObject.cxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+#include <Standard_GUID.hxx>
+#include <string>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
+
+const Standard_GUID& SALOMEDSImpl_AttributePythonObject::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributePythonObjectID;
+}
+
+Handle(SALOMEDSImpl_AttributePythonObject) SALOMEDSImpl_AttributePythonObject::Set(const TDF_Label& label)
+{
+ Handle(SALOMEDSImpl_AttributePythonObject) anAttr;
+ if (!label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID(),anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributePythonObject();
+ label.AddAttribute(anAttr);
+ }
+ return anAttr;
+}
+
+SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject()
+:SALOMEDSImpl_GenericAttribute("AttributePythonObject")
+{
+}
+
+void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence,
+ const bool theScript)
+{
+ CheckLocked();
+ Backup();
+ mySequence = theSequence;
+ myIsScript = theScript;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::GetObject() const
+{
+ return mySequence;
+}
+
+bool SALOMEDSImpl_AttributePythonObject::IsScript() const
+{
+ return myIsScript;
+}
+
+int SALOMEDSImpl_AttributePythonObject::GetLength() const
+{
+ return mySequence.Length();
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributePythonObject::ID() const
+{
+ return GetID();
+}
+
+void SALOMEDSImpl_AttributePythonObject::Restore(const Handle(TDF_Attribute)& with)
+{
+ Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(with);
+ SetObject(anObj->GetObject(),anObj->IsScript());
+}
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributePythonObject::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributePythonObject();
+}
+
+void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)&) const
+{
+ Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(into);
+ anObj->SetObject(GetObject(),IsScript());
+}
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save()
+{
+ char* aString = (char*)GetObject().ToCString();
+ char* aResult = new char[strlen(aString) + 2];
+ aResult[0] = IsScript()?'s':'n';
+ strcpy(aResult+1, aString);
+ TCollection_AsciiString ret(aResult);
+
+ delete aResult;
+ return ret;
+}
+
+void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value)
+{
+ char* aString = value.ToCString();
+ SetObject(aString + 1, aString[0]=='s');
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributePythonObject.hxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile
+#define _SALOMEDSImpl_AttributePythonObject_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <Standard.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
+
+#ifdef GetObject
+#undef GetObject
+#endif
+
+class SALOMEDSImpl_AttributePythonObject : public SALOMEDSImpl_GenericAttribute
+{
+
+public:
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributePythonObject Set(const TDF_Label& label) ;
+Standard_EXPORT SALOMEDSImpl_AttributePythonObject();
+Standard_EXPORT void SetObject(const TCollection_AsciiString& theSequence, const bool theScript) ;
+Standard_EXPORT TCollection_AsciiString GetObject() const;
+Standard_EXPORT bool IsScript() const;
+Standard_EXPORT int GetLength() const;
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributePythonObject() {}
+
+private:
+
+TCollection_AsciiString mySequence;
+bool myIsScript;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePythonObject )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeReal.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeReal.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID ()
+{
+ static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
+ return realID;
+}
+
+Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val)
+{
+ Handle(SALOMEDSImpl_AttributeReal) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) {
+ A = new SALOMEDSImpl_AttributeReal();
+ L.AddAttribute(A);
+ }
+
+ A->SetValue(Val);
+ return A;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v)
+{
+ CheckLocked();
+
+ if( myValue == v) return;
+
+ Backup();
+ myValue = v;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const
+{
+ return GetID();
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeReal();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeReal_HeaderFile
+#define _SALOMEDSImpl_AttributeReal_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Label.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeReal : public SALOMEDSImpl_GenericAttribute
+{
+private:
+ Standard_Real myValue;
+public:
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {}
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReal) Set (const TDF_Label& L, const Standard_Real Val);
+Standard_EXPORT void SetValue(const Standard_Real theVal);
+Standard_EXPORT Standard_Real Value() const { return myValue; }
+Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.RealValue(); }
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeReal() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReal )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeReference.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeReference.hxx"
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_RelocationTable.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeReference::GetID ()
+{
+ static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
+ return refID;
+}
+
+Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel,
+ const TDF_Label& theRefLabel)
+{
+ Handle(SALOMEDSImpl_AttributeReference) A;
+ if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) {
+ A = new SALOMEDSImpl_AttributeReference();
+ theLabel.AddAttribute(A);
+ }
+
+ A->Set(theRefLabel);
+ return A;
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin)
+{
+ CheckLocked();
+
+ if(myLabel == Origin) return;
+
+ Backup();
+ myLabel = Origin;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save()
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(myLabel, anEntry);
+ return anEntry;
+}
+
+void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value)
+{
+ TDF_Label aLabel;
+ TDF_Tool::Label(Label().Data(), value, aLabel);
+ myLabel = aLabel;
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeReference();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With)
+{
+ myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ TDF_Label tLab;
+ if (!myLabel.IsNull()) {
+ if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel;
+ }
+ Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeIOR.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeReference_HeaderFile
+#define _SALOMEDSImpl_AttributeReference_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
+
+
+
+class SALOMEDSImpl_AttributeReference : public SALOMEDSImpl_GenericAttribute
+{
+private:
+ TDF_Label myLabel;
+
+public:
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {}
+Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReference) Set(const TDF_Label& theLabel, const TDF_Label& theRefLabel);
+Standard_EXPORT void Set(const TDF_Label& theLabel);
+Standard_EXPORT TDF_Label Get() const { return myLabel; }
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+
+Standard_EXPORT ~SALOMEDSImpl_AttributeReference() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReference )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSelectable.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeSelectableID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set (const TDF_Label& L,
+ const Standard_Integer value)
+{
+ Handle(SALOMEDSImpl_AttributeSelectable) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeSelectable();
+ L.AddAttribute(A);
+ }
+
+ A->SetSelectable (value);
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeSelectable::SALOMEDSImpl_AttributeSelectable()
+:SALOMEDSImpl_GenericAttribute("AttributeSelectable")
+{
+ myValue = 0;
+}
+
+//=======================================================================
+//function : SetSelectable
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theValue)
+{
+ Backup();
+
+ (theValue!=0)?myValue=1:myValue=0;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeSelectable();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with)
+{
+ myValue = Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (with)->IsSelectable ();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSelectable::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (into)->SetSelectable (myValue);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSelectable.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile
+#define _SALOMEDSImpl_AttributeSelectable_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
+
+
+
+class SALOMEDSImpl_AttributeSelectable : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_Integer myValue;
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSelectable Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT SALOMEDSImpl_AttributeSelectable();
+Standard_EXPORT void SetSelectable(const Standard_Integer value);
+Standard_EXPORT Standard_Integer IsSelectable() const { return myValue; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeSelectable() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSequenceOfInteger.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeSequenceOfIntegerID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOfInteger::Set (const TDF_Label& L)
+{
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeSequenceOfInteger();
+ L.AddAttribute(A);
+ }
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeSequenceOfInteger::SALOMEDSImpl_AttributeSequenceOfInteger()
+:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfInteger")
+{
+ myValue = new TColStd_HSequenceOfInteger();
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeSequenceOfInteger();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute)& with)
+{
+ Standard_Integer i;
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(with);
+ if(!anSeq->myValue.IsNull()) {
+ myValue = new TColStd_HSequenceOfInteger();
+ Standard_Integer Len = anSeq->Length();
+ for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
+ }
+ else
+ myValue.Nullify();
+ return;
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& ) const
+{
+ if(!myValue.IsNull()) {
+ Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast (into)->Assign(myValue);
+ }
+}
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
+{
+ CheckLocked();
+ Backup();
+ if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
+ myValue->ChangeSequence() = other->Sequence();
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
+{
+ CheckLocked();
+ Backup();
+ myValue->SetValue(Index, Value);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const Standard_Integer Value)
+{
+ CheckLocked();
+ Backup();
+ myValue->Append(Value);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Index)
+{
+ CheckLocked();
+ Backup();
+ myValue->Remove(Index);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length()
+{
+ return myValue->Length();
+}
+Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index)
+{
+ return myValue->Value(Index);
+}
+
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfInteger::Save()
+{
+ Standard_Integer aLength = Length();
+ char* aResult = new char[aLength * 25];
+ aResult[0] = 0;
+ Standard_Integer aPosition = 0;
+ for (int i = 1; i <= aLength; i++) {
+ sprintf(aResult + aPosition , "%d ", Value(i));
+ aPosition += strlen(aResult + aPosition);
+ }
+ TCollection_AsciiString ret(aResult);
+ delete aResult;
+
+ return ret;
+}
+
+void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const TCollection_AsciiString& value)
+{
+ Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
+
+ char* aCopy = value.ToCString();
+ char* adr = strtok(aCopy, " ");
+ while (adr) {
+ int l = atol(adr);
+ CasCadeSeq->Append(l);
+ adr = strtok(NULL, " ");
+ }
+ Assign(CasCadeSeq);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSequenceOfInteger.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
+#define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeSequenceOfInteger : public SALOMEDSImpl_GenericAttribute
+{
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfInteger Set(const TDF_Label& label) ;
+Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfInteger();
+Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ;
+Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ;
+Standard_EXPORT void Add(const Standard_Integer value) ;
+Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ;
+Standard_EXPORT void Remove(const Standard_Integer Index) ;
+Standard_EXPORT Standard_Integer Length() ;
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfInteger() {}
+
+private:
+
+Handle_TColStd_HSequenceOfInteger myValue;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfInteger )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSequenceOfReal.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeSequenceOfRealID;
+}
+
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfReal::Set (const TDF_Label& L)
+{
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeSequenceOfReal();
+ L.AddAttribute(A);
+ }
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal()
+:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfReal")
+{
+ myValue = new TColStd_HSequenceOfReal();
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeSequenceOfReal();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& with)
+{
+ Standard_Integer i;
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(with);
+ if(!anSeq->myValue.IsNull()) {
+ myValue = new TColStd_HSequenceOfReal();
+ Standard_Integer Len = anSeq->Length();
+ for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
+ }
+ else
+ myValue.Nullify();
+ return;
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& ) const
+{
+ if(!myValue.IsNull()) {
+ Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast (into)->Assign(myValue);
+ }
+}
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const Handle(TColStd_HSequenceOfReal)& other)
+{
+ CheckLocked();
+ Backup();
+ if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
+ myValue->ChangeSequence() = other->Sequence();
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
+{
+ CheckLocked();
+ Backup();
+ myValue->SetValue(Index, Value);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Add(const Standard_Real Value)
+{
+ CheckLocked();
+ Backup();
+ myValue->Append(Value);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index)
+{
+ CheckLocked();
+ Backup();
+ myValue->Remove(Index);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length()
+{
+ return myValue->Length();
+}
+
+Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index)
+{
+ return myValue->Value(Index);
+}
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfReal::Save()
+{
+ Standard_Integer aLength = Length();
+ char* aResult = new char[aLength * 25];
+ aResult[0] = 0;
+ Standard_Integer aPosition = 0;
+ for (int i = 1; i <= aLength; i++) {
+ sprintf(aResult + aPosition , "%f ", Value(i));
+ aPosition += strlen(aResult + aPosition);
+ }
+ TCollection_AsciiString ret(aResult);
+ delete aResult;
+
+ return ret;
+}
+
+void SALOMEDSImpl_AttributeSequenceOfReal::Load(const TCollection_AsciiString& value)
+{
+ Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
+
+ char* aCopy = value.ToCString();
+ char* adr = strtok(aCopy, " ");
+ char *err = NULL;
+ while (adr) {
+ Standard_Real r = strtod(adr, &err);
+ CasCadeSeq->Append(r);
+ adr = strtok(NULL, " ");
+ }
+ Assign(CasCadeSeq);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeSequenceOfReal.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
+#define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TColStd_HSequenceOfReal.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeSequenceOfReal : public SALOMEDSImpl_GenericAttribute
+{
+
+public:
+
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfReal Set(const TDF_Label& label) ;
+Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfReal();
+Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ;
+Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ;
+Standard_EXPORT void Add(const Standard_Real Value) ;
+Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ;
+Standard_EXPORT void Remove(const Standard_Integer Index) ;
+Standard_EXPORT Standard_Integer Length() ;
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfReal() {}
+
+private:
+Handle_TColStd_HSequenceOfReal myValue;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfReal )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeStudyProperties.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include <SALOMEDSImpl_AttributeStudyProperties.hxx>
+#include <Standard_GUID.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
+
+const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeStudyPropertiesID;
+}
+
+Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label)
+{
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties();
+ label.AddAttribute(anAttr);
+ }
+ return anAttr;
+}
+
+SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties()
+:SALOMEDSImpl_GenericAttribute("AttributeStudyProperties")
+{
+ myLocked = Standard_False;
+ myLockChanged = Standard_False;
+ Init();
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::Init()
+{
+ myUserName = new TColStd_HSequenceOfExtendedString();
+ myMinute = new TColStd_HSequenceOfInteger();
+ myHour = new TColStd_HSequenceOfInteger();
+ myDay = new TColStd_HSequenceOfInteger();
+ myMonth = new TColStd_HSequenceOfInteger();
+ myYear = new TColStd_HSequenceOfInteger();
+// myModified = 0;
+ myMode = 0; // none
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_ExtendedString& theUserName,
+ const Standard_Integer theMinute,
+ const Standard_Integer theHour,
+ const Standard_Integer theDay,
+ const Standard_Integer theMonth,
+ const Standard_Integer theYear)
+{
+ if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 ||
+ theDay<0 || theDay>31 || theMonth<0 || theMonth>12)
+ return;
+
+ CheckLocked();
+ Backup();
+
+ myUserName->Append(theUserName);
+ myMinute->Append(theMinute);
+ myHour->Append(theHour);
+ myDay->Append(theDay);
+ myMonth->Append(theMonth);
+ myYear->Append(theYear);
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::GetModifications
+ (Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
+ Handle(TColStd_HSequenceOfInteger)& theMinutes,
+ Handle(TColStd_HSequenceOfInteger)& theHours,
+ Handle(TColStd_HSequenceOfInteger)& theDays,
+ Handle(TColStd_HSequenceOfInteger)& theMonths,
+ Handle(TColStd_HSequenceOfInteger)& theYears) const
+{
+ theUserNames = myUserName;
+ theMinutes = myMinute;
+ theHours = myHour;
+ theDays = myDay;
+ theMonths = myMonth;
+ theYears = myYear;
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
+{
+ if (myUserName->Length() == 0)
+ return TCollection_ExtendedString("");
+ return myUserName->Value(1);
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
+ (Standard_Integer& theMinute,
+ Standard_Integer& theHour,
+ Standard_Integer& theDay,
+ Standard_Integer& theMonth,
+ Standard_Integer& theYear) const
+{
+ if (myMinute->Length() != 0) {
+ theMinute = myMinute->Value(1);
+ theHour = myHour->Value(1);
+ theDay = myDay->Value(1);
+ theMonth = myMonth->Value(1);
+ theYear = myYear->Value(1);
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName)
+{
+ if (myUserName->Length() > 0) {
+ CheckLocked();
+ Backup();
+ myUserName->SetValue(1, theName);
+ }
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode)
+{
+ CheckLocked();
+ Backup();
+ myMode = theMode;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const
+{
+ return myMode;
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified)
+{
+ myModified = theModified;
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsModified() const
+{
+ return (myModified != 0);
+}
+
+Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const
+{
+ return myModified;
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked)
+{
+// Backup();
+ if (myLocked != theLocked) {
+ myLockChanged = Standard_True;
+ myLocked = theLocked;
+ }
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLocked() const
+{
+ return myLocked;
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const Standard_Boolean theErase) {
+ if (!myLockChanged) return Standard_False;
+ if (theErase) myLockChanged = Standard_False;
+ return Standard_True;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const
+{
+ return GetID();
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with)
+{
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with);
+ Init();
+ Standard_Integer i;
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+ for (i = aNames->Length(); i > 0; i--) {
+ myUserName->Prepend(aNames->Value(i));
+ myMinute->Prepend(aMinutes->Value(i));
+ myHour->Prepend(aHours->Value(i));
+ myDay->Prepend(aDays->Value(i));
+ myMonth->Prepend(aMonths->Value(i));
+ myYear->Prepend(aYears->Value(i));
+ }
+ myMode = aProp->GetCreationMode();
+// myModified = aProp->GetModified();
+// myLocked = aProp->IsLocked();
+}
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributeStudyProperties();
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)&) const
+{
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
+ Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into);
+ aProp->Init();
+
+ Standard_Integer i;
+ for(i = 1; i <= myUserName->Length(); i++) {
+ aProp->SetModification(myUserName->Value(i),
+ myMinute->Value(i), myHour->Value(i),
+ myDay->Value(i), myMonth->Value(i), myYear->Value(i));
+ }
+
+ aProp->SetCreationMode(myMode);
+// aProp->SetModified(myModified);
+// aProp->SetLocked(myLocked);
+}
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+
+ int aLength, anIndex;
+ for (aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--)
+ aLength += aNames->Value(anIndex).Length() + 1;
+
+ char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+
+ char crMode = (char)GetCreationMode();
+
+ sprintf(aProperty,"%c%c", crMode, IsLocked()?'l':'u');
+
+ aLength = aNames->Length();
+ int a = 2;
+ for (anIndex = 1; anIndex <= aLength; anIndex++) {
+ sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
+ (int)(aMinutes->Value(anIndex)),
+ (int)(aHours->Value(anIndex)),
+ (int)(aDays->Value(anIndex)),
+ (int)(aMonths->Value(anIndex)),
+ (int)(aYears->Value(anIndex)),
+ (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString()));
+ a = strlen(aProperty);
+ aProperty[a++] = 1;
+ }
+ aProperty[a] = 0;
+ TCollection_AsciiString prop(aProperty);
+ delete aProperty;
+
+ return prop;
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value)
+{
+ char* aCopy = value.ToCString();
+
+ int crMode = (int)aCopy[0];
+ SetCreationMode(crMode);
+
+ int anIndex;
+ for (anIndex = 2; anIndex + 2 < value.Length() ;) {
+ char str[10];
+ Standard_Integer aMinute, aHour, aDay, aMonth, aYear;
+ str[0] = aCopy[anIndex++];
+ str[1] = aCopy[anIndex++];
+ str[2] = 0;
+ aMinute = atoi(str);
+ str[0] = aCopy[anIndex++];
+ str[1] = aCopy[anIndex++];
+ aHour = atoi(str);
+ str[0] = aCopy[anIndex++];
+ str[1] = aCopy[anIndex++];
+ aDay = atoi(str);
+ str[0] = aCopy[anIndex++];
+ str[1] = aCopy[anIndex++];
+ aMonth = atoi(str);
+ str[0] = aCopy[anIndex++];
+ str[1] = aCopy[anIndex++];
+ str[2] = aCopy[anIndex++];
+ str[3] = aCopy[anIndex++];
+ str[4] = 0;
+ aYear = atoi(str);
+
+ int aNameSize;
+ for(aNameSize = 0; aCopy[anIndex+aNameSize]!=1; aNameSize++);
+ char *aName = new char[aNameSize+1];
+ strncpy(aName, &(aCopy[anIndex]), aNameSize);
+ aName[aNameSize] = 0;
+ SetModification(aName,aMinute,aHour,aDay,aMonth,aYear);
+ delete(aName);
+ anIndex += aNameSize + 1;
+ }
+ if (aCopy[1] == 'l') {
+ SetLocked(Standard_True);
+ }
+ SetModified(0);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeStudyProperties.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
+#define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <Standard.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
+
+#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
+{
+public:
+Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties();
+Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {}
+
+Standard_EXPORT static const Standard_GUID& GetID();
+Standard_EXPORT const Standard_GUID& ID() const;
+
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_Label& label);
+
+Standard_EXPORT void Init();
+
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+
+Standard_EXPORT void SetModification(const TCollection_ExtendedString& theUserName,
+ const Standard_Integer theMinute,
+ const Standard_Integer theHour,
+ const Standard_Integer theDay,
+ const Standard_Integer theMonth,
+ const Standard_Integer theYear);
+Standard_EXPORT void GetModifications(Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
+ Handle(TColStd_HSequenceOfInteger)& theMinutes,
+ Handle(TColStd_HSequenceOfInteger)& theHours,
+ Handle(TColStd_HSequenceOfInteger)& theDays,
+ Handle(TColStd_HSequenceOfInteger)& theMonths,
+ Handle(TColStd_HSequenceOfInteger)& theYears) const;
+
+Standard_EXPORT TCollection_ExtendedString GetCreatorName() const;
+Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,
+ Standard_Integer& theHour,
+ Standard_Integer& theDay,
+ Standard_Integer& theMonth,
+ Standard_Integer& theYear) const;
+
+Standard_EXPORT void ChangeCreatorName(const TCollection_ExtendedString& theUserName);
+
+Standard_EXPORT void SetCreationMode(const Standard_Integer theMode);
+Standard_EXPORT Standard_Integer GetCreationMode() const;
+
+Standard_EXPORT void SetModified(const Standard_Integer theModified);
+Standard_EXPORT Standard_Boolean IsModified() const;
+Standard_EXPORT Standard_Integer GetModified() const;
+
+Standard_EXPORT void SetLocked(const Standard_Boolean theLocked);
+Standard_EXPORT Standard_Boolean IsLocked() const;
+Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase);
+
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with);
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const;
+
+private:
+
+Handle_TColStd_HSequenceOfExtendedString myUserName;
+Handle_TColStd_HSequenceOfInteger myMinute;
+Handle_TColStd_HSequenceOfInteger myHour;
+Handle_TColStd_HSequenceOfInteger myDay;
+Handle_TColStd_HSequenceOfInteger myMonth;
+Handle_TColStd_HSequenceOfInteger myYear;
+Standard_Integer myMode;
+Standard_Integer myModified;
+Standard_Boolean myLocked;
+Standard_Boolean myLockChanged;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeStudyProperties )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTableOfInteger.cxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#include <SALOMEDSImpl_AttributeTableOfInteger.hxx>
+#include <Standard_Failure.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+#include <Standard_GUID.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
+
+#define SEPARATOR '\1'
+
+static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
+ return aString.Split(aPos);
+}
+
+static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos < 1) return aString;
+ if(aPos == 1) return TCollection_ExtendedString();
+ aString.Split(aPos-1);
+ return aString;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTableOfIntegerID;
+}
+
+Handle(SALOMEDSImpl_AttributeTableOfInteger) SALOMEDSImpl_AttributeTableOfInteger::Set(const TDF_Label& label)
+{
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) anAttr;
+ if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID(),anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeTableOfInteger();
+ label.AddAttribute(anAttr);
+ }
+ return anAttr;
+}
+
+SALOMEDSImpl_AttributeTableOfInteger::SALOMEDSImpl_AttributeTableOfInteger()
+:SALOMEDSImpl_GenericAttribute("AttributeTableOfInteger")
+{
+ myRows = new TColStd_HSequenceOfExtendedString();
+ myCols = new TColStd_HSequenceOfExtendedString();
+ myNbRows = 0;
+ myNbColumns = 0;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const Standard_Integer theNbColumns)
+{
+ CheckLocked();
+ Backup();
+
+ TColStd_DataMapOfIntegerInteger aMap;
+ aMap = myTable;
+ myTable.Clear();
+
+ TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap);
+ for(; anIterator.More(); anIterator.Next()) {
+ int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
+ int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ if(aCol == 0) { aCol = myNbColumns; aRow--; }
+ if(aCol > theNbColumns) continue;
+ int aKey = (aRow-1)*theNbColumns+aCol;
+ myTable.Bind(aKey, anIterator.Value());
+ }
+
+ myNbColumns = theNbColumns;
+
+ while (myCols->Length() < myNbColumns) { // append empty columns titles
+ myCols->Append(TCollection_ExtendedString(""));
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ myTitle = theTitle;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const
+{
+ return myTitle;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer theRow,
+ const Handle(TColStd_HSequenceOfInteger)& theData)
+{
+ CheckLocked();
+ if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+
+ Backup();
+
+ while (myRows->Length() < theRow) { // append new row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(aShift + i, theData->Value(i));
+ }
+
+ if(theRow > myNbRows) myNbRows = theRow;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger();
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift+i))
+ aSeq->Append(myTable.Find(aShift+i));
+ else
+ aSeq->Append(0);
+ }
+
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.Length()>0) {
+ aTitle += SEPARATOR;
+ aTitle += aUnit;
+ }
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theUnit)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ aTitle += SEPARATOR;
+ aTitle += theUnit;
+
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+{
+ if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theUnits->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ return aSeq;
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowTitle(const Standard_Integer theRow) const
+{
+ return getTitle(myRows->Value(theRow));
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const Standard_Integer theRow) const
+{
+ return getUnit(myRows->Value(theRow));
+}
+
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer theColumn,
+ const Handle(TColStd_HSequenceOfInteger)& theData)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Backup();
+
+ Standard_Integer i, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ }
+
+ if(aLength > myNbRows) {
+ myNbRows = aLength;
+ while (myRows->Length() < myNbRows) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1) + theColumn;
+ if(myTable.IsBound(anIndex))
+ aSeq->Append(myTable.Find(anIndex));
+ else
+ aSeq->Append(0);
+ }
+
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const Standard_Integer theColumn,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
+ myCols->SetValue(theColumn,theTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const Standard_Integer theColumn) const
+{
+ if(myCols.IsNull()) return "";
+ if(myCols->Length() < theColumn) return "";
+ return myCols->Value(theColumn);
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myCols->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ return aSeq;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbRows() const
+{
+ return myNbRows;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbColumns() const
+{
+ return myNbColumns;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const Standard_Integer theValue,
+ const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable.Bind(anIndex, theValue);
+
+ if(theRow > myNbRows) {
+ while (myRows->Length() < theRow) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ myNbRows = theRow;
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeTableOfInteger::HasValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) return Standard_False;
+ if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ return myTable.IsBound(anIndex);
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+
+ Standard_Failure::Raise("Invalid cell index");
+ return 0;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::ID() const
+{
+ return GetID();
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& with)
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(with);
+
+ myTable.Clear();
+ myCols->Clear();
+ myRows->Clear();
+
+ myTable = aTable->myTable;
+ myNbRows = aTable->myNbRows;
+ myNbColumns = aTable->myNbColumns;
+ myTitle = aTable->myTitle;
+
+ for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+ myRows->Append(aTable->GetRowTitle(anIndex));
+
+ for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
+ myCols->Append(aTable->GetColumnTitle(anIndex));
+}
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributeTableOfInteger();
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)&) const
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(into);
+
+ aTable->myTable.Clear();
+ aTable->myCols->Clear();
+ aTable->myRows->Clear();
+
+ aTable->myTable = myTable;
+ aTable->myTitle = myTitle;
+ aTable->myNbRows = myNbRows;
+ aTable->myNbColumns = myNbColumns;
+
+ for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+ aTable->myRows->Append(GetRowTitle(anIndex));
+ for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
+ aTable->myCols->Append(GetColumnTitle(anIndex));
+}
+
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1)+theColumn;
+ if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+
+void SALOMEDSImpl_AttributeTableOfInteger::ConvertToString(ostrstream& theStream)
+{
+ int i, j, l;
+
+ theStream.precision(64);
+
+ //Title
+ l = myTitle.Length();
+ theStream << l << "\n";
+ for(i=1; i<=l; i++)
+ theStream << myTitle.Value(i) << "\n";
+
+ //Nb rows
+ theStream << myNbRows << "\n";
+
+ //Rows titles
+ for(i=1; i<=myNbRows; i++) {
+ l = myRows->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myRows->Value(i).Value(j) << "\n";
+ }
+
+ //Nb columns
+ theStream << myNbColumns << "\n";
+
+ //Columns titles
+ for(i=1; i<=myNbColumns; i++) {
+ l = myCols->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myCols->Value(i).Value(j) << "\n";
+ }
+
+ //Store the table values
+ l = myTable.Extent();
+ theStream << l << "\n";
+ TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(myTable);
+ for(; anIterator.More(); anIterator.Next()) {
+ theStream << anIterator.Key() << "\n";
+ theStream << anIterator.Value() << "\n";
+ }
+
+ return;
+}
+
+bool SALOMEDSImpl_AttributeTableOfInteger::RestoreFromString(istrstream& theStream)
+{
+ Backup();
+
+ int i, j, l;
+
+ Standard_ExtCharacter anExtChar;
+ TCollection_ExtendedString aStr;
+
+ //Title
+ theStream >> l;
+
+ myTitle = TCollection_ExtendedString(l, 0);
+ for(i=1; i<=l; i++) {
+ theStream >> anExtChar;
+ myTitle.SetValue(i, anExtChar);
+ }
+
+ //Nb rows
+ theStream >> myNbRows;
+
+ //Rows titles
+ myRows->Clear();
+ for(i=1; i<=myNbRows; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myRows->Append(aStr);
+ }
+
+ //Nb columns
+ theStream >> myNbColumns;
+
+ //Columns titles
+ myCols->Clear();
+ for(i=1; i<=myNbColumns; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myCols->Append(aStr);
+ }
+
+ //Restore the table values
+ theStream >> l;
+ myTable.Clear();
+ for(i=1; i<=l; i++) {
+ int aKey, aValue;
+ theStream >> aKey;
+ theStream >> aValue;
+ myTable.Bind(aKey, aValue);
+ }
+
+ return true;
+}
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTableOfInteger::Save()
+{
+ ostrstream ostr;
+ ConvertToString(ostr);
+ TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
+ return aString;
+}
+
+void SALOMEDSImpl_AttributeTableOfInteger::Load(const TCollection_AsciiString& value)
+{
+ istrstream aStream(value.ToCString(), strlen(value.ToCString()));
+ RestoreFromString(aStream);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTableOfReal.cxx
+// Author : Michael Ponikarov
+// Module : SALOME
+
+#include <SALOMEDSImpl_AttributeTableOfReal.hxx>
+#include <Standard_Failure.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfIntegerReal.hxx>
+#include <Standard_GUID.hxx>
+#include <stdio.h>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
+
+#define SEPARATOR '\1'
+
+static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
+ return aString.Split(aPos);
+}
+
+static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos < 1) return aString;
+ if(aPos == 1) return TCollection_ExtendedString();
+ aString.Split(aPos-1);
+ return aString;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTableOfRealID;
+}
+
+Handle(SALOMEDSImpl_AttributeTableOfReal) SALOMEDSImpl_AttributeTableOfReal::Set(const TDF_Label& label)
+{
+ Handle(SALOMEDSImpl_AttributeTableOfReal) anAttr;
+ if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID(),anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeTableOfReal();
+ label.AddAttribute(anAttr);
+ }
+ return anAttr;
+}
+
+SALOMEDSImpl_AttributeTableOfReal::SALOMEDSImpl_AttributeTableOfReal()
+:SALOMEDSImpl_GenericAttribute("AttributeTableOfReal")
+{
+ myRows = new TColStd_HSequenceOfExtendedString();
+ myCols = new TColStd_HSequenceOfExtendedString();
+ myNbRows = 0;
+ myNbColumns = 0;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const Standard_Integer theNbColumns)
+{
+ CheckLocked();
+ Backup();
+
+ TColStd_DataMapOfIntegerReal aMap;
+ aMap = myTable;
+ myTable.Clear();
+
+ TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap);
+ for(; anIterator.More(); anIterator.Next()) {
+ int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
+ int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ if(aCol == 0) { aCol = myNbColumns; aRow--; }
+ if(aCol > theNbColumns) continue;
+ int aKey = (aRow-1)*theNbColumns+aCol;
+ myTable.Bind(aKey, anIterator.Value());
+ }
+
+ myNbColumns = theNbColumns;
+
+ while (myCols->Length() < myNbColumns) { // append empty columns titles
+ myCols->Append(TCollection_ExtendedString(""));
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ myTitle = theTitle;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetTitle() const
+{
+ return myTitle;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow,
+ const Handle(TColStd_HSequenceOfReal)& theData)
+{
+ CheckLocked();
+ if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+
+ Backup();
+
+ while (myRows->Length() < theRow) { // append new row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(aShift + i, theData->Value(i));
+ }
+
+ if(theRow > myNbRows) myNbRows = theRow;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetRowData(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal();
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift+i))
+ aSeq->Append(myTable.Find(aShift+i));
+ else
+ aSeq->Append(0.);
+ }
+
+ return aSeq;
+}
+
+
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.Length()>0) {
+ aTitle += SEPARATOR;
+ aTitle += aUnit;
+ }
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theUnit)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ aTitle += SEPARATOR;
+ aTitle += theUnit;
+
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+{
+ if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theUnits->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowUnits()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ return aSeq;
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowTitle(const Standard_Integer theRow) const
+{
+ return getTitle(myRows->Value(theRow));
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const Standard_Integer theRow) const
+{
+ return getUnit(myRows->Value(theRow));
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer theColumn,
+ const Handle(TColStd_HSequenceOfReal)& theData)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Backup();
+
+ Standard_Integer i, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ }
+
+ if(aLength > myNbRows) {
+ myNbRows = aLength;
+ while (myRows->Length() < myNbRows) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1) + theColumn;
+ if(myTable.IsBound(anIndex))
+ aSeq->Append(myTable.Find(anIndex));
+ else
+ aSeq->Append(0.);
+ }
+
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const Standard_Integer theColumn,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
+ myCols->SetValue(theColumn,theTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const Standard_Integer theColumn) const
+{
+ if(myCols.IsNull()) return "";
+ if(myCols->Length() < theColumn) return "";
+ return myCols->Value(theColumn);
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myCols->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ return aSeq;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbRows() const
+{
+ return myNbRows;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbColumns() const
+{
+ return myNbColumns;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::PutValue(const Standard_Real theValue,
+ const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable.Bind(anIndex, theValue);
+
+ if(theRow > myNbRows) {
+ while (myRows->Length() < theRow) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ myNbRows = theRow;
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeTableOfReal::HasValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) return Standard_False;
+ if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ return myTable.IsBound(anIndex);
+}
+
+Standard_Real SALOMEDSImpl_AttributeTableOfReal::GetValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+
+ Standard_Failure::Raise("Invalid cell index");
+ return 0.;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::ID() const
+{
+ return GetID();
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& with)
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(with);
+
+ myTable.Clear();
+ myCols->Clear();
+ myRows->Clear();
+
+ myTable = aTable->myTable;
+ myNbRows = aTable->myNbRows;
+ myNbColumns = aTable->myNbColumns;
+ myTitle = aTable->myTitle;
+
+ for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+ myRows->Append(aTable->GetRowTitle(anIndex));
+
+ for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
+ myCols->Append(aTable->GetColumnTitle(anIndex));
+}
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributeTableOfReal();
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)&) const
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(into);
+
+ aTable->myTable.Clear();
+ aTable->myCols->Clear();
+ aTable->myRows->Clear();
+
+ aTable->myTable = myTable;
+ aTable->myTitle = myTitle;
+ aTable->myNbRows = myNbRows;
+ aTable->myNbColumns = myNbColumns;
+
+ for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+ aTable->myRows->Append(GetRowTitle(anIndex));
+ for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
+ aTable->myCols->Append(GetColumnTitle(anIndex));
+}
+
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1)+theColumn;
+ if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+
+
+void SALOMEDSImpl_AttributeTableOfReal::ConvertToString(ostrstream& theStream)
+{
+ int i, j, l;
+
+
+ //Title
+ l = myTitle.Length();
+ theStream << l << "\n";
+ for(i=1; i<=l; i++)
+ theStream << myTitle.Value(i) << "\n";
+
+ //Nb rows
+ theStream << myNbRows << "\n";
+
+ //Rows titles
+ for(i=1; i<=myNbRows; i++) {
+ l = myRows->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myRows->Value(i).Value(j) << "\n";
+ }
+
+ //Nb columns
+ theStream << myNbColumns << "\n";
+
+ //Columns titles
+ for(i=1; i<=myNbColumns; i++) {
+ l = myCols->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myCols->Value(i).Value(j) << "\n";
+ }
+
+ //Store the table values
+ l = myTable.Extent();
+ theStream << l << "\n";
+ char *aBuffer = new char[128];
+ TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(myTable);
+ for(; anIterator.More(); anIterator.Next()) {
+ theStream << anIterator.Key() << "\n";
+ sprintf(aBuffer, "%.64e", anIterator.Value());
+ theStream << aBuffer << "\n";
+ }
+
+ delete []aBuffer;
+
+ return;
+}
+
+bool SALOMEDSImpl_AttributeTableOfReal::RestoreFromString(istrstream& theStream)
+{
+ Backup();
+
+ int i, j, l;
+
+ Standard_ExtCharacter anExtChar;
+ TCollection_ExtendedString aStr;
+
+ //Title
+ theStream >> l;
+
+ myTitle = TCollection_ExtendedString(l, 0);
+ for(i=1; i<=l; i++) {
+ theStream >> anExtChar;
+ myTitle.SetValue(i, anExtChar);
+ }
+
+ //Nb rows
+ theStream >> myNbRows;
+
+ //Rows titles
+ myRows->Clear();
+ for(i=1; i<=myNbRows; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myRows->Append(aStr);
+ }
+
+ //Nb columns
+ theStream >> myNbColumns;
+
+ //Columns titles
+ myCols->Clear();
+ for(i=1; i<=myNbColumns; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myCols->Append(aStr);
+ }
+
+ //Restore the table values
+ theStream >> l;
+ myTable.Clear();
+ for(i=1; i<=l; i++) {
+ Standard_Integer aKey;
+ Standard_Real aValue;
+ theStream >> aKey;
+ theStream >> aValue;
+ myTable.Bind(aKey, aValue);
+ }
+
+ return true;
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTableOfReal::Save()
+{
+ ostrstream ostr;
+ ConvertToString(ostr);
+ TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
+ return aString;
+}
+
+void SALOMEDSImpl_AttributeTableOfReal::Load(const TCollection_AsciiString& value)
+{
+ istrstream aStream(value.ToCString(), strlen(value.ToCString()));
+ RestoreFromString(aStream);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTableOfString.cxx
+// Author : Sergey Ruin
+// Module : SALOME
+
+#include <SALOMEDSImpl_AttributeTableOfString.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_GUID.hxx>
+#include <stdio.h>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
+
+typedef NCollection_DataMap<Standard_Integer, TCollection_ExtendedString>::Iterator DataMapIterator;
+
+#define SEPARATOR '\1'
+
+static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
+ return aString.Split(aPos);
+}
+
+static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+{
+ TCollection_ExtendedString aString(theString);
+ int aPos = aString.Search(SEPARATOR);
+ if(aPos < 1) return aString;
+ if(aPos == 1) return TCollection_ExtendedString();
+ aString.Split(aPos-1);
+ return aString;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTableOfStringID;
+}
+
+Handle(SALOMEDSImpl_AttributeTableOfString) SALOMEDSImpl_AttributeTableOfString::Set(const TDF_Label& label)
+{
+ Handle(SALOMEDSImpl_AttributeTableOfString) anAttr;
+ if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(),anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeTableOfString();
+ label.AddAttribute(anAttr);
+ }
+ return anAttr;
+}
+
+SALOMEDSImpl_AttributeTableOfString::SALOMEDSImpl_AttributeTableOfString()
+:SALOMEDSImpl_GenericAttribute("AttributeTableOfString")
+{
+ myRows = new TColStd_HSequenceOfExtendedString();
+ myCols = new TColStd_HSequenceOfExtendedString();
+ myNbRows = 0;
+ myNbColumns = 0;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const Standard_Integer theNbColumns)
+{
+ CheckLocked();
+ Backup();
+
+ DataMapOfIntegerString aMap;
+ aMap = myTable;
+ myTable.Clear();
+
+ DataMapIterator anIterator(aMap);
+ for(; anIterator.More(); anIterator.Next()) {
+ int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
+ int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ if(aCol == 0) { aCol = myNbColumns; aRow--; }
+ if(aCol > theNbColumns) continue;
+ int aKey = (aRow-1)*theNbColumns+aCol;
+ myTable.Bind(aKey, anIterator.Value());
+ }
+
+ myNbColumns = theNbColumns;
+
+ while (myCols->Length() < myNbColumns) { // append empty columns titles
+ myCols->Append(TCollection_ExtendedString(""));
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.Length()>0) {
+ aTitle += SEPARATOR;
+ aTitle += aUnit;
+ }
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const Standard_Integer theRow,
+ const TCollection_ExtendedString& theUnit)
+{
+ CheckLocked();
+ Backup();
+ TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ aTitle += SEPARATOR;
+ aTitle += theUnit;
+
+ myRows->SetValue(theRow, aTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+{
+ if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theUnits->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowUnits()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myRows->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ return aSeq;
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowTitle(const Standard_Integer theRow) const
+{
+ return getTitle(myRows->Value(theRow));
+}
+
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const Standard_Integer theRow) const
+{
+ return getUnit(myRows->Value(theRow));
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theRow,
+ const Handle(TColStd_HSequenceOfExtendedString)& theData)
+{
+ CheckLocked();
+ if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+
+ Backup();
+
+ while (myRows->Length() < theRow) { // append new row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(aShift + i, theData->Value(i));
+ }
+
+ if(theRow > myNbRows) myNbRows = theRow;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ myTitle = theTitle;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetTitle() const
+{
+ return myTitle;
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowData(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString();
+ Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift+i))
+ aSeq->Append(myTable.Find(aShift+i));
+ else
+ aSeq->Append(0.);
+ }
+
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer theColumn,
+ const Handle(TColStd_HSequenceOfExtendedString)& theData)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Backup();
+
+ Standard_Integer i, aLength = theData->Length();
+ for(i = 1; i <= aLength; i++) {
+ myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ }
+
+ if(aLength > myNbRows) {
+ myNbRows = aLength;
+ while (myRows->Length() < myNbRows) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnData(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1) + theColumn;
+ if(myTable.IsBound(anIndex))
+ aSeq->Append(myTable.Find(anIndex));
+ else
+ aSeq->Append(0.);
+ }
+
+ return aSeq;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const Standard_Integer theColumn,
+ const TCollection_ExtendedString& theTitle)
+{
+ CheckLocked();
+ Backup();
+ while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
+ myCols->SetValue(theColumn,theTitle);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const Standard_Integer theColumn) const
+{
+ if(myCols.IsNull()) return "";
+ if(myCols->Length() < theColumn) return "";
+ return myCols->Value(theColumn);
+}
+
+
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+{
+ if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
+ int aLength = theTitles->Length(), i;
+ for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnTitles()
+{
+ Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ int aLength = myCols->Length(), i;
+ for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ return aSeq;
+}
+
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbRows() const
+{
+ return myNbRows;
+}
+
+Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbColumns() const
+{
+ return myNbColumns;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::PutValue(const TCollection_ExtendedString& theValue,
+ const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ CheckLocked();
+ if(theColumn > myNbColumns) SetNbColumns(theColumn);
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable.Bind(anIndex, theValue);
+
+ if(theRow > myNbRows) {
+ while (myRows->Length() < theRow) { // append empty row titles
+ myRows->Append(TCollection_ExtendedString(""));
+ }
+ myNbRows = theRow;
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+Standard_Boolean SALOMEDSImpl_AttributeTableOfString::HasValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) return Standard_False;
+ if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ return myTable.IsBound(anIndex);
+}
+
+TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetValue(const Standard_Integer theRow,
+ const Standard_Integer theColumn)
+{
+ if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+
+ Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+
+ Standard_Failure::Raise("Invalid cell index");
+ return 0.;
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::ID() const
+{
+ return GetID();
+}
+
+void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& with)
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(with);
+
+ myTable.Clear();
+ myCols->Clear();
+ myRows->Clear();
+
+ myTable = aTable->myTable;
+ myNbRows = aTable->myNbRows;
+ myNbColumns = aTable->myNbColumns;
+ myTitle = aTable->myTitle;
+
+ for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+ myRows->Append(aTable->GetRowTitle(anIndex));
+
+ for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
+ myCols->Append(aTable->GetColumnTitle(anIndex));
+}
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfString::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributeTableOfString();
+}
+
+void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)&) const
+{
+ Standard_Integer anIndex;
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(into);
+
+ aTable->myTable.Clear();
+ aTable->myCols->Clear();
+ aTable->myRows->Clear();
+
+ aTable->myTable = myTable;
+ aTable->myTitle = myTitle;
+ aTable->myNbRows = myNbRows;
+ aTable->myNbColumns = myNbColumns;
+
+ for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+ aTable->myRows->Append(GetRowTitle(anIndex));
+ for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
+ aTable->myCols->Append(GetColumnTitle(anIndex));
+}
+
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const Standard_Integer theRow)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ for(i = 1; i <= myNbColumns; i++) {
+ if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const Standard_Integer theColumn)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ Standard_Integer i, anIndex;
+ for(i = 1; i <= myNbRows; i++) {
+ anIndex = myNbColumns*(i-1)+theColumn;
+ if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ }
+
+ return aSeq;
+}
+
+
+
+void SALOMEDSImpl_AttributeTableOfString::ConvertToString(ostrstream& theStream)
+{
+ int i, j, l;
+
+ //Title
+ l = myTitle.Length();
+ theStream << l << "\n";
+ for(i=1; i<=l; i++)
+ theStream << myTitle.Value(i) << "\n";
+
+ //Nb rows
+ theStream << myNbRows << "\n";
+
+ //Rows titles
+ for(i=1; i<=myNbRows; i++) {
+ l = myRows->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myRows->Value(i).Value(j) << "\n";
+ }
+
+ //Nb columns
+ theStream << myNbColumns << "\n";
+
+ //Columns titles
+ for(i=1; i<=myNbColumns; i++) {
+ l = myCols->Value(i).Length();
+ theStream << l << "\n";
+ for(j=1; j<=l; j++)
+ theStream << myCols->Value(i).Value(j) << "\n";
+ }
+
+ //Store the table values
+ l = myTable.Extent();
+ theStream << l << "\n";
+ DataMapIterator anIterator(myTable);
+ for(; anIterator.More(); anIterator.Next()) {
+ if (anIterator.Value().Length()) { // check empty string in the value table
+ theStream << anIterator.Key() << "\n";
+ unsigned long aValueSize = anIterator.Value().Length();
+ theStream<<aValueSize << "\n";
+ theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
+ theStream<<"\n";
+ } else { // write index only of kind: "0key"; "05", for an example
+ theStream << "0" << anIterator.Key() << "\n";
+ }
+ }
+ return;
+}
+
+bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStream)
+{
+ Backup();
+
+ theStream.seekg(0, ios::end);
+ long aSize = theStream.tellg();
+ theStream.seekg(0, ios::beg);
+
+ int i, j, l;
+ char *aValueString = new char[aSize];
+
+ Standard_ExtCharacter anExtChar;
+ TCollection_ExtendedString aStr;
+
+ //Title
+ theStream >> l;
+
+ myTitle = TCollection_ExtendedString(l, 0);
+ for(i=1; i<=l; i++) {
+ theStream >> anExtChar;
+ myTitle.SetValue(i, anExtChar);
+ }
+
+ //Nb rows
+ theStream >> myNbRows;
+
+ //Rows titles
+ myRows->Clear();
+ for(i=1; i<=myNbRows; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myRows->Append(aStr);
+ }
+
+ //Nb columns
+ theStream >> myNbColumns;
+
+ //Columns titles
+ myCols->Clear();
+ for(i=1; i<=myNbColumns; i++) {
+ theStream >> l;
+ aStr = TCollection_ExtendedString(l,0);
+ for(j=1; j<=l; j++) {
+ theStream >> anExtChar;
+ aStr.SetValue(j, anExtChar);
+ }
+ myCols->Append(aStr);
+ }
+
+ //Restore the table values
+ TCollection_AsciiString aValue;
+ theStream >> l;
+ myTable.Clear();
+ theStream.getline(aValueString,aSize,'\n');
+ for(i=1; i<=l; i++) {
+ Standard_Integer aKey;
+
+ theStream.getline(aValueString,aSize,'\n');
+ aValue = aValueString;
+ aKey = aValue.IntegerValue();
+ if (aValue.Value(1) == '0')
+ aValue = "";
+ else {
+ unsigned long aValueSize;
+ theStream >> aValueSize;
+ theStream.read(aValueString, 1); // an '\n' omitting
+ theStream.read(aValueString, aValueSize);
+ theStream.read(aValueString, 1); // an '\n' omitting
+ aValue = aValueString;
+ }
+ myTable.Bind(aKey, aValue);
+ }
+ delete(aValueString);
+ return true;
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTableOfString::Save()
+{
+ ostrstream ostr;
+ ConvertToString(ostr);
+ TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
+ return aString;
+}
+
+void SALOMEDSImpl_AttributeTableOfString::Load(const TCollection_AsciiString& value)
+{
+ istrstream aStream(value.ToCString(), strlen(value.ToCString()));
+ RestoreFromString(aStream);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTarget.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+#include "SALOMEDSImpl_AttributeReference.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include <TDF_RelocationTable.hxx>
+#include <TDF_ListIteratorOfAttributeList.hxx>
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTargetID;
+}
+
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(SALOMEDSImpl_AttributeTarget) SALOMEDSImpl_AttributeTarget::Set (const TDF_Label& L)
+{
+ Handle(SALOMEDSImpl_AttributeTarget) A;
+ if (!L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),A)) {
+ A = new SALOMEDSImpl_AttributeTarget();
+ L.AddAttribute(A);
+ }
+ return A;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeTarget::SALOMEDSImpl_AttributeTarget()
+:SALOMEDSImpl_GenericAttribute("AttributeTarget")
+{
+}
+
+void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& theRelation)
+{
+ CheckLocked();
+ if(myRelation == theRelation) return;
+
+ Backup();
+ myRelation = theRelation;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO)
+{
+ Backup();
+ TDF_Label aRefLabel = theSO->GetLabel();
+ Handle(SALOMEDSImpl_AttributeReference) aReference;
+ if (aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),aReference)) {
+ TDF_ListIteratorOfAttributeList anIter(GetVariables());
+ for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == aRefLabel) return; //BugID: PAL6192
+ GetVariables().Append(aReference);
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : Get
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get()
+{
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ TDF_ListIteratorOfAttributeList anIter(GetVariables());
+ for(;anIter.More();anIter.Next()) {
+ const TDF_Label& aLabel = anIter.Value()->Label();
+ aSeq->Append( SALOMEDSImpl_Study::SObject(aLabel));
+ }
+ return aSeq;
+}
+
+//=======================================================================
+//function : Remove
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO)
+{
+ Backup();
+ TDF_Label aRefLabel = theSO->GetLabel();
+ TDF_ListIteratorOfAttributeList anIter(GetVariables());
+ for(;anIter.More();anIter.Next()) {
+ if (anIter.Value()->Label() == aRefLabel) {
+ GetVariables().Remove(anIter);
+ return;
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); }
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With)
+{
+ Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (With);
+ myRelation = REL->GetRelation();
+ Handle(SALOMEDSImpl_AttributeReference) V;
+ myVariables.Clear();
+ for (TDF_ListIteratorOfAttributeList it (REL->GetVariables()); it.More(); it.Next()) {
+ V = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
+ myVariables.Append(V);
+ }
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const
+{
+ return new SALOMEDSImpl_AttributeTarget();
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTarget::Paste(const Handle(TDF_Attribute)& Into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (Into);
+ REL->SetRelation(myRelation);
+ Handle(SALOMEDSImpl_AttributeReference) V1,V2;
+ for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) {
+ V1 = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
+ RT->HasRelocation (V1,V2);
+ REL->GetVariables().Append(V2);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTarget.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile
+#define _SALOMEDSImpl_AttributeTarget_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_LabelList.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_AttributeList.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
+
+
+class SALOMEDSImpl_AttributeTarget : public SALOMEDSImpl_GenericAttribute
+{
+private:
+TCollection_ExtendedString myRelation;
+TDF_AttributeList myVariables;
+
+public:
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ;
+Standard_EXPORT SALOMEDSImpl_AttributeTarget();
+Standard_EXPORT void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO);
+Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get();
+Standard_EXPORT void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO);
+Standard_EXPORT TCollection_ExtendedString GetRelation() { return myRelation; }
+Standard_EXPORT void SetRelation(const TCollection_ExtendedString& theRelation);
+Standard_EXPORT TDF_AttributeList& GetVariables() { return myVariables; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeTarget() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTarget )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTextColor.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTextColorID;
+}
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor()
+:SALOMEDSImpl_GenericAttribute("AttributeTextColor")
+{
+ myValue = new TColStd_HArray1OfReal(1, 3, RealFirst());
+}
+
+//=======================================================================
+//function : SetTextColor
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B)
+{
+ CheckLocked();
+ if(myValue.IsNull()) return;
+ Backup();
+
+ myValue->SetValue(1, R);
+ myValue->SetValue(2, G);
+ myValue->SetValue(3, B);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : TextColor
+//purpose :
+//=======================================================================
+Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor()
+{
+ return myValue;
+}
+
+//=======================================================================
+//function : ChangeArray
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+{
+ Backup();
+
+ for(int i = 1; i <= 3; i++)
+ myValue->SetValue(i, newArray->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeTextColor();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with)
+{
+ Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (with)->TextColor ();
+ ChangeArray(s);
+ return;
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeTextColor::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (into)->ChangeArray (myValue);
+}
+
+
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTextColor::Save()
+{
+ char *Val = new char[75];
+ sprintf(Val, "%f %f %f", (float)myValue->Value(1),
+ (float)myValue->Value(2),
+ (float)myValue->Value(3));
+ TCollection_AsciiString ret(Val);
+ delete Val;
+ return ret;
+}
+
+void SALOMEDSImpl_AttributeTextColor::Load(const TCollection_AsciiString& value)
+{
+ float r, g, b;
+ sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
+ myValue->SetValue(1, r);
+ myValue->SetValue(2, g);
+ myValue->SetValue(3, b);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTextColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile
+#define _SALOMEDSImpl_AttributeTextColor_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeTextColor : public SALOMEDSImpl_GenericAttribute
+{
+private:
+ Handle(TColStd_HArray1OfReal) myValue;
+
+public:
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT SALOMEDSImpl_AttributeTextColor();
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B);
+Standard_EXPORT Handle(TColStd_HArray1OfReal) TextColor();
+Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeTextColor() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextColor )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTextHighlightColor.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+#include <Standard_GUID.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
+{
+ static Standard_GUID SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
+ return SALOMEDSImpl_AttributeTextHighlightColorID;
+}
+
+
+
+//=======================================================================
+//function : constructor
+//purpose :
+//=======================================================================
+SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor()
+:SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor")
+{
+ myValue = new TColStd_HArray1OfReal(1, 3, RealFirst());
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
+
+
+//=======================================================================
+//function : SetTextHighlightColor
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Standard_Real R,
+ const Standard_Real G,
+ const Standard_Real B)
+{
+ CheckLocked();
+ if(myValue.IsNull()) return;
+ Backup();
+
+ myValue->SetValue(1, R);
+ myValue->SetValue(2, G);
+ myValue->SetValue(3, B);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : TextHighlightColor
+//purpose :
+//=======================================================================
+Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
+{
+ return myValue;
+}
+
+//=======================================================================
+//function : ChangeArray
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+{
+ Backup();
+
+ for(int i = 1; i <= 3; i++)
+ myValue->SetValue(i, newArray->Value(i));
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
+{
+ return new SALOMEDSImpl_AttributeTextHighlightColor();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribute)& with)
+{
+ Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (with)->TextHighlightColor ();
+ ChangeArray(s);
+ return;
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_AttributeTextHighlightColor::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& ) const
+{
+ Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (into)->ChangeArray (myValue);
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTextHighlightColor::Save()
+{
+ char *Val = new char[75];
+ sprintf(Val, "%f %f %f", (float)myValue->Value(1),
+ (float)myValue->Value(2),
+ (float)myValue->Value(3));
+ TCollection_AsciiString ret(Val);
+ delete Val;
+ return ret;
+}
+
+void SALOMEDSImpl_AttributeTextHighlightColor::Load(const TCollection_AsciiString& value)
+{
+ float r, g, b;
+ sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
+ myValue->SetValue(1, r);
+ myValue->SetValue(2, g);
+ myValue->SetValue(3, b);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTextHighlightColor.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
+#define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeTextHighlightColor : public SALOMEDSImpl_GenericAttribute
+{
+private:
+ Handle(TColStd_HArray1OfReal) myValue;
+
+public:
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT SALOMEDSImpl_AttributeTextHighlightColor();
+Standard_EXPORT void SetTextHighlightColor(const Standard_Real R, const Standard_Real G, const Standard_Real B);
+Standard_EXPORT Handle(TColStd_HArray1OfReal) TextHighlightColor();
+Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeTextHighlightColor() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextHighlightColor )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTreeNode.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+#include <Standard_DomainError.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_DataSet.hxx>
+#include <TDF_RelocationTable.hxx>
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
+
+static char* Entry(const TDF_Label& theLabel)
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theLabel, anEntry);
+ return anEntry.ToCString();
+}
+
+const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID()
+{
+ static Standard_GUID TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648");
+ return TreeNodeID;
+}
+
+
+SALOMEDSImpl_AttributeTreeNode::SALOMEDSImpl_AttributeTreeNode()
+:SALOMEDSImpl_GenericAttribute("AttributeTreeNode"), myFather(NULL), myPrevious(NULL), myNext(NULL), myFirst(NULL)
+{}
+
+
+Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (const TDF_Label& L, const Standard_GUID& ID)
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) TN;
+
+ if (!L.FindAttribute(ID,TN)) {
+ TN = new SALOMEDSImpl_AttributeTreeNode ();
+ TN->SetTreeID(ID);
+ L.AddAttribute(TN);
+ }
+
+ return TN;
+}
+
+//=======================================================================
+//TreeNode : ID
+//purpose : Returns GUID of the TreeNode
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const
+{
+ return myTreeID;
+}
+
+//=======================================================================
+//function : Append
+//purpose : Add <TN> as last child of me
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+{
+ CheckLocked();
+
+ if (!(TN->ID() == myTreeID) )
+ Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) bid;
+ TN->SetNext(bid); // Deconnects from next.
+
+ // Find the last
+ if (!HasFirst()) {
+ SetFirst(TN);
+ TN->SetPrevious(bid); // Deconnects from previous.
+ }
+ else {
+ Handle(SALOMEDSImpl_AttributeTreeNode) Last = GetFirst();
+ while (Last->HasNext()) {
+ Last = Last->GetNext();
+ }
+ Last->SetNext(TN);
+ TN->SetPrevious(Last);
+ }
+ // Set Father
+ TN->SetFather(this);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+ return !TN.IsNull();
+}
+
+//=======================================================================
+//function : Prepend
+//purpose : Add <TN> as first child of me
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+{
+ CheckLocked();
+
+ if (!(TN->ID() == myTreeID) )
+ Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) bid;
+ TN->SetPrevious(bid);
+ if (HasFirst()) {
+ TN->SetNext(GetFirst());
+ GetFirst()->SetPrevious(TN);
+ }
+ else {
+ TN->SetNext(bid);
+ }
+ TN->SetFather(this);
+ SetFirst(TN);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+ return !TN.IsNull();
+}
+
+
+//=======================================================================
+//function : InsertBefore
+//purpose : Inserts the TreeNode <TN> before me
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+{
+ CheckLocked();
+
+ if (!(TN->ID() == myTreeID) )
+ Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
+
+ TN->SetFather(GetFather());
+ TN->SetPrevious(GetPrevious());
+ TN->SetNext(this);
+
+ if (!HasPrevious())
+ GetFather()->SetFirst(TN);
+ else
+ GetPrevious()->SetNext(TN);
+
+ SetPrevious(TN);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+ return !TN.IsNull();
+}
+
+//=======================================================================
+//function : InsertAfter
+//purpose : Inserts the TreeNode <TN> after me
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+{
+ CheckLocked();
+
+ if (!(TN->ID() == myTreeID) )
+ Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
+
+ TN->SetFather(GetFather());
+ TN->SetPrevious(this);
+ TN->SetNext(GetNext());
+
+ if (HasNext()) GetNext()->SetPrevious(TN);
+
+ SetNext(TN);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+ return !TN.IsNull();
+}
+
+//=======================================================================
+//function : Remove
+//purpose : Removees the function from the function tree
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove ()
+{
+ CheckLocked();
+
+ if (IsRoot()) return Standard_True;
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) bid;
+ if (!HasPrevious())
+ GetFather()->SetFirst(GetNext());
+ else
+ GetPrevious()->SetNext(GetNext());
+
+ if (HasNext()) {
+ if (HasPrevious()) GetNext()->SetPrevious(GetPrevious());
+ else GetNext()->SetPrevious(bid);
+ }
+ else {
+ if (HasPrevious()) GetPrevious()->SetNext(bid);
+ }
+
+ if (GetFather()->HasFirst()) {
+ if (Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(this) == GetFather()->GetFirst()) {
+ if (HasNext()) {
+ GetFather()->SetFirst(GetNext());
+ }
+ else GetFather()->SetFirst(bid);
+ }
+ }
+
+ SetFather(bid);
+ SetNext(bid);
+ SetPrevious(bid);
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+
+ return Standard_True;
+}
+
+//=======================================================================
+//function : Depth
+//purpose :
+//=======================================================================
+Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const
+{
+ Standard_Integer depth = 0;
+ Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
+ while (current->HasFather()) {
+ depth++;
+ current = current->GetFather();
+ }
+ return depth;
+}
+
+//=======================================================================
+//function : SetTreeID
+//purpose : Finds or creates a TreeNode attribute with explicit ID
+// : a driver for it
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID)
+{
+ myTreeID = explicitID;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+//=======================================================================
+//function : IsAscendant
+//purpose :
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+{
+ return ofTN->IsDescendant(this);
+}
+
+//=======================================================================
+//function : IsDescendant
+//purpose :
+//=======================================================================
+
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
+ while (current->HasFather()) {
+ if (current->GetFather() == ofTN) return Standard_True;
+ current = current->GetFather();
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : IsFather
+//purpose :
+//=======================================================================
+
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+{
+ return (ofTN->GetFather() == this);
+}
+
+
+//=======================================================================
+//function : IsChild
+//purpose :
+//=======================================================================
+
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+{
+ return (myFather == ofTN);
+}
+
+//=======================================================================
+//TreeNode : IsRoot
+//purpose : Returns Standard_True if the TreeNode is not attached to a
+// TreeNode tree or hasn't an Father.
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsRoot() const
+{
+ if (myFather.IsNull() &&
+ myPrevious.IsNull() &&
+ myNext.IsNull())
+ return Standard_True;
+ return Standard_False;
+}
+
+//=======================================================================
+//TreeNode : Root
+//purpose : Returns the TreeNode which has no Father
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() const
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) O = this;
+ while (O->HasFather())
+ O = O->GetFather();
+ return O;
+}
+
+//=======================================================================
+//TreeNode : SetFather
+//purpose : Sets the TreeNode F as Father of me
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+{
+ CheckLocked();
+ Backup();
+ myFather = F;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//TreeNode : SetNext
+//purpose : Sets the TreeNode F next to me
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+{
+ CheckLocked();
+ Backup();
+ myNext = F;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+
+//=======================================================================
+//TreeNode : SetPrevious
+//purpose : Sets the TreeNode F previous to me
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+{
+ CheckLocked();
+ Backup();
+ myPrevious = F;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//TreeNode : SetFirst
+//purpose : Sets the TreeNode F as first in the TreeNode tree
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+{
+ CheckLocked();
+ Backup();
+ myFirst = F;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//TreeNode : AfterAddition
+//purpose : Connects the TreeNode to the tree.
+// Backuped attribute must stay disconnected
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::AfterAddition()
+{
+ if (!IsBackuped()) {
+ if (!myPrevious.IsNull()) {
+ myPrevious->SetNext(this);
+ }
+ else if (!myFather.IsNull()) {
+ myFather->SetFirst(this);
+ }
+ if (!myNext.IsNull())
+ myNext->SetPrevious(this);
+ }
+}
+
+//=======================================================================
+//TreeNode : BeforeForget
+//purpose : Disconnect the TreeNode from the tree.
+// Backuped attribute is normaly not concerned by such an operation
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::BeforeForget()
+{
+ if (!IsBackuped()) {
+ Remove();
+ while (HasFirst()) GetFirst()->Remove();
+ }
+}
+
+//=======================================================================
+//TreeNode : AfterResume
+//purpose : Connects the TreeNode to the tree
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::AfterResume()
+{
+ AfterAddition();
+}
+
+//=======================================================================
+//TreeNode : BeforeUndo
+//purpose : Disconnect the TreeNode from the tree.
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
+ const Standard_Boolean forceIt)
+{
+ if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) BeforeForget(); // Disconnect.
+ return Standard_True;
+}
+
+//=======================================================================
+//TreeNode : AfterUndo
+//purpose : Connect the TreeNode from the tree.
+//=======================================================================
+Standard_Boolean SALOMEDSImpl_AttributeTreeNode::AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
+ const Standard_Boolean forceIt)
+{
+ if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) AfterAddition(); // Reconnect.
+ return Standard_True;
+}
+
+//=======================================================================
+//TreeNode : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other)
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) F = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(other);
+ myFather = F->myFather;
+ myPrevious = F->myPrevious;
+ myNext = F->myNext;
+ myFirst = F->myFirst;
+ myTreeID = F->myTreeID;
+}
+
+//=======================================================================
+//TreeNode : Paste
+//purpose : Method for Copy mechanism
+//=======================================================================
+
+void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) intof = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(into);
+ Handle(SALOMEDSImpl_AttributeTreeNode) func;
+ if (!RT->HasRelocation(myFather, func) && RT->AfterRelocate()) {
+ func.Nullify();
+ }
+ intof->SetFather(func);
+ if (!RT->HasRelocation(myNext, func) && RT->AfterRelocate()) {
+ func.Nullify();
+ }
+ intof->SetNext(func);
+ if (!RT->HasRelocation(myPrevious, func) && RT->AfterRelocate()) {
+ func.Nullify();
+ }
+ intof->SetPrevious(func);
+ if (!RT->HasRelocation(myFirst, func) && RT->AfterRelocate()) {
+ func.Nullify();
+ }
+
+ intof->SetFirst(func);
+ intof->SetTreeID(myTreeID);
+}
+
+//=======================================================================
+//TreeNode : NewEmpty
+//purpose : Returns new empty TreeNode attribute
+//=======================================================================
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeTreeNode::NewEmpty() const
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) T = new SALOMEDSImpl_AttributeTreeNode();
+ T->SetTreeID(myTreeID);
+ return T;
+}
+
+//=======================================================================
+//TreeNode : References
+//purpose : Collects the references
+//=======================================================================
+void SALOMEDSImpl_AttributeTreeNode::References(const Handle(TDF_DataSet)& aDataSet) const
+{
+ Handle(SALOMEDSImpl_AttributeTreeNode) fct = myFirst;
+ while (!fct.IsNull()) {
+ aDataSet->AddAttribute(fct);
+ fct = fct->myNext;
+ }
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Type()
+{
+ char* aNodeName = new char[60];
+ char aGUID[40];
+ ID().ToCString(aGUID);
+ sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID);
+ TCollection_AsciiString ret(aNodeName);
+ delete aNodeName;
+
+ return ret;
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Save()
+{
+ TCollection_AsciiString aFather, aPrevious, aNext, aFirst;
+
+ if (HasFather()) aFather = Entry(GetFather()->Label()); else aFather = "!";
+ if (HasPrevious()) aPrevious = Entry(GetPrevious()->Label()); else aPrevious = "!";
+ if (HasNext()) aNext = Entry(GetNext()->Label()); else aNext = "!";
+ if (HasFirst()) aFirst = Entry(GetFirst()->Label()); else aFirst = "!";
+
+ int aLength = 4;
+ aLength += aFather.Length() + aPrevious.Length() + aNext.Length() + aFirst.Length();
+ char* aResult = new char[aLength];
+ sprintf(aResult, "%s %s %s %s", aFather.ToCString(), aPrevious.ToCString(), aNext.ToCString(), aFirst.ToCString());
+ TCollection_AsciiString ret(aResult);
+ delete aResult;
+ return ret;
+}
+
+void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value)
+{
+ Handle(TDF_Data) DF = Label().Data();
+
+ char* aCopy = (char*)value.ToCString();
+ char* adr = strtok(aCopy, " ");
+
+ TDF_Label aLabel;
+ Handle(SALOMEDSImpl_AttributeTreeNode) aDepNode;
+
+ if (adr && adr[0] != '!') {
+ TDF_Tool::Label(DF, adr, aLabel, 1);
+ if (!aLabel.FindAttribute(ID(), aDepNode))
+ aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
+
+ SetFather(aDepNode);
+ }
+
+ adr = strtok(NULL, " ");
+ if (adr && adr[0] != '!') {
+ TDF_Tool::Label(DF, adr, aLabel, 1);
+ if (!aLabel.FindAttribute(ID(), aDepNode))
+ aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
+ SetPrevious(aDepNode);
+ }
+
+ adr = strtok(NULL, " ");
+ if (adr && adr[0] != '!') {
+ TDF_Tool::Label(DF, adr, aLabel, 1);
+ if (!aLabel.FindAttribute(ID(), aDepNode))
+ aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
+ SetNext(aDepNode);
+ }
+
+ adr = strtok(NULL, " ");
+ if (adr && adr[0] != '!') {
+ TDF_Tool::Label(DF, adr, aLabel, 1);
+ if (!aLabel.FindAttribute(ID(), aDepNode))
+ aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
+ SetFirst(aDepNode);
+ }
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeTreeNode.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile
+#define _SALOMEDSImpl_AttributeTreeNode_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_AttributeDelta.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle_TDF_DataSet;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+class SALOMEDSImpl_ChildNodeIterator;
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute
+{
+public:
+
+Standard_EXPORT const static Standard_GUID& GetDefaultTreeID();
+Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTreeNode Set(const TDF_Label& L, const Standard_GUID& ID);
+
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode();
+Standard_EXPORT void SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT void SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT void SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT void SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT void SetTreeID(const Standard_GUID& value);
+
+Standard_EXPORT Standard_Boolean Append(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT Standard_Boolean Prepend(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT Standard_Boolean Remove();
+Standard_EXPORT Standard_Boolean InsertBefore(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+Standard_EXPORT Standard_Boolean InsertAfter(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
+
+Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFather() { return myFather; }
+Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetPrevious() { return myPrevious; }
+Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetNext() { return myNext; }
+Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFirst() { return myFirst; }
+
+Standard_EXPORT Standard_Boolean HasFather() { return (!myFather.IsNull()); }
+Standard_EXPORT Standard_Boolean HasPrevious() { return (!myPrevious.IsNull()); }
+Standard_EXPORT Standard_Boolean HasNext() {return (!myNext.IsNull()); }
+Standard_EXPORT Standard_Boolean HasFirst() { return (!myFirst.IsNull()); }
+Standard_EXPORT const Standard_GUID& GetTreeID() { return ID(); }
+Standard_EXPORT Standard_Integer Depth() const;
+Standard_EXPORT Standard_Boolean IsRoot() const ;
+Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) Root() const;
+Standard_EXPORT Standard_Boolean IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const;
+Standard_EXPORT Standard_Boolean IsDescendant(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
+Standard_EXPORT Standard_Boolean IsFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
+Standard_EXPORT Standard_Boolean IsChild(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
+
+Standard_EXPORT virtual TCollection_AsciiString Save();
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual TCollection_AsciiString Type();
+
+Standard_EXPORT virtual void AfterAddition() ;
+Standard_EXPORT virtual void BeforeForget() ;
+Standard_EXPORT virtual void AfterResume() ;
+Standard_EXPORT virtual Standard_Boolean BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
+ const Standard_Boolean forceIt = Standard_False) ;
+Standard_EXPORT virtual Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
+ const Standard_Boolean forceIt = Standard_False) ;
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
+Standard_EXPORT void References(const Handle(TDF_DataSet)& aDataSet) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTreeNode )
+
+private:
+
+Standard_GUID myTreeID;
+Handle(SALOMEDSImpl_AttributeTreeNode) myFather;
+Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious;
+Handle(SALOMEDSImpl_AttributeTreeNode) myNext;
+Handle(SALOMEDSImpl_AttributeTreeNode) myFirst;
+
+friend class SALOMEDSImpl_ChildNodeIterator;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeUAttribute.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
+
+Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TDF_Label& L, const Standard_GUID& ID)
+{
+ Handle(SALOMEDSImpl_AttributeUserID) A;
+ if (!L.FindAttribute(ID, A)) {
+ A = new SALOMEDSImpl_AttributeUserID();
+ A->SetValue(ID);
+ L.AddAttribute(A);
+ }
+ return A;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const
+{ return myID; }
+
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid)
+{
+ CheckLocked();
+ if(myID == guid) return;
+
+ Backup();
+ myID = guid;
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const
+{
+ Handle(SALOMEDSImpl_AttributeUserID) A = new SALOMEDSImpl_AttributeUserID();
+ A->SetValue(myID);
+ return A;
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with)
+{
+ Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(with);
+ SetValue( A->ID() );
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeUserID::Paste (const Handle(TDF_Attribute)& into,
+ const Handle(TDF_RelocationTable)& RT) const
+{
+ Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(into);
+ A->SetValue( myID );
+}
+
+TCollection_AsciiString SALOMEDSImpl_AttributeUserID::Type()
+{
+
+ char* aUAttrName = new char[60];
+ char aGUID[40];
+ ID().ToCString(aGUID);
+ sprintf(aUAttrName, "AttributeUserID_%s",aGUID);
+
+ TCollection_AsciiString ret(aUAttrName);
+ delete aUAttrName;
+
+ return ret;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_AttributeUAttribute.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile
+#define _SALOMEDSImpl_AttributeUserID_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
+
+class SALOMEDSImpl_AttributeUserID : public SALOMEDSImpl_GenericAttribute
+{
+private:
+Standard_GUID myID;
+
+public:
+SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {}
+static Handle(SALOMEDSImpl_AttributeUserID) Set (const TDF_Label& L, const Standard_GUID& ID);
+static const Standard_GUID& DefaultID()
+{
+ static Standard_GUID SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
+ return SALOMEDSImpl_DefaultUserAttributeID;
+}
+
+Standard_EXPORT const Standard_GUID& Value() const { return ID(); }
+Standard_EXPORT void SetValue(const Standard_GUID& value);
+
+Standard_EXPORT virtual TCollection_AsciiString Type();
+
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
+Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
+Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeUserID() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeUserID )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Attributes.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_ATTRIBUTES__H__
+#define __SALOMEDSIMPL_ATTRIBUTES__H__
+
+#include <iostream>
+class LockProtection
+{
+public :
+ LockProtection(const char *message) {
+ std::cerr << message << std::endl;
+ }
+};
+
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeName.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+#include "SALOMEDSImpl_AttributeInteger.hxx"
+#include "SALOMEDSImpl_AttributeReal.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+#include "SALOMEDSImpl_AttributeUserID.hxx"
+#include "SALOMEDSImpl_AttributeReference.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
+#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOMEDSImpl_AttributePersistentRef.hxx"
+#include "SALOMEDSImpl_AttributeDrawable.hxx"
+#include "SALOMEDSImpl_AttributeSelectable.hxx"
+#include "SALOMEDSImpl_AttributeExpandable.hxx"
+#include "SALOMEDSImpl_AttributeOpened.hxx"
+#include "SALOMEDSImpl_AttributeTextColor.hxx"
+#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
+#include "SALOMEDSImpl_AttributePixMap.hxx"
+#include "SALOMEDSImpl_AttributeLocalID.hxx"
+#include "SALOMEDSImpl_AttributeTarget.hxx"
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
+#include "SALOMEDSImpl_AttributeTableOfString.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributePythonObject.hxx"
+#include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
+#include "SALOMEDSImpl_AttributeFileType.hxx"
+#include "SALOMEDSImpl_AttributeFlags.hxx"
+#include "SALOMEDSImpl_AttributeGraphic.hxx"
+
+
+#define __AttributeTypeToGUIDForSObject \
+ if(theType == "AttributeReal") return SALOMEDSImpl_AttributeReal::GetID(); \
+ if(theType == "AttributeInteger") return SALOMEDSImpl_AttributeInteger::GetID(); \
+ if(theType == "AttributeSequenceOfReal") return SALOMEDSImpl_AttributeSequenceOfReal::GetID(); \
+ if(theType == "AttributeSequenceOfInteger") return SALOMEDSImpl_AttributeSequenceOfInteger::GetID(); \
+ if(theType == "AttributeName") return SALOMEDSImpl_AttributeName::GetID(); \
+ if(theType == "AttributeComment") return SALOMEDSImpl_AttributeComment::GetID(); \
+ if(theType == "AttributeIOR") return SALOMEDSImpl_AttributeIOR::GetID(); \
+ if(theType == "AttributePersistentRef") return SALOMEDSImpl_AttributePersistentRef::GetID(); \
+ if(theType == "AttributeDrawable") return SALOMEDSImpl_AttributeDrawable::GetID(); \
+ if(theType == "AttributeSelectable") return SALOMEDSImpl_AttributeSelectable::GetID(); \
+ if(theType == "AttributeExpandable") return SALOMEDSImpl_AttributeExpandable::GetID(); \
+ if(theType == "AttributeOpened") return SALOMEDSImpl_AttributeOpened::GetID(); \
+ if(theType == "AttributeTextColor") return SALOMEDSImpl_AttributeTextColor::GetID(); \
+ if(theType == "AttributeTextHighlightColor") return SALOMEDSImpl_AttributeTextHighlightColor::GetID(); \
+ if(theType == "AttributePixMap") return SALOMEDSImpl_AttributePixMap::GetID(); \
+ if(theType == "AttributeLocalID") return SALOMEDSImpl_AttributeLocalID::GetID(); \
+ if(theType == "AttributeTarget") return SALOMEDSImpl_AttributeTarget::GetID(); \
+ if(theType == "AttributeTableOfInteger") return SALOMEDSImpl_AttributeTableOfInteger::GetID(); \
+ if(theType == "AttributeTableOfReal") return SALOMEDSImpl_AttributeTableOfReal::GetID(); \
+ if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \
+ if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \
+ if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \
+ if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
+ if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \
+ if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
+ if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
+ if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \
+ if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID();
+
+
+#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
+ Handle(SALOMEDSImpl_##ClassName) anAttr; \
+ if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+ CheckLocked(); \
+ anAttr = new SALOMEDSImpl_##ClassName; \
+ Lab.AddAttribute(anAttr); \
+ } \
+ return anAttr; \
+ }
+
+#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
+ Handle(SALOMEDSImpl_##ClassName) anAttr; \
+ if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+ anAttr = new SALOMEDSImpl_##ClassName; \
+ Lab.AddAttribute(anAttr); \
+ } \
+ return anAttr; \
+ }
+
+#define __FindOrCreateAttributeForBuilder \
+__FindOrCreateAttributeLocked(AttributeReal) \
+__FindOrCreateAttributeLocked(AttributeInteger) \
+__FindOrCreateAttributeLocked(AttributeSequenceOfReal) \
+__FindOrCreateAttributeLocked(AttributeSequenceOfInteger) \
+__FindOrCreateAttributeLocked(AttributeName) \
+__FindOrCreateAttributeLocked(AttributeComment) \
+__FindOrCreateAttributeLocked(AttributeIOR) \
+__FindOrCreateAttributeLocked(AttributePixMap) \
+__FindOrCreateAttributeLocked(AttributeLocalID) \
+__FindOrCreateAttributeLocked(AttributeTableOfInteger) \
+__FindOrCreateAttributeLocked(AttributeTableOfReal) \
+__FindOrCreateAttributeLocked(AttributeTableOfString) \
+__FindOrCreateAttributeLocked(AttributePythonObject) \
+__FindOrCreateAttribute(AttributePersistentRef) \
+__FindOrCreateAttribute(AttributeDrawable) \
+__FindOrCreateAttribute(AttributeSelectable) \
+__FindOrCreateAttribute(AttributeExpandable) \
+__FindOrCreateAttribute(AttributeOpened) \
+__FindOrCreateAttribute(AttributeTextColor) \
+__FindOrCreateAttribute(AttributeTextHighlightColor) \
+__FindOrCreateAttribute(AttributeTarget) \
+__FindOrCreateAttribute(AttributeStudyProperties) \
+__FindOrCreateAttribute(AttributeExternalFileDef) \
+__FindOrCreateAttribute(AttributeFileType) \
+__FindOrCreateAttribute(AttributeFlags) \
+__FindOrCreateAttribute(AttributeGraphic)
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Callback.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_Callback.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Callback, MMgt_TShared )
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Callback.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_CALLBACK_H__
+#define __SALOMEDSIMPL_CALLBACK_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
+
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+
+class SALOMEDSImpl_Callback : public MMgt_TShared
+{
+private:
+ Handle(SALOMEDSImpl_UseCaseBuilder) _builder;
+
+public:
+
+ SALOMEDSImpl_Callback(const Handle(SALOMEDSImpl_UseCaseBuilder)& builder)
+ {
+ _builder = builder;
+ }
+
+ virtual void OnAddSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ {
+ if(_builder != NULL && theObject != NULL) _builder->Append(theObject);
+ }
+
+ virtual void OnRemoveSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ {
+ if(_builder != NULL && theObject != NULL) _builder->Remove(theObject);
+ }
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_Callback )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_ChildIterator.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_ChildIterator.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_ChildIterator, MMgt_TShared )
+
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO)
+{
+ _so = theSO;
+ _it = TDF_ChildIterator(_so->GetLabel());
+}
+
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel)
+{
+ _so = SALOMEDSImpl_Study::SObject(theLabel);
+ _it = TDF_ChildIterator(theLabel);
+}
+
+void SALOMEDSImpl_ChildIterator::Init()
+{
+ _it.Initialize(_so->GetLabel(), Standard_False);
+}
+
+void SALOMEDSImpl_ChildIterator::Init(const TDF_Label& theLabel)
+{
+ _it.Initialize(theLabel, Standard_False);
+}
+
+void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels)
+{
+ _it.Initialize(_so->GetLabel(), theAllLevels);
+}
+
+void SALOMEDSImpl_ChildIterator::InitEx(const TDF_Label& theLabel, bool theAllLevels)
+{
+ _it.Initialize(theLabel, theAllLevels);
+}
+
+bool SALOMEDSImpl_ChildIterator::More()
+{
+ return _it.More();
+}
+
+void SALOMEDSImpl_ChildIterator::Next()
+{
+ _it.Next();
+}
+
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_ChildIterator::Value()
+{
+ return SALOMEDSImpl_Study::SObject(_it.Value());
+}
+
+TDF_Label SALOMEDSImpl_ChildIterator::Label()
+{
+ return _it.Value();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_ChildIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSImpl_CHILDITERATOR_H__
+#define __SALOMEDSImpl_CHILDITERATOR_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "TDF_ChildIterator.hxx"
+#include "TDF_Label.hxx"
+
+class SALOMEDSImpl_ChildIterator: public MMgt_TShared
+{
+private:
+ TDF_ChildIterator _it;
+ Handle(SALOMEDSImpl_SObject) _so;
+
+public:
+
+ Standard_EXPORT SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO);
+ Standard_EXPORT SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel);
+ Standard_EXPORT ~SALOMEDSImpl_ChildIterator() {};
+
+ Standard_EXPORT virtual void Init();
+ Standard_EXPORT virtual void Init(const TDF_Label& theLabel);
+ Standard_EXPORT virtual void InitEx(bool theAllLevels);
+ Standard_EXPORT virtual void InitEx(const TDF_Label& theLabel, bool theAllLevels);
+ Standard_EXPORT virtual bool More();
+ Standard_EXPORT virtual void Next();
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Value();
+ Standard_EXPORT virtual TDF_Label Label();
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File: SALOMEDSImpl_ChildNodeIterator.cxx
+// Created: Wed Jan 26 16:43:08 2000
+// Author: Denis PASCAL
+// <dp@dingox.paris1.matra-dtv.fr>
+
+
+#include <SALOMEDSImpl_ChildNodeIterator.hxx>
+
+#define ChildNodeIterator_UpToBrother \
+{ \
+ while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
+ myNode = myNode->myFather; \
+ if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
+ myNode = myNode->myNext; \
+ else \
+ myNode = NULL; \
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_ChildNodeIterator
+//purpose :
+//=======================================================================
+SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator()
+ : myFirstLevel(0)
+{}
+
+//=======================================================================
+//function : SALOMEDSImpl_ChildNodeIterator
+//purpose :
+//=======================================================================
+
+SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
+ const Standard_Boolean allLevels)
+: myNode(aNode->myFirst),
+ myFirstLevel(allLevels ? aNode->Depth() : -1)
+{}
+
+//=======================================================================
+//function : Initialize
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
+ const Standard_Boolean allLevels)
+{
+ myNode = aNode->myFirst;
+ myFirstLevel = allLevels ? aNode->Depth() : -1;
+}
+
+//=======================================================================
+//function : Next
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_ChildNodeIterator::Next()
+{
+ if (myFirstLevel == -1) {
+ myNode = myNode->myNext;
+ }
+ else {
+ if (myNode->myFirst != NULL) myNode = myNode->myFirst;
+ else ChildNodeIterator_UpToBrother;
+ }
+}
+
+//=======================================================================
+//function : NextBrother
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_ChildNodeIterator::NextBrother()
+{
+ if (myNode->myNext != NULL) myNode = myNode->myNext;
+ else ChildNodeIterator_UpToBrother;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile
+#define _SALOMEDSImpl_ChildNodeIterator_HeaderFile
+
+#ifndef _Standard_Integer_HeaderFile
+#include <Standard_Integer.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
+
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+class SALOMEDSImpl_ChildNodeIterator
+{
+
+public:
+
+Standard_EXPORT SALOMEDSImpl_ChildNodeIterator();
+Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
+ const Standard_Boolean allLevels = Standard_False);
+Standard_EXPORT void Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
+ const Standard_Boolean allLevels = Standard_False) ;
+Standard_EXPORT Standard_Boolean More() const { return !myNode.IsNull(); }
+Standard_EXPORT void Next() ;
+Standard_EXPORT void NextBrother() ;
+Standard_EXPORT Handle_SALOMEDSImpl_AttributeTreeNode Value() const { return myNode; }
+
+private:
+
+Handle_SALOMEDSImpl_AttributeTreeNode myNode;
+Standard_Integer myFirstLevel;
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+#ifndef __SALOMEDSIMPL_DRIVER_H__
+#define __SALOMEDSIMPL_DRIVER_H__
+
+#include <TCollection_AsciiString.hxx>
+#include <SALOMEDSImpl_SComponent.hxx>
+#include <SALOMEDSImpl_SObject.hxx>
+
+
+class SALOMEDSImpl_Driver
+{
+public:
+
+ virtual TCollection_AsciiString GetIOR() = 0;
+
+ virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
+
+ virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const TCollection_AsciiString& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
+
+ virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile) = 0;
+
+ virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const TCollection_AsciiString& theURL,
+ bool isMultiFile) = 0;
+
+ virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) = 0;
+
+ virtual TCollection_AsciiString ComponentDataType() = 0;
+
+
+ virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
+ const TCollection_AsciiString& IORString,
+ bool isMultiFile,
+ bool isASCII) = 0;
+
+ virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
+ const TCollection_AsciiString& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII) = 0;
+
+ virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+
+ virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
+ int& theObjectID,
+ long& theStreamLength) = 0;
+
+ virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0;
+
+ virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
+ const long theStreamLength,
+ int theObjectID,
+ const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+
+ virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength) = 0;
+};
+
+class SALOMEDSImpl_DriverFactory
+{
+public:
+
+ virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType) = 0;
+
+ virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_GenericAttribute.hxx
+// Author : SERGEY_RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_Attributes.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
+
+char* SALOMEDSImpl_GenericAttribute::Impl_GetType(const Handle(TDF_Attribute)& theAttr)
+{
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
+ return ga->Type().ToCString();
+}
+
+char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr)
+{
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
+ return ga->GetClassType().ToCString();
+}
+
+void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr)
+{
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
+ ga->CheckLocked();
+}
+
+TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type()
+{
+ return _type;
+}
+
+
+void SALOMEDSImpl_GenericAttribute::CheckLocked()
+{
+ TDF_Label aLabel = Label();
+ if(aLabel.IsNull()) return;
+
+ Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return;
+ if(aStudy->IsLocked()) {
+ aStudy->_errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ }
+}
+
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject()
+{
+ TDF_Label aLabel = Label();
+ if(aLabel.IsNull()) return NULL;
+ return SALOMEDSImpl_Study::SObject(aLabel);
+}
+
+void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
+{
+ TDF_Label aLabel = Label();
+ if(aLabel.IsNull()) return;
+
+ Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(!aStudy.IsNull()) aStudy->Modify();
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_GenericAttribute.hxx
+// Author : SERGEY_RUIN
+// Module : SALOME
+
+#ifndef _GENERICIMPL_ATTRIBUTE_HXX_
+#define _GENERICIMPL_ATTRIBUTE_HXX_
+
+#include <TDF_Label.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+
+#include "SALOMEDSImpl_SObject.hxx"
+
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
+
+class SALOMEDSImpl_GenericAttribute: public TDF_Attribute
+{
+protected:
+
+ TCollection_AsciiString _type; //This field must be filled in each attribute that inherits from this class.
+
+public:
+
+Standard_EXPORT SALOMEDSImpl_GenericAttribute(const TCollection_AsciiString& theType)
+:_type(theType)
+{}
+
+Standard_EXPORT virtual TCollection_AsciiString Save() { return ""; }
+Standard_EXPORT virtual void Load(const TCollection_AsciiString&) {}
+Standard_EXPORT virtual TCollection_AsciiString Type();
+Standard_EXPORT virtual void CheckLocked();
+Standard_EXPORT TCollection_AsciiString GetClassType() { return _type; }
+Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject();
+Standard_EXPORT void SetModifyFlag();
+
+Standard_EXPORT static char* Impl_GetType(const Handle(TDF_Attribute)& theAttr);
+Standard_EXPORT static char* Impl_GetClassType(const Handle(TDF_Attribute)& theAttr);
+Standard_EXPORT static void Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr);
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_GenericAttribute )
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_OCAFApplication.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_OCAFApplication.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
+
+//=======================================================================
+//function : SALOMEDSImpl_OCAFApplication
+//purpose :
+//=======================================================================
+
+SALOMEDSImpl_OCAFApplication::SALOMEDSImpl_OCAFApplication()
+{
+}
+
+
+//=======================================================================
+//function : Formats
+//purpose :
+//=======================================================================
+
+void SALOMEDSImpl_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
+{
+ Formats.Append(TCollection_ExtendedString ("SALOME_STUDY"));
+}
+
+
+//=======================================================================
+//function : ResourcesName
+//purpose :
+//=======================================================================
+
+Standard_CString SALOMEDSImpl_OCAFApplication::ResourcesName()
+{
+ return Standard_CString ("SALOMEDSImpl_Resources");
+}
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_OCAFApplication.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile
+#define _SALOMEDSImpl_OCAFApplication_HeaderFile
+
+
+//Handle definition
+#include <TDocStd_Application.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application)
+
+#include <Standard_CString.hxx>
+#include <TColStd_SequenceOfExtendedString.hxx>
+
+
+class SALOMEDSImpl_OCAFApplication : public TDocStd_Application {
+
+public:
+
+Standard_EXPORT SALOMEDSImpl_OCAFApplication();
+Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ;
+Standard_EXPORT Standard_CString ResourcesName() ;
+Standard_EXPORT ~SALOMEDSImpl_OCAFApplication() {}
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_OCAFApplication )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_SComponent.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_AttributeComment.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel)
+ :SALOMEDSImpl_SObject(theLabel)
+{
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
+{}
+
+
+//============================================================================
+/*! Function : ComponentDataType
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType()
+{
+ TCollection_AsciiString res = "";
+ Handle(SALOMEDSImpl_AttributeComment) type;
+ if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) {
+ res = type->Value();
+ }
+
+ return res;
+}
+
+
+//============================================================================
+/*! Function : ComponentIOR
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR)
+{
+ Handle(SALOMEDSImpl_AttributeIOR) ior;
+ if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) )
+ return false;
+ IOR = ior->Value();
+ return true;
+}
+
+
+//============================================================================
+/*! Function : IsA
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel)
+{
+ // scomponent must contain comment and belong to the 2th depth label
+ if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) {
+ return true;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_SComponent.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_SCOMPONENT_H__
+#define __SALOMEDSIMPL_SCOMPONENT_H__
+
+//SALOMEDSImpl headers
+#include "SALOMEDSImpl_SObject.hxx"
+
+//Handle definition
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
+
+// std C++ headers
+#include <iostream>
+
+// Cascade headers
+#include <TDF_Label.hxx>
+#include <SALOMEDSImpl_SObject.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Tool.hxx>
+#include <stdio.h>
+
+class SALOMEDSImpl_SComponent : public SALOMEDSImpl_SObject
+{
+public:
+
+ SALOMEDSImpl_SComponent(const TDF_Label& lab);
+
+ ~SALOMEDSImpl_SComponent();
+
+ virtual TCollection_AsciiString ComponentDataType();
+ virtual bool ComponentIOR(TCollection_AsciiString& theID);
+ static bool IsA(const TDF_Label& theLabel);
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_SComponent )
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_SComponentIterator.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+using namespace std;
+
+//============================================================================
+/*! Function : constructor
+ *
+ */
+//============================================================================
+
+SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument)
+{
+ _lab = theDocument->Main();
+ _it.Initialize (_lab);
+}
+
+//============================================================================
+/*! Function : Init
+ *
+ */
+//============================================================================
+void SALOMEDSImpl_SComponentIterator::Init()
+{
+ _it.Initialize (_lab);
+}
+
+//============================================================================
+/*! Function : More
+ *
+ */
+//============================================================================
+bool SALOMEDSImpl_SComponentIterator::More()
+{
+ if (!_it.More())
+ return false;
+ TDF_Label L = _it.Value();
+ if (SALOMEDSImpl_SComponent::IsA(L))
+ return true;
+
+ return _it.More();
+}
+
+ //============================================================================
+/*! Function : Next
+ */
+//============================================================================
+void SALOMEDSImpl_SComponentIterator::Next()
+{
+ _it.Next();
+}
+
+
+//============================================================================
+/*! Function : Value
+ *
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value()
+{
+ return SALOMEDSImpl_Study::SComponent(_it.Value());
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_SComponentIterator_i.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_SCOMPONENTITERATOR_H__
+#define __SALOMEDSIMPL_SCOMPONENTITERATOR_H__
+
+
+//SALOMEDSImpl headers
+#include "SALOMEDSImpl_SComponent.hxx"
+
+// Cascade headers
+#include <TDocStd_Document.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TDF_Label.hxx>
+#include <stdio.h>
+
+class Standard_EXPORT SALOMEDSImpl_SComponentIterator
+{
+private:
+
+ TDF_ChildIterator _it;
+ TDF_Label _lab;
+
+public:
+
+ SALOMEDSImpl_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
+ {
+ _it = theIterator._it;
+ _lab = theIterator._lab;
+ }
+
+ SALOMEDSImpl_SComponentIterator() {};
+
+ SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument);
+
+ ~SALOMEDSImpl_SComponentIterator() {};
+
+ virtual void Init();
+ virtual bool More();
+ virtual void Next();
+ virtual Handle(SALOMEDSImpl_SComponent) Value();
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
+// File : SALOMEDSImpl_SObject.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Attributes.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+using namespace std;
+
+#include <TDF_AttributeIterator.hxx>
+#include <map>
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SObject, MMgt_TShared )
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel)
+ :_lab(theLabel)
+{
+ _value = "";
+ _type = "";
+ _name = "";
+}
+
+//============================================================================
+/*! Function : Desctructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject()
+{}
+
+//============================================================================
+/*! Function : GetID
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_SObject::GetID()
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry (_lab,anEntry);
+ return anEntry;
+}
+
+//============================================================================
+/*! Function : GetFatherComponent
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent()
+{
+ TDF_Label LF = _lab;
+ while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) {
+ LF = LF.Father();
+ }
+
+ if(LF.IsRoot()) return NULL;
+
+ return GetStudy()->GetSComponent(LF);
+}
+
+//============================================================================
+/*! Function : GetFather
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather()
+{
+ return GetStudy()->GetSObject(_lab.Father());
+}
+
+
+//============================================================================
+/*! Function : GetStudy
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy()
+{
+ return SALOMEDSImpl_Study::GetStudy(_lab);
+}
+
+//============================================================================
+/*! Function : FindAttribute
+ * Purpose : Find attribute of given type on this SObject
+ */
+//============================================================================
+bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute,
+ const TCollection_AsciiString& theTypeOfAttribute)
+{
+ if(_lab.IsNull()) return Standard_False;
+ Standard_GUID aGUID = GetGUID(theTypeOfAttribute);
+ if (_lab.FindAttribute(aGUID, theAttribute)) return Standard_True;
+ return Standard_False;
+}
+
+
+
+//============================================================================
+/*! Function : GetAllAttributes
+ * Purpose : Returns list of all attributes for this sobject
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes()
+{
+ Standard_Integer NumAttr = _lab.NbAttributes();
+ Handle(TColStd_HSequenceOfTransient) SeqOfAttr = new TColStd_HSequenceOfTransient();
+ Handle(SALOMEDSImpl_GenericAttribute) anAttr;
+ if (NumAttr != 0) {
+ for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
+ anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(iter.Value());
+ if(!anAttr.IsNull() && anAttr->Type() != "AttributeReference")
+ SeqOfAttr->Append(anAttr);
+ }
+ }
+ return SeqOfAttr;
+}
+
+
+//============================================================================
+/*! Function : ReferencedObject
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ Handle(SALOMEDSImpl_AttributeReference) Ref;
+ if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref))
+ return false;
+
+ theObject = GetStudy()->GetSObject(Ref->Get());
+ return true;
+}
+
+//============================================================================
+/*! Function : FindSubObject
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ TDF_Label L = _lab.FindChild(theTag, false);
+ if (L.IsNull()) return false;
+
+ theObject = GetStudy()->GetSObject(L);
+ return true;
+
+}
+
+
+//============================================================================
+/*! Function : GetName
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_SObject::GetName()
+{
+ TCollection_AsciiString aStr = "";
+ Handle(SALOMEDSImpl_AttributeName) aName;
+ if (_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
+ aStr = aName->Value();
+ }
+ return aStr;
+}
+
+//============================================================================
+/*! Function : GetComment
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_SObject::GetComment()
+{
+ TCollection_AsciiString aStr = "";
+ Handle(SALOMEDSImpl_AttributeComment) aComment;
+ if (_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComment)) {
+ aStr = aComment->Value();
+ }
+ return aStr;
+}
+
+//============================================================================
+/*! Function : GetIOR
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_SObject::GetIOR()
+{
+ TCollection_AsciiString aStr = "";
+ Handle(SALOMEDSImpl_AttributeIOR) anIOR;
+ if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anIOR)) {
+ aStr = anIOR->Value();
+ }
+ return aStr;
+}
+
+
+Standard_GUID SALOMEDSImpl_SObject::GetGUID(const TCollection_AsciiString& theType)
+{
+ __AttributeTypeToGUIDForSObject
+
+ if (strncmp(theType.ToCString(), "AttributeTreeNodeGUID",21) == 0) {
+ const char* aCType = theType.ToCString();
+ char* aGUIDString = new char[40];
+ sprintf(aGUIDString, &(aCType[21]));
+ Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
+ delete(aGUIDString);
+ return aGUID;
+ }
+ return Standard_GUID();
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_SObject.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_SOBJECT_H__
+#define __SALOMEDSIMPL_SOBJECT_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
+
+class SALOMEDSImpl_SComponent;
+class Handle_SALOMEDSImpl_SComponent;
+class SALOMEDSImpl_Study;
+class Handle_SALOMEDSImpl_Study;
+
+// Cascade headers
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+class SALOMEDSImpl_SObject : public MMgt_TShared
+{
+protected:
+ TDF_Label _lab;
+ TCollection_AsciiString _name;
+ TCollection_AsciiString _value;
+ TCollection_AsciiString _type;
+
+public:
+
+ Standard_EXPORT SALOMEDSImpl_SObject(const TDF_Label& theLabel);
+ Standard_EXPORT ~SALOMEDSImpl_SObject();
+
+ Standard_EXPORT virtual TCollection_AsciiString GetID();
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetFatherComponent();
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetFather() ;
+ Standard_EXPORT virtual bool FindAttribute(Handle(TDF_Attribute)& theAttribute, const TCollection_AsciiString& theTypeOfAttribute);
+ Standard_EXPORT virtual bool ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) ;
+ Standard_EXPORT virtual bool FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudy() ;
+ Standard_EXPORT virtual TCollection_AsciiString Name() { return _name; }
+ Standard_EXPORT virtual void Name(const TCollection_AsciiString& theName) { _name = theName; }
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetAllAttributes();
+
+ Standard_EXPORT virtual TCollection_AsciiString GetName();
+ Standard_EXPORT virtual TCollection_AsciiString GetComment();
+ Standard_EXPORT virtual TCollection_AsciiString GetIOR();
+
+ Standard_EXPORT virtual int Tag() { return _lab.Tag(); }
+ Standard_EXPORT virtual int Depth() { return _lab.Depth(); }
+
+ Standard_EXPORT virtual TDF_Label GetLabel() { return _lab; }
+
+ Standard_EXPORT static Standard_GUID GetGUID(const TCollection_AsciiString& theTypeOfAttribute);
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Study.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_Study.hxx"
+
+using namespace std;
+
+#include <TColStd_SequenceOfExtendedString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TDocStd_Application.hxx>
+#include <TDocStd_Owner.hxx>
+#include <TDF_LabelList.hxx>
+#include <TDF_ListIteratorOfLabelList.hxx>
+#include <CDM_Document.hxx>
+#include <CDM_Application.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TDF_AttributeIterator.hxx>
+
+#include "SALOMEDSImpl_ChildNodeIterator.hxx"
+#include "SALOMEDSImpl_Attributes.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+#include "SALOMEDSImpl_AttributeReference.hxx"
+#include "SALOMEDSImpl_StudyHandle.hxx"
+#include "SALOMEDSImpl_Tool.hxx"
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
+
+#define DIRECTORYID 16661
+#define FILELOCALID 26662
+#define FILEID "FILE: "
+
+//============================================================================
+/*! Function : SALOMEDSImpl_Study
+ * Purpose : SALOMEDSImpl_Study constructor
+ */
+//============================================================================
+SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc,
+ const TCollection_AsciiString& study_name)
+{
+ doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work
+ _name = study_name;
+ _doc = doc;
+ _Saved = false ;
+ _URL = "";
+ _StudyId = -1;
+ _autoFill = true;
+ myNbPostponed.Append(0);
+ myNbUndos = 0;
+ _errorCode = "";
+ _useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc);
+ _builder = new SALOMEDSImpl_StudyBuilder(this);
+ _cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
+ //Put on the root label a StudyHandle attribute to store the address of this object
+ //It will be used to retrieve the study object by TDF_Label that belongs to the study
+ SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
+}
+
+
+//============================================================================
+/*! Function : ~SALOMEDSImpl_Study
+ * Purpose : SALOMEDSImpl_Study destructor
+ */
+//============================================================================
+SALOMEDSImpl_Study::~SALOMEDSImpl_Study()
+{}
+
+//============================================================================
+/*! Function : GetPersistentReference
+ * Purpose : Get persistent reference of study (idem URL())
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference()
+{
+ _errorCode = "";
+ return URL();
+}
+//============================================================================
+/*! Function : GetTransientReference
+ * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference()
+{
+ _errorCode = "";
+ TCollection_AsciiString IOR = "";
+
+ Handle(SALOMEDSImpl_AttributeIOR) Att;
+ TDF_Label _lab = _doc->GetData()->Root();
+ if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) {
+ IOR = Att->Value();
+ }
+ else {
+ _errorCode = "IOR is empty";
+ }
+
+ return IOR;
+}
+
+void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR)
+{
+ _errorCode = "";
+
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ int aLocked = aProp->IsLocked();
+ if (aLocked) aProp->SetLocked(Standard_False);
+
+ // Assign the value of the IOR in the study->root
+ SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR);
+
+ if (aLocked) aProp->SetLocked(Standard_True);
+}
+
+//============================================================================
+/*! Function : IsEmpty
+ * Purpose : Detect if study is empty
+ */
+//============================================================================
+bool SALOMEDSImpl_Study::IsEmpty()
+{
+ _errorCode = "";
+ if (_doc.IsNull()) return true;
+ return _doc->IsEmpty();
+}
+
+//============================================================================
+/*! Function : FindComponent
+ * Purpose : Find a Component with ComponentDataType = aComponentName
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName)
+{
+ _errorCode = "";
+ bool _find = false;
+ TCollection_AsciiString name;
+ SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
+ Handle(SALOMEDSImpl_SComponent) compo;
+
+ for (; itcomp.More(); itcomp.Next()) {
+ Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
+ name = SC->ComponentDataType();
+ if(aComponentName == name) {
+ _find = true;
+ return SC;
+ }
+ }
+
+ if(!_find)
+ {
+ _errorCode = "No component was found";
+ return NULL;
+ }
+ return compo;
+}
+
+//============================================================================
+/*! Function : FindComponentID
+ * Purpose : Find a Component from it's ID
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID)
+{
+ _errorCode = "";
+
+ // Iterate on each components defined in the study
+ // Get the component ID and compare with aComponentID
+ bool _find = false;
+ TCollection_AsciiString ID;
+ Handle(SALOMEDSImpl_SComponent) compo;
+
+ SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
+ for (; itcomp.More(); itcomp.Next()) {
+ Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
+ ID = SC->GetID();
+ if(aComponentID == ID)
+ {
+ // ComponentID found
+ _find = true;
+ compo = SC;
+ }
+ }
+ if(!_find)
+ {
+ _errorCode = "No component was found";
+ compo = NULL;
+ }
+
+ return compo;
+}
+
+//============================================================================
+/*! Function : FindObject
+ * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName)
+{
+ _errorCode = "";
+
+ // Iterate to all components defined in the study
+ // After testing the component name, iterate in all objects defined under
+ // components (function _FindObject)
+ bool _find = false;
+ Handle(SALOMEDSImpl_SObject) RefSO = NULL;
+
+ SALOMEDSImpl_SComponentIterator it = NewComponentIterator();
+ for (; it.More();it.Next()){
+ if(!_find)
+ {
+ Handle(SALOMEDSImpl_SComponent) SC = it.Value();
+ if (SC->GetName() == anObjectName)
+ {
+ _find = true;
+ RefSO = SC;
+
+ }
+ if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
+ }
+ }
+ if(RefSO.IsNull()) _errorCode = "No object was found";
+ return RefSO;
+}
+
+//============================================================================
+/*! Function : FindObjectID
+ * Purpose : Find an Object with ID = anObjectID
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID)
+{
+ _errorCode = "";
+
+ // Convert aSO->GetID in TDF_Label.
+ TDF_Label Lab;
+ TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab);
+
+ if (Lab.IsNull()) {
+ _errorCode = "No label was found by ID";
+ return NULL;
+ }
+ return GetSObject(Lab);
+
+}
+
+//============================================================================
+/*! Function : CreateObjectID
+ * Purpose : Creates an Object with ID = anObjectID
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID)
+{
+ _errorCode = "";
+
+ // Convert aSO->GetID in TDF_Label.
+ TDF_Label Lab;
+ TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True);
+
+ if (Lab.IsNull()) {
+ _errorCode = "Can not create a label";
+ return NULL;
+ }
+ return GetSObject(Lab);
+
+}
+
+//============================================================================
+/*! Function : FindObjectByName
+ * Purpose : Find Objects with SALOMEDSImpl_Name = anObjectName in a Component
+ * : with ComponentDataType = aComponentName
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName,
+ const TCollection_AsciiString& aComponentName)
+{
+ _errorCode = "";
+
+ Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient();
+
+ Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ;
+ if ( compo.IsNull() ) {
+ _errorCode = "Can not find the component";
+ return listSO;
+ }
+
+ // Iterate on each object and subobject of the component
+ // If objectName is found add it to the list of SObjects
+ TCollection_AsciiString childName ;
+
+ TCollection_AsciiString compoId = compo->GetID();
+ Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo);
+ for ( ; it->More(); it->Next() ) {
+
+ Handle(SALOMEDSImpl_SObject) CSO = it->Value();
+ if ( CSO->GetName() == anObjectName ) {
+ /* add to list */
+ listSO->Append(CSO) ;
+ }
+
+ /* looks also for eventual children */
+ bool found = false ;
+ CSO = _FindObject( CSO, anObjectName, found ) ;
+ if( found) {
+ listSO->Append(CSO) ;
+ }
+ }
+
+ return listSO;
+}
+
+
+
+//============================================================================
+/*! Function : FindObjectIOR
+ * Purpose : Find an Object with IOR = anObjectIOR
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR)
+{
+ _errorCode = "";
+
+ // firstly searching in the datamap for optimization
+ if (myIORLabels.IsBound(anObjectIOR)) {
+ Handle(SALOMEDSImpl_SObject) aResult = GetSObject(myIORLabels.Find(anObjectIOR));
+ // 11 oct 2002: forbidden attributes must be checked here
+ if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
+ myIORLabels.UnBind(anObjectIOR);
+ } else
+ return aResult;
+ }
+ // Iterate to all components defined in the study
+ // After testing the component name, iterate in all objects defined under
+ // components (function _FindObject)
+ bool _find = false;
+ Handle(SALOMEDSImpl_SObject) RefSO = NULL;
+
+ SALOMEDSImpl_SComponentIterator it = NewComponentIterator();
+ Handle(SALOMEDSImpl_SComponent) SC;
+ for (; it.More();it.Next()){
+ if(!_find)
+ {
+ SC = it.Value();
+ TCollection_AsciiString ior = SC->GetIOR();
+ if (ior != "")
+ {
+ if (ior == anObjectIOR)
+ {
+ _find = true;
+ RefSO = SC;
+ }
+ }
+ if (!_find)
+ RefSO = _FindObjectIOR(SC, anObjectIOR, _find);
+ }
+ }
+
+ if(RefSO.IsNull()) _errorCode = "No object was found";
+ return RefSO;
+}
+
+//============================================================================
+/*! Function : FindObjectByPath
+ * Purpose : Find an Object by its path = thePath
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath)
+{
+ _errorCode = "";
+
+ TCollection_AsciiString aPath(thePath), aToken;
+ Handle(SALOMEDSImpl_SObject) aSO = NULL;
+ int i = 1, aLength = aPath.Length();
+ bool isRelative = false;
+
+ if(aLength == 0) { //Empty path - return the current context
+ return GetSObject(_current);
+ }
+
+ if(aPath.Value(1) != '/') //Relative path
+ isRelative = true;
+
+ TDF_ChildIterator anIterator;
+ TDF_Label aLabel;
+ Handle(SALOMEDSImpl_AttributeName) anAttr;
+
+ if(isRelative) {
+ if(_current.IsNull()) return NULL;
+ anIterator.Initialize(_current, Standard_False);
+ }
+ else {
+ if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
+ return GetSObject(_doc->Main());
+ }
+ anIterator.Initialize(_doc->Main(), Standard_False);
+ }
+
+ while(i <= aLength) {
+
+ aToken = aPath.Token("/", i);
+ if(aToken.Length() == 0) break;
+
+ for ( ; anIterator.More(); anIterator.Next() ) {
+ aLabel = anIterator.Value();
+ if(aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) {
+ if(anAttr->Value() == aToken) {
+ aToken = aPath.Token("/", i+1); //Check if it was the last part of the path
+ if(aToken.Length() == 0) { //The searched label is found (no part of the path is left)
+ return GetSObject(aLabel);
+ }
+
+ anIterator.Initialize(aLabel, Standard_False);
+ break;
+ }
+ }
+ }
+
+ i++;
+ }
+
+ if(aSO.IsNull()) _errorCode = "No object was found";
+ return aSO;
+}
+
+//============================================================================
+/*! Function : GetObjectPath
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ _errorCode = "";
+
+ TCollection_AsciiString aPath("");
+ if(theObject.IsNull()) {
+ _errorCode = "Null object";
+ return aPath.ToCString();
+ }
+
+ TCollection_AsciiString aName = theObject->GetName();
+ if(!aName.IsEmpty() && aName != "" ) {
+ TCollection_AsciiString aValue((char*)aName.ToCString());
+ aValue.Prepend("/");
+ aValue += aPath;
+ aPath = aValue;
+ Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather();
+ if(!aFather.IsNull()) {
+ aName = aFather->GetName();
+ if(!aName.IsEmpty() && aName != "") {
+ aValue = (char*)GetObjectPath(aFather).ToCString();
+ aPath = aValue + aPath;
+ }
+ }
+ }
+
+ return aPath;
+}
+
+
+//============================================================================
+/*! Function : GetObjectPathByIOR
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
+{
+ _errorCode = "";
+
+ TCollection_AsciiString aPath;
+ Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR);
+ if(so.IsNull()) {
+ _errorCode = "No SObject was found by IOR";
+ return aPath;
+ }
+
+ return GetObjectPath(so);
+}
+
+
+//============================================================================
+/*! Function : SetContext
+ * Purpose : Sets the current context
+ */
+//============================================================================
+bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath)
+{
+ _errorCode = "";
+ if(thePath.IsEmpty()) {
+ _errorCode = "InvalidPath";
+ return false;
+ }
+
+ TCollection_AsciiString aPath(thePath), aContext("");
+ bool isInvalid = false;
+ Handle(SALOMEDSImpl_SObject) aSO;
+
+ if(aPath.Value(1) != '/') { //Relative path
+ aContext = GetContext();
+ aContext += '/';
+ aContext += aPath;
+ }
+ else
+ aContext = aPath;
+
+ try {
+ aSO = FindObjectByPath(aContext.ToCString());
+ }
+ catch( ... ) {
+ isInvalid = true;
+ }
+
+ if(isInvalid || aSO.IsNull()) {
+ _errorCode = "InvalidContext";
+ return false;
+ }
+
+ TDF_Label aLabel = aSO->GetLabel();
+ if(aLabel.IsNull()) {
+ _errorCode = "InvalidContext";
+ return false;
+ }
+ else
+ _current = aLabel; //Set the current context
+
+ return true;
+}
+
+//============================================================================
+/*! Function : GetContext
+ * Purpose : Gets the current context
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
+{
+ _errorCode = "";
+
+ if(_current.IsNull()) {
+ _errorCode = "InvaidContext";
+ return "";
+ }
+ Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
+ return GetObjectPath(so);
+}
+
+//============================================================================
+/*! Function : GetObjectNames
+ * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
+{
+ _errorCode = "";
+
+ Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
+ TDF_Label aLabel;
+ if (theContext.IsEmpty()) {
+ if(_current.IsNull()) {
+ _errorCode = "InvalidContext";
+ return aResultSeq;
+ }
+ aLabel = _current;
+ } else {
+ TDF_Label aTmp = _current;
+ SetContext(theContext);
+ aLabel = _current;
+ _current = aTmp;
+ }
+ TDF_ChildIterator anIter(aLabel, Standard_False); // iterate all subchildren at all sublevels
+ for(; anIter.More(); anIter.Next()) {
+ TDF_Label aLabel = anIter.Value();
+ Handle(SALOMEDSImpl_AttributeName) aName;
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ }
+
+ return aResultSeq;
+}
+
+//============================================================================
+/*! Function : GetDirectoryNames
+ * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext)
+{
+ _errorCode = "";
+
+ Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
+ TDF_Label aLabel;
+ if (theContext.IsEmpty()) {
+ if(_current.IsNull()) {
+ _errorCode = "InvalidContext";
+ return aResultSeq;
+ }
+ aLabel = _current;
+ } else {
+ TDF_Label aTmp = _current;
+ SetContext(theContext);
+ aLabel = _current;
+ _current = aTmp;
+ }
+ TDF_ChildIterator anIter(aLabel, Standard_False); // iterate first-level children at all sublevels
+ for(; anIter.More(); anIter.Next()) {
+ TDF_Label aLabel = anIter.Value();
+ Handle(SALOMEDSImpl_AttributeLocalID) anID;
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ if (anID->Value() == DIRECTORYID) {
+ Handle(SALOMEDSImpl_AttributeName) aName;
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
+ aResultSeq->Append(aName->Value());
+ }
+ }
+ }
+ }
+
+ return aResultSeq;
+}
+
+//============================================================================
+/*! Function : GetFileNames
+ * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext)
+{
+ _errorCode = "";
+
+ Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
+ TDF_Label aLabel;
+ if (theContext.IsEmpty()) {
+ if(_current.IsNull()) {
+ _errorCode = "InvalidContext";
+ return aResultSeq;
+ }
+ aLabel = _current;
+ } else {
+ TDF_Label aTmp = _current;
+ SetContext(theContext);
+ aLabel = _current;
+ _current = aTmp;
+ }
+ TDF_ChildIterator anIter(aLabel, Standard_False); // iterate all subchildren at all sublevels
+ for(; anIter.More(); anIter.Next()) {
+ TDF_Label aLabel = anIter.Value();
+ Handle(SALOMEDSImpl_AttributeLocalID) anID;
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ if (anID->Value() == FILELOCALID) {
+ Handle(SALOMEDSImpl_AttributePersistentRef) aName;
+ if(aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) {
+ TCollection_ExtendedString aFileName = aName->Value();
+ if(aFileName.Length() > 0)
+ aResultSeq->Append(aFileName.Split(strlen(FILEID)));
+ }
+ }
+ }
+ }
+
+ return aResultSeq;
+}
+
+//============================================================================
+/*! Function : GetComponentNames
+ * Purpose : method to get all components names
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext)
+{
+ _errorCode = "";
+
+ Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
+ TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level
+ for(; anIter.More(); anIter.Next()) {
+ TDF_Label aLabel = anIter.Value();
+ Handle(SALOMEDSImpl_AttributeName) aName;
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ }
+
+ return aResultSeq;
+}
+
+//============================================================================
+/*! Function : NewChildIterator
+ * Purpose : Create a ChildIterator from an SObject
+ */
+//============================================================================
+Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO)
+{
+ _errorCode = "";
+ return new SALOMEDSImpl_ChildIterator(aSO);
+}
+
+
+//============================================================================
+/*! Function : NewComponentIterator
+ * Purpose : Create a SComponentIterator
+ */
+//============================================================================
+SALOMEDSImpl_SComponentIterator SALOMEDSImpl_Study::NewComponentIterator()
+{
+ _errorCode = "";
+ return SALOMEDSImpl_SComponentIterator(_doc);
+}
+
+
+//============================================================================
+/*! Function : NewBuilder
+ * Purpose : Create a StudyBuilder
+ */
+//============================================================================
+Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder()
+{
+ _errorCode = "";
+ if(_autoFill) {
+ _builder->SetOnAddSObject(_cb);
+ _builder->SetOnRemoveSObject(_cb);
+ }
+ return _builder;
+
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : get study name
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::Name()
+{
+ _errorCode = "";
+ return _name;
+}
+
+//============================================================================
+/*! Function : Name
+ * Purpose : set study name
+ */
+//============================================================================
+void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name)
+{
+ _errorCode = "";
+ _name = name;
+}
+
+//============================================================================
+/*! Function : IsSaved
+ * Purpose : get if study has been saved
+ */
+//============================================================================
+bool SALOMEDSImpl_Study::IsSaved()
+{
+ _errorCode = "";
+ return _Saved;
+}
+
+//============================================================================
+/*! Function : IsSaved
+ * Purpose : set if study has been saved
+ */
+//============================================================================
+void SALOMEDSImpl_Study::IsSaved(bool save)
+{
+ _errorCode = "";
+ _Saved = save;
+ if(save) _doc->UnModify();
+}
+
+//============================================================================
+/*! Function : IsModified
+ * Purpose : Detect if a Study has been modified since it has been saved
+ */
+//============================================================================
+bool SALOMEDSImpl_Study::IsModified()
+{
+ _errorCode = "";
+
+ // True if is modified
+ if (_doc->IsModified()) return true;
+
+ return false;
+}
+
+//============================================================================
+/*! Function : URL
+ * Purpose : get URL of the study (persistent reference of the study)
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Study::URL()
+{
+ _errorCode = "";
+ return _URL;
+}
+
+//============================================================================
+/*! Function : URL
+ * Purpose : set URL of the study (persistent reference of the study)
+ */
+//============================================================================
+void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url)
+{
+ _errorCode = "";
+ _URL = url;
+
+ /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study
+ TCollection_AsciiString tmp(_URL);
+
+ char *aName = (char*)tmp.ToCString();
+ char *adr = strtok(aName, "/");
+ while (adr)
+ {
+ aName = adr;
+ adr = strtok(NULL, "/");
+ }
+ Name(aName);*/
+ Name(url);
+}
+
+
+//============================================================================
+/*! Function : _FindObject
+ * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
+ const TCollection_AsciiString& theObjectName,
+ bool& _find)
+{
+ if(SO.IsNull()) return NULL;
+
+ // Iterate on each objects and subobjects of the component
+ // If objectName find, stop the loop and get the object reference
+ Handle(SALOMEDSImpl_SObject) RefSO;
+ Handle(SALOMEDSImpl_AttributeName) anAttr;
+
+ TCollection_AsciiString soid = SO->GetID();
+ TDF_ChildIterator it(SO->GetLabel());
+ for (; it.More(); it.Next()){
+ if(!_find)
+ {
+ if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr))
+ {
+ TCollection_AsciiString Val(anAttr->Value());
+ if (Val == theObjectName)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
+ }
+ }
+ return RefSO;
+}
+
+//============================================================================
+/*! Function : _FindObjectIOR
+ * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject)
+SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
+ const TCollection_AsciiString& theObjectIOR,
+ bool& _find)
+{
+ if(SO.IsNull()) return NULL;
+
+ // Iterate on each objects and subobjects of the component
+ // If objectName find, stop the loop and get the object reference
+ Handle(SALOMEDSImpl_SObject) RefSO, aSO;
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr;
+
+ TDF_ChildIterator it(SO->GetLabel());
+ for (; it.More();it.Next()){
+ if(!_find)
+ {
+ if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ {
+ TCollection_AsciiString Val(anAttr->Value());
+ if (Val == theObjectIOR)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ aSO = GetSObject(it.Value());
+ if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
+ }
+ }
+ return RefSO;
+}
+
+bool SALOMEDSImpl_Study::IsLocked()
+{
+ _errorCode = "";
+ return GetProperties()->IsLocked();
+}
+
+int SALOMEDSImpl_Study::StudyId()
+{
+ _errorCode = "";
+ return _StudyId;
+}
+
+void SALOMEDSImpl_Study::StudyId(int id)
+{
+ _errorCode = "";
+ _StudyId = id;
+}
+
+void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry)
+{
+ _errorCode = "";
+ TDF_Label aLabel;
+ char* anEn = (char*)anEntry.ToCString();
+ char* IOR = (char*)anIOR.ToCString();
+ TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True);
+ if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR));
+ myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
+}
+
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel)
+{
+ Handle(SALOMEDSImpl_StudyHandle) Att;
+ if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) {
+ return Att->GetHandle();
+ }
+ return NULL;
+}
+
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel)
+{
+ return GetStudy(theLabel)->GetSObject(theLabel);
+}
+
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel)
+{
+ return GetStudy(theLabel)->GetSComponent(theLabel);
+}
+
+
+void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute)
+{
+ TCollection_AsciiString aString;
+ TDF_Tool::Entry(theAttribute->Label(), aString);
+ GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
+}
+
+Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject)
+{
+ _errorCode = "";
+ Handle(TColStd_HSequenceOfTransient) aSeq;
+
+ Handle(SALOMEDSImpl_AttributeTarget) aTarget;
+ if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) {
+ return aTarget->Get();
+ }
+
+ return aSeq;
+}
+
+
+Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties()
+{
+ _errorCode = "";
+ return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main());
+}
+
+TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate()
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+
+ int aLastIndex = aNames->Length();
+ char aResult[20];
+ sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
+ (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)),
+ (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex)));
+ TCollection_AsciiString aResStr (aResult);
+ return aResStr;
+}
+
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate()
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+
+ int anIndex, aLength = aNames->Length();
+ Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString;
+
+ for (anIndex = 2; anIndex <= aLength; anIndex++) {
+ char aDate[20];
+ sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
+ (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)),
+ (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex)));
+ aDates->Append(aDate);
+ }
+ return aDates;
+}
+
+
+
+//============================================================================
+/*! Function : GetUseCaseBuilder
+ * Purpose : Returns a UseCase builder
+ */
+//============================================================================
+Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
+{
+ _errorCode = "";
+ return _useCaseBuilder;
+}
+
+
+//============================================================================
+/*! Function : Close
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_Study::Close()
+{
+ _errorCode = "";
+ Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
+ if(!anApp.IsNull()) anApp->Close(_doc);
+ _doc.Nullify();
+ _mapOfSO.Clear();
+ _mapOfSCO.Clear();
+}
+
+//============================================================================
+/*! Function : AddPostponed
+ * Purpose :
+ */
+ //============================================================================
+void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR)
+{
+ _errorCode = "";
+ if (!NewBuilder()->HasOpenCommand()) return;
+ TCollection_AsciiString anIOR(theIOR);
+ anIOR.Prepend("d");
+ myPostponedIORs.Append(anIOR); // add prefix: deleted
+ myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
+}
+
+//============================================================================
+/*! Function : AddCreatedPostponed
+ * Purpose :
+ */
+ //============================================================================
+void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR)
+{
+ _errorCode = "";
+ if (!NewBuilder()->HasOpenCommand()) return;
+ TCollection_AsciiString anIOR(theIOR);
+ anIOR.Prepend("c");
+ myPostponedIORs.Append(anIOR); // add prefix: created
+ myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
+}
+
+//============================================================================
+/*! Function : RemovePostponed
+ * Purpose :
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit)
+{
+ _errorCode = "";
+
+ int anIndex;
+ int anOld;
+
+ int aUndoLimit = theUndoLimit;
+ if (theUndoLimit < 0) aUndoLimit = 0;
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString;
+
+ if (myNbUndos > 0) { // remove undone
+ anOld = 0;
+ for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
+ anOld += myNbPostponed(anIndex);
+ int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
+
+ for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
+ TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
+ if (anIOR.Value(1) == 'c') {
+ aSeq->Append(anIOR.Split(1).ToCString());
+ }
+ }
+ if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
+ if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
+
+ myNbUndos = 0;
+ }
+
+ if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
+ anOld = 0;
+ for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
+ anOld += myNbPostponed(anIndex);
+ for(anIndex = 1; anIndex <= anOld; anIndex++) {
+ TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
+ if (anIOR.Value(1) == 'd') {
+ aSeq->Append(anIOR.Split(1).ToCString());
+ }
+ }
+ if (anOld > 0) myPostponedIORs.Remove(1, anOld);
+ myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
+ }
+
+ if (theUndoLimit == -1) { // remove all IORs from the study on the study close
+ TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True);
+ for(; anIter.More(); anIter.Next()) {
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value());
+ aSeq->Append(anAttr->Value());
+ }
+ } else myNbPostponed.Append(0);
+
+ return aSeq;
+}
+
+//============================================================================
+/*! Function : UndoPostponed
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
+{
+ _errorCode = "";
+
+ myNbUndos += theWay;
+ // remove current postponed
+ if (myNbPostponed.Last() > 0)
+ myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
+ myNbPostponed(myNbPostponed.Length()) = 0;
+}
+
+
+//============================================================================
+/*! Function : GetSComponent
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
+{
+ Handle(SALOMEDSImpl_SComponent) aSCO;
+ if(_mapOfSCO.IsBound(theEntry))
+ aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
+ else {
+ TDF_Label aLabel;
+ TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
+ aSCO = new SALOMEDSImpl_SComponent(aLabel);
+ _mapOfSCO.Bind(theEntry, aSCO);
+ }
+
+ return aSCO;
+}
+
+//============================================================================
+/*! Function : GetSComponent
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theLabel, anEntry);
+ return GetSComponent(anEntry);
+}
+
+//============================================================================
+/*! Function : GetSObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
+{
+ Handle(SALOMEDSImpl_SObject) aSO;
+ if(_mapOfSO.IsBound(theEntry))
+ aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
+ else {
+ TDF_Label aLabel;
+ TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
+ aSO = new SALOMEDSImpl_SObject(aLabel);
+ _mapOfSO.Bind(theEntry, aSO);
+ }
+
+ return aSO;
+}
+
+//============================================================================
+/*! Function : GetSObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theLabel, anEntry);
+ return GetSObject(anEntry);
+}
+
+//============================================================================
+/*! Function : GetAttribute
+ * Purpose :
+ */
+//============================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
+ const TCollection_AsciiString& theType)
+{
+ Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
+ Handle(TDF_Attribute) anAttr;
+ aSO->FindAttribute(anAttr, theType);
+ return anAttr;
+}
+
+//============================================================================
+/*! Function : DumpStudy
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
+ const TCollection_AsciiString& theBaseName,
+ bool isPublished,
+ SALOMEDSImpl_DriverFactory* theFactory)
+{
+ _errorCode = "";
+
+ if(theFactory == NULL) {
+ _errorCode = "Null factory for creation of Engines";
+ return false;
+ }
+
+ TColStd_SequenceOfExtendedString aSeq;
+ TCollection_AsciiString aCompType, aFactoryType;
+
+ //Build a list of all components in the Study
+ SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator();
+
+ for (; itcomponent.More(); itcomponent.Next()) {
+ Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
+ aCompType = sco->ComponentDataType();
+ //GEOM and MED are independent components
+ if(aCompType == "GEOM" || aCompType == "MED") aSeq.Prepend(TCollection_ExtendedString(aCompType));
+ else aSeq.Append(TCollection_ExtendedString(aCompType));
+ }
+
+#ifdef WIN32
+ TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("\\")+theBaseName+TCollection_AsciiString(".py");
+#else
+ TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("/")+theBaseName+TCollection_AsciiString(".py");
+#endif
+
+ //Create a file that will contain a main Study script
+ fstream fp;
+ fp.open(aFileName.ToCString(), ios::out);
+
+#ifdef WIN32
+ bool isOpened = fp.is_open();
+#else
+ bool isOpened = fp.rdbuf()->is_open();
+#endif
+
+ if(!isOpened) {
+ _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ return false;
+ }
+
+ TCollection_AsciiString aBatchModeScript = "salome";
+
+ //Output to the main Study script required Python modules import, set sys.path and add a creation of the study.
+ fp << GetDumpStudyComment().ToCString() << endl << endl;
+ fp << "import sys" << endl;
+ fp << "import " << aBatchModeScript << "\n" << endl;
+ fp << "sys.path.insert( 0, \'" << thePath << "\')\n" << endl;
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
+
+ //Iterate all components and create the componponents specific scripts.
+ bool isOk = true;
+ int aLength = aSeq.Length();
+ for(int i = 1; i <= aLength; i++) {
+
+ aCompType = aSeq.Value(i);
+ Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType);
+ SALOMEDSImpl_Driver* aDriver = NULL;
+ // if there is an associated Engine call its method for saving
+ TCollection_AsciiString IOREngine;
+ try {
+ if (!sco->ComponentIOR(IOREngine)) {
+ if (!aCompType.IsEmpty()) {
+
+ aDriver = theFactory->GetDriverByType(aCompType);
+
+ if (aDriver != NULL) {
+ Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
+ cout << "Before SB" << endl;
+ if(!SB->LoadWith(sco, aDriver)) {
+ _errorCode = SB->GetErrorCode();
+ return false;
+ }
+ cout << "After SB" << endl;
+ }
+ else continue;
+ }
+ }
+ else {
+ aDriver = theFactory->GetDriverByIOR(IOREngine);
+ }
+ } catch(...) {
+ _errorCode = "Can not restore information to dump it";
+ return false;
+ }
+
+ if(aDriver == NULL) continue;
+
+ bool isValidScript;
+ long aStreamLength = 0;
+ unsigned char* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
+ if ( !isValidScript )
+ isOk = false;
+
+ //Create a file that will contain the component specific script
+ fstream fp2;
+#ifdef WIN32
+ aFileName=thePath+TCollection_AsciiString("\\");
+#else
+ aFileName=thePath+TCollection_AsciiString("/");
+#endif
+ TCollection_AsciiString aScriptName;
+ aScriptName += theBaseName;
+ aScriptName += "_";
+ aScriptName += aCompType;
+
+ aFileName += aScriptName+ TCollection_AsciiString(".py");
+ aSeqOfFileNames->Append(aFileName);
+
+ fp2.open(aFileName.ToCString(), ios::out);
+
+#ifdef WIN32
+ isOpened = fp.is_open();
+#else
+ isOpened = fp.rdbuf()->is_open();
+#endif
+
+ if(!isOpened) {
+ _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false);
+ return false;
+ }
+
+ //Output the Python script generated by the component in the newly created file.
+ fp2 << aStream;
+ fp2.close();
+
+ //Add to the main script a call to RebuildData of the generated by the component the Python script
+ fp << "import " << aScriptName << endl;
+ fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
+ }
+
+ fp << "salome.sg.updateObjBrowser(1)" << endl;
+
+ fp.close();
+ return isOk;
+}
+
+//=======================================================================
+//function : GetDumpStudyComment
+//purpose : return a header comment for a DumpStudy script
+//=======================================================================
+
+TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
+{
+ TCollection_AsciiString txt
+ ("### This file is generated by SALOME automatically by dump python functionality");
+ if ( theComponentName )
+ txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
+ return txt;
+}
+
+void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+ fstream& fp,
+ const TCollection_AsciiString& Tab,
+ const Handle(SALOMEDSImpl_Study) theStudy);
+//============================================================================
+/*! Function : dump
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName)
+{
+ //Create a file that will contain a main Study script
+ fstream fp;
+ fp.open(theFileName.ToCString(), ios::out);
+
+#ifdef WIN32
+ bool isOpened = fp.is_open();
+#else
+ bool isOpened = fp.rdbuf()->is_open();
+#endif
+
+ if(!isOpened) {
+ _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName;
+ cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl;
+ return;
+ }
+
+ Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1");
+ fp << "0:1" << endl;
+ Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO);
+ TCollection_AsciiString aTab(" ");
+ for(; Itr->More(); Itr->Next()) {
+ dumpSO(Itr->Value(), fp, aTab, this);
+ }
+
+ fp.close();
+}
+
+
+void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+ fstream& fp,
+ const TCollection_AsciiString& Tab,
+ const Handle(SALOMEDSImpl_Study) theStudy)
+{
+ TCollection_AsciiString aTab(Tab), anID(theSO->GetID());
+ fp << aTab << anID << endl;
+ TDF_AttributeIterator anItr(theSO->GetLabel());
+ for(; anItr.More(); anItr.Next()) {
+ Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value());
+
+ if(anAttr.IsNull()) {
+ fp << Tab << " -- " << anItr.Value()->DynamicType();
+ continue;
+ }
+
+ TCollection_AsciiString aType = anAttr->GetClassType();
+ fp << Tab << " -- " << aType;
+
+ if(aType == "AttributeReal") {
+ fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
+ }
+ else if(aType == "AttributeInteger") {
+ fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value();
+ }
+ else if(aType == "AttributeName") {
+ fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value();
+ }
+ else if(aType == "AttributeComment") {
+ fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value();
+ }
+ else if(aType == "AttributeReference") {
+ fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save();
+ }
+ fp << endl;
+ }
+
+ Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO);
+ TCollection_AsciiString aNewTab(" ");
+ aNewTab+=aTab;
+ for(; Itr->More(); Itr->Next()) {
+ dumpSO(Itr->Value(), fp, aNewTab, theStudy);
+ }
+
+ return;
+}
+
+void SALOMEDSImpl_Study::Modify()
+{
+ _errorCode = "";
+ _doc->Modify();
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Study.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_STUDY_I_H__
+#define __SALOMEDSIMPL_STUDY_I_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
+
+// std C++ headers
+#include <iostream>
+
+// Cascade headers
+#include <TDocStd_Document.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_Label.hxx>
+#include <stdio.h>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#ifndef WNT
+#include <NCollection_DataMap.hxx>
+#else
+#include <NCollection_DataMap1.hxx>
+#endif
+
+//SALOMEDSImpl headers
+#include "SALOMEDSImpl_SComponentIterator.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOMEDSImpl_Callback.hxx"
+#include "SALOMEDSImpl_Driver.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+
+class SALOMEDSImpl_StudyManager;
+class SALOMEDSImpl_GenericAttribute;
+
+#ifndef WNT
+typedef NCollection_DataMap <TCollection_AsciiString, Handle_Standard_Transient> DataMapOfAsciiStringTransient;
+typedef NCollection_DataMap <TCollection_AsciiString, TDF_Label> DataMapAsciiStringLabel;
+#else
+typedef NCollection_DataMap1 <TCollection_AsciiString, Handle_Standard_Transient> DataMapOfAsciiStringTransient;
+typedef NCollection_DataMap1 <TCollection_AsciiString, TDF_Label> DataMapAsciiStringLabel;
+#endif
+
+class SALOMEDSImpl_Study : public MMgt_TShared
+{
+private:
+ TCollection_AsciiString _name;
+ Handle(TDocStd_Document) _doc; // OCAF Document
+ bool _Saved; // True if the Study is saved
+ TCollection_AsciiString _URL; //URL of the persistent reference of the study
+ int _StudyId;
+ TDF_Label _current;
+ bool _autoFill;
+ TCollection_AsciiString _errorCode;
+ Handle(SALOMEDSImpl_Callback) _cb;
+ Handle(SALOMEDSImpl_StudyBuilder) _builder;
+ Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder;
+
+ DataMapOfAsciiStringTransient _mapOfSO;
+ DataMapOfAsciiStringTransient _mapOfSCO;
+
+ // data structures for postponed destroying of object functionality
+ TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs
+ TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction
+ int myNbUndos; // number of current Undos, made by user
+ DataMapAsciiStringLabel myIORLabels;
+
+
+ Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
+ const TCollection_AsciiString& anObjectName,
+ bool& _find);
+
+ Handle(SALOMEDSImpl_SObject) _FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
+ const TCollection_AsciiString& anObjectIOR,
+ bool& _find);
+
+public:
+
+ Standard_EXPORT static Handle(SALOMEDSImpl_Study) GetStudy(const TDF_Label& theLabel);
+ Standard_EXPORT static Handle(SALOMEDSImpl_SObject) SObject(const TDF_Label& theLabel);
+ Standard_EXPORT static Handle(SALOMEDSImpl_SComponent) SComponent(const TDF_Label& theLabel);
+ Standard_EXPORT static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute);
+
+ //! standard constructor
+ Standard_EXPORT SALOMEDSImpl_Study(const Handle(TDocStd_Document)&, const TCollection_AsciiString& study_name);
+
+ //! standard destructor
+ Standard_EXPORT virtual ~SALOMEDSImpl_Study();
+
+ //! method to Get persistent reference of study (idem URL())
+ Standard_EXPORT virtual TCollection_AsciiString GetPersistentReference();
+
+ //! method to Get transient reference of study
+ Standard_EXPORT virtual TCollection_AsciiString GetTransientReference();
+
+ Standard_EXPORT virtual void SetTransientReference(const TCollection_AsciiString& theIOR);
+
+ //! method to detect if a study is empty
+ Standard_EXPORT virtual bool IsEmpty();
+
+ //! method to Find a Component with ComponentDataType = aComponentName
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponent (const TCollection_AsciiString& aComponentName);
+
+ //! method to Find a Component Find a Component from it's ID
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponentID(const TCollection_AsciiString& aComponentID);
+
+ //! method to Find an Object with SALOMEDSImpl::Name = anObjectName
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObject(const TCollection_AsciiString& anObjectName);
+
+
+ //! method to Find Object(s) with SALOMEDSImpl::Name=anObjectName in a component with ComponentDataType = aComponentName
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindObjectByName( const TCollection_AsciiString& anObjectName,
+ const TCollection_AsciiString& aComponentName ) ;
+
+ //! method to Find an Object with ID = anObjectID
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectID(const TCollection_AsciiString& anObjectID);
+
+ //! method to Create an Object with ID = anObjectID
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) CreateObjectID(const TCollection_AsciiString& anObjectID);
+
+ //! method to Find an Object with ID = anObjectIOR
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectIOR(const TCollection_AsciiString& anObjectIOR);
+
+ //! method to Find an Object by its path
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectByPath(const TCollection_AsciiString& thePath);
+
+ //! method to get a path of SObject
+ Standard_EXPORT virtual TCollection_AsciiString GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT TCollection_AsciiString GetObjectPathByIOR(const TCollection_AsciiString& theIOR);
+
+ //! method to set a context: root ('/') is UserData component
+ Standard_EXPORT virtual bool SetContext(const TCollection_AsciiString& thePath);
+
+ //! method to get a context
+ Standard_EXPORT virtual TCollection_AsciiString GetContext();
+
+ //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetObjectNames(const TCollection_AsciiString& theContext);
+
+ //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetDirectoryNames(const TCollection_AsciiString& theContext);
+
+ //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetFileNames(const TCollection_AsciiString& theContext);
+
+ //! method to get all components names
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetComponentNames(const TCollection_AsciiString& theContext);
+
+ //! method to Create a ChildIterator from an SObject
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_ChildIterator) NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO);
+
+ //! method to Create a SComponentIterator
+ Standard_EXPORT virtual SALOMEDSImpl_SComponentIterator NewComponentIterator();
+
+ //! method to Create a StudyBuilder
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_StudyBuilder) NewBuilder();
+
+ //! method to get study name
+ Standard_EXPORT virtual TCollection_AsciiString Name();
+
+ //! method to set study name
+ Standard_EXPORT virtual void Name(const TCollection_AsciiString& name);
+
+ //! method to get if study has been saved
+ Standard_EXPORT virtual bool IsSaved();
+
+ //! method to set if study has been saved
+ Standard_EXPORT virtual void IsSaved(bool save);
+
+ //! method to Detect if a Study has been modified since it has been saved
+ Standard_EXPORT virtual bool IsModified();
+
+ //! method to get URL of the study (idem GetPersistentReference)
+ Standard_EXPORT virtual TCollection_AsciiString URL();
+
+ //! method to set URL of the study
+ Standard_EXPORT virtual void URL(const TCollection_AsciiString& url);
+
+ Standard_EXPORT virtual bool IsLocked();
+
+ Standard_EXPORT virtual int StudyId();
+
+ Standard_EXPORT virtual void StudyId(int id);
+
+ Standard_EXPORT virtual void UpdateIORLabelMap(const TCollection_AsciiString& anIOR, const TCollection_AsciiString& aLabel);
+
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties();
+
+ Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate();
+
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetModificationsDate();
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseBuilder) GetUseCaseBuilder();
+
+ Standard_EXPORT virtual void Close();
+
+ Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled) { _errorCode = ""; _autoFill = isEnabled; }
+
+ // postponed destroying of object functionality
+ Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR);
+
+ Standard_EXPORT virtual void AddCreatedPostponed(const TCollection_AsciiString& theIOR);
+
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) RemovePostponed(const int theUndoLimit);
+ // removes postponed IORs of old transaction
+ // if theUndoLimit==0, removes all
+ Standard_EXPORT virtual void UndoPostponed(const int theWay); // theWay = 1: resurrect objects,
+ // theWay = -1: get back to the list of postponed
+
+
+ Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TCollection_AsciiString& theEntry);
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TDF_Label& theLabel);
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TDF_Label& theEntryLabel);
+ Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute(const TCollection_AsciiString& theEntry,
+ const TCollection_AsciiString& theType);
+
+ Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); }
+
+ Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath,
+ const TCollection_AsciiString& theBaseName,
+ bool isPublished,
+ SALOMEDSImpl_DriverFactory* theFactory);
+
+ Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0);
+
+ Standard_EXPORT virtual Handle(TDocStd_Document) GetDocument() { return _doc; }
+
+ //The method dump creates a txt file that contain a dump of the study, for debug use
+ Standard_EXPORT void dump(const TCollection_AsciiString& theFileName);
+
+ //This method marks the study as being modified
+ Standard_EXPORT void Modify();
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study )
+
+friend class SALOMEDSImpl_StudyManager;
+friend class SALOMEDSImpl_GenericAttribute;
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyBuilder.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+
+#include "SALOMEDSImpl_Attributes.hxx"
+
+using namespace std;
+
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_Tool.hxx"
+
+#include <TDF_ChildIterator.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <SALOMEDSImpl_ChildNodeIterator.hxx>
+#include <TDF_ListIteratorOfAttributeList.hxx>
+
+#include <HDFOI.hxx>
+#include <stdlib.h>
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
+
+#define USE_CASE_LABEL_TAG 2
+#define DIRECTORYID 16661
+#define FILELOCALID 26662
+
+static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII);
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner)
+{
+ _errorCode = "";
+ _study = theOwner;
+ _doc = Handle(SALOMEDSImpl_Study)::DownCast(theOwner)->GetDocument();
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_StudyBuilder::~SALOMEDSImpl_StudyBuilder()
+{}
+
+//============================================================================
+/*! Function : NewComponent
+ * Purpose : Create a new component (Scomponent)
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TCollection_AsciiString& DataType)
+{
+ _errorCode = "";
+ CheckLocked();
+ //Always create component under main label.
+ TDF_Label L = _doc->Main();
+
+ int imax = 0;
+ for (TDF_ChildIterator it(L); it.More(); it.Next()) {
+ if (it.Value().Tag() > imax)
+ imax = it.Value().Tag();
+ }
+ imax++;
+ TDF_Label NL = L.FindChild(imax);
+
+ SALOMEDSImpl_AttributeComment::Set(NL, DataType);
+
+ Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL);
+
+ if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+
+ _doc->Modify();
+
+ return so;
+}
+
+//============================================================================
+/*! Function : DefineComponentInstance
+ * Purpose : Add IOR attribute of a Scomponent
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImpl_SComponent)& aComponent,
+ const TCollection_AsciiString& IOR)
+{
+ _errorCode = "";
+
+ CheckLocked();
+ if(aComponent.IsNull() || IOR.IsEmpty()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ //add IOR definition
+ SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR);
+
+ //_doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : RemoveComponent
+ * Purpose : Delete a Scomponent
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent)
+{
+ _errorCode = "";
+ CheckLocked();
+ return RemoveObject(aComponent);
+}
+
+//============================================================================
+/*! Function : NewObject
+ * Purpose : Create a new SObject
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject)
+{
+ _errorCode = "";
+ CheckLocked();
+
+ //Find label of father
+ TDF_Label Lab = theFatherObject->GetLabel();
+
+ //Create a new label
+ int imax = 0;
+ for (TDF_ChildIterator it(Lab); it.More(); it.Next()) {
+ if (it.Value().Tag() > imax)
+ imax = it.Value().Tag();
+ }
+ imax++;
+ TDF_Label NewLab = Lab.FindChild(imax);
+
+ Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
+ if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+
+ _doc->Modify();
+ return so;
+}
+
+//============================================================================
+/*! Function : NewObjectToTag
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
+ const int theTag)
+{
+ _errorCode = "";
+ CheckLocked();
+ //Find label of father
+ TDF_Label Lab = theFatherObject->GetLabel();
+
+ //Create or find label
+ TDF_Label NewLab = Lab.FindChild(theTag, 1);
+
+ Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
+
+ if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+
+ _doc->Modify();
+ return so;
+}
+
+//============================================================================
+/*! Function : RemoveObject
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(anObject.IsNull()) {
+ _errorCode = "Null object";
+ return false;
+ }
+
+ if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+
+ TDF_Label Lab = anObject->GetLabel();
+
+ Handle(SALOMEDSImpl_AttributeReference) aReference;
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
+ Handle(SALOMEDSImpl_AttributeTarget) aTarget;
+ if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
+ }
+
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+
+ Lab.ForgetAllAttributes();
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : RemoveObjectWithChildren
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(anObject.IsNull()) {
+ _errorCode = "Null object";
+ return false;
+ }
+
+ if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+
+ TDF_Label Lab = anObject->GetLabel();
+
+ Handle(SALOMEDSImpl_AttributeReference) aReference;
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
+ Handle(SALOMEDSImpl_AttributeTarget) aTarget;
+ if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
+ }
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+
+ TDF_ChildIterator it(Lab, Standard_True);
+ for(;it.More();it.Next()) {
+ TDF_Label aLabel = it.Value();
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
+ Handle(SALOMEDSImpl_AttributeTarget) aTarget;
+ if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ aTarget->Remove(SALOMEDSImpl_Study::SObject(aLabel));
+ }
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
+ if (aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ }
+
+ Lab.ForgetAllAttributes(Standard_True);
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : LoadWith
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO, SALOMEDSImpl_Driver* aDriver)
+{
+ _errorCode = "";
+
+ TDF_Label Lab = anSCO->GetLabel();
+ Handle(SALOMEDSImpl_AttributePersistentRef) Att;
+
+ //Find the current Url of the study
+ if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
+ int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
+ if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
+
+ TCollection_ExtendedString Res(Att->Value());
+
+ Handle(SALOMEDSImpl_AttributeComment) type;
+ TCollection_ExtendedString DataType;
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type))
+ DataType = type->Value();
+
+ // associate the driver to the SComponent
+ if(aDriver == NULL) {
+ _errorCode = "Driver is null";
+ return false;
+ }
+
+ // mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again
+ Handle(SALOMEDSImpl_AttributeIOR) attrIOR;
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), attrIOR)) {
+ if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ return true;
+ }
+
+ DefineComponentInstance (anSCO, aDriver->GetIOR());
+
+ TCollection_AsciiString aHDFPath(Res);
+
+ char* aHDFUrl;
+ bool isASCII = false;
+ if (HDFascii::isASCII(aHDFPath.ToCString())) {
+ isASCII = true;
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
+ aHDFUrl = new char[strlen(aResultPath) + 19];
+ sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
+ delete(aResultPath);
+ } else {
+ aHDFUrl = aHDFPath.ToCString();
+ }
+
+ //Open the Study HDF file
+ HDFfile *hdf_file = new HDFfile(aHDFUrl);
+
+ char aMultifileState[2];
+ char ASCIIfileState[2];
+ try {
+ TCollection_AsciiString scoid = anSCO->GetID();
+ hdf_file->OpenOnDisk(HDF_RDONLY);
+ HDFgroup *hdf_group = new HDFgroup("DATACOMPONENT",hdf_file);
+ hdf_group->OpenOnDisk();
+ HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group);
+ hdf_sco_group->OpenOnDisk();
+
+ unsigned char* aStreamFile = NULL;
+ int aStreamSize = 0;
+
+ if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) {
+ HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group);
+ hdf_dataset->OpenOnDisk();
+ aStreamSize = hdf_dataset->GetSize();
+ aStreamFile = new unsigned char[aStreamSize];
+ if(aStreamFile == NULL) throw HDFexception("Unable to open dataset FILE_STREAM");
+ hdf_dataset->ReadFromDisk(aStreamFile);
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0;
+ } else aStreamFile = NULL;
+
+ HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
+ multifile_hdf_dataset->OpenOnDisk();
+ multifile_hdf_dataset->ReadFromDisk(aMultifileState);
+
+ HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
+ ascii_hdf_dataset->OpenOnDisk();
+ ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
+
+ // set path without file name from URL
+ int aFileNameSize = Res.Length();
+ char* aDir = new char[aFileNameSize];
+ memcpy(aDir, TCollection_AsciiString(Res).ToCString(), aFileNameSize);
+ for(int aCounter = aFileNameSize-1; aCounter>=0; aCounter--)
+ if (aDir[aCounter] == '/') {
+ aDir[aCounter+1] = 0;
+ break;
+ }
+
+ bool aResult = (ASCIIfileState[0]=='A')?
+ aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M'):
+ aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M');
+
+ if(aStreamFile != NULL) delete []aStreamFile;
+
+ if(!aResult) {
+ RemoveAttribute( anSCO, "AttributeIOR" );
+
+ _errorCode = "Can't load component";
+ throw HDFexception("Unable to load component");
+ }
+
+ if(aDir != NULL) delete []aDir;
+
+ multifile_hdf_dataset->CloseOnDisk();
+ multifile_hdf_dataset = 0;
+ ascii_hdf_dataset->CloseOnDisk();
+ ascii_hdf_dataset = 0;
+
+ hdf_sco_group->CloseOnDisk();
+ hdf_sco_group = 0;
+ hdf_group->CloseOnDisk();
+ hdf_group = 0;
+ hdf_file->CloseOnDisk();
+ delete hdf_file;
+
+ if (isASCII) {
+ Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
+ aFilesToRemove->Append(aHDFUrl);
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ }
+
+ delete aHDFUrl;
+ }
+ catch (HDFexception) {
+ delete hdf_file;
+
+ if (isASCII) {
+ Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
+ aFilesToRemove->Append(aHDFUrl);
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ }
+ delete aHDFUrl;
+
+ if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ _errorCode = "No persistent file";
+ return false;
+ }
+
+ try {
+ Translate_persistentID_to_IOR (Lab, aDriver, aMultifileState[0]=='M', ASCIIfileState[0] == 'A');
+ } catch(...) {
+ _errorCode = "Can not convert persistent IDs to IORs";
+ return false;
+ }
+
+ if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ } else {
+ _errorCode = "No persistent file";
+ }
+
+ return true;
+}
+
+
+//============================================================================
+/*! Function : Load
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco)
+{
+ _errorCode = "Not implemented";
+ return false;
+}
+
+//============================================================================
+/*! Function : FindOrCreateAttribute
+ * Purpose : Add attribute of given type to SObject, if there is attribute of such type, returns
+ * existing one
+ */
+//============================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
+ const TCollection_AsciiString& aTypeOfAttribute)
+{
+ _errorCode = "";
+ if(anObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return NULL;
+ }
+
+ TDF_Label Lab = anObject->GetLabel();
+ if(Lab.IsNull()) {
+ _errorCode = "Null label";
+ return NULL;
+ }
+
+ _doc->Modify();
+
+ //The macro adds all necessary checks for standardly behaiving attributes
+ __FindOrCreateAttributeForBuilder
+
+ //Add checks for TreeNode and UserID attributes
+ if (strncmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode",17) == 0 ) {
+ Standard_GUID aTreeNodeGUID;
+ if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) {
+ aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID();
+ } else {
+ char* aGUIDString = new char[40];
+ char* aType = (char*)aTypeOfAttribute.ToCString();
+ sprintf(aGUIDString, &(aType[21]));
+ aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
+ delete(aGUIDString);
+ }
+ Handle(SALOMEDSImpl_AttributeTreeNode) anAttr;
+ if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) {
+ CheckLocked();
+ anAttr = SALOMEDSImpl_AttributeTreeNode::Set(Lab, aTreeNodeGUID);
+ }
+ return anAttr;
+ }
+
+ if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) {
+ Handle(SALOMEDSImpl_AttributeUserID) anAttr;
+ if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) {
+ CheckLocked();
+ anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, SALOMEDSImpl_AttributeUserID::DefaultID());
+ }
+ return anAttr;
+ }
+ _errorCode = "Can not create an attribute";
+
+ return NULL;
+}
+
+//============================================================================
+/*! Function : FindAttribute
+ * Purpose : Find attribute of given type assigned SObject, returns Standard_True if it is found
+ */
+//============================================================================
+
+bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
+ Handle(TDF_Attribute)& anAttribute,
+ const TCollection_AsciiString& aTypeOfAttribute)
+{
+ _errorCode = "";
+ if(anObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ TDF_Label Lab = anObject->GetLabel();
+ if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) {
+ _doc->Modify();
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//============================================================================
+/*! Function : RemoveAttribute
+ * Purpose : Remove attribute of given type assigned SObject
+ */
+//============================================================================
+
+bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
+ const TCollection_AsciiString& aTypeOfAttribute)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(anObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ TDF_Label Lab = anObject->GetLabel();
+
+ if (aTypeOfAttribute == "AttributeIOR") { // postponed removing of CORBA objects
+ Handle(SALOMEDSImpl_AttributeIOR) anAttr;
+ if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(anAttr->Value());
+ }
+
+ Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute));
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : Addreference
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& me,
+ const Handle(SALOMEDSImpl_SObject)& theReferencedObject)
+{
+ _errorCode = "";
+ if(me.IsNull() || theReferencedObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ CheckLocked();
+ TDF_Label Lab = me->GetLabel();
+ TDF_Label RefLab = theReferencedObject->GetLabel();
+ SALOMEDSImpl_AttributeReference::Set(Lab,RefLab);
+
+ SALOMEDSImpl_AttributeTarget::Set(RefLab)->Add(SALOMEDSImpl_Study::SObject(Lab));
+
+ if(!_callbackOnRemove.IsNull() && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+
+ return true;
+}
+
+//============================================================================
+/*! Function : RemoveReference
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObject)& me)
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_SObject) theReferencedObject;
+ if(!me->ReferencedObject(theReferencedObject)) return false; //No reference is found
+
+ CheckLocked();
+ TDF_Label Lab = me->GetLabel();
+
+ Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID());
+
+ //SRN: 30 Aug, 2004 : fix from Ecole l'ete version
+
+ TDF_Label RefLab = theReferencedObject->GetLabel();
+
+ Handle(SALOMEDSImpl_AttributeTarget) aTarget;
+ if(RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget))
+ aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
+
+ _doc->Modify();
+
+ return true;
+}
+
+
+
+//============================================================================
+/*! Function : AddDirectory
+ * Purpose : adds a new directory with a path = thePath
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& thePath)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(thePath.IsEmpty() || thePath == "") {
+ _errorCode = "Invalid path";
+ return false;
+ }
+
+ TCollection_AsciiString aPath(thePath), aContext(""), aFatherPath;
+ TDF_Label aLabel;
+ Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(_doc->Main());
+ Handle(SALOMEDSImpl_SObject) anObject;
+
+ try {
+ anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists
+ }
+ catch(...) { }
+
+ if(!anObject.IsNull()) {
+ _errorCode = "StudyNameAlreadyUsed";
+ return false;
+ }
+
+ if(aPath.Value(1) != '/') { //Relative path
+ aPath.Prepend('/');
+ aPath = aStudy->GetContext() + aPath;
+ }
+
+ TCollection_AsciiString aToken = aPath.Token("/", 1);
+ if(aToken.Length() == 0) aFatherPath = "/";
+
+ int i = 1;
+ while(aToken.Length() != 0) {
+ if(aPath.Token("/", i+1).Length() > 0) {
+ aFatherPath += "/";
+ aFatherPath += aToken;
+ }
+ aToken = aPath.Token("/", ++i);
+ }
+
+ anObject.Nullify();
+ try {
+ anObject = aStudy->FindObjectByPath(aFatherPath); //Check if the father directory exists
+ }
+ catch(...) { ; }
+ if(anObject.IsNull()) {
+ _errorCode = "StudyInvalidDirectory";
+ return false;
+ }
+
+ Handle(SALOMEDSImpl_SObject) aNewObject = NewObject(anObject);
+ aLabel = aNewObject->GetLabel();
+ if(aLabel.IsNull()) {
+ _errorCode = "StudyInvalidComponent";
+ return false;
+ }
+
+ SALOMEDSImpl_AttributeName::Set(aLabel, aPath.Token("/", i-1));
+
+ //Set LocalID attribute to identify the directory object
+ Handle(SALOMEDSImpl_AttributeLocalID) aLocalID = SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
+
+ _doc->Modify();
+
+ return true;
+}
+
+
+//============================================================================
+/*! Function : SetGUID
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
+ const TCollection_AsciiString& theGUID)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(anObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+
+ TDF_Label aLabel = anObject->GetLabel();
+ SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID.ToCString());
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : IsGUID
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
+ const TCollection_AsciiString& theGUID)
+{
+ _errorCode = "";
+ if(anObject.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ TDF_Label aLabel = anObject->GetLabel();
+ return aLabel.IsAttribute(theGUID.ToCString());
+}
+
+
+//============================================================================
+/*! Function : NewCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::NewCommand()
+{
+ _errorCode = "";
+ // mpv: for SAL2114 - unset "lock changed" flag at the operation start
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties;
+ _doc->Main().AddAttribute(anAttr);
+ }
+ anAttr->IsLockChanged(true);
+
+ _doc->NewCommand();
+}
+
+//============================================================================
+/*! Function : CommitCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::CommitCommand()
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties;
+ _doc->Main().AddAttribute(anAttr);
+ }
+ if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) {
+ AbortCommand();
+ _errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ } else {
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->RemovePostponed(_doc->GetUndoLimit());
+
+ int aModif = anAttr->GetModified();
+ if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero
+ anAttr->SetModified(aModif+1);
+ _doc->CommitCommand();
+ }
+
+ _doc->Modify();
+}
+
+//============================================================================
+/*! Function : HasOpenCommand
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::HasOpenCommand()
+{
+ _errorCode = "";
+ return _doc->HasOpenCommand();
+}
+
+//============================================================================
+/*! Function : AbortCommand
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::AbortCommand()
+{
+ _errorCode = "";
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0);
+
+ _doc->AbortCommand();
+}
+
+//============================================================================
+/*! Function : Undo
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::Undo()
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties;
+ _doc->Main().AddAttribute(anAttr);
+ }
+ if (anAttr->IsLocked()) {
+ _errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ } else {
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(1);
+ _doc->Undo();
+ anAttr->SetModified(anAttr->GetModified()-1);
+ }
+
+ _doc->Modify();
+}
+
+//============================================================================
+/*! Function : Redo
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::Redo()
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties;
+ _doc->Main().AddAttribute(anAttr);
+ }
+
+ if (anAttr->IsLocked()) {
+ _errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ } else {
+ _doc->Redo();
+ SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(-1);
+ anAttr->SetModified(anAttr->GetModified()+1);
+ }
+
+ _doc->Modify();
+}
+
+//============================================================================
+/*! Function : GetAvailableUndos
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos()
+{
+ _errorCode = "";
+ return _doc->GetAvailableUndos();
+}
+
+//============================================================================
+/*! Function : GetAvailableRedos
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos()
+{
+ _errorCode = "";
+ return _doc->GetAvailableRedos();
+}
+
+//============================================================================
+/*! Function : UndoLimit
+ * Purpose :
+ */
+//============================================================================
+int SALOMEDSImpl_StudyBuilder::UndoLimit()
+{
+ _errorCode = "";
+ return _doc->GetUndoLimit();
+}
+
+//============================================================================
+/*! Function : UndoLimit
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::UndoLimit(int n)
+{
+ _errorCode = "";
+ CheckLocked();
+ _doc->SetUndoLimit (n);
+}
+
+//============================================================================
+/*! Function : SetOnAddSObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Callback)
+SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_Callback) aRet = _callbackOnAdd;
+ _callbackOnAdd = theCallback;
+ return aRet;
+}
+
+//============================================================================
+/*! Function : SetOnNewSObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Callback)
+SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_Callback) aRet = _callbackOnRemove;
+ _callbackOnRemove = theCallback;
+ return aRet;
+}
+
+//============================================================================
+/*! Function : CheckLocked
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_StudyBuilder::CheckLocked()
+{
+ _errorCode = "";
+ if (_doc->HasOpenCommand()) return;
+ Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
+ if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
+ anAttr = new SALOMEDSImpl_AttributeStudyProperties;
+ _doc->Main().AddAttribute(anAttr);
+ }
+ if (anAttr->IsLocked()) {
+ _errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ }
+}
+
+//============================================================================
+/*! Function : SetName
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theSO,
+ const TCollection_AsciiString& theValue)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(theSO.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ SALOMEDSImpl_AttributeName::Set(theSO->GetLabel(), theValue);
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : SetComment
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& theSO,
+ const TCollection_AsciiString& theValue)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(theSO.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ SALOMEDSImpl_AttributeComment::Set(theSO->GetLabel(), theValue);
+
+ _doc->Modify();
+
+ return true;
+}
+
+//============================================================================
+/*! Function : SetIOR
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO,
+ const TCollection_AsciiString& theValue)
+{
+ _errorCode = "";
+ CheckLocked();
+ if(theSO.IsNull()) {
+ _errorCode = "Invalid arguments";
+ return false;
+ }
+ SALOMEDSImpl_AttributeIOR::Set(theSO->GetLabel(), theValue);
+
+ _doc->Modify();
+
+ return true;
+}
+
+
+//============================================================================
+/*! Function : Translate_persistentID_to_IOR
+ * Purpose :
+ */
+//============================================================================
+static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII)
+{
+ if(driver == NULL) return;
+ TDF_ChildIterator itchild (Lab);
+
+ for (; itchild.More(); itchild.Next()) {
+ TDF_Label current = itchild.Value();
+ Handle(SALOMEDSImpl_AttributePersistentRef) Att;
+ if (current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
+
+ Handle(SALOMEDSImpl_AttributeLocalID) anID;
+ if (current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID))
+ if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
+
+ TCollection_AsciiString persist_ref(Att->Value());
+ Handle(SALOMEDSImpl_SObject) so = SALOMEDSImpl_Study::SObject(current);
+ TCollection_AsciiString ior_string = driver->LocalPersistentIDToIOR(so,
+ persist_ref,
+ isMultiFile,
+ isASCII);
+ SALOMEDSImpl_AttributeIOR::Set (current, ior_string);
+
+ }
+ Translate_persistentID_to_IOR (current, driver, isMultiFile, isASCII);
+ }
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSImpl_STUDYBUILDER_H__
+#define __SALOMEDSImpl_STUDYBUILDER_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
+
+// std C++ headers
+#include <iostream>
+
+// Cascade header
+#include <TCollection_AsciiString.hxx>
+#include <TDocStd_Document.hxx>
+
+#include "SALOMEDSImpl_Callback.hxx"
+#include "SALOMEDSImpl_Driver.hxx"
+
+class SALOMEDSImpl_StudyBuilder : public MMgt_TShared
+{
+private:
+ Handle(TDocStd_Document) _doc;
+ Handle(Standard_Transient) _study;
+ Handle(SALOMEDSImpl_Callback) _callbackOnAdd;
+ Handle(SALOMEDSImpl_Callback) _callbackOnRemove;
+ TCollection_AsciiString _errorCode;
+
+public:
+
+ Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
+
+ Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
+
+ Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
+
+ Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
+ const int theTag);
+
+ //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
+ Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath);
+
+ Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
+
+ Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
+
+ Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
+ const TCollection_AsciiString& aTypeOfAttribute);
+ Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
+ Handle(TDF_Attribute)& anAttribute,
+ const TCollection_AsciiString& aTypeOfAttribute);
+
+ Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
+
+ Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me,
+ const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
+
+ Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
+
+ Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
+ Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
+
+ Standard_EXPORT virtual void NewCommand();
+ Standard_EXPORT virtual void CommitCommand();
+ Standard_EXPORT virtual bool HasOpenCommand();
+ Standard_EXPORT virtual void AbortCommand();
+ Standard_EXPORT virtual void Undo();
+ Standard_EXPORT virtual void Redo();
+ Standard_EXPORT bool GetAvailableUndos();
+ Standard_EXPORT bool GetAvailableRedos();
+ Standard_EXPORT bool IsSaved();
+ Standard_EXPORT bool IsModified();
+ Standard_EXPORT virtual int UndoLimit();
+ Standard_EXPORT virtual void UndoLimit(const int);
+
+ Standard_EXPORT void CheckLocked();
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
+
+ Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+
+ Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+
+ Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+
+ Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
+
+ Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyHandle.cxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_StudyHandle.hxx"
+#include <TDF_Attribute.hxx>
+#include <Standard_GUID.hxx>
+
+/*
+ Class : SALOMEDSImpl_StudyHandle
+ Description : This class is intended for storing information about
+ graphic representation of objects in dirrent views
+*/
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
+
+//=======================================================================
+//function : GetID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
+{
+ static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
+ return SALOMEDSImpl_StudyHandleID;
+}
+
+//=======================================================================
+//function : SALOMEDSImpl_StudyHandle
+//purpose : Empty Constructor
+//=======================================================================
+SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
+{
+ myHandle.Nullify();
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel,
+ const Handle(SALOMEDSImpl_Study)& theStudy)
+{
+ Handle(SALOMEDSImpl_StudyHandle) A;
+ if (!theLabel.FindAttribute(GetID(), A)) {
+ A = new SALOMEDSImpl_StudyHandle();
+ theLabel.AddAttribute(A);
+ }
+
+ A->SetHandle(theStudy);
+ return A;
+}
+
+
+//=======================================================================
+//function : ID
+//purpose : Get GUID of this attribute
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
+{
+ return GetID();
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose : Create new empty attribute
+//=======================================================================
+Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
+{
+ return new SALOMEDSImpl_StudyHandle ();
+}
+
+
+//=======================================================================
+//function : Restore
+//purpose : Restore value of attribute with value of theWith one
+//=======================================================================
+void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
+{
+ Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
+ if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
+}
+
+//=======================================================================
+//function : Paste
+//purpose : Paste value of current attribute to the value of entry one
+//=======================================================================
+void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
+ const Handle(TDF_RelocationTable)& ) const
+{
+ Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
+ if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyHandle.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef SALOMEDSImpl_StudyHandle_HeaderFile
+#define SALOMEDSImpl_StudyHandle_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+/*
+ Class : SALOMEDSImpl_StudyHandle
+ Description : PRIVATE: This class is intended for storing of the study handle
+*/
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
+
+#include "SALOMEDSImpl_Study.hxx"
+
+#ifndef WNT
+class Standard_EXPORT SALOMEDSImpl_StudyHandle : public TDF_Attribute
+#else
+class SALOMEDSImpl_StudyHandle : public TDF_Attribute
+#endif
+{
+
+public:
+Standard_EXPORT SALOMEDSImpl_StudyHandle();
+Standard_EXPORT ~SALOMEDSImpl_StudyHandle() { myHandle.Nullify(); }
+
+Standard_EXPORT static Handle(SALOMEDSImpl_StudyHandle) Set(const TDF_Label& theLabel, const Handle(SALOMEDSImpl_Study)& theStudy);
+Standard_EXPORT static const Standard_GUID& GetID() ;
+
+Standard_EXPORT void SetHandle(const Handle(SALOMEDSImpl_Study)& theStudy) { myHandle = theStudy; }
+Standard_EXPORT Handle(SALOMEDSImpl_Study) GetHandle() { return myHandle; }
+Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
+Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
+Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
+ const Handle(TDF_RelocationTable)& ) const;
+
+private:
+ Handle(SALOMEDSImpl_Study) myHandle;
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyHandle )
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyManager.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_StudyManager.hxx"
+
+using namespace std;
+
+#include <CDF_Session.hxx>
+#include <CDF_DirectoryIterator.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_RelocationTable.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TDF_AttributeIterator.hxx>
+#include <TColStd_HSequenceOfReal.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HArray1OfCharacter.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <OSD_Process.hxx>
+#include <Quantity_Date.hxx>
+#include "HDFexplorer.hxx"
+
+#include "SALOMEDSImpl_Attributes.hxx"
+#include "SALOMEDSImpl_Tool.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include <map>
+
+#include "HDFOI.hxx"
+#include <iostream>
+#include <stdlib.h>
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared )
+
+#define USE_CASE_LABEL_ID "0:2"
+#define AUTO_SAVE_GUID "128268A3-71C9-4036-89B1-F81BD6A4FCF2"
+#define AUTO_SAVE_TAG "0:8"
+#define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200
+
+static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject);
+static void ReadAttributes(const Handle(SALOMEDSImpl_Study)&, const Handle(SALOMEDSImpl_SObject)&, HDFdataset* );
+static void BuildTree (const Handle(SALOMEDSImpl_Study)&, HDFgroup*);
+static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&,
+ SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII);
+
+//============================================================================
+/*! Function : SALOMEDSImpl_StudyManager
+ * Purpose : SALOMEDSImpl_StudyManager constructor
+ */
+//============================================================================
+SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager()
+{
+ _errorCode = "";
+ _OCAFApp = new SALOMEDSImpl_OCAFApplication();
+ _IDcounter = 0;
+ _OCAFApp->NewDocument("SALOME_STUDY", _clipboard);
+}
+
+//============================================================================
+/*! Function : ~SALOMEDSImpl_StudyManager
+ * Purpose : SALOMEDSImpl_StudyManager destructor
+ */
+//============================================================================
+SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager()
+{
+ // Destroy OCAF application
+ _OCAFApp.Nullify();
+}
+
+
+//============================================================================
+/*! Function : NewStudy
+ * Purpose : Create a New Study of name study_name
+ */
+//==================================================T==========================
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name)
+{
+ _errorCode = "";
+
+ Handle(TDocStd_Document) Doc;
+ _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+
+ Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name);
+
+ _IDcounter++;
+ Study->StudyId( _IDcounter );
+
+ // set Study properties
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Study->GetProperties();
+ OSD_Process aProcess;
+ Quantity_Date aDate = aProcess.SystemDate();
+ aProp->SetModification(aProcess.UserName().ToCString(),
+ aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+ aProp->SetCreationMode(1); //"from scratch"
+
+ return Study;
+}
+
+//============================================================================
+/*! Function : Open
+ * Purpose : Open a Study from it's persistent reference
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_AsciiString& aUrl)
+{
+ _errorCode = "";
+
+ // open the HDFFile
+ HDFfile *hdf_file =0;
+ HDFgroup *hdf_group_study_structure =0;
+
+ char* aC_HDFUrl;
+ TCollection_AsciiString aHDFUrl;
+ bool isASCII = false;
+ if (HDFascii::isASCII(aUrl.ToCString())) {
+ isASCII = true;
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.ToCString());
+ aC_HDFUrl = new char[strlen(aResultPath) + 19];
+ sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
+ delete(aResultPath);
+ aHDFUrl = aC_HDFUrl;
+ delete aC_HDFUrl;
+ } else {
+ aHDFUrl = aUrl;
+ }
+
+ hdf_file = new HDFfile((char*)aHDFUrl.ToCString());
+ try {
+ hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too
+ }
+ catch (HDFexception)
+ {
+#ifndef WNT
+ char eStr[strlen(aUrl.ToCString())+17];
+#else
+ char *eStr;
+ eStr = new char[strlen(aUrl.ToCString())+17];
+#endif
+ sprintf(eStr,"Can't open file %s",aUrl.ToCString());
+#ifdef WNT
+ delete [] eStr;
+#endif
+ _errorCode = TCollection_AsciiString(eStr);
+ return NULL;
+ }
+
+ // Temporary aStudyUrl in place of study name
+ Handle(TDocStd_Document) Doc;
+ _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+
+ Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl);
+
+ _IDcounter++;
+ Study->StudyId( _IDcounter );
+
+ // Assign the value of the URL in the study object
+ Study->URL (aUrl);
+
+ SALOMEDSImpl_AttributePersistentRef::Set(Doc->Main(), aUrl);
+
+ if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) {
+ _errorCode = "Study is empty";
+ return Study;
+ }
+
+ //Create the Structure of the OCAF Document
+ hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file);
+
+ Handle(TDF_Data) DF = Doc->GetData();
+ try {
+ BuildTree (Study, hdf_group_study_structure);
+ }
+ catch (HDFexception)
+ {
+#ifndef WNT
+ char eStr[strlen(aUrl.ToCString())+17];
+#else
+ char *eStr = new char [strlen(aUrl.ToCString())+17];
+#endif
+ sprintf(eStr,"Can't open file %s", aUrl.ToCString());
+ _errorCode = TCollection_AsciiString(eStr);
+ return NULL;
+ }
+
+ hdf_file->CloseOnDisk();
+
+ if (isASCII) {
+ Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
+ aFilesToRemove->Append(aHDFUrl);
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ }
+
+ delete hdf_file; // all related hdf objects will be deleted
+
+ return Study;
+}
+
+
+
+//============================================================================
+/*! Function : Close
+ * Purpose : Close a study.
+ * If the study hasn't been saved, ask the user to confirm the
+ * close action without saving
+ */
+
+//============================================================================
+void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy)
+{
+ _errorCode = "";
+
+ if(aStudy.IsNull()) {
+ _errorCode = "Study is null";
+ return;
+ }
+
+ aStudy->Close();
+}
+
+//============================================================================
+/*! Function : Save
+ * Purpose : Save a Study to it's persistent reference
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile)
+{
+ _errorCode = "";
+
+ TCollection_AsciiString url = aStudy->URL();
+ if (url.IsEmpty()) {
+ _errorCode = "No path specified to save the study. Nothing done";
+ return false;
+ }
+ else {
+ return Impl_SaveAs(url,aStudy, aFactory, theMultiFile, false);
+ }
+
+ return false;
+}
+
+bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile)
+{
+ _errorCode = "";
+
+ TCollection_AsciiString url = aStudy->URL();
+ if (url.IsEmpty()) {
+ _errorCode = "No path specified to save the study. Nothing done";
+ return false;
+ }
+ else {
+ return Impl_SaveAs(url,aStudy, aFactory, theMultiFile, true);
+ }
+
+ return false;
+}
+
+//=============================================================================
+/*! Function : SaveAs
+ * Purpose : Save a study to the persistent reference aUrl
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile)
+{
+ _errorCode = "";
+ return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, false);
+}
+
+bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile)
+{
+ _errorCode = "";
+ return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, true);
+}
+
+//============================================================================
+/*! Function : GetOpenStudies
+ * Purpose : Get name list of open studies in the session
+ */
+//============================================================================
+Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies()
+{
+ _errorCode = "";
+ Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient;
+
+ int nbDocs = _OCAFApp->NbDocuments();
+
+ if(nbDocs == 0) {
+ _errorCode = "No active study in this session";
+ return aList;
+ }
+ else {
+ Handle(SALOMEDSImpl_Study) aStudy;
+ Handle(CDF_Session) S = CDF_Session::CurrentSession();
+ CDF_DirectoryIterator it (S->Directory());
+ for (;it.MoreDocument();it.NextDocument()) {
+ Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
+ if(D == _clipboard) continue;
+ aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
+ if(aStudy.IsNull()) continue;
+ aList->Append(aStudy);
+ }
+ }
+
+ return aList;
+}
+
+//============================================================================
+/*! Function : GetStudyByName
+ * Purpose : Get a study from its name
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName
+ (const TCollection_AsciiString& aStudyName)
+{
+ _errorCode = "";
+ int nbDocs = _OCAFApp->NbDocuments();
+
+ if (nbDocs == 0) {
+ _errorCode = "No active study in this session";
+ return NULL;
+ }
+ else {
+ Handle(SALOMEDSImpl_Study) aStudy;
+ Handle(CDF_Session) S = CDF_Session::CurrentSession();
+ CDF_DirectoryIterator it (S->Directory());
+ for (; it.MoreDocument(); it.NextDocument()) {
+ Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
+ if (D == _clipboard) continue;
+ aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
+ if (aStudy.IsNull()) continue;
+ if (aStudy->Name() == aStudyName) return aStudy;
+ }
+ }
+
+ _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName;
+ return NULL;
+}
+
+//============================================================================
+/*! Function : GetStudyByID
+ * Purpose : Get a study from its ID
+ */
+//============================================================================
+Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID)
+{
+ _errorCode = "";
+ int nbDocs = _OCAFApp->NbDocuments();
+
+ if (nbDocs == 0) {
+ _errorCode = "No active study in this session";
+ return NULL;
+ }
+ else {
+ Handle(SALOMEDSImpl_Study) aStudy;
+ Handle(CDF_Session) S = CDF_Session::CurrentSession();
+ CDF_DirectoryIterator it (S->Directory());
+ for (; it.MoreDocument(); it.NextDocument()) {
+ Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
+ if (D == _clipboard) continue;
+ aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
+ if (aStudy.IsNull()) continue;
+ if (aStudy->StudyId() == aStudyID) return aStudy;
+ }
+ }
+
+ _errorCode = "Found no study with the given ID";
+ return NULL;
+}
+
+//=============================================================================
+/*! Function : _SaveProperties
+ * Purpose : save the study properties in HDF file
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy,
+ HDFgroup *hdf_group)
+{
+ _errorCode = "";
+
+ HDFdataset *hdf_dataset = 0;
+ hdf_size size[1];
+ hdf_int32 name_len;
+
+ // add modifications list (user and date of save)
+ Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = aStudy->GetProperties();
+ Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ int aLocked = aProp->IsLocked();
+ if (aLocked) aProp->SetLocked(Standard_False);
+
+ OSD_Process aProcess;
+ Quantity_Date aDate = aProcess.SystemDate();
+ aProp->SetModification(aProcess.UserName().ToCString(),
+ aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+
+ if (aLocked) aProp->SetLocked(Standard_True);
+
+ Handle(TColStd_HSequenceOfExtendedString) aNames;
+ Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+
+ aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
+
+ int aLength = 0, anIndex, i;
+ for(i=1; i<=aNames->Length(); i++)
+ aLength += aNames->Value(i).Length() + 1;
+
+ //string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, "zero" byte
+ char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+
+
+ sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u');
+
+ aLength = aNames->Length();
+ int a = 2;
+ for(anIndex = 1; anIndex <= aLength; anIndex++) {
+ sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
+ (int)(aMinutes->Value(anIndex)),
+ (int)(aHours->Value(anIndex)),
+ (int)(aDays->Value(anIndex)),
+ (int)(aMonths->Value(anIndex)),
+ (int)(aYears->Value(anIndex)),
+ TCollection_AsciiString(aNames->Value(anIndex)).ToCString());
+ a = strlen(aProperty);
+ aProperty[a++] = 1;
+ }
+ aProperty[a] = 0;
+
+ name_len = (hdf_int32) a;
+ size[0] = name_len + 1 ;
+ hdf_dataset = new HDFdataset("AttributeStudyProperties",hdf_group,HDF_STRING,size,1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk(aProperty);
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; //will be deleted by hdf_sco_group destructor
+ delete [] aProperty;
+
+ aProp->SetModified(0);
+ return true;
+}
+
+//=============================================================================
+/*! Function : _SaveAs
+ * Purpose : save the study in HDF file
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile,
+ bool theASCII)
+{
+ // HDF File will be composed of differents part :
+ // * For each ComponentDataType, all data created by the component
+ // Informations in data group hdf_group_datacomponent
+ // * Study Structure -> Exactly what is contained in OCAF document
+ // Informations in data group hdf_group_study_structure
+
+ _errorCode = "";
+
+ HDFfile *hdf_file=0;
+ HDFgroup *hdf_group_study_structure =0;
+ HDFgroup *hdf_sco_group =0;
+ HDFgroup *hdf_sco_group2 =0;
+
+ HDFgroup *hdf_group_datacomponent =0;
+ HDFdataset *hdf_dataset =0;
+ hdf_size size[1];
+ hdf_int32 name_len = 0;
+ char *component_name = 0;
+
+ int aLocked = aStudy->GetProperties()->IsLocked();
+ if (aLocked) aStudy->GetProperties()->SetLocked(false);
+
+ Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ map<char*, SALOMEDSImpl_Driver*> aMapTypeDriver;
+
+ if(aStudy.IsNull()) {
+ _errorCode = "Study is null";
+ return false;
+ }
+
+ try
+ {
+ // mpv 15.12.2003: for saving components we have to load all data from all modules
+ SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator();
+ for (; itcomponent1.More(); itcomponent1.Next())
+ {
+ Handle(SALOMEDSImpl_SComponent) sco = itcomponent1.Value();
+
+ // if there is an associated Engine call its method for saving
+ TCollection_AsciiString IOREngine;
+ try {
+ if (!sco->ComponentIOR(IOREngine)) {
+ TCollection_AsciiString aCompType = sco->GetComment();
+ if (!aCompType.IsEmpty()) {
+
+ SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType);
+ aMapTypeDriver[aCompType.ToCString()] = aDriver;
+
+ if (aDriver != NULL) {
+ if(!SB->LoadWith(sco, aDriver)) {
+ _errorCode = SB->GetErrorCode();
+ return false;
+ }
+ }
+ }
+ }
+ } catch(...) {
+ _errorCode = "Can not restore information to resave it";
+ return false;
+ }
+ }
+
+ TCollection_AsciiString anOldName = aStudy->Name();
+ aStudy->URL(aUrl);
+
+ // To change for Save
+ // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
+ hdf_file = new HDFfile(aUrl.ToCString());
+ hdf_file->CreateOnDisk();
+
+ //-----------------------------------------------------------------------
+ // 1 - Create a groupe for each SComponent and Update the PersistanceRef
+ //-----------------------------------------------------------------------
+ hdf_group_datacomponent = new HDFgroup("DATACOMPONENT",hdf_file);
+ hdf_group_datacomponent->CreateOnDisk();
+
+ SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator();
+
+ //SRN: Added 17 Nov, 2003
+ Handle(SALOMEDSImpl_SObject) anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG);
+ //SRN: End
+ for (; itcomponent.More(); itcomponent.Next())
+ {
+ Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
+
+ TCollection_AsciiString scoid = sco->GetID();
+ hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent);
+ hdf_sco_group->CreateOnDisk();
+
+ TCollection_AsciiString componentDataType = sco->ComponentDataType();
+
+ //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save
+ if(!anAutoSaveSO.IsNull() && SB->IsGUID(sco, AUTO_SAVE_GUID)) {
+
+ Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
+ if(anAutoSaveSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(), aTable)) {
+ Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0;
+ if(nbRows > 0 && aTable->GetNbColumns() > 1) {
+
+ Handle(TColStd_HSequenceOfExtendedString) aRow;
+ for(k=1; k<=nbRows; k++) {
+ aRow = aTable->GetRowData(k);
+ if (aRow->Value(1) == componentDataType) {
+ TCollection_AsciiString anEntry = TCollection_AsciiString(aRow->Value(2));
+ Handle(SALOMEDSImpl_SObject) aCompSpecificSO = aStudy->FindObjectID(anEntry);
+ if(!aCompSpecificSO.IsNull()) {
+ Handle(SALOMEDSImpl_AttributeInteger) anInteger;
+ if(aCompSpecificSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) {
+ anInteger->SetValue(-1);
+ while(anInteger->Value() < 0) {
+#ifndef WNT
+ sleep(2);
+#else
+ Sleep(2);
+#endif
+ if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS)
+ break;
+ }
+ } // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger"))
+ } // if(!CORBA::is_nil(aCompSpecificSO))
+ } // if (strcmp(aRow[0], componentDataType) == 0)
+ } // for
+
+ } // if(nbRows > 0 && aTable->GetNbColumns() > 1)
+
+ } // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString")
+
+ } // if(SB->IsGUID(AUTO_SAVE_GUID)
+
+ //SRN: End
+ TCollection_AsciiString IOREngine;
+ if (sco->ComponentIOR(IOREngine))
+ {
+ SALOMEDSImpl_Driver* Engine = NULL;
+ if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) {
+ // we have found the associated engine to write the data
+ Engine = aMapTypeDriver[componentDataType.ToCString()];
+ }
+ else {
+ Engine = aFactory->GetDriverByIOR(IOREngine);
+ }
+
+ if (Engine != NULL)
+ {
+ unsigned char* aStream;
+ long length;
+
+ if (theASCII) aStream = Engine->SaveASCII(sco,
+ SALOMEDSImpl_Tool::GetDirFromPath(aUrl),
+ length,
+ theMultiFile);
+ else aStream = Engine->Save(sco,
+ SALOMEDSImpl_Tool::GetDirFromPath(aUrl),
+ length,
+ theMultiFile);
+ HDFdataset *hdf_dataset;
+ hdf_size aHDFSize[1];
+ if(length > 0) { //The component saved some auxiliary files, then put them into HDF file
+
+ aHDFSize[0] = length;
+
+ HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk(aStream); //Save the stream in the HDF file
+ hdf_dataset->CloseOnDisk();
+ }
+
+ // store multifile state
+ aHDFSize[0] = 2;
+ hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void*)(theMultiFile?"M":"S")); // save: multi or single
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor
+ // store ASCII state
+ aHDFSize[0] = 2;
+ hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void*)(theASCII?"A":"B")); // save: ASCII or BINARY
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor
+ // Creation of the persistance reference attribute
+ Translate_IOR_to_persistentID (sco, Engine, theMultiFile, theASCII);
+
+ if(aStream != NULL) delete [] aStream;
+ }
+ }
+ hdf_sco_group->CloseOnDisk();
+ hdf_sco_group=0; // will be deleted by hdf_group_datacomponent destructor
+ }
+ hdf_group_datacomponent->CloseOnDisk();
+ hdf_group_datacomponent =0; // will be deleted by hdf_file destructor
+
+ //-----------------------------------------------------------------------
+ //3 - Write the Study Structure
+ //-----------------------------------------------------------------------
+ hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file);
+ hdf_group_study_structure->CreateOnDisk();
+ // save component attributes
+ SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator();
+ for (; itcomp.More(); itcomp.Next())
+ {
+ Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
+ TCollection_AsciiString scid = SC->GetID();
+ hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure);
+ hdf_sco_group2->CreateOnDisk();
+ SaveAttributes(SC, hdf_sco_group2);
+ // ComponentDataType treatment
+ component_name = SC->ComponentDataType().ToCString();
+ name_len = (hdf_int32)strlen(component_name);
+ size[0] = name_len +1 ;
+ hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk(component_name);
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; //will be deleted by hdf_sco_group destructor
+ Impl_SaveObject(SC, hdf_sco_group2);
+ hdf_sco_group2->CloseOnDisk();
+ hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor
+ }
+
+ //-----------------------------------------------------------------------
+ //4 - Write the Study UseCases Structure
+ //-----------------------------------------------------------------------
+ Handle(SALOMEDSImpl_SObject) aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
+ if (!aSO.IsNull()) {
+ HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure);
+ hdf_soo_group->CreateOnDisk();
+ SaveAttributes(aSO, hdf_soo_group);
+ Impl_SaveObject(aSO, hdf_soo_group);
+ hdf_soo_group->CloseOnDisk();
+ hdf_soo_group=0; // will be deleted by hdf_group_study_structure destructor
+ }
+
+ if (aLocked) aStudy->GetProperties()->SetLocked(true);
+ //-----------------------------------------------------------------------
+ //5 - Write the Study Properties
+ //-----------------------------------------------------------------------
+ name_len = (hdf_int32) aStudy->Name().Length();
+ size[0] = name_len +1 ;
+ hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1);
+ hdf_dataset->CreateOnDisk();
+ char* studid = aStudy->Name().ToCString();
+ hdf_dataset->WriteOnDisk(studid);
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor
+
+ Impl_SaveProperties(aStudy, hdf_group_study_structure);
+
+ hdf_group_study_structure->CloseOnDisk();
+ hdf_file->CloseOnDisk();
+
+ aStudy->IsSaved(true);
+ hdf_group_study_structure =0; // will be deleted by hdf_file destructor
+ delete hdf_file; // recursively deletes all hdf objects...
+ }
+ catch (HDFexception)
+ {
+ _errorCode = "HDFexception ! ";
+ return false;
+ }
+ if (theASCII) { // save file in ASCII format
+ HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true);
+ }
+
+ return true;
+}
+
+//============================================================================
+/*! Function : Impl_SaveObject
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC,
+ HDFgroup *hdf_group_datatype)
+{
+ _errorCode = "";
+
+ // Write in group hdf_group_datatype all informations of SObject SC
+ // Iterative function to parse all SObjects under a SComponent
+
+ HDFgroup *hdf_group_sobject = 0;
+
+ TDF_ChildIterator itchild(SC->GetLabel());
+ for (; itchild.More(); itchild.Next())
+ {
+
+ // mpv: don't save empty labels
+ TDF_AttributeIterator AI1(itchild.Value());
+ if (!AI1.More()) { //No attributes on the label
+ TDF_ChildIterator subchild(SC->GetLabel());
+ if (!subchild.More()) {
+ continue;
+ }
+ subchild.Initialize(SC->GetLabel(), true);
+ bool anEmpty = true;
+ for (; subchild.More() && anEmpty; subchild.Next()) {
+ TDF_AttributeIterator AI2(subchild.Value());
+ if (AI2.More()) anEmpty = false; //There are attributes on the child label
+ }
+ if (anEmpty) continue;
+ }
+
+ Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::SObject(itchild.Value());
+
+ char* scoid = (char*) SO->GetID().ToCString();
+ hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
+ hdf_group_sobject->CreateOnDisk();
+ SaveAttributes(SO, hdf_group_sobject);
+ Impl_SaveObject(SO, hdf_group_sobject);
+ hdf_group_sobject->CloseOnDisk();
+ hdf_group_sobject =0; // will be deleted by father hdf object destructor
+ }
+
+ return true;
+}
+
+//============================================================================
+/*! Function : Impl_SubstituteSlash
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TCollection_AsciiString& aUrl)
+{
+ _errorCode = "";
+
+ TCollection_ExtendedString theUrl(aUrl);
+ Standard_ExtCharacter val1 = ToExtCharacter('/');
+ Standard_ExtCharacter val2 = ToExtCharacter(':');
+ theUrl.ChangeAll(val1,val2);
+ return theUrl;
+}
+
+//============================================================================
+/*! Function : GetDocumentOfStudy
+ * Purpose :
+ */
+//============================================================================
+Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy)
+{
+ _errorCode = "";
+ return theStudy->_doc;
+}
+
+//============================================================================
+/*! Function : CanCopy
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject,
+ SALOMEDSImpl_Driver* theEngine)
+{
+ _errorCode = "";
+ Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
+ if (aComponent.IsNull()) return false;
+ if (aComponent->GetLabel() == theObject->GetLabel()) return false;
+ TCollection_AsciiString IOREngine;
+ if (!aComponent->ComponentIOR(IOREngine)) return false;
+ if (theEngine == NULL) return false;
+ return theEngine->CanCopy(theObject);
+}
+
+//============================================================================
+/*! Function : CopyLabel
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const Standard_Integer theSourceStartDepth,
+ const TDF_Label& theSource,
+ const TDF_Label& theDestinationMain)
+{
+ _errorCode = "";
+
+ int a;
+ TDF_Label aTargetLabel = theDestinationMain;
+ TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2);
+ for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) {
+ TDF_Label aSourceLabel = theSource;
+ for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
+ aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
+ aAuxTargetLabel = aAuxTargetLabel.FindChild(aSourceLabel.Tag());
+ }
+ // iterate attributes
+ TDF_AttributeIterator anAttrIterator(theSource);
+ Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
+ for(; anAttrIterator.More(); anAttrIterator.Next()) {
+ Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
+ if (!Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(anAttr).IsNull()) continue; // never copy tree node attribute
+ if (!Handle(SALOMEDSImpl_AttributeTarget)::DownCast(anAttr).IsNull()) continue; // and target attribute
+
+ if (!Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr).IsNull()) { // reference copied as Comment in aux tree
+ TDF_Label aReferenced = Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Get();
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(aReferenced, anEntry);
+ // store the value of name attribute of referenced label
+ Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
+ if (aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
+ anEntry += " ";
+ anEntry += aNameAttribute->Value();
+ }
+ SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry));
+ continue;
+ }
+
+ if (!Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theSource, anEntry);
+ Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
+ int anObjID;
+ long aLen;
+ unsigned char* aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
+ TCollection_ExtendedString aResStr("");
+ for(a = 0; a < aLen; a++) {
+ aResStr += TCollection_ExtendedString(ToExtCharacter((Standard_Character)aStream[a]));
+ }
+ if(aStream != NULL) delete [] aStream;
+ SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID);
+ SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr);
+ continue;
+ }
+ Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ aTargetLabel.AddAttribute(aNewAttribute);
+ anAttr->Paste(aNewAttribute, aRT);
+ }
+
+ return true;
+}
+
+//============================================================================
+/*! Function : Copy
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject,
+ SALOMEDSImpl_Driver* theEngine)
+{
+ _errorCode = "";
+
+ // adoptation for alliances datamodel copy: without IOR attributes !!!
+ bool aStructureOnly; // copy only SObjects and attributes without component help
+ aStructureOnly = !theObject->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
+
+ // get component-engine
+ Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+
+ // CAF document of current study usage
+ Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
+ if (aDocument.IsNull()) {
+ _errorCode = "OCAF document is null";
+ return false;
+ }
+
+ //Clear the clipboard
+ _clipboard->Main().Root().ForgetAllAttributes(Standard_True);
+ _OCAFApp->Close(_clipboard);
+ Handle(TDocStd_Document) aDoc;
+ _OCAFApp->NewDocument("SALOME_STUDY", aDoc);
+ _clipboard = aDoc;
+
+ // set component data type to the name attribute of root label
+ if (!aStructureOnly) {
+ SALOMEDSImpl_AttributeComment::Set(_clipboard->Main().Root(),
+ TCollection_ExtendedString(theEngine->ComponentDataType()));
+ }
+ // set to the Root label integer attribute: study id
+ SALOMEDSImpl_AttributeInteger::Set(_clipboard->Main().Root(), aStudy->StudyId());
+ // iterate all theObject's label children
+ TDF_Label aStartLabel = theObject->GetLabel();
+ Standard_Integer aSourceStartDepth = aStartLabel.Depth();
+
+ // copy main source label
+ CopyLabel(aStudy, theEngine, aSourceStartDepth, aStartLabel, _clipboard->Main());
+
+ // copy all subchildren of the main source label (all levels)
+ TDF_ChildIterator anIterator(aStartLabel, Standard_True);
+ for(; anIterator.More(); anIterator.Next()) {
+ CopyLabel(aStudy, theEngine, aSourceStartDepth, anIterator.Value(), _clipboard->Main());
+ }
+
+ return true;
+}
+//============================================================================
+/*! Function : CanPaste
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject,
+ SALOMEDSImpl_Driver* theEngine)
+{
+ _errorCode = "";
+
+ if (_clipboard.IsNull()) {
+ _errorCode = "Clipboard is null";
+ return false;
+ }
+
+ Handle(SALOMEDSImpl_AttributeComment) aCompName;
+ if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCompName)) {
+ _errorCode = "Clipboard has no component type";
+ return false;
+ }
+ Handle(SALOMEDSImpl_AttributeInteger) anObjID;
+ if (!_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID)) {
+ _errorCode = "Clipboard has no object id";
+ return false;
+ }
+ Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
+ if (aComponent.IsNull()) {
+ _errorCode = "Object doesn't belong to component";
+ return false;
+ }
+
+ TCollection_AsciiString IOREngine;
+ if (!aComponent->ComponentIOR(IOREngine)) {
+ _errorCode = "component has no IOR";
+ return false;
+ }
+ return theEngine->CanPaste(aCompName->Value(), anObjID->Value());
+}
+
+//============================================================================
+/*! Function : PasteLabel
+ * Purpose :
+ */
+//============================================================================
+TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const TDF_Label& theSource,
+ const TDF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement)
+{
+ _errorCode = "";
+
+ // get corresponding source, target and auxiliary labels
+ TDF_Label aTargetLabel = theDestinationStart;
+
+ TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2);
+ int a;
+ if (!isFirstElement) {
+ for(a = theSource.Depth() - 1; a > 0 ; a--) {
+ TDF_Label aSourceLabel = theSource;
+ for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
+ aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
+ aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag());
+ }
+ }
+
+ // check auxiliary label for TMPFile => IOR
+ Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
+ if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
+ Handle(SALOMEDSImpl_AttributeInteger) anObjID;
+
+ aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID);
+ Handle(SALOMEDSImpl_AttributeComment) aComponentName;
+ theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
+ TCollection_AsciiString aCompName = aComponentName->Value();
+
+ if (theEngine->CanPaste(aCompName, anObjID->Value())) {
+ TCollection_ExtendedString aTMPStr = aNameAttribute->Value();
+ int aLen = aTMPStr.Length();
+ unsigned char* aStream = NULL;
+ if(aLen > 0) {
+ aStream = new unsigned char[aLen+10];
+ for(a = 0; a < aLen; a++) {
+ aStream[a] = ToCharacter(aTMPStr.Value(a+1));
+ }
+ }
+
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(aTargetLabel, anEntry);
+ Handle(SALOMEDSImpl_SObject) aPastedSO = theDestinationStudy->FindObjectID(anEntry);
+
+ if (isFirstElement) {
+ TCollection_AsciiString aDestEntry = theEngine->PasteInto(aStream,
+ aLen,
+ anObjID->Value(),
+ aPastedSO->GetFatherComponent());
+ TDF_Tool::Label(theDestinationStart.Data(), aDestEntry, aTargetLabel);
+ } else
+ theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO);
+
+ if(aStream != NULL) delete []aStream;
+ }
+ }
+
+ // iterate attributes
+ TDF_AttributeIterator anAttrIterator(theSource);
+ Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
+ for(; anAttrIterator.More(); anAttrIterator.Next()) {
+ Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
+ if (aTargetLabel.FindAttribute(anAttr->ID(), anAttr)) {
+ aTargetLabel.ForgetAttribute(anAttr->ID());
+ anAttr = anAttrIterator.Value();
+ }
+ Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ aTargetLabel.AddAttribute(aNewAttribute);
+ anAttr->Paste(aNewAttribute, aRT);
+ }
+
+ // check auxiliary label for Comment => reference or name attribute of the referenced object
+ Handle(SALOMEDSImpl_AttributeComment) aCommentAttribute;
+ if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCommentAttribute)) {
+ char * anEntry = new char[aCommentAttribute->Value().Length() + 1];
+ strcpy(anEntry, TCollection_AsciiString(aCommentAttribute->Value()).ToCString());
+ char* aNameStart = strchr(anEntry, ' ');
+ if (aNameStart) {
+ *aNameStart = '\0';
+ aNameStart++;
+ }
+ if (theCopiedStudyID == theDestinationStudy->StudyId()) { // if copy to the same study, reanimate reference
+ TDF_Label aRefLabel;
+ TDF_Tool::Label(aTargetLabel.Data(), anEntry, aRefLabel);
+ SALOMEDSImpl_AttributeReference::Set(aTargetLabel, aRefLabel);
+ // target attributes structure support
+ SALOMEDSImpl_AttributeTarget::Set(aRefLabel)->Add(SALOMEDSImpl_Study::SObject(aTargetLabel));
+ } else {
+ if (aNameStart) SALOMEDSImpl_AttributeName::Set(aTargetLabel, aNameStart);
+ else SALOMEDSImpl_AttributeName::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry);
+ }
+ delete [] anEntry;
+ }
+
+ return aTargetLabel;
+}
+
+//============================================================================
+/*! Function : Paste
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOMEDSImpl_SObject)& theObject,
+ SALOMEDSImpl_Driver* theEngine)
+{
+ _errorCode = "";
+
+ Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+
+ // if study is locked, then paste can't be done
+ if (aStudy->GetProperties()->IsLocked()) {
+ _errorCode = "LockProtection";
+ throw LockProtection("LockProtection");
+ }
+
+ // if there is no component name, then paste only SObjects and attributes: without component help
+ Handle(SALOMEDSImpl_AttributeComment) aComponentName;
+ bool aStructureOnly = !_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
+
+ // get copied study ID
+ Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute;
+ if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) {
+ _errorCode = "No study ID was found";
+ return NULL;
+ }
+ int aCStudyID = aStudyIDAttribute->Value();
+
+ // CAF document of current study usage
+ Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
+ if (aDocument.IsNull()) {
+ _errorCode = "OCAF document is null";
+ return NULL;
+ }
+
+ Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
+
+ // fill root inserted SObject
+ TDF_Label aStartLabel;
+ if (aStructureOnly) {
+ TDF_Label anObjectLabel;
+ TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel);
+ aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false);
+ } else {
+ TDF_Label aComponentLabel;
+ TDF_Tool::Label(aDocument->GetData(), aComponent->GetID(), aComponentLabel);
+ aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), aComponentLabel, aCStudyID, true);
+ }
+
+ // paste all sublebels
+ TDF_ChildIterator anIterator(_clipboard->Main(), Standard_True);
+ for(; anIterator.More(); anIterator.Next()) {
+ PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false);
+ }
+
+ return SALOMEDSImpl_Study::SObject(aStartLabel);
+}
+
+//#######################################################################################################
+//# STATIC PRIVATE FUNCTIONS
+//#######################################################################################################
+
+//============================================================================
+/*! Function : SaveAttributes
+ * Purpose : Save attributes for object
+ */
+//============================================================================
+static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject)
+{
+ hdf_size size[1];
+ TDF_AttributeIterator Itr(aSO->GetLabel());
+ Handle(TDF_Attribute) anAttr;
+ for(; Itr.More(); Itr.Next()) {
+ anAttr = Itr.Value();
+ //The following attributes are not supposed to be written to the file
+ if(anAttr->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_AttributeIOR)) continue; //IOR attribute is not saved
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
+ TCollection_AsciiString aSaveStr = ga->Save();
+ //cout << "Saving: " << aSO->GetID() << " "<< ga->Type() << " value: " << aSaveStr << endl;
+ size[0] = (hdf_int32) strlen(aSaveStr.ToCString()) + 1;
+ HDFdataset *hdf_dataset = new HDFdataset((char*)ga->Type().ToCString(), hdf_group_sobject,HDF_STRING,size,1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((char*)aSaveStr.ToCString());
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset=0; //will be deleted by hdf_sco_group destructor
+ }
+}
+
+//===========================================================================
+//Function : ReadAttributes
+//===========================================================================
+static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy,
+ const Handle(SALOMEDSImpl_SObject)& aSO,
+ HDFdataset* hdf_dataset)
+{
+ hdf_dataset->OpenOnDisk();
+
+ Handle(TDF_Attribute) anAttr;
+
+ char* current_string = new char[hdf_dataset->GetSize()];
+ hdf_dataset->ReadFromDisk(current_string);
+
+ if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
+ anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
+ } else if (!strcmp(hdf_dataset->GetName(),"AttributeReference")) {
+ theStudy->NewBuilder()->Addreference(aSO, theStudy->CreateObjectID(current_string));
+ delete(current_string);
+ hdf_dataset->CloseOnDisk();
+ return;
+ } else {
+ anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
+ }
+
+ if (!anAttr.IsNull()) {
+
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
+ ga->Load(current_string);
+ //cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl;
+ }
+
+ delete(current_string);
+ hdf_dataset->CloseOnDisk();
+}
+
+//============================================================================
+//Function : BuildlTree
+//============================================================================
+static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf_current_group)
+{
+ hdf_current_group->OpenOnDisk();
+ Handle(SALOMEDSImpl_SObject) aSO;
+ char* Entry = hdf_current_group->GetName();
+ if (strcmp(Entry,"STUDY_STRUCTURE") == 0) {
+ aSO = theStudy->CreateObjectID("0:1");
+ }
+ else {
+ aSO = theStudy->CreateObjectID(Entry);
+ }
+
+ char name[HDF_NAME_MAX_LEN+1];
+ Standard_Integer nbsons = hdf_current_group->nInternalObjects();
+ for (Standard_Integer i=0; i<nbsons; i++) {
+ hdf_current_group->InternalObjectIndentify(i,name);
+ if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
+ hdf_object_type type = hdf_current_group->InternalObjectType(name);
+
+ if (type == HDF_DATASET) {
+ HDFdataset* new_dataset = new HDFdataset(name,hdf_current_group);
+ ReadAttributes(theStudy,aSO,new_dataset);
+ new_dataset = 0; // will be deleted by father destructor
+
+ }
+ else if (type == HDF_GROUP) {
+ HDFgroup* new_group = new HDFgroup(name,hdf_current_group);
+ BuildTree (theStudy, new_group);
+ new_group = 0; // will be deleted by father destructor
+ }
+ }
+ hdf_current_group->CloseOnDisk();
+}
+
+
+//============================================================================
+//Function : Translate_IOR_to_persistentID
+//============================================================================
+static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& so,
+ SALOMEDSImpl_Driver* engine,
+ bool isMultiFile,
+ bool isASCII)
+{
+ TDF_ChildIterator itchild(so->GetLabel());
+ TCollection_AsciiString ior_string, persistent_string, curid;
+
+ for (; itchild.More(); itchild.Next()) {
+ Handle(SALOMEDSImpl_SObject) current = SALOMEDSImpl_Study::SObject(itchild.Value());
+ Handle(SALOMEDSImpl_AttributeIOR) IOR;
+ if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) {
+ ior_string = IOR->Value();
+
+ persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII);
+ SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string);
+ }
+ Translate_IOR_to_persistentID (current, engine, isMultiFile, isASCII);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_StudyManager.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
+#define __SALOMEDSImpl_STUDYMANAGER_I_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
+
+// std C++ headers
+#include <strstream>
+
+// Cascade headers
+#include "SALOMEDSImpl_OCAFApplication.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Driver.hxx"
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TDocStd_Document.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+class HDFgroup;
+
+class SALOMEDSImpl_StudyManager : public MMgt_TShared
+{
+
+private:
+
+ Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp;
+ int _IDcounter;
+ Handle(TDocStd_Document) _clipboard;
+ TCollection_AsciiString _errorCode;
+
+public:
+
+ //! standard constructor
+ Standard_EXPORT SALOMEDSImpl_StudyManager();
+
+ //! standard destructor
+ Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
+
+ //! method to Create a New Study of name study_name
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name);
+
+ //! method to Open a Study from it's persistent reference
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl);
+
+ //! method to close a Study
+ Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy);
+
+ //! method to save a Study
+ Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
+
+ Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
+
+ //! method to save a Study to the persistent reference aUrl
+ Standard_EXPORT virtual bool SaveAs(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
+
+ Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
+
+ //! method to Get name list of open studies in the session
+ Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies();
+
+ //! method to get a Study from it's name
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ;
+
+ //! method to get a Study from it's ID
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ;
+
+
+ Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy);
+
+ Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; }
+
+ Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const int theSourceStartDepth,
+ const TDF_Label& theSource,
+ const TDF_Label& theDestinationMain);
+
+ Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const TDF_Label& theSource,
+ const TDF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement);
+
+ Standard_EXPORT virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+
+ // _SaveAs private function called by Save and SaveAs
+ Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl,
+ const Handle(SALOMEDSImpl_Study)& aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile,
+ bool theASCII);
+
+ // _SaveObject private function called by _SaveAs
+ Standard_EXPORT virtual bool Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype);
+
+ // _SubstituteSlash function called by Open and GetStudyByName
+ Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl);
+
+ Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group);
+
+ Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager )
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Tool.cxx
+// Created : Mon Oct 21 16:24:34 2002
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : SALOMEDSImpl
+// Copyright : Open CASCADE
+
+#include "SALOMEDSImpl_Tool.hxx"
+
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Process.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_SingleProtection.hxx>
+#include <OSD_FileIterator.hxx>
+
+#ifndef WNT
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#include <stdlib.h>
+
+using namespace std;
+
+
+//============================================================================
+// function : GetTempDir
+// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Tool::GetTmpDir()
+{
+ //Find a temporary directory to store a file
+
+ TCollection_AsciiString aTmpDir;
+
+ char *Tmp_dir = getenv("SALOME_TMP_DIR");
+ if(Tmp_dir != NULL) {
+ aTmpDir = TCollection_AsciiString(Tmp_dir);
+#ifdef WIN32
+ if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+#else
+ if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+#endif
+ }
+ else {
+#ifdef WIN32
+ aTmpDir = TCollection_AsciiString("C:\\");
+#else
+ aTmpDir = TCollection_AsciiString("/tmp/");
+#endif
+ }
+
+ srand((unsigned int)time(NULL));
+ int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
+ TCollection_AsciiString aSubDir(aRND);
+ if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+
+ aTmpDir += aSubDir; //Get RND sub directory
+
+#ifdef WIN32
+ if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+#else
+ if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+#endif
+
+ OSD_Path aPath(aTmpDir);
+ OSD_Directory aDir(aPath);
+
+ for(aRND = 0; aDir.Exists(); aRND++) {
+ aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
+ aPath = OSD_Path(aTmpDir);
+ aDir = OSD_Directory(aPath);
+ }
+
+ OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
+ aDir.Build(aProtection);
+
+ return aTmpDir;
+}
+
+//============================================================================
+// function : RemoveTemporaryFiles
+// purpose : Removes files listed in theFileList
+//============================================================================
+void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
+ const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+ const bool IsDirDeleted)
+{
+ TCollection_AsciiString aDirName = theDirectory;
+
+ int i, aLength = theFiles->Length();
+ for(i=1; i<=aLength; i++) {
+ TCollection_AsciiString aFile(aDirName);
+ aFile += theFiles->Value(i);
+ OSD_Path anOSDPath(aFile);
+ OSD_File anOSDFile(anOSDPath);
+ if(!anOSDFile.Exists()) continue;
+
+ OSD_Protection aProtection = anOSDFile.Protection();
+ aProtection.SetUser(OSD_RW);
+ anOSDFile.SetProtection(aProtection);
+
+ anOSDFile.Remove();
+ }
+
+ if(IsDirDeleted) {
+ OSD_Path aPath(aDirName);
+ OSD_Directory aDir(aPath);
+ OSD_FileIterator anIterator(aPath, '*');
+
+ if(aDir.Exists() && !anIterator.More()) aDir.Remove();
+ }
+
+}
+
+//============================================================================
+// function : GetNameFromPath
+// purpose : Returns the name by the path
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Tool::GetNameFromPath(const TCollection_AsciiString& thePath) {
+ if (thePath.IsEmpty()) return "";
+ OSD_Path aPath = OSD_Path(thePath);
+ TCollection_AsciiString aNameString(aPath.Name());
+ return aNameString;
+}
+
+//============================================================================
+// function : GetDirFromPath
+// purpose : Returns the dir by the path
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_Tool::GetDirFromPath(const TCollection_AsciiString& thePath) {
+ if (thePath.IsEmpty()) return "";
+ OSD_Path aPath = OSD_Path(thePath);
+ TCollection_AsciiString aDirString(aPath.Trek());
+ aDirString.ChangeAll('|','/');
+ return aDirString;
+}
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_Tool.hxx
+// Created : Mon Oct 21 16:24:50 2002
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : SALOMEDSImpl
+// Copyright : Open CASCADE
+
+
+#ifndef __SALOMEDSIMPL_TOOL_H__
+#define __SALOMEDSIMPL_TOOL_H__
+
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Label.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+class SALOMEDSImpl_Tool
+{
+
+public:
+
+ // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ static TCollection_AsciiString GetTmpDir();
+
+
+ // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
+ // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
+ static void RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
+ const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+ const bool IsDirDeleted);
+
+ // Returns the name by the path
+ // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
+ static TCollection_AsciiString GetNameFromPath(const TCollection_AsciiString& thePath);
+
+ // Returns the directory by the path
+ // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
+ static TCollection_AsciiString GetDirFromPath(const TCollection_AsciiString& thePath);
+
+};
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_UseCaseBuilder.cxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_Attributes.hxx"
+
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_AttributeList.hxx>
+#include <TDF_ListIteratorOfAttributeList.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_ChildIterator.hxx>
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
+
+
+#define USE_CASE_LABEL_TAG 2
+#define USE_CASE_GUID "AA43BB12-D9CD-11d6-945D-0050DA506788"
+
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument)
+:_doc(theDocument)
+{
+ if(_doc.IsNull()) return;
+
+ TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
+ if(!aLabel.FindAttribute(Standard_GUID(USE_CASE_GUID), _root)) {
+ _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, Standard_GUID(USE_CASE_GUID));
+ }
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
+ }
+
+ Handle(SALOMEDSImpl_AttributeName) aNameAttr;
+ if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttr)) {
+ aNameAttr = SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases");
+ }
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseBuilder::~SALOMEDSImpl_UseCaseBuilder()
+{
+}
+
+
+//============================================================================
+/*! Function : Append
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(_root.IsNull() || theObject.IsNull()) return false;
+
+ TDF_Label aLabel = theObject->GetLabel();
+ if(aLabel.IsNull()) return false;
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aCurrentNode;
+ aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
+ aNode->Remove();
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
+ }
+
+ TDF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode))
+ aCurrentNode = _root;
+
+ aCurrentNode->Append(aNode);
+
+ return true;
+}
+
+ //============================================================================
+/*! Function : Remove
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(_root.IsNull() || theObject.IsNull()) return false;
+
+ TDF_Label aLabel = theObject->GetLabel();
+ if(aLabel.IsNull()) return false;
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
+ if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+
+ aNode->Remove();
+
+ TDF_AttributeList aList;
+ aList.Append(aNode);
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
+ }
+ TDF_Label aCurrent = aRef->Get();
+
+ SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, Standard_True);
+ for(; aChildItr.More(); aChildItr.Next())
+ aList.Append(aChildItr.Value());
+
+ TDF_ListIteratorOfAttributeList anIterator(aList);
+ for(; anIterator.More(); anIterator.Next()) {
+ if(anIterator.Value()->Label() == aCurrent) { //The current node is removed
+ aRef->Set(_root->Label()); //Reset the current node to the root
+ }
+ anIterator.Value()->Label().ForgetAttribute(_root->ID());
+ }
+
+ return true;
+}
+
+
+//============================================================================
+/*! Function : AppendTo
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather,
+ const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false;
+
+ TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode;
+
+ if(aFatherLabel.IsNull()) return false;
+ if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return false;
+
+ if(aLabel.IsNull()) return false;
+ if(!aLabel.FindAttribute(_root->ID(), aNode)) {
+ aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
+ }
+
+ aNode->Remove();
+
+ return aFather->Append(aNode);
+}
+
+//============================================================================
+/*! Function : InsertBefore
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst,
+ const Handle(SALOMEDSImpl_SObject)& theNext)
+{
+ if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false;
+
+ TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode;
+
+ if(aFirstLabel.IsNull()) return false;
+ if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) {
+ aFirstNode->Remove();
+ aFirstLabel.ForgetAttribute(aFirstNode->ID());
+ }
+
+ aFirstNode = SALOMEDSImpl_AttributeTreeNode::Set(aFirstLabel, _root->ID());
+
+ if(aLabel.IsNull()) return false;
+ if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+
+ aFirstNode->Remove();
+
+ return aNode->InsertBefore(aFirstNode);
+}
+
+
+//============================================================================
+/*! Function : SetCurrentObject
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(_root.IsNull() || theObject.IsNull()) return false;
+
+ TDF_Label aLabel = theObject->GetLabel();
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
+ if(aLabel.IsNull()) return false;
+ if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), aNode->Label());
+ }
+
+ aRef->Set(aNode->Label());
+
+ return true;
+}
+
+//============================================================================
+/*! Function : SetRootCurrent
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent()
+{
+ if(_root.IsNull()) return false;
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef))
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
+
+ aRef->Set(_root->Label());
+ return true;
+}
+
+//============================================================================
+/*! Function : HasChildren
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(_root.IsNull()) return false;
+
+ TDF_Label aLabel;
+ if (theObject.IsNull()) aLabel = _root->Label();
+ else
+ aLabel = theObject->GetLabel();
+ if(aLabel.IsNull()) return false;
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
+ if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+
+ return !(aNode->GetFirst().IsNull());
+}
+
+//============================================================================
+/*! Function : SetName
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName) {
+ if(_root.IsNull()) return false;
+
+ Handle(SALOMEDSImpl_AttributeName) aNameAttrib;
+
+ if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttrib))
+ aNameAttrib = SALOMEDSImpl_AttributeName::Set(_root->Label(), theName);
+ else
+ aNameAttrib->SetValue(theName);
+
+ return true;
+}
+
+
+//============================================================================
+/*! Function : GetCurrentObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject()
+{
+ if(_root.IsNull()) return NULL;
+
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
+ }
+ TDF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull()) return NULL;
+
+ return SALOMEDSImpl_Study::SObject(aCurrent);
+}
+
+//============================================================================
+/*! Function : GetName
+ * Purpose :
+ */
+//============================================================================
+TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName()
+{
+ TCollection_AsciiString aString;
+ if(_root.IsNull()) return aString;
+
+ Handle(SALOMEDSImpl_AttributeName) aName;
+ if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString;
+ aString = TCollection_AsciiString(aName->Value());
+ return aString;
+}
+
+//============================================================================
+/*! Function : IsUseCase
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ if(theObject.IsNull()) return false;
+ TDF_Label aFather, aLabel = theObject->GetLabel();
+ aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
+ if(aLabel.Father() == aFather) return true;
+ return false;
+}
+
+//============================================================================
+/*! Function : NewUseCase
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TCollection_AsciiString& theName)
+{
+ Standard_GUID aBasicGUID(USE_CASE_GUID);
+
+ //Create a use cases structure if it not exists
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) aFatherNode, aNode;
+ Handle(SALOMEDSImpl_AttributeInteger) anInteger;
+ Handle(SALOMEDSImpl_AttributeReference) aRef;
+
+ TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
+
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ aRef = SALOMEDSImpl_AttributeReference::Set(aLabel, aLabel);
+ }
+
+ if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) {
+ aFatherNode = SALOMEDSImpl_AttributeTreeNode::Set(aRef->Get(), aBasicGUID);
+ }
+
+ if(!_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) {
+ anInteger = SALOMEDSImpl_AttributeInteger::Set(aLabel, 0);
+ }
+
+ //Create a new use case
+ anInteger->SetValue(anInteger->Value()+1);
+ TDF_Label aChild = aLabel.FindChild(anInteger->Value());
+ aNode = SALOMEDSImpl_AttributeTreeNode::Set(aChild, aBasicGUID);
+ aNode->Remove();
+ aFatherNode->Append(aNode);
+ SALOMEDSImpl_AttributeName::Set(aChild, theName);
+
+ return SALOMEDSImpl_Study::SObject(aChild);
+}
+
+//============================================================================
+/*! Function : GetUseCaseIterator
+ * Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated
+ */
+//============================================================================
+Handle(SALOMEDSImpl_UseCaseIterator)
+SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& theObject)
+{
+ TDF_Label aLabel;
+
+ if(!theObject.IsNull()) {
+ aLabel = theObject->GetLabel(); //Iterate only sub tree in the use case
+ }
+ else {
+ aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
+ }
+
+ return new SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false);
+}
+
+
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetSObject(const TCollection_AsciiString& theEntry)
+{
+ TDF_Label aLabel;
+ TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
+ return SALOMEDSImpl_Study::SObject(aLabel);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_UseCaseBuilder.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_USECaseBuilder_H__
+#define __SALOMEDSIMPL_USECaseBuilder_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
+
+// Cascade headers
+#include <SALOMEDSImpl_AttributeTreeNode.hxx>
+#include <TDocStd_Document.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Standard_GUID.hxx>
+
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+
+class SALOMEDSImpl_UseCaseBuilder : public MMgt_TShared
+{
+private:
+
+ Handle(SALOMEDSImpl_AttributeTreeNode) _root;
+ Handle(TDocStd_Document) _doc;
+
+public:
+
+ //! standard constructor
+ Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument);
+
+ //! standard destructor
+ Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder();
+
+ Standard_EXPORT virtual bool Append(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool Remove(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, const Handle(SALOMEDSImpl_SObject)& theNext);
+
+ Standard_EXPORT virtual bool SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool SetRootCurrent();
+
+ Standard_EXPORT virtual bool HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject);
+
+ Standard_EXPORT virtual bool SetName(const TCollection_AsciiString& theName);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetCurrentObject();
+
+ Standard_EXPORT virtual TCollection_AsciiString GetName();
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) AddUseCase(const TCollection_AsciiString& theName);
+
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseIterator) GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& anObject);
+
+ Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseBuilder )
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_UseCaseIterator.cxx
+// Author : Serge RUIN
+// Module : SALOME
+
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
+
+//============================================================================
+/*! Function : constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
+ const Standard_GUID& theGUID,
+ const bool allLevels)
+:_guid(theGUID), _levels(allLevels)
+{
+ if(theLabel.FindAttribute(_guid, _node)) {
+ _it.Initialize (_node, _levels);
+ }
+}
+
+//============================================================================
+/*! Function : destructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator::~SALOMEDSImpl_UseCaseIterator()
+{
+}
+
+//============================================================================
+/*! Function :Init
+ *
+ */
+//============================================================================
+void SALOMEDSImpl_UseCaseIterator::Init(bool allLevels)
+{
+ _it.Initialize (_node, allLevels);
+}
+
+//============================================================================
+/*! Function : More
+ *
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseIterator::More()
+{
+ return _it.More();
+}
+
+ //============================================================================
+/*! Function : Next
+ *
+ */
+//============================================================================
+void SALOMEDSImpl_UseCaseIterator::Next()
+{
+ _it.Next();
+}
+
+
+//============================================================================
+/*! Function :
+ * Purpose :
+ */
+//============================================================================
+
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value()
+{
+ TDF_Label L = _it.Value()->Label();
+ return SALOMEDSImpl_Study::SObject(L);
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDSImpl_UseCaseIterator.hxx
+// Author : Sergey RUIN
+// Module : SALOME
+
+#ifndef __SALOMEDSIMPL_USECASEITERATOR_H__
+#define __SALOMEDSIMPL_USECASEITERATOR_H__
+
+//Handle definition
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
+
+#include "SALOMEDSImpl_SObject.hxx"
+
+// Cascade headers
+#include <TDF_ChildIterator.hxx>
+#include <SALOMEDSImpl_ChildNodeIterator.hxx>
+#include <Standard_GUID.hxx>
+
+class SALOMEDSImpl_UseCaseIterator : public MMgt_TShared
+{
+
+private:
+ Standard_GUID _guid;
+ bool _levels;
+ Handle(SALOMEDSImpl_AttributeTreeNode) _node;
+ SALOMEDSImpl_ChildNodeIterator _it;
+
+public:
+
+ //! standard constructor
+ SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
+ const Standard_GUID& theGUID,
+ const bool allLevels);
+
+ //! standard destructor
+ ~SALOMEDSImpl_UseCaseIterator();
+
+ virtual void Init(bool);
+ virtual bool More();
+ virtual void Next();
+ virtual Handle(SALOMEDSImpl_SObject) Value();
+
+public:
+ DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseIterator )
+};
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+//File: testDS.cxx
+//Author: Sergey RUIN
+
+#include <stdio.h>
+#include <iostream>
+
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDocStd_Document.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_Tool.hxx>
+
+#include "SALOMEDSImpl_Attributes.hxx"
+#include "SALOMEDSImpl_StudyManager.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_SComponent.hxx"
+//#include "SALOMEDSImpl_.hxx"
+
+int main (int argc, char * argv[])
+{
+ cout << "Test started " << endl;
+
+ Handle(SALOMEDSImpl_StudyManager) aSM = new SALOMEDSImpl_StudyManager();
+ cout << "Manager is created " << endl;
+ Handle(SALOMEDSImpl_Study) aStudy = aSM->NewStudy("SRN");
+ cout << "Study with id = " << aStudy->StudyId() << " is created " << endl;
+ Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder();
+ cout << "StudyBuilder is created " << endl;
+ Handle(SALOMEDSImpl_SComponent) aSC = aBuilder->NewComponent("TEST");
+ cout << "New component with type " << aSC->ComponentDataType() << " is created " << endl;
+ Handle(SALOMEDSImpl_SObject) aSO = aBuilder->NewObject(aSC);
+ cout << "New SObject with ID = " << aSO->GetID() << " is created" << endl;
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(aSO->GetLabel(), anEntry);
+ cout << "An entry of newly created SO is " << anEntry << endl;
+ Handle(SALOMEDSImpl_AttributeIOR) aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO->GetLabel(), "ior1234");
+ cout << "New AttributeIOR is created, it contains " << aIORA->Value() << endl;
+ Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aIORA);
+ cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ cout << "Just another way to create an attribute: official one :) " << endl;
+ Handle(TDF_Attribute) aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
+ Handle(SALOMEDSImpl_AttributeName) aRN = Handle(SALOMEDSImpl_AttributeName)::DownCast(aTDFAttr);
+ aRN->SetValue("name_attribute");
+ cout << " The type = " << aRN->Type() << endl;
+ ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aRN);
+ cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ cout << "Check GetObjectPath: " << aStudy->GetObjectPath(aSO) << endl;
+
+ Handle(SALOMEDSImpl_SObject) aSubSO = aBuilder->NewObject(aSO);
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeIOR");
+ Handle(SALOMEDSImpl_AttributeIOR) aIOR2 = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(aTDFAttr);
+ aIOR2->SetValue("some ior");
+ aBuilder->Addreference(aSubSO, aSO);
+ Handle(SALOMEDSImpl_SObject) aRefObject;
+ aSubSO->ReferencedObject(aRefObject);
+ cout << "Check reference : ReferencedObject is " << aRefObject->GetID() << endl;
+ cout << "Check : Remove object: " << endl;
+ aBuilder->RemoveObject(aSubSO);
+ cout << "Remove: done" << endl;
+
+ cout << "Check the attributes on SObject" << endl;
+ Handle(TColStd_HSequenceOfTransient) aSeq = aSO->GetAllAttributes();
+ for(int i = 1; i <= aSeq->Length(); i++)
+ cout << "Found: " << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))->Type() << endl;
+
+ cout << "Check AttributeTreeNode " << endl;
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode");
+ cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+ cout << "Check AttributeTreeNode : done " << endl;
+
+ cout << "Test finished " << endl;
+ return 0;
+}
+
--- /dev/null
+// Copyright (C) 2004 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : FileTraceCollector.cxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+
+using namespace std;
+
+//#define _DEVDEBUG_
+#include "FileTraceCollector.hxx"
+
+// Class attributes initialisation, for class method FileTraceCollector::run
+
+std::string FileTraceCollector::_fileName = "";
+
+// ============================================================================
+/*!
+ * This class is for use without CORBA, inside or outside SALOME.
+ * SALOME uses SALOMETraceCollector, to allow trace collection via CORBA.
+ * Type of trace (and corresponding class) is choosen in LocalTraceBufferPool.
+ *
+ * Guarantees a unique object instance of the class (singleton thread safe)
+ * a separate thread for loop to print traces is launched.
+ */
+// ============================================================================
+
+BaseTraceCollector* FileTraceCollector::instance(const char *fileName)
+{
+ if (_singleton == 0) // no need of lock when singleton already exists
+ {
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton == 0) // another thread may have got
+ { // the lock after the first test
+ DEVTRACE("FileTraceCollector:: instance()");
+ BaseTraceCollector* myInstance = new FileTraceCollector();
+ _fileName = fileName;
+ DEVTRACE(" _fileName: " << _fileName);
+
+ sem_init(&_sem,0,0); // to wait until run thread is initialized
+ pthread_t traceThread;
+ int bid;
+ int re2 = pthread_create(&traceThread, NULL,
+ FileTraceCollector::run, (void *)bid);
+ sem_wait(&_sem);
+ _singleton = myInstance; // _singleton known only when init done
+ DEVTRACE("FileTraceCollector:: instance()-end");
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ }
+ return _singleton;
+}
+
+// ============================================================================
+/*!
+ * In a separate thread, loop to print traces.
+ * Mutex garantees intialisation on instance method is done and only one run
+ * allowed (double check ...)
+ * Loop until there is no more buffer to print,
+ * and no ask for end from destructor.
+ * Get a buffer. If type = ABORT then exit application with message.
+ */
+// ============================================================================
+
+void* FileTraceCollector::run(void *bid)
+{
+ //DEVTRACE("init run");
+ _threadId = new pthread_t;
+ *_threadId = pthread_self();
+ sem_post(&_sem); // unlock instance
+
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ LocalTrace_TraceInfo myTrace;
+
+ // --- opens a file with append mode
+ // so, several processes can share the same file
+
+ ofstream traceFile;
+ const char *theFileName = _fileName.c_str();
+ DEVTRACE("try to open trace file "<< theFileName);
+ traceFile.open(theFileName, ios::out | ios::app);
+ if (!traceFile)
+ {
+ cerr << "impossible to open trace file "<< theFileName << endl;
+ exit (1);
+ }
+
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
+ DEVTRACE("Begin loop");
+ while ((!_threadToClose) || myTraceBuffer->toCollect() )
+ {
+ if (_threadToClose)
+ {
+ DEVTRACE("FileTraceCollector _threadToClose");
+ //break;
+ }
+
+ int fullBuf = myTraceBuffer->retrieve(myTrace);
+ if (myTrace.traceType == ABORT_MESS)
+ {
+#ifndef WNT
+ traceFile << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
+#else
+ traceFile << "INTERRUPTION from thread "
+ << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ traceFile.close();
+ cout << flush ;
+#ifndef WNT
+ cerr << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
+#else
+ cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ cerr << flush ;
+ exit(1);
+ }
+ else
+ {
+#ifndef WNT
+ traceFile << "th. " << myTrace.threadId
+ << " " << myTrace.trace;
+#else
+ traceFile << "th. " << (void*)(&myTrace.threadId)
+ << " " << myTrace.trace;
+#endif
+ }
+ }
+ DEVTRACE("traceFile.close()");
+ traceFile.close();
+ DEVTRACE("traceFile.close()_end");
+ pthread_exit(NULL);
+}
+
+// ============================================================================
+/*!
+ * Destructor: wait until printing thread ends (FileTraceCollector::run)
+ */
+// ============================================================================
+
+FileTraceCollector:: ~FileTraceCollector()
+{
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton)
+ {
+ DEVTRACE("FileTraceCollector:: ~FileTraceCollector()");
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ _threadToClose = 1;
+ myTraceBuffer->insert(NORMAL_MESS,"end of trace\n"); // to wake up thread
+ if (_threadId)
+ {
+ int ret = pthread_join(*_threadId, NULL);
+ if (ret) cerr << "error close FileTraceCollector : "<< ret << endl;
+ else DEVTRACE("FileTraceCollector destruction OK");
+ _threadId = 0;
+ _threadToClose = 0;
+ }
+ _singleton = 0;
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+}
+
+// ============================================================================
+/*!
+ * Constructor: no need of LocalTraceBufferPool object initialization here,
+ * thread safe singleton used in LocalTraceBufferPool::instance()
+ */
+// ============================================================================
+
+FileTraceCollector::FileTraceCollector()
+{
+ _threadId=0;
+ _threadToClose = 0;
+}
+
+
--- /dev/null
+// Copyright (C) 2004 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+//
+// Cf. C++ Users Journal, June 2004, Tracing Application Execution, Tomer Abramson
+//
+
+#include <iostream>
+#include <limits.h>
+#include <cassert>
+
+#ifndef WNT
+#include <dlfcn.h>
+#else
+#endif
+
+//#define _DEVDEBUG_
+#include "LocalTraceBufferPool.hxx"
+#include "BaseTraceCollector.hxx"
+#include "LocalTraceCollector.hxx"
+#include "FileTraceCollector.hxx"
+#include "BasicsGenericDestructor.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+// In case of truncated message, end of trace contains "...\n\0"
+
+#define TRUNCATED_MESSAGE "...\n"
+#define MAXMESS_LENGTH MAX_TRACE_LENGTH-5
+
+// Class static attributes initialisation
+
+LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0;
+#ifndef WNT
+pthread_mutex_t LocalTraceBufferPool::_singletonMutex;
+#else
+pthread_mutex_t LocalTraceBufferPool::_singletonMutex =
+ PTHREAD_MUTEX_INITIALIZER;
+#endif
+BaseTraceCollector *LocalTraceBufferPool::_myThreadTrace = 0;
+
+// ============================================================================
+/*!
+ * Guarantees a unique object instance of the class (singleton thread safe).
+ * When the LocalTraceBufferPool instance is created, the trace collector is
+ * also created (singleton). Type of trace collector to create depends on
+ * environment variable "SALOME_trace":
+ * - "local" implies standard err trace, LocalTraceCollector is launched.
+ * - "file" implies trace in /tmp/tracetest.log
+ * - "file:pathname" implies trace in file pathname
+ * - anything else like "other" : try to load dynamically a library named
+ * otherTraceCollector, and invoque C method instance() to start a singleton
+ * instance of the trace collector. Example: with_loggerTraceCollector, for
+ * CORBA Log.
+ */
+// ============================================================================
+
+LocalTraceBufferPool* LocalTraceBufferPool::instance()
+{
+ if (_singleton == 0) // no need of lock when singleton already exists
+ {
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton == 0) // another thread may have got
+ { // the lock after the first test
+ DEVTRACE("New buffer pool");
+ LocalTraceBufferPool* myInstance = new LocalTraceBufferPool();
+
+ DESTRUCTOR_OF<LocalTraceBufferPool> *ptrDestroy =
+ new DESTRUCTOR_OF<LocalTraceBufferPool> (*myInstance);
+ _singleton = myInstance;
+
+ // --- start a trace Collector
+
+ char* traceKind = getenv("SALOME_trace");
+ assert(traceKind);
+ //cerr<<"SALOME_trace="<<traceKind<<endl;
+
+ if (strcmp(traceKind,"local")==0)
+ {
+ _myThreadTrace = LocalTraceCollector::instance();
+ }
+ else if (strncmp(traceKind,"file",strlen("file"))==0)
+ {
+ char *fileName;
+ if (strlen(traceKind) > strlen("file"))
+ fileName = &traceKind[strlen("file")+1];
+ else
+ fileName = "/tmp/tracetest.log";
+
+ _myThreadTrace = FileTraceCollector::instance(fileName);
+ }
+ else // --- try a dynamic library
+ {
+ void* handle;
+#ifndef WNT
+ string impl_name = string ("lib") + traceKind
+ + string("TraceCollector.so");
+ handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+#else
+ string impl_name = string ("lib") + traceKind + string(".dll");
+ handle = dlopen( impl_name.c_str() , 0 ) ;
+#endif
+ if ( handle )
+ {
+ typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void);
+ FACTORY_FUNCTION TraceCollectorFactory =
+ (FACTORY_FUNCTION) dlsym(handle, "SingletonInstance");
+ char *error ;
+ if ( (error = dlerror() ) != NULL)
+ {
+ cerr << "Can't resolve symbol: SingletonInstance" <<endl;
+ cerr << "dlerror: " << error << endl;
+ assert(error == NULL); // to give file and line
+ exit(1); // in case assert is deactivated
+ }
+ _myThreadTrace = (TraceCollectorFactory) ();
+ }
+ else
+ {
+ cerr << "library: " << impl_name << " not found !" << endl;
+ assert(handle); // to give file and line
+ exit(1); // in case assert is deactivated
+ }
+ }
+ DEVTRACE("New buffer pool: end");
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ }
+ return _singleton;
+}
+
+// ============================================================================
+/*!
+ * Called by trace producers within their threads. The trace message is copied
+ * in specific buffer from a circular pool of buffers.
+ * Waits until there is a free buffer in the pool, gets the first available
+ * buffer, fills it with the message.
+ * Messages are printed in a separate thread (see retrieve method)
+ */
+// ============================================================================
+
+int LocalTraceBufferPool::insert(int traceType, const char* msg)
+{
+
+ // get immediately a message number to control sequence (mutex protected)
+
+ unsigned long myMessageNumber = lockedIncrement(_position);
+
+ // wait until there is a free buffer in the pool
+
+ int ret = -1;
+ while (ret)
+ {
+ ret = sem_wait(&_freeBufferSemaphore);
+ if (ret) perror(" LocalTraceBufferPool::insert, sem_wait");
+ }
+
+ // get the next free buffer available (mutex protected)
+
+ unsigned long myInsertPos = lockedIncrement(_insertPos);
+
+ // fill the buffer with message, thread id and type (normal or abort)
+
+ strncpy(_myBuffer[myInsertPos%TRACE_BUFFER_SIZE].trace,
+ msg,
+ MAXMESS_LENGTH); // last chars always "...\n\0" if msg too long
+ _myBuffer[myInsertPos%TRACE_BUFFER_SIZE].threadId =pthread_self();//thread id
+ _myBuffer[myInsertPos%TRACE_BUFFER_SIZE].traceType = traceType;
+ _myBuffer[myInsertPos%TRACE_BUFFER_SIZE].position = myMessageNumber;
+
+
+ // increment the full buffer semaphore
+ // (if previously 0, awake thread in charge of trace)
+
+ ret = sem_post(&_fullBufferSemaphore);
+
+ // returns the number of free buffers
+
+ sem_getvalue(&_freeBufferSemaphore, &ret);
+ return ret;
+}
+
+// ============================================================================
+/*!
+ * Called by the thread in charge of printing trace messages.
+ * Waits until there is a buffer with a message to print.
+ * Gets the first buffer to print, copies it int the provided buffer
+ */
+// ============================================================================
+
+int LocalTraceBufferPool::retrieve(LocalTrace_TraceInfo& aTrace)
+{
+
+ // wait until there is a buffer in the pool, with a message to print
+
+ int ret = -1;
+ while (ret)
+ {
+ ret = sem_wait(&_fullBufferSemaphore);
+ if (ret) perror(" LocalTraceBufferPool::retrieve, sem_wait");
+ }
+
+ // get the next buffer to print
+
+ unsigned long myRetrievePos = lockedIncrement(_retrievePos);
+
+ // copy the buffer from the pool to the provided buffer
+
+ memcpy((void*)&aTrace,
+ (void*)&_myBuffer[myRetrievePos%TRACE_BUFFER_SIZE],
+ sizeof(aTrace));
+
+ // increment the free buffer semaphore
+ // (if previously 0, awake one of the threads waiting to put a trace, if any)
+ // there is no way to preserve the order of waiting threads if several
+ // threads are waiting to put a trace: the waken up thread is not
+ // necessarily the first thread to wait.
+
+ ret = sem_post(&_freeBufferSemaphore);
+
+ // returns the number of full buffers
+
+ sem_getvalue(&_fullBufferSemaphore, &ret);
+ return ret;
+}
+
+// ============================================================================
+/*!
+ * Gives the number of buffers to print.
+ * Usage : when the thread in charge of messages print id to be stopped,
+ * check if there is still something to print, before stop.
+ * There is no need of mutex here, provided there is only one thread to
+ * retrieve and print the buffers.
+ */
+// ============================================================================
+
+unsigned long LocalTraceBufferPool::toCollect()
+{
+ return _insertPos - _retrievePos;
+}
+
+// ============================================================================
+/*!
+ * Constructor : initialize pool of buffers, semaphores and mutex.
+ */
+// ============================================================================
+
+LocalTraceBufferPool::LocalTraceBufferPool()
+{
+ //cerr << "LocalTraceBufferPool::LocalTraceBufferPool()" << endl;
+
+ _insertPos = ULONG_MAX; // first increment will give 0
+ _retrievePos = ULONG_MAX;
+ _position=0; // first message will have number = 1
+
+ memset(_myBuffer, 0, sizeof(_myBuffer)); // to guarantee end of strings = 0
+ for (int i=0; i<TRACE_BUFFER_SIZE; i++)
+ strcpy(&(_myBuffer[i].trace[MAXMESS_LENGTH]),TRUNCATED_MESSAGE);
+ int ret;
+ ret=sem_init(&_freeBufferSemaphore, 0, TRACE_BUFFER_SIZE); // all buffer free
+ if (ret!=0) IMMEDIATE_ABORT(ret);
+ ret=sem_init(&_fullBufferSemaphore, 0, 0); // 0 buffer full
+ if (ret!=0) IMMEDIATE_ABORT(ret);
+ ret=pthread_mutex_init(&_incrementMutex,NULL); // default = fast mutex
+ if (ret!=0) IMMEDIATE_ABORT(ret);
+
+ //cerr << "LocalTraceBufferPool::LocalTraceBufferPool()-end" << endl;
+}
+
+// ============================================================================
+/*!
+ * Destructor : release memory associated with semaphores and mutex
+ */
+// ============================================================================
+
+LocalTraceBufferPool::~LocalTraceBufferPool()
+{
+ int ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton)
+ {
+ DEVTRACE("LocalTraceBufferPool::~LocalTraceBufferPool()");
+ delete (_myThreadTrace);
+ _myThreadTrace = 0;
+ int ret;
+ ret=sem_destroy(&_freeBufferSemaphore);
+ ret=sem_destroy(&_fullBufferSemaphore);
+ ret=pthread_mutex_destroy(&_incrementMutex);
+ DEVTRACE("LocalTraceBufferPool::~LocalTraceBufferPool()-end");
+ _singleton = 0;
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+}
+
+// ============================================================================
+/*!
+ * pool counters are incremented under a mutex protection
+ */
+// ============================================================================
+
+unsigned long LocalTraceBufferPool::lockedIncrement(unsigned long& pos)
+{
+ int ret;
+ ret = pthread_mutex_lock(&_incrementMutex); // lock access to counters
+ unsigned long mypos = ++pos;
+ ret = pthread_mutex_unlock(&_incrementMutex); // release lock
+ return mypos;
+}
+
--- /dev/null
+// Copyright (C) 2004 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : LocalTraceCollector.cxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+
+using namespace std;
+
+#include "LocalTraceCollector.hxx"
+
+// ============================================================================
+/*!
+ * This class is for use without CORBA, inside or outside SALOME.
+ * SALOME uses SALOMETraceCollector, to allow trace collection via CORBA.
+ * Type of trace (and corresponding class) is choosen in LocalTraceBufferPool.
+ *
+ * Guarantees a unique object instance of the class (singleton thread safe)
+ * a separate thread for loop to print traces is launched.
+ */
+// ============================================================================
+
+BaseTraceCollector* LocalTraceCollector::instance()
+{
+ if (_singleton == 0) // no need of lock when singleton already exists
+ {
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton == 0) // another thread may have got
+ { // the lock after the first test
+ BaseTraceCollector* myInstance = new LocalTraceCollector();
+
+ sem_init(&_sem,0,0); // to wait until run thread is initialized
+ pthread_t traceThread;
+ int bid;
+ int re2 = pthread_create(&traceThread, NULL,
+ LocalTraceCollector::run, (void *)bid);
+ sem_wait(&_sem);
+ _singleton = myInstance; // _singleton known only when init done
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ }
+ return _singleton;
+}
+
+// ============================================================================
+/*!
+ * In a separate thread, loop to print traces.
+ * Mutex garantees intialisation on instance method is done and only one run
+ * allowed (double check ...)
+ * Loop until there is no more buffer to print,
+ * and no ask for end from destructor.
+ * Get a buffer. If type = ABORT then exit application with message.
+ */
+// ============================================================================
+
+void* LocalTraceCollector::run(void *bid)
+{
+ _threadId = new pthread_t;
+ *_threadId = pthread_self();
+ sem_post(&_sem); // unlock instance
+
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ LocalTrace_TraceInfo myTrace;
+
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
+
+ while ((!_threadToClose) || myTraceBuffer->toCollect() )
+ {
+ if (_threadToClose)
+ {
+ DEVTRACE("FileTraceCollector _threadToClose");
+ //break;
+ }
+
+ int fullBuf = myTraceBuffer->retrieve(myTrace);
+ if (myTrace.traceType == ABORT_MESS)
+ {
+ cout << flush ;
+#ifndef WNT
+ cerr << "INTERRUPTION from thread " << myTrace.threadId
+ << " : " << myTrace.trace;
+#else
+ cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ cerr << flush ;
+ exit(1);
+ }
+ else
+ {
+ cout << flush ;
+#ifndef WNT
+ cerr << "th. " << myTrace.threadId << " " << myTrace.trace;
+#else
+ cerr << "th. " << (void*)(&myTrace.threadId)
+ << " " << myTrace.trace;
+#endif
+ cerr << flush ;
+ }
+ }
+ pthread_exit(NULL);
+ return NULL;
+}
+
+// ============================================================================
+/*!
+ * Destructor: wait until printing thread ends (LocalTraceCollector::run)
+ */
+// ============================================================================
+
+LocalTraceCollector:: ~LocalTraceCollector()
+{
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton)
+ {
+ DEVTRACE("LocalTraceCollector:: ~LocalTraceCollector()");
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ _threadToClose = 1;
+ myTraceBuffer->insert(NORMAL_MESS,"end of trace\n"); // to wake up thread
+ if (_threadId)
+ {
+ int ret = pthread_join(*_threadId, NULL);
+ if (ret) cerr << "error close LocalTraceCollector : "<< ret << endl;
+ else DEVTRACE("LocalTraceCollector destruction OK");
+ _threadId = 0;
+ _threadToClose = 0;
+ }
+ _singleton = 0;
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+}
+
+// ============================================================================
+/*!
+ * Constructor: no need of LocalTraceBufferPool object initialization here,
+ * thread safe singleton used in LocalTraceBufferPool::instance()
+ */
+// ============================================================================
+
+LocalTraceCollector::LocalTraceCollector()
+{
+ _threadId=0;
+ _threadToClose = 0;
+}
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include "SALOMELocalTraceTest.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include "LocalTraceBufferPool.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+
+void
+SALOMELocalTraceTest::setUp()
+{
+}
+
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+
+void
+SALOMELocalTraceTest::tearDown()
+{
+}
+
+#define TRACEFILE "/tmp/traceUnitTest.log"
+
+// ============================================================================
+/*!
+ * Open and close a trace on a file, test singleton
+ */
+// ============================================================================
+
+void
+SALOMELocalTraceTest::testSingletonBufferPool()
+{
+ // --- trace on file
+ char *theFileName = TRACEFILE;
+
+ string s = "file:";
+ s += theFileName;
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ ofstream traceFile;
+ traceFile.open(theFileName, ios::out | ios::app);
+ CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+ traceFile.close();
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ LocalTraceBufferPool* bp2 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1 == bp2);
+ bp1->deleteInstance(bp1);
+}
+
+
+
+#define NUM_THREADS 2
+#define NUM_MESSAGES 5
+void *PrintHello(void *threadid);
+
+// ============================================================================
+/*!
+ * open a trace on console, multithread writing on file, close
+ */
+// ============================================================================
+
+void
+SALOMELocalTraceTest::testLoadBufferPoolLocal()
+{
+ string s = "local";
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ // --- numThread thread creation for trace generation.
+ int numThread = 2;
+ pthread_t threads[numThread];
+ int rc, t;
+ for(t=0;t<numThread;t++)
+ {
+ MESSAGE("Creating thread " << t);
+ rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t) ;
+ CPPUNIT_ASSERT( !rc);
+ }
+
+ // --- wait for end of each thread producing trace.
+
+ for(t=0;t<numThread;t++)
+ {
+ int ret = pthread_join(threads[t], NULL);
+ MESSAGE("--------------------- end of PrintHello thread " << t);
+ }
+ MESSAGE(" ---- end of PrintHello threads ---- ");
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+// ============================================================================
+/*!
+ * open a trace on a file, multithread writing on file, close
+ */
+// ============================================================================
+
+void
+SALOMELocalTraceTest::testLoadBufferPoolFile()
+{
+ char *theFileName = TRACEFILE;
+
+ string s = "file:";
+ s += theFileName;
+ //s = "local";
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ ofstream traceFile;
+ traceFile.open(theFileName, ios::out | ios::trunc);
+ CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+ traceFile.close();
+
+ // --- NUM_THREADS thread creation for trace generation.
+
+ pthread_t threads[NUM_THREADS];
+ int rc, t;
+ for(t=0;t<NUM_THREADS;t++)
+ {
+ MESSAGE("Creating thread " << t);
+ rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t) ;
+ CPPUNIT_ASSERT( !rc);
+ }
+
+ // --- wait for end of each thread producing trace.
+
+ for(t=0;t<NUM_THREADS;t++)
+ {
+ int ret = pthread_join(threads[t], NULL);
+ MESSAGE("--------------------- end of PrintHello thread " << t);
+ }
+ MESSAGE(" ---- end of PrintHello threads ---- ");
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+// ============================================================================
+/*!
+ * NUM_THREAD are created with function PrintHello,
+ * which produces NUM_MESSAGES traces.
+ */
+// ============================================================================
+
+void *PrintHello(void *threadid)
+{
+ int id_thread = (int)threadid;
+ for (int i=0; i<NUM_MESSAGES;i++)
+ MESSAGE("Hello World! This is a trace test : " << id_thread
+ << " - iter " << i);
+ pthread_exit(NULL);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _SALOMELOCALTRACETEST_HXX_
+#define _SALOMELOCALTRACETEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class SALOMELocalTraceTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( SALOMELocalTraceTest );
+ CPPUNIT_TEST( testSingletonBufferPool );
+ CPPUNIT_TEST( testLoadBufferPoolLocal );
+ CPPUNIT_TEST( testLoadBufferPoolFile );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void setUp();
+ void tearDown();
+
+ void testSingletonBufferPool();
+ void testLoadBufferPoolLocal();
+ void testLoadBufferPoolFile();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+// Copyright (C) 2004 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : LocalTraceCollector.cxx
+// Author : Paul RASCLE (EDF)
+// Module : KERNEL
+// $Header$
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+#include <CORBA.h>
+
+using namespace std;
+
+#include "SALOMETraceCollector.hxx"
+#include "TraceCollector_WaitForServerReadiness.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(Logger)
+
+// Class attributes initialisation, for class method SALOMETraceCollector::run
+
+CORBA::ORB_ptr SALOMETraceCollector::_orb = 0;
+
+// ============================================================================
+/*!
+ * This class is for use with CORBA, inside SALOME.
+ * Type of trace (and corresponding class) is choosen in LocalTraceBufferPool.
+ *
+ * Guarantees a unique object instance of the class (singleton thread safe)
+ * a separate thread for loop to print traces is launched.
+ */
+// ============================================================================
+
+BaseTraceCollector* SALOMETraceCollector::instance()
+{
+ if (_singleton == 0) // no need of lock when singleton already exists
+ {
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton == 0) // another thread may have got
+ { // the lock after the first test
+ BaseTraceCollector* myInstance = new SALOMETraceCollector();
+ int argc=0;
+ char *_argv=0;
+ char ** argv = &_argv;
+ _orb = CORBA::ORB_init (argc, argv);
+
+ sem_init(&_sem,0,0); // to wait until run thread is initialized
+ pthread_t traceThread;
+ int bid;
+ int re2 = pthread_create(&traceThread, NULL,
+ SALOMETraceCollector::run, (void *)bid);
+ sem_wait(&_sem);
+ _singleton = myInstance; // _singleton known only when init done
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+ }
+ return _singleton;
+}
+
+// ============================================================================
+/*!
+ * In a separate thread, loop to print traces.
+ * Mutex garantees intialisation on instance method is done and only one run
+ * allowed (double check ...)
+ * Loop until there is no more buffer to print,
+ * and no ask for end from destructor.
+ * Get a buffer. If type = ABORT then exit application with message.
+ */
+// ============================================================================
+
+void* SALOMETraceCollector::run(void *bid)
+{
+ _threadId = new pthread_t;
+ *_threadId = pthread_self();
+ sem_post(&_sem); // unlock instance
+
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ LocalTrace_TraceInfo myTrace;
+
+ SALOME_Logger::Logger_var m_pInterfaceLogger;
+ CORBA::Object_var obj;
+
+ obj = TraceCollector_WaitForServerReadiness(_orb,"Logger");
+ if (!CORBA::is_nil(obj))
+ m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
+ if (CORBA::is_nil(m_pInterfaceLogger))
+ {
+ cerr << "Logger server not found ! Abort" << endl;
+ cerr << flush ;
+ exit(1);
+ }
+ else
+ {
+ CORBA::String_var LogMsg =
+ CORBA::string_dup("\n---Init logger trace---\n");
+ m_pInterfaceLogger->putMessage(LogMsg);
+ DEVTRACE("Logger server found");
+ }
+
+ // --- Loop until there is no more buffer to print,
+ // and no ask for end from destructor.
+
+ while ((!_threadToClose) || myTraceBuffer->toCollect() )
+ {
+ if (_threadToClose)
+ {
+ DEVTRACE("SALOMETraceCollector _threadToClose");
+ //break;
+ }
+
+ int fullBuf = myTraceBuffer->retrieve(myTrace);
+ if (!CORBA::is_nil(_orb))
+ {
+ if (myTrace.traceType == ABORT_MESS)
+ {
+ stringstream abortMessage("");
+#ifndef WNT
+ abortMessage << "INTERRUPTION from thread "
+ << myTrace.threadId << " : " << myTrace.trace;
+#else
+ abortMessage << "INTERRUPTION from thread "
+ << (void*)&myTrace.threadId
+ << " : " << myTrace.trace;
+#endif
+ CORBA::String_var LogMsg =
+ CORBA::string_dup(abortMessage.str().c_str());
+ m_pInterfaceLogger->putMessage(LogMsg);
+ exit(1);
+ }
+ else
+ {
+ stringstream aMessage("");
+#ifndef WNT
+ aMessage << "th. " << myTrace.threadId
+#else
+ aMessage << "th. " << (void*)&myTrace.threadId
+#endif
+ << " " << myTrace.trace;
+ CORBA::String_var LogMsg =
+ CORBA::string_dup(aMessage.str().c_str());
+ m_pInterfaceLogger->putMessage(LogMsg);
+ }
+ }
+ }
+ pthread_exit(NULL);
+ return NULL;
+}
+
+// ============================================================================
+/*!
+ * Destructor: wait until printing thread ends (SALOMETraceCollector::run)
+ */
+// ============================================================================
+
+SALOMETraceCollector:: ~SALOMETraceCollector()
+{
+ int ret;
+ ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone
+ if (_singleton)
+ {
+ DEVTRACE("SALOMETraceCollector:: ~SALOMETraceCollector()");
+ LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
+ _threadToClose = 1;
+ myTraceBuffer->insert(NORMAL_MESS,"end of trace\n"); // to wake up thread
+ if (_threadId)
+ {
+ int ret = pthread_join(*_threadId, NULL);
+ if (ret) cerr << "error close SALOMETraceCollector : "<< ret << endl;
+ else DEVTRACE("SALOMETraceCollector destruction OK");
+ _threadId = 0;
+ _threadToClose = 0;
+ }
+ _singleton = 0;
+ }
+ ret = pthread_mutex_unlock(&_singletonMutex); // release lock
+}
+
+// ============================================================================
+/*!
+ * Constructor: no need of LocalTraceBufferPool object initialization here,
+ * thread safe singleton used in LocalTraceBufferPool::instance()
+ */
+// ============================================================================
+
+SALOMETraceCollector::SALOMETraceCollector()
+{
+ _threadId=0;
+ _threadToClose = 0;
+}
+
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+
+extern "C"
+{
+ BaseTraceCollector *SingletonInstance(void)
+ {
+ BaseTraceCollector *instance = SALOMETraceCollector::instance();
+ return instance;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include "SALOMETraceCollectorTest.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include "LocalTraceBufferPool.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+
+void
+SALOMETraceCollectorTest::setUp()
+{
+}
+
+// ============================================================================
+/*!
+ *
+ */
+// ============================================================================
+
+void
+SALOMETraceCollectorTest::tearDown()
+{
+}
+
+#define NUM_THREADS 20
+#define NUM_MESSAGES 20
+void *PrintHello(void *threadid);
+
+// ============================================================================
+/*!
+ * open a trace on a CORBA, multithread writing on file, close
+ */
+// ============================================================================
+
+void
+SALOMETraceCollectorTest::testLoadBufferPoolCORBA()
+{
+ string s = "with_logger";
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ // --- NUM_THREADS thread creation for trace generation.
+
+ pthread_t threads[NUM_THREADS];
+ int rc, t;
+ for(t=0;t<NUM_THREADS;t++)
+ {
+ MESSAGE("Creating thread " << t);
+ rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t) ;
+ CPPUNIT_ASSERT( !rc);
+ }
+
+ // --- wait for end of each thread producing trace.
+
+ for(t=0;t<NUM_THREADS;t++)
+ {
+ int ret = pthread_join(threads[t], NULL);
+ MESSAGE("--------------------- end of PrintHello thread " << t);
+ }
+ MESSAGE(" ---- end of PrintHello threads ---- ");
+
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+// ============================================================================
+/*!
+ * NUM_THREAD are created with function PrintHello,
+ * which produces NUM_MESSAGES traces.
+ */
+// ============================================================================
+
+void *PrintHello(void *threadid)
+{
+ int id_thread = (int)threadid;
+ for (int i=0; i<NUM_MESSAGES;i++)
+ MESSAGE("Hello World! This is a trace test : " << id_thread
+ << " - iter " << i);
+ pthread_exit(NULL);
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _SALOMETRACECOLLECTORTTEST_HXX_
+#define _SALOMETRACECOLLECTORTTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class SALOMETraceCollectorTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( SALOMETraceCollectorTest );
+ CPPUNIT_TEST( testLoadBufferPoolCORBA );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void setUp();
+ void tearDown();
+
+ void testLoadBufferPoolCORBA();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMETraceCollectorTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+#==============================================================================
+# File : Makefile.in
+# Author : Marc Tajchman
+#==============================================================================
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS = SALOMEDS_Tool.hxx
+
+# Libraries targets
+
+LIB = libTOOLSDS.la
+LIB_SRC = \
+ SALOMEDS_Tool.cxx \
+
+# Executables targets
+BIN =
+BIN_SRC =
+LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_GenericObj.idl
+BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
+BIN_CLIENT_IDL =
+
+CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
+CXXFLAGS+=$(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
+LDFLAGS+= -lOpUtil $(CAS_KERNEL)
+
+@CONCLUDE@
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Tool.cxx
+// Created : Mon Oct 21 16:24:34 2002
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : SALOMEDS
+// Copyright : Open CASCADE
+
+#include "SALOMEDS_Tool.hxx"
+
+#include "utilities.h"
+
+#include <TCollection_AsciiString.hxx>
+
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Process.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_SingleProtection.hxx>
+#include <OSD_FileIterator.hxx>
+
+#ifndef WNT
+#include <stdio.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <sys/time.h>
+#else
+#endif
+#include <stdlib.h>
+
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+using namespace std;
+
+//============================================================================
+// function : GetTempDir
+// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
+//============================================================================
+std::string SALOMEDS_Tool::GetTmpDir()
+{
+ //Find a temporary directory to store a file
+
+ TCollection_AsciiString aTmpDir;
+
+ char *Tmp_dir = getenv("SALOME_TMP_DIR");
+ if(Tmp_dir != NULL) {
+ aTmpDir = TCollection_AsciiString(Tmp_dir);
+#ifdef WIN32
+ if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+#else
+ if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+#endif
+ }
+ else {
+#ifdef WIN32
+ aTmpDir = TCollection_AsciiString("C:\\");
+#else
+ aTmpDir = TCollection_AsciiString("/tmp/");
+#endif
+ }
+
+ srand((unsigned int)time(NULL));
+ int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
+ TCollection_AsciiString aSubDir(aRND);
+ if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+
+ aTmpDir += aSubDir; //Get RND sub directory
+
+#ifdef WIN32
+ if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+#else
+ if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+#endif
+
+ OSD_Path aPath(aTmpDir);
+ OSD_Directory aDir(aPath);
+
+ for(aRND = 0; aDir.Exists(); aRND++) {
+ aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
+ aPath = OSD_Path(aTmpDir);
+ aDir = OSD_Directory(aPath);
+ }
+
+ MESSAGE("#### TMP" << aTmpDir.ToCString());
+
+ OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
+ aDir.Build(aProtection);
+
+ return aTmpDir.ToCString();
+}
+
+//============================================================================
+// function : RemoveTemporaryFiles
+// purpose : Removes files listed in theFileList
+//============================================================================
+void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory,
+ const SALOMEDS::ListOfFileNames& theFiles,
+ const bool IsDirDeleted)
+{
+ TCollection_AsciiString aDirName(const_cast<char*>(theDirectory.c_str()));
+
+ int i, aLength = theFiles.length();
+ for(i=0; i<aLength; i++) {
+ TCollection_AsciiString aFile(aDirName);
+// aFile += (char*)theFiles[i];
+ aFile += (char*)theFiles[i].in();
+ OSD_Path anOSDPath(aFile);
+ OSD_File anOSDFile(anOSDPath);
+ if(!anOSDFile.Exists()) continue;
+
+ OSD_Protection aProtection = anOSDFile.Protection();
+ aProtection.SetUser(OSD_RW);
+ anOSDFile.SetProtection(aProtection);
+
+ anOSDFile.Remove();
+ }
+
+ if(IsDirDeleted) {
+ OSD_Path aPath(aDirName);
+ OSD_Directory aDir(aPath);
+ OSD_FileIterator anIterator(aPath, '*');
+
+ if(aDir.Exists() && !anIterator.More()) aDir.Remove();
+ }
+
+}
+
+//============================================================================
+// function : PutFilesToStream
+// purpose : converts the files from a list 'theFiles' to the stream
+//============================================================================
+SALOMEDS::TMPFile*
+SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
+ const SALOMEDS::ListOfFileNames& theFiles,
+ const int theNamesOnly)
+{
+ int i, aLength = theFiles.length();
+ if(aLength == 0)
+// return NULL;
+ return (new SALOMEDS::TMPFile);
+
+ //Get a temporary directory for saved a file
+ TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory.c_str()));
+
+ long aBufferSize = 0;
+ long aCurrentPos;
+
+ int aNbFiles = 0;
+ int* aFileNameSize= new int[aLength];
+ long* aFileSize= new long[aLength];
+
+ //Determine the required size of the buffer
+
+ for(i=0; i<aLength; i++) {
+
+ //Check if the file exists
+
+ if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
+ TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
+ OSD_Path anOSDPath(aFullPath);
+ OSD_File anOSDFile(anOSDPath);
+ if(!anOSDFile.Exists()) continue;
+#ifdef WNT
+ ifstream aFile(aFullPath.ToCString(), ios::binary);
+#else
+ ifstream aFile(aFullPath.ToCString());
+#endif
+ aFile.seekg(0, ios::end);
+ aFileSize[i] = aFile.tellg();
+ aBufferSize += aFileSize[i]; //Add a space to store the file
+ }
+ aFileNameSize[i] = strlen(theFiles[i])+1;
+ aBufferSize += aFileNameSize[i]; //Add a space to store the file name
+ aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
+ // 8 bytes: length of the file itself
+ aNbFiles++;
+ }
+
+ aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream;
+ unsigned char* aBuffer = new unsigned char[aBufferSize];
+ if(aBuffer == NULL)
+// return NULL;
+ return (new SALOMEDS::TMPFile);
+
+ //Initialize 4 bytes of the buffer by 0
+ memset(aBuffer, 0, 4);
+ //Copy the number of files that will be written to the stream
+ memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int)));
+
+
+ aCurrentPos = 4;
+
+ for(i=0; i<aLength; i++) {
+ ifstream *aFile;
+ if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
+ TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
+ OSD_Path anOSDPath(aFullPath);
+ OSD_File anOSDFile(anOSDPath);
+ if(!anOSDFile.Exists()) continue;
+#ifdef WNT
+ aFile = new ifstream(aFullPath.ToCString(), ios::binary);
+#else
+ aFile = new ifstream(aFullPath.ToCString());
+#endif
+ }
+ //Initialize 4 bytes of the buffer by 0
+ memset((aBuffer + aCurrentPos), 0, 4);
+ //Copy the length of the file name to the buffer
+ memcpy((aBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int)));
+ aCurrentPos += 4;
+
+ //Copy the file name to the buffer
+ memcpy((aBuffer + aCurrentPos), theFiles[i], aFileNameSize[i]);
+ aCurrentPos += aFileNameSize[i];
+
+ if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
+ //Initialize 8 bytes of the buffer by 0
+ memset((aBuffer + aCurrentPos), 0, 8);
+ //Copy the length of the file to the buffer
+ memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long)));
+ aCurrentPos += 8;
+
+ aFile->seekg(0, ios::beg);
+ aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]);
+ aFile->close();
+ delete(aFile);
+ aCurrentPos += aFileSize[i];
+ }
+ }
+
+ delete[] aFileNameSize;
+ delete[] aFileSize;
+
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+
+ return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1));
+}
+
+//============================================================================
+// function : PutStreamToFile
+// purpose : converts the stream "theStream" to the files
+//============================================================================
+SALOMEDS::ListOfFileNames_var
+SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
+ const std::string& theToDirectory,
+ const int theNamesOnly)
+{
+ SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
+
+ if(theStream.length() == 0)
+ return aFiles;
+
+ //Get a temporary directory for saving a file
+ TCollection_AsciiString aTmpDir(const_cast<char*>(theToDirectory.c_str()));
+
+ unsigned char *aBuffer = (unsigned char*)theStream.NP_data();
+
+ if(aBuffer == NULL)
+ return aFiles;
+
+ long aFileSize, aCurrentPos = 4;
+ int i, aFileNameSize, aNbFiles = 0;
+
+ //Copy the number of files in the stream
+ memcpy(&aNbFiles, aBuffer, sizeof(int));
+
+ aFiles->length(aNbFiles);
+
+ for(i=0; i<aNbFiles; i++) {
+
+ //Put a length of the file name to aFileNameSize
+ memcpy(&aFileNameSize, (aBuffer + aCurrentPos), ((sizeof(int) > 4) ? 4 : sizeof(int)));
+ aCurrentPos += 4;
+
+ char *aFileName = new char[aFileNameSize];
+ //Put a file name to aFileName
+ memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize);
+ aCurrentPos += aFileNameSize;
+
+ //Put a length of the file to aFileSize
+ if (!theNamesOnly) {
+ memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long)));
+ aCurrentPos += 8;
+
+ TCollection_AsciiString aFullPath = aTmpDir + aFileName;
+ ofstream aFile(aFullPath.ToCString());
+ aFile.write((char *)(aBuffer+aCurrentPos), aFileSize);
+ aFile.close();
+ aCurrentPos += aFileSize;
+ }
+ aFiles[i] = CORBA::string_dup(aFileName);
+ delete[] aFileName;
+ }
+
+ return aFiles;
+}
+
+//============================================================================
+// function : GetNameFromPath
+// purpose : Returns the name by the path
+//============================================================================
+std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) {
+ if(thePath == "")
+ return "";
+ OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast<char*>(thePath.c_str())));
+ TCollection_AsciiString aNameString(aPath.Name());
+ return aNameString.ToCString();
+}
+
+//============================================================================
+// function : GetDirFromPath
+// purpose : Returns the dir by the path
+//============================================================================
+std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) {
+ if(thePath == "")
+ return "";
+ OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast<char*>(thePath.c_str())));
+ TCollection_AsciiString aDirString(aPath.Trek());
+ aDirString.ChangeAll('|','/');
+ return aDirString.ToCString();
+}
+
+//=======================================================================
+// name : GetFlag
+// Purpose : Retrieve specified flaf from "AttributeFlags" attribute
+//=======================================================================
+bool SALOMEDS_Tool::GetFlag( const int theFlag,
+ SALOMEDS::Study_var theStudy,
+ SALOMEDS::SObject_var theObj )
+{
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( !theObj->_is_nil() && theObj->FindAttribute( anAttr, "AttributeFlags" ) )
+ {
+ SALOMEDS::AttributeFlags_var aFlags = SALOMEDS::AttributeFlags::_narrow( anAttr );
+ return aFlags->Get( theFlag );
+ }
+
+ return false;
+}
+
+//=======================================================================
+// name : SetFlag
+// Purpose : Set/Unset specified flaf from "AttributeFlags" attribute
+//=======================================================================
+bool SALOMEDS_Tool::SetFlag( const int theFlag,
+ SALOMEDS::Study_var theStudy,
+ const std::string& theEntry,
+ const bool theValue )
+{
+ SALOMEDS::SObject_var anObj = theStudy->FindObjectID(theEntry.c_str());
+
+ if ( !anObj->_is_nil() )
+ {
+ SALOMEDS::GenericAttribute_var aGAttr;
+ if ( anObj->FindAttribute( aGAttr, "AttributeFlags" ) )
+ {
+ SALOMEDS::AttributeFlags_var anAttr = SALOMEDS::AttributeFlags::_narrow( aGAttr );
+ anAttr->Set( theFlag, theValue );
+ }
+ else if ( theValue )
+ {
+ SALOMEDS::StudyBuilder_var aBuilder = theStudy->NewBuilder();
+ SALOMEDS::AttributeFlags_var anAttr = SALOMEDS::AttributeFlags::_narrow(
+ aBuilder->FindOrCreateAttribute( anObj, "AttributeFlags" ) );
+ anAttr->Set( theFlag, theValue );
+ }
+ return true;
+ }
+
+ return false;
+}
+
+//=======================================================================
+// name : getAllChildren
+// Purpose : Get all children of object.
+// If theObj is null all objects of study are returned
+//=======================================================================
+void SALOMEDS_Tool::GetAllChildren( SALOMEDS::Study_var theStudy,
+ SALOMEDS::SObject_var theObj,
+ std::list<SALOMEDS::SObject_var>& theList )
+{
+ if ( theObj->_is_nil() )
+ {
+ SALOMEDS::SComponentIterator_var anIter = theStudy->NewComponentIterator();
+ for ( ; anIter->More(); anIter->Next() )
+ {
+ SALOMEDS::SObject_var anObj = SALOMEDS::SObject::_narrow( anIter->Value() );
+ if ( !anObj->_is_nil() )
+ {
+ theList.push_back( anObj );
+ GetAllChildren( theStudy, anObj, theList );
+ }
+ }
+ }
+ else
+ {
+ SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator( theObj );
+ for ( ; anIter->More(); anIter->Next() )
+ {
+ SALOMEDS::SObject_var anObj = anIter->Value();
+ SALOMEDS::SObject_var aRef;
+ if ( !anObj->ReferencedObject( aRef ) )
+ {
+ theList.push_back( anObj );
+ GetAllChildren( theStudy, anObj, theList );
+ }
+ }
+ }
+}
+
+
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File : SALOMEDS_Tool.hxx
+// Created : Mon Oct 21 16:24:50 2002
+// Author : Sergey RUIN
+
+// Project : SALOME
+// Module : SALOMEDS
+// Copyright : Open CASCADE
+
+
+#ifndef __SALOMEDS_Tool_H__
+#define __SALOMEDS_Tool_H__
+
+#include <string>
+#include <list>
+
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+#ifdef WNT
+#include <SALOME_WNT.hxx>
+#else
+#define SALOME_WNT_EXPORT
+#endif
+
+class SALOME_WNT_EXPORT SALOMEDS_Tool
+{
+
+public:
+
+ // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ static std::string GetTmpDir();
+
+
+ // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
+ // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
+ static void RemoveTemporaryFiles(const std::string& theDirectory,
+ const SALOMEDS::ListOfFileNames& theFiles,
+ const bool IsDirDeleted);
+
+ // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
+ static SALOMEDS::TMPFile* PutFilesToStream(const std::string& theFromDirectory,
+ const SALOMEDS::ListOfFileNames& theFiles,
+ const int theNamesOnly = 0);
+
+ // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
+ static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
+ const std::string& theToDirectory,
+ const int theNamesOnly = 0);
+
+ // Returns the name by the path
+ // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
+ static std::string GetNameFromPath(const std::string& thePath);
+
+ // Returns the directory by the path
+ // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
+ static std::string GetDirFromPath(const std::string& thePath);
+
+ // Retrieves specified flaf from "AttributeFlags" attribute
+ static bool GetFlag( const int theFlag,
+ SALOMEDS::Study_var theStudy,
+ SALOMEDS::SObject_var theObj );
+
+ // Sets/Unsets specified flaf from "AttributeFlags" attribute
+ static bool SetFlag( const int theFlag,
+ SALOMEDS::Study_var theStudy,
+ const std::string& theEntry,
+ const bool theValue );
+
+ // Get all children of object. If theObj is null all objects of study are returned
+ static void GetAllChildren( SALOMEDS::Study_var theStudy,
+ SALOMEDS::SObject_var theObj,
+ std::list<SALOMEDS::SObject_var>& theList );
+
+};
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#==============================================================================
+# File : Makefile.in
+# Created : mer jui 04 12:58:13 CEST 2003
+# Author : Bernard SECHER, CEA
+# Project : SALOME
+# Copyright : CEA 2003
+# $Header$
+#==============================================================================
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS =
+
+EXPORT_HEADERS = TestMPIComponentEngine.hxx
+
+# Libraries targets
+
+LIB = libSalomeTestMPIComponentEngine.la
+LIB_SRC = TestMPIComponentEngine.cxx
+LIB_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_TestMPIComponent.idl SALOME_Component.idl
+
+# Executables targets
+BIN = TestMPIContainer
+BIN_SRC =
+BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl SALOME_Exception.idl
+BIN_SERVER_IDL =
+
+LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeMPIContainer -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeResourcesManager ${MPI_LIBS}
+
+CXXFLAGS+=${MPI_INCLUDES}
+CXX_DEPEND_FLAG+=${MPI_INCLUDES}
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+//=============================================================================
+// File : TestMPIComponentEngine.cxx
+// Created : mer jui 4 12:28:26 CEST 2003
+// Author : Bernard SECHER, 2003
+// Project : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+
+#include <mpi.h>
+#include "utilities.h"
+#include "TestMPIComponentEngine.hxx"
+using namespace std;
+
+TestMPIComponentEngine::TestMPIComponentEngine(int nbproc, int numproc,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool regist) :
+ Engines_Component_i(orb, poa, contId, instanceName, interfaceName,true,regist), MPIObject_i(nbproc,numproc)
+{
+ MESSAGE("activate object")
+ _thisObj = this ;
+ _id = _poa->reference_to_id(_thisObj->_this());
+}
+
+TestMPIComponentEngine::TestMPIComponentEngine(): Engines_Component_i(), MPIObject_i()
+{
+}
+
+TestMPIComponentEngine::~TestMPIComponentEngine()
+{
+}
+
+void TestMPIComponentEngine::Coucou(CORBA::Long L)
+{
+ if(_numproc==0)
+ for(int ip=1;ip<_nbproc;ip++)
+ Engines::TestMPIComponent::_narrow((*_tior)[ip])->SPCoucou(L);
+ SPCoucou(L);
+}
+
+void TestMPIComponentEngine::SPCoucou(CORBA::Long L)
+{
+ BEGIN_OF("[" << _numproc << "] TestMPIComponentEngine::Coucou()");
+ MESSAGE("[" << _numproc << "] TestMPIComponentEngine : L = " << L);
+ END_OF("[" << _numproc << "] TestMPIComponentEngine::Coucou()");
+ MPI_Barrier(MPI_COMM_WORLD);
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * TestMPIComponentEngine_factory(
+ int nbproc, int numproc,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ bool regist;
+ TestMPIComponentEngine * myTestMPIComponent;
+ MESSAGE("[" << numproc << "] PortableServer::ObjectId * TestMPIComponentEngine_factory()");
+ SCRUTE(interfaceName);
+ if(numproc==0)
+ regist = true;
+ else
+ regist = false;
+
+ myTestMPIComponent
+ = new TestMPIComponentEngine(nbproc,numproc,orb, poa, contId, instanceName, interfaceName,regist);
+ return myTestMPIComponent->getId() ;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+//=============================================================================
+// File : TestMPIComponentEngine.hxx
+// Created : mer jui 4 12:28:30 CEST 2003
+// Author : Bernard SECHER, CEA
+// Project : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+
+#ifndef _SALOME_TESTCOMPONENT_I_HXX_
+#define _SALOME_TESTCOMPONENT_I_HXX_
+
+#include <iostream.h>
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_TestMPIComponent)
+#include "SALOME_Component_i.hxx"
+#include "MPIObject_i.hxx"
+
+class TestMPIComponentEngine:
+ public POA_Engines::TestMPIComponent,
+ public Engines_Component_i, public MPIObject_i
+{
+public:
+ TestMPIComponentEngine();
+ TestMPIComponentEngine(int nbproc, int numproc,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool regist);
+
+ virtual ~TestMPIComponentEngine();
+
+ void Coucou(CORBA::Long L);
+ void SPCoucou(CORBA::Long L);
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// using namespace std;
+//=============================================================================
+// File : TestMPIContainer.cxx
+// Created : mer jui 4 13:11:27 CEST 2003
+// Author : Bernard SECHER, 2003
+// Project : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+
+#include "utilities.h"
+#include <iostream>
+#include <unistd.h>
+#include <string>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
+#include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent)
+
+# include "Utils_ORB_INIT.hxx"
+# include "Utils_SINGLETON.hxx"
+#include "SALOME_NamingService.hxx"
+#include "OpUtil.hxx"
+#include "SALOMETraceCollector.hxx"
+using namespace std;
+
+int main (int argc, char * argv[])
+{
+
+ // Initializing omniORB
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+ // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+
+ BEGIN_OF(argv[0])
+ try{
+
+ int status;
+
+ if( argc != 3 || strcmp(argv[1],"-np") ){
+ cout << "Usage: TestMPIContainer -np nbproc" << endl;
+ exit(0);
+ }
+
+ // Obtain a reference to the root POA
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
+ PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
+
+ // Use Name Service to find container
+ SALOME_NamingService NS(orb) ;
+ string containerName = "/Containers/" ;
+ string hostName = GetHostname();
+ containerName += hostName + "/MPIFactoryServer_" + argv[2];
+
+ string dirn(getenv("KERNEL_ROOT_DIR"));
+ dirn += "/lib/salome/libSalomeTestMPIComponentEngine.so";
+
+ // Try to resolve MPI Container
+ obj = NS.Resolve(containerName.c_str()) ;
+ Engines::MPIContainer_var iGenFact = Engines::MPIContainer::_narrow(obj);
+
+ if(CORBA::is_nil(iGenFact)){
+
+ // Launch MPI Container
+ string cmd("mpirun -np ");
+ cmd += argv[2];
+ cmd += " ";
+ cmd += getenv("KERNEL_ROOT_DIR");
+ cmd += "/bin/salome/SALOME_MPIContainer MPIFactoryServer_";
+ cmd += argv[2];
+ cmd += " &";
+ MESSAGE(cmd);
+ status = system(cmd.c_str());
+ if (status == -1) {
+ INFOS("TestMPIContainer launch MPI Container failed (system command status -1)") ;
+ }
+ else if (status == 217) {
+ INFOS("TestMPIContainer launch MPI Container failed (system command status 217)") ;
+ }
+
+ // Try to resolve MPI Container
+ int it = 0;
+ do{
+ sleep(1);
+ obj = NS.Resolve(containerName.c_str()) ;
+ iGenFact = Engines::MPIContainer::_narrow(obj);
+ MESSAGE("Waiting for MPI Container " << containerName << " : it = " << it );
+ }while( CORBA::is_nil(iGenFact) && (it++<15) );
+
+ }
+
+ if(CORBA::is_nil(iGenFact)){
+ MESSAGE("launching container failed");
+ exit(1);
+ }
+
+
+ Engines::TestMPIComponent_var m1;
+
+// for (int iter = 0; iter < 1 ; iter++){
+// MESSAGE("----------------------------------------------------" << iter);
+ obj = iGenFact->load_impl("TestMPIComponent",dirn.c_str());
+
+ INFOS("Get Handle on MPI Component");
+ m1 = Engines::TestMPIComponent::_narrow(obj);
+ if(CORBA::is_nil(m1)){
+ INFOS("getting handle on MPI component failed");
+ }
+ else{
+ m1->Coucou(1L);
+// // sleep(5);
+ INFOS("Unload MPI Component");
+ iGenFact->remove_impl(m1) ;
+ }
+// }
+// // Clean-up.
+// // iGenFact->finalize_removal() ;
+// // sleep(5);
+ iGenFact->Shutdown();
+// INFOS("shut down corba server for Test MPI Container");
+// orb->destroy();
+ }
+ catch(CORBA::COMM_FAILURE& ex) {
+ INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
+ }
+ catch(CORBA::SystemException&) {
+ INFOS("Caught a CORBA::SystemException.");
+ }
+ catch(CORBA::Exception&) {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(...) {
+ INFOS("Caught unknown exception.");
+ }
+
+ END_OF(argv[0]);
+ // delete myThreadTrace;
+ return 0 ;
+}
--- /dev/null
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE (EDF)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS=
+
+EXPORT_PYSCRIPTS = UnitTests.py
+
+# Libraries targets
+
+LIB =
+LIB_SRC =
+
+# Executables targets
+
+BIN = UnitTests
+BIN_SRC =
+BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
+ SALOME_Exception.idl nstest.idl
+
+CXXFLAGS += @CPPUNIT_INCLUDES@
+CPPFLAGS += @CPPUNIT_INCLUDES@
+
+LIBS= @LIBS@ @CPPUNIT_LIBS@
+
+LDFLAGSFORBIN+= \
+ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \
+ -lSALOMETraceCollectorTest \
+ -lUtilsTest -lOpUtil \
+ -lNamingServiceTest -lSalomeNS \
+ -lSalomeContainer -lSalomeResourcesManager \
+ -lRegistry -lSalomeNotification \
+ -lLifeCycleCORBATest -lSalomeLifeCycleCORBA \
+
+
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMETraceCollectorTest.hxx"
+#include "UtilsTest.hxx"
+#include "NamingServiceTest.hxx"
+#include "LifeCycleCORBATest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( UtilsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( NamingServiceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( LifeCycleCORBATest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+// --- include all Unit Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMETraceCollectorTest.hxx"
+#include "UtilsTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( UtilsTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include "UtilsTest.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include "Utils_SALOME_Exception.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+#define TRACEFILE "/tmp/traceUnitTest.log"
+
+// ============================================================================
+/*!
+ * Set Trace mecanism
+ * - delete preexisting trace classes if any
+ * - set trace on file
+ */
+// ============================================================================
+
+void
+UtilsTest::setUp()
+{
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+
+ // --- trace on file
+ char *theFileName = TRACEFILE;
+
+ string s = "file:";
+ s += theFileName;
+ CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+ ofstream traceFile;
+ traceFile.open(theFileName, ios::out | ios::app);
+ CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+ traceFile.close();
+
+ bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+}
+
+// ============================================================================
+/*!
+ * - delete trace classes
+ */
+// ============================================================================
+
+void
+UtilsTest::tearDown()
+{
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ CPPUNIT_ASSERT(bp1);
+ bp1->deleteInstance(bp1);
+}
+
+int genExcept()
+{
+ throw SALOME_Exception("a message");
+};
+
+// ============================================================================
+/*!
+ * Check basic SALOME_exception mecanism
+ */
+// ============================================================================
+
+void
+UtilsTest::testSALOME_ExceptionThrow()
+{
+ CPPUNIT_ASSERT_THROW(genExcept(), SALOME_Exception);
+}
+
+// ============================================================================
+/*!
+ * Check message on catch
+ */
+// ============================================================================
+
+void
+UtilsTest::testSALOME_ExceptionMessage()
+{
+#define EXAMPLE_EXCEPTION_MESSAGE "something for the end user"
+ try
+ {
+ throw SALOME_Exception(EXAMPLE_EXCEPTION_MESSAGE);
+ }
+ catch (const SALOME_Exception &ex)
+ {
+ string expectedMessage = EXAMPLE_EXCEPTION_MESSAGE;
+ string actualMessage = ex.what();
+ CPPUNIT_ASSERT(actualMessage.find(expectedMessage) != string::npos);
+ }
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#ifndef _UTILSTEST_HXX_
+#define _UTILSTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class UtilsTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( UtilsTest );
+ CPPUNIT_TEST( testSALOME_ExceptionThrow );
+ CPPUNIT_TEST( testSALOME_ExceptionMessage );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+
+ void setUp();
+ void tearDown();
+
+ void testSALOME_ExceptionThrow();
+ void testSALOME_ExceptionMessage();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+// File: Utils_ExceptHandler.cxx
+// Created: Mon Mar 15 10:23:41 2004
+// Author: Oksana TCHEBANOVA
+// <ota@localhost.localdomain>
+
+
+#include "Utils_ExceptHandlers.hxx"
+#include "Utils_CorbaException.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Exception)
+
+using namespace std;
+
+void SalomeException ()
+{
+ throw SALOME_Exception("Salome Exception");
+}
+
+void SALOME_SalomeException() {
+ THROW_SALOME_CORBA_EXCEPTION("INTERNAL ERROR", SALOME::INTERNAL_ERROR);
+}
+